Hi Erik, Thank you so much for your help so far. I'm in a more complex situation: our kernel module will need to support different version and distribution of Linux. At beginning, we have the compiler operation: #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,30) to define what we do with genl_register_family..., and it is would be logical to add a && (LINUX_VERSION_CODE < KERNEL_VERSION(3,12,0)). But the recent Kernel update /RHEL update make this changed from 7.4 (3.10.0-693) and 7.5 (3.10.0-862). How can I check the kernel build number (-693 v.s. -862) with pre-compile operation? – Weishan Yang May 14 '18 at 7:54
Hi Erik, just to update you in short, the information you've provided is what I'm looking for, and has resolved my problem. For the moment, I use the RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(7,5) to deal with the mass of versioning, and it would work for now. Thank you so much for your help! – Weishan Yang May 14 '18 at 11:13