ksrc: respect struct proc_dir_entry changes in 2.6.30
PATCH 1/1 ksrc: respect struct proc_dir_entry changes in 2.6.30
Hello,
please apply the attached simple patch, which resolves a kind of compilation problems against 2.6.30 kernel.
Signature · 2 lines
With best wishes, Vladimir
Quoted 1 line
From
894660f7dc91b406d8e078247b46606778562de9Mon Sep 17 00:00:00 2001
From: Vladimir Zapolskiy <[email protected]>
Date: Thu, 11 Jun 2009 12:32:00 +0400
Subject: [PATCH] Made conditional inclusion of owner field in struct proc_dir_entry due to changes in 2.6.30
--- ksrc/arch/generic/hal.c | 6 ++++++ ksrc/drivers/comedi/device.c | 2 ++ ksrc/drivers/comedi/rtdm_interface.c | 4 ++++ ksrc/nucleus/registry.c | 2 ++ 4 files changed, 14 insertions(+), 0 deletions(-)
ksrc/arch/generic/hal.c +6 -0
@@ -738,7 +738,9 @@ struct proc_dir_entry *rthal_add_proc_leaf(const char *name, entry->data = data; entry->read_proc = rdproc; entry->write_proc = wrproc; +#if LINUX_VERSION_CODE <KERNEL_VERSION (2 ,6 ,30 ) entry->owner =THIS_MODULE ; +#endif return entry; }
@@ -756,7 +758,9 @@ struct proc_dir_entry *rthal_add_proc_seq(const char *name,return NULL ; entry->proc_fops = fops; +#if LINUX_VERSION_CODE <KERNEL_VERSION (2 ,6 ,30 ) entry->owner =THIS_MODULE ; +#endif if (size) entry->size = size;
@@ -773,7 +777,9 @@ static int rthal_proc_register(void)return -1 ; } +#if LINUX_VERSION_CODE <KERNEL_VERSION (2 ,6 ,30 ) rthal_proc_root->owner =THIS_MODULE ; +#endif rthal_add_proc_leaf ("hal" , &hal_read_proc,NULL ,NULL , rthal_proc_root); rthal_add_proc_leaf("faults",
ksrc/drivers/comedi/device.c +2 -0
@@ -144,7 +144,9 @@ int comedi_proc_attach(comedi_cxt_t * cxt) entry->data = dev->transfer; entry->write_proc =NULL ; entry->read_proc = comedi_rdproc_transfer; +#if LINUX_VERSION_CODE <KERNEL_VERSION (2 ,6 ,30 ) entry->owner =THIS_MODULE ; +#endif out_setup_proc_transfer:/* Frees the file name buffer */
ksrc/drivers/comedi/rtdm_interface.c +4 -0
@@ -78,7 +78,9 @@ int comedi_init_proc(void) entry->data =NULL ; entry->write_proc =NULL ; entry->read_proc = comedi_rdproc_devs; +#if LINUX_VERSION_CODE <KERNEL_VERSION (2 ,6 ,30 ) entry->owner =THIS_MODULE ; +#endif /* Creates the drivers related file */ entry =create_proc_entry ("drivers" ,0444 , comedi_proc_root);
@@ -93,7 +95,9 @@ int comedi_init_proc(void) entry->data =NULL ; entry->write_proc =NULL ; entry->read_proc = comedi_rdproc_drvs; +#if LINUX_VERSION_CODE <KERNEL_VERSION (2 ,6 ,30 ) entry->owner =THIS_MODULE ; +#endif return 0 ;
ksrc/nucleus/registry.c +2 -0
@@ -280,7 +280,9 @@ static struct proc_dir_entry *add_proc_link(const char *name,if (!entry)return NULL ; +#if LINUX_VERSION_CODE <KERNEL_VERSION (2 ,6 ,30 ) entry->owner =THIS_MODULE ; +#endif return entry; }
Signature · 1 line
1.6.2.4
Hi Vladimir,
Quoted 27 lines · Vladimir Zapolskiy
Hello,
please apply the attached simple patch, which resolves a kind of compilation problems against 2.6.30 kernel.
Signature · 15 lines
With best wishes, Vladimir From 894660f7dc91b406d8e078247b46606778562de9 Mon Sep 17 00:00:00 2001 From: Vladimir Zapolskiy <[email protected]> Date: Thu, 11 Jun 2009 12:32:00 +0400 Subject: [PATCH] Made conditional inclusion of owner field in struct proc_dir_entry due to changes in 2.6.30 Signed-off-by: Vladimir Zapolskiy <[email protected]> --- ksrc/arch/generic/hal.c | 6 ++++++ ksrc/drivers/comedi/device.c | 2 ++ ksrc/drivers/comedi/rtdm_interface.c | 4 ++++ ksrc/nucleus/registry.c | 2 ++ 4 files changed, 14 insertions(+), 0 deletions(-)ksrc/arch/generic/hal.c +0
-0
ksrc/arch/generic/hal.c struct proc_dir_entry *rthal_add_proc_leaf(const char *name, · line 743
Quoted 6 lines
ksrc/arch/generic/hal.c +2
-0@@ -738,7 +738,9 @@ struct proc_dir_entry *rthal_add_proc_leaf(const char *name, entry->data = data; entry->read_proc = rdproc; entry->write_proc = wrproc; +#if LINUX_VERSION_CODE <KERNEL_VERSION (2 ,6 ,30 ) entry->owner =THIS_MODULE ; +#endif
I would suggest to squeeze all these assignments into a helper function that is void from 2.6.30 on, hiding the #ifdefs
Jan
Hi Jan,
I observed that LINUX_VERSION_CODE comparisons are common enough in Xenomai code. Do you propose to make a separate header, which is included from nucleus, drivers and arch files?
--
With best wishes,
Vladimir
Quoted 42 lines · Jan Kiszka
Hi Vladimir,
Quoted 27 lines · Vladimir Zapolskiy
Hello,
please apply the attached simple patch, which resolves a kind of compilation problems against 2.6.30 kernel.
Signature · 15 lines
With best wishes, Vladimir From 894660f7dc91b406d8e078247b46606778562de9 Mon Sep 17 00:00:00 2001 From: Vladimir Zapolskiy <[email protected]> Date: Thu, 11 Jun 2009 12:32:00 +0400 Subject: [PATCH] Made conditional inclusion of owner field in struct proc_dir_entry due to changes in 2.6.30 Signed-off-by: Vladimir Zapolskiy <[email protected]> --- ksrc/arch/generic/hal.c | 6 ++++++ ksrc/drivers/comedi/device.c | 2 ++ ksrc/drivers/comedi/rtdm_interface.c | 4 ++++ ksrc/nucleus/registry.c | 2 ++ 4 files changed, 14 insertions(+), 0 deletions(-)ksrc/arch/generic/hal.c +0
-0ksrc/arch/generic/hal.c struct proc_dir_entry *rthal_add_proc_leaf(const char *name, · line 743
Quoted 6 lines
ksrc/arch/generic/hal.c +2
-0@@ -738,7 +738,9 @@ struct proc_dir_entry *rthal_add_proc_leaf(const char *name, entry->data = data; entry->read_proc = rdproc; entry->write_proc = wrproc; +#if LINUX_VERSION_CODE <KERNEL_VERSION (2 ,6 ,30 ) entry->owner =THIS_MODULE ; +#endif I would suggest to squeeze all these assignments into a helper function that is void from 2.6.30 on, hiding the #ifdefs
Jan
Quoted 4 lines · Vladimir Zapolskiy
Hi Jan,
I observed thatLINUX_VERSION_CODEcomparisons are common enough in Xenomai code. Do you propose to make a separate header, which is included from nucleus, drivers and arch files?
Yes, it's common, but we also keep a lot of wrapping in asm-*/wrappers.h.
Jan
PS: Please avoid top-posts.
Quoted 8 lines · Jan Kiszka
Quoted 4 lines · Vladimir Zapolskiy
Hi Jan,
I observed thatLINUX_VERSION_CODEcomparisons are common enough in Xenomai code. Do you propose to make a separate header, which is included from nucleus, drivers and arch files?Yes, it's common, but we also keep a lot of wrapping in
asm-*/wrappers.h.
No, it's not that common actually. Most of them are used in the HAL, half of those in assembly files because we don't have assembly-level wrappers, and the remaining spots are located in a few RT drivers (namely serial, CAN and irqbench).
So the canonical way to fix this is indeed to add the proper wrapper to include/asm-generic/wrappers.h. TIA,
Quoted 4 lines
Jan
PS: Please avoid top-posts.
Signature · 1 line
Philippe.
Thank you very much for the detailed explanation. The updated patch is attached.
With best wishes,
Vladimir
Quoted 14 lines · Philippe Gerum
Quoted 7 lines · Jan Kiszka
Quoted 4 lines · Vladimir Zapolskiy
Hi Jan,
I observed thatLINUX_VERSION_CODEcomparisons are common enough in Xenomai code. Do you propose to make a separate header, which is included from nucleus, drivers and arch files?Yes, it's common, but we also keep a lot of wrapping in
asm-*/wrappers.h.No, it's not that common actually. Most of them are used in the HAL, half of those in assembly files because we don't have assembly-level wrappers, and the remaining spots are located in a few RT drivers (namely serial, CAN and irqbench).
Quoted 8 lines
So the canonical way to fix this is indeed to add the proper wrapper to
include/asm-generic/wrappers.h. TIA,Quoted 4 lines
Jan
PS: Please avoid top-posts.
From
aa0d1003333982f5840879d0b435b9673986ea2fMon Sep 17 00:00:00 2001
From: Vladimir Zapolskiy <[email protected]>
Date: Thu, 11 Jun 2009 15:26:19 +0400
Subject: [PATCH] Made conditional inclusion of owner field in struct proc_dir_entry due to changes in 2.6.30.
--- include/asm-generic/wrappers.h | 13 +++++++++++++ ksrc/arch/generic/hal.c | 6 +++--- ksrc/drivers/comedi/device.c | 2 +- ksrc/drivers/comedi/rtdm_interface.c | 4 ++-- ksrc/nucleus/registry.c | 2 +- 5 files changed, 20 insertions(+), 7 deletions(-)
include/asm-generic/wrappers.h +13 -0
@@ -523,4 +523,17 @@ static inline int wrap_raise_cap(int cap) }#endif /* LINUX_VERSION_CODE >= 2.6.29 */ +#ifdef CONFIG_PROC_FS +#if LINUX_VERSION_CODE <KERNEL_VERSION (2 ,6 ,30 ) +#include <linux/module.h> +#include <linux/proc_fs.h> +static inline void wrap_proc_dir_entry_owner (struct proc_dir_entry *entry) +{ + entry->owner =THIS_MODULE ; +} +#else /* LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30) */ +#define wrap_proc_dir_entry_owner (entry) +#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30) */ +#endif /* CONFIG_PROC_FS */ +#endif /* _XENO_ASM_GENERIC_WRAPPERS_H */
ksrc/arch/generic/hal.c +3 -3
@@ -738,7 +738,7 @@ struct proc_dir_entry *rthal_add_proc_leaf(const char *name, entry->data = data; entry->read_proc = rdproc; entry->write_proc = wrproc; - entry->owner =THIS_MODULE ; +wrap_proc_dir_entry_owner (entry);return entry; }
@@ -756,7 +756,7 @@ struct proc_dir_entry *rthal_add_proc_seq(const char *name,return NULL ; entry->proc_fops = fops; - entry->owner =THIS_MODULE ; +wrap_proc_dir_entry_owner (entry);if (size) entry->size = size;
@@ -773,7 +773,7 @@ static int rthal_proc_register(void)return -1 ; } - rthal_proc_root->owner =THIS_MODULE ; +wrap_proc_dir_entry_owner (rthal_proc_root);rthal_add_proc_leaf ("hal" , &hal_read_proc,NULL ,NULL , rthal_proc_root); rthal_add_proc_leaf("faults",
ksrc/drivers/comedi/device.c +1 -1
@@ -144,7 +144,7 @@ int comedi_proc_attach(comedi_cxt_t * cxt) entry->data = dev->transfer; entry->write_proc =NULL ; entry->read_proc = comedi_rdproc_transfer; - entry->owner =THIS_MODULE ; +wrap_proc_dir_entry_owner (entry); out_setup_proc_transfer:/* Frees the file name buffer */
ksrc/drivers/comedi/rtdm_interface.c +2 -2
@@ -78,7 +78,7 @@ int comedi_init_proc(void) entry->data =NULL ; entry->write_proc =NULL ; entry->read_proc = comedi_rdproc_devs; - entry->owner =THIS_MODULE ; +wrap_proc_dir_entry_owner (enrty);/* Creates the drivers related file */ entry =create_proc_entry ("drivers" ,0444 , comedi_proc_root);
@@ -93,7 +93,7 @@ int comedi_init_proc(void) entry->data =NULL ; entry->write_proc =NULL ; entry->read_proc = comedi_rdproc_drvs; - entry->owner =THIS_MODULE ; +wrap_proc_dir_entry_owner (enrty);return 0 ;
ksrc/nucleus/registry.c +1 -1
@@ -280,7 +280,7 @@ static struct proc_dir_entry *add_proc_link(const char *name,if (!entry)return NULL ; - entry->owner =THIS_MODULE ; +wrap_proc_dir_entry_owner (entry);return entry; }
Signature · 1 line
1.6.2.4