Compiling kernel module ...
I am compiling my driver and have run into following scenario. Socket create function got a new parameter in Vanila kenrel 2.6.33. while Scientific Linux has it back ported to 2.6.32. How do I handle this kind of situation ? so that my driver compiles for both kernel versions.
Use #if like * *#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 33) // New socket create function #else // Old socket create function #endif LINUX_VERSION_CODE is defined somewhere in the kernel and you should get to use it easily. HTH Akash On Fri, Aug 5, 2011 at 12:34 PM, Abu Rasheda <rcpilot2010@gmail.com> wrote:
I am compiling my driver and have run into following scenario.
Socket create function got a new parameter in Vanila kenrel 2.6.33. while Scientific Linux has it back ported to 2.6.32. How do I handle this kind of situation ? so that my driver compiles for both kernel versions.
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
On Fri, Aug 5, 2011 at 5:10 PM, Akash <email2akashjain@gmail.com> wrote:
Use #if like * *#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 33) // New socket create function #else // Old socket create function #endif
LINUX_VERSION_CODE is defined somewhere in the kernel and you should get to use it easily.
HTH
Akash
I do this in many parts of my code. Issue in this particular case is different. In Vanila kernel this change appears in 2.6.33 and in Scientific Linux this change appears in 2.6.32. So in addition to LINUX_KERNEL_VERSION, I have to use some distribution specific #if. I was wondwring what is general practice in this regard.
On Sat, Aug 06, 2011 at 11:34:46AM -0700, Abu Rasheda wrote:
On Fri, Aug 5, 2011 at 5:10 PM, Akash <email2akashjain@gmail.com> wrote:
Use #if like
#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 33) // New socket create function #else // Old socket create function #endif
LINUX_VERSION_CODE is defined somewhere in the kernel and you should get to use it easily.
HTH
Akash
I do this in many parts of my code. Issue in this particular case is different. In Vanila kernel this change appears in 2.6.33 and in Scientific Linux this change appears in 2.6.32. So in addition to LINUX_KERNEL_VERSION, I have to use some distribution specific #if.
I was wondwring what is general practice in this regard.
Get the code merged upstream so you never have to worry about it again. Seriously, that is how this is handled, please read Documenation/stable_api_nonsense.txt for details. If you need help getting your driver merged, please let me know. We have ways of merging drivers that need "work" into the tree through the drivers/staging/ portion of the kernel and we have people to help out with the work as well. What type of driver is this? Why hasn't it been submitted for inclusion in the kernel already? thanks, greg k-h
On Sat, Aug 06, 2011 at 11:52:06AM -0700, Abu Rasheda wrote:
Get the code merged upstream so you never have to worry about it again.
Greg, my issue is basic. I am talking about change in parameter .create of net_proto_family struct.
It seems that Scientific Linux had it back ported.
Again, the real solution here is to get your code merged into the main kernel tree. Do you have a pointer to it anywhere so we can look at it to see what that would entail? thanks, greg k-h
participants (3)
-
Abu Rasheda -
Akash -
Greg KH