On 02/09/2011 01:25 PM, Jan Kiszka wrote: > On 2011-02-09 13:08, Wolfgang Grandegger wrote: >> On 02/09/2011 12:49 PM, Jan Kiszka wrote: >>> On 2011-02-09 12:08, Wolfgang Grandegger wrote: >>>> Signed-off-by: Wolfgang Grandegger <[email protected]> >>>> --- >>>> stack/include/rtnet_port.h | 9 +++++++++ >>>> stack/ipv4/route.c | 1 + >>>> stack/rtcfg/rtcfg_proc.c | 1 + >>>> stack/rtnet_chrdev.c | 9 +++++++++ >>>> 4 files changed, 20 insertions(+), 0 deletions(-) >>>> >>>> diff --git a/stack/include/rtnet_port.h b/stack/include/rtnet_port.h >>>> index b47c0db..09101cc 100644 >>>> --- a/stack/include/rtnet_port.h >>>> +++ b/stack/include/rtnet_port.h >>>> @@ -213,6 +213,15 @@ static inline void *netdev_priv(struct net_device >>>> *dev) >>>> #define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1)) >>>> #endif >>>> >>>> +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,35) >>>> +#define NIPQUAD(addr) \ >>>> + ((unsigned char *)&addr)[0], \ >>>> + ((unsigned char *)&addr)[1], \ >>>> + ((unsigned char *)&addr)[2], \ >>>> + ((unsigned char *)&addr)[3] >>>> +#define NIPQUAD_FMT "%u.%u.%u.%u" >>>> +#endif >>>> + >>>> #endif /* __KERNEL__ */ >>>> >>>> #endif /* __RTNET_PORT_H_ */ >>>> diff --git a/stack/ipv4/route.c b/stack/ipv4/route.c >>>> index 2151686..505b32e 100644 >>>> --- a/stack/ipv4/route.c >>>> +++ b/stack/ipv4/route.c >>>> @@ -26,6 +26,7 @@ >>>> #include <net/ip.h> >>>> >>>> #include <rtnet_internal.h> >>>> +#include <rtnet_port.h> >>>> #include <rtnet_chrdev.h> >>>> #include <ipv4/af_inet.h> >>>> #include <ipv4/route.h> >>>> diff --git a/stack/rtcfg/rtcfg_proc.c b/stack/rtcfg/rtcfg_proc.c >>>> index 3d55d50..93aafd8 100644 >>>> --- a/stack/rtcfg/rtcfg_proc.c >>>> +++ b/stack/rtcfg/rtcfg_proc.c >>>> @@ -24,6 +24,7 @@ >>>> >>>> #include <rtdev.h> >>>> #include <rtnet_internal.h> >>>> +#include <rtnet_port.h> >>>> #include <rtcfg/rtcfg_conn_event.h> >>>> #include <rtcfg/rtcfg_event.h> >>>> #include <rtcfg/rtcfg_frame.h> >>> >>> OK for this. >>> >>>> diff --git a/stack/rtnet_chrdev.c b/stack/rtnet_chrdev.c >>>> index b0f2863..0d3fae3 100644 >>>> --- a/stack/rtnet_chrdev.c >>>> +++ b/stack/rtnet_chrdev.c >>>> @@ -47,8 +47,13 @@ LIST_HEAD(ioctl_handlers); >>>> * @request: >>>> * @arg: >>>> */ >>>> +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,35) >>>> +static long rtnet_ioctl(struct file *file, >>>> + unsigned int request, unsigned long arg) >>>> +#else >>>> static int rtnet_ioctl(struct inode *inode, struct file *file, >>>> unsigned int request, unsigned long arg) >>>> +#endif >> >> Any clever idea on how to handle this unconditionally? > > Actually... no. :) > >> >>>> { >>>> struct rtnet_ioctl_head head; >>>> struct rtnet_device *rtdev = NULL; >>>> @@ -286,7 +291,11 @@ void rtnet_unregister_ioctls(struct rtnet_ioctls >>>> *ioctls) >>>> >>>> >>>> static struct file_operations rtnet_fops = { >>>> +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,35) >>>> + .unlocked_ioctl = rtnet_ioctl, >>>> +#else >>>> .ioctl= rtnet_ioctl, >>>> +#endif >>>> }; >>>> >>>> static struct miscdevice rtnet_chr_misc_dev = { >>> >>> But here we should be able to rely on Xenomai redefining unlocked_ioctl >>> to ioctl on 2.4 kernels. Means: convert unconditionally. Can you check this? >> >> Well, as I just realized, in Xenomai we just use: >> >> #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,11) >> ##define unlocked_ioctl ioctl >> #endif >> >> with the modified new argument list. But this will not work for < 2.6.11 >> :-(. > > Ah. At least we found a bug this way. Then let's keep it conditional in > RTnet (depending on < 2.6.11) - and fix Xenomai.
OK, see patch below. Patch for Xenomai will follow. > The alternative is to finally bury 2.4 (and old 2.6) support with the > next release. I bet no one would dare to update RTnet while sticking > with such prehistoric kernels. Anyway, this fixup could then still be > consolidated. We still have support for 2.4, I think, therefore... Wolfgang. From: Wolfgang Grandegger <[email protected]> Subject: [PATCH] Build fixes for 2.6.36 Signed-off-by: Wolfgang Grandegger <[email protected]> --- stack/include/rtnet_port.h | 9 +++++++++ stack/ipv4/route.c | 1 + stack/rtcfg/rtcfg_proc.c | 1 + stack/rtnet_chrdev.c | 9 +++++++++ 4 files changed, 20 insertions(+) Index: rtnet/stack/include/rtnet_port.h =================================================================== --- rtnet.orig/stack/include/rtnet_port.h 2011-02-09 16:22:47.000000000 +0100 +++ rtnet/stack/include/rtnet_port.h 2011-02-09 16:22:51.279350420 +0100 @@ -213,6 +213,15 @@ #define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1)) #endif +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,35) +#define NIPQUAD(addr) \ + ((unsigned char *)&addr)[0], \ + ((unsigned char *)&addr)[1], \ + ((unsigned char *)&addr)[2], \ + ((unsigned char *)&addr)[3] +#define NIPQUAD_FMT "%u.%u.%u.%u" +#endif + #endif /* __KERNEL__ */ #endif /* __RTNET_PORT_H_ */ Index: rtnet/stack/ipv4/route.c =================================================================== --- rtnet.orig/stack/ipv4/route.c 2011-02-09 16:22:47.000000000 +0100 +++ rtnet/stack/ipv4/route.c 2011-02-09 16:22:51.366362852 +0100 @@ -26,6 +26,7 @@ #include <net/ip.h> #include <rtnet_internal.h> +#include <rtnet_port.h> #include <rtnet_chrdev.h> #include <ipv4/af_inet.h> #include <ipv4/route.h> Index: rtnet/stack/rtcfg/rtcfg_proc.c =================================================================== --- rtnet.orig/stack/rtcfg/rtcfg_proc.c 2011-02-09 16:22:47.000000000 +0100 +++ rtnet/stack/rtcfg/rtcfg_proc.c 2011-02-09 16:22:51.400367679 +0100 @@ -24,6 +24,7 @@ #include <rtdev.h> #include <rtnet_internal.h> +#include <rtnet_port.h> #include <rtcfg/rtcfg_conn_event.h> #include <rtcfg/rtcfg_event.h> #include <rtcfg/rtcfg_frame.h> Index: rtnet/stack/rtnet_chrdev.c =================================================================== --- rtnet.orig/stack/rtnet_chrdev.c 2011-02-09 16:22:47.000000000 +0100 +++ rtnet/stack/rtnet_chrdev.c 2011-02-09 16:28:51.891258634 +0100 @@ -47,8 +47,13 @@ * @request: * @arg: */ +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,11) +static long rtnet_ioctl(struct file *file, + unsigned int request, unsigned long arg) +#else static int rtnet_ioctl(struct inode *inode, struct file *file, unsigned int request, unsigned long arg) +#endif { struct rtnet_ioctl_head head; struct rtnet_device *rtdev = NULL; @@ -286,7 +291,11 @@ static struct file_operations rtnet_fops = { +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,11) + .unlocked_ioctl= rtnet_ioctl, +#else .ioctl= rtnet_ioctl, +#endif }; static struct miscdevice rtnet_chr_misc_dev = { ------------------------------------------------------------------------------ The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE: Pinpoint memory and threading errors before they happen. Find and fix more than 250 security defects in the development cycle. Locate bottlenecks in serial and parallel code that limit performance. http://p.sf.net/sfu/intel-dev2devfeb _______________________________________________ RTnet-developers mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/rtnet-developers

