Re: [RTnet-developers] [PATCH] Build fixes for 2.6.36
Brought to you by:
bet-frogger,
kiszka
|
From: Jan K. <jan...@si...> - 2011-02-09 12:25:21
|
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 <wg...@de...>
>>> ---
>>> 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.
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.
Jan
--
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
|