fix proc filesystem usage, patch from Wipster.

SVN-Revision: 24008
This commit is contained in:
Florian Fainelli 2010-11-15 18:33:09 +00:00
parent 0733900356
commit 41534f1d58
2 changed files with 86 additions and 12 deletions

View file

@ -1,8 +1,6 @@
Index: sangam_atm-D7.04.03.00/tn7dsl.c --- a/tn7dsl.c
=================================================================== +++ b/tn7dsl.c
--- sangam_atm-D7.04.03.00.orig/tn7dsl.c 2010-08-26 09:36:54.000000000 +0200 @@ -203,7 +203,11 @@ led_reg_t ledreg[2];
+++ sangam_atm-D7.04.03.00/tn7dsl.c 2010-08-26 10:18:47.000000000 +0200
@@ -203,7 +203,11 @@
static struct led_funcs ledreg[2]; static struct led_funcs ledreg[2];
#endif #endif
@ -14,7 +12,7 @@ Index: sangam_atm-D7.04.03.00/tn7dsl.c
#define MAX_STR_SIZE 256 #define MAX_STR_SIZE 256
#define DSL_MOD_SIZE 256 #define DSL_MOD_SIZE 256
@@ -3431,9 +3435,16 @@ @@ -3431,9 +3435,16 @@ static int dslmod_sysctl(ctl_table *ctl,
*/ */
if(write) if(write)
{ {
@ -32,7 +30,7 @@ Index: sangam_atm-D7.04.03.00/tn7dsl.c
{ {
case DEV_DSLMOD: case DEV_DSLMOD:
ptr = strpbrk(info, " \t"); ptr = strpbrk(info, " \t");
@@ -3517,14 +3528,22 @@ @@ -3517,14 +3528,29 @@ static int dslmod_sysctl(ctl_table *ctl,
else else
{ {
len += sprintf(info+len, mod_req); len += sprintf(info+len, mod_req);
@ -50,8 +48,32 @@ Index: sangam_atm-D7.04.03.00/tn7dsl.c
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33) +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33)
{DEV_DSLMOD, "dslmod", info, DSL_MOD_SIZE, 0644, NULL, NULL, &dslmod_sysctl, &sysctl_string} {DEV_DSLMOD, "dslmod", info, DSL_MOD_SIZE, 0644, NULL, NULL, &dslmod_sysctl, &sysctl_string}
+#else +#else
+ {"dslmod", info, DSL_MOD_SIZE, 0644, NULL, NULL, &dslmod_sysctl, NULL, (void *)DEV_DSLMOD} + {
+ .procname = "dslmod",
+ .data = info,
+ .maxlen = DSL_MOD_SIZE,
+ .mode = 0644,
+ .proc_handler = &dslmod_sysctl,
+ .extra2 = (void *)DEV_DSLMOD,
+ }
+#endif +#endif
, ,
{0} {0}
}; };
@@ -3532,7 +3558,16 @@ ctl_table dslmod_table[] = {
/* Make sure that /proc/sys/dev is there */
ctl_table dslmod_root_table[] = {
#ifdef CONFIG_PROC_FS
+ #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33)
{CTL_DEV, "dev", NULL, 0, 0555, dslmod_table}
+ #else
+ {
+ .procname = "dev",
+ .maxlen = 0,
+ .mode = 0555,
+ .child = dslmod_table,
+ }
+ #endif
,
#endif /* CONFIG_PROC_FS */
{0}

View file

@ -1,8 +1,20 @@
Index: sangam_atm-D7.05.01.00/tn7dsl.c Index: sangam_atm-D7.05.01.00/tn7dsl.c
=================================================================== ===================================================================
--- sangam_atm-D7.05.01.00.orig/tn7dsl.c 2010-03-07 18:19:09.000000000 +0100 --- sangam_atm-D7.05.01.00.orig/tn7dsl.c 2010-11-09 18:32:33.478706990 +0100
+++ sangam_atm-D7.05.01.00/tn7dsl.c 2010-03-07 18:19:12.000000000 +0100 +++ sangam_atm-D7.05.01.00/tn7dsl.c 2010-11-09 18:32:33.488706997 +0100
@@ -3615,8 +3615,11 @@ @@ -215,7 +215,11 @@
static struct led_funcs ledreg[2];
#endif
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33)
#define DEV_DSLMOD CTL_UNNUMBERED
+#else
+#define DEV_DSLMOD 0
+#endif
#define MAX_STR_SIZE 256
#define DSL_MOD_SIZE 256
@@ -3615,9 +3619,16 @@
*/ */
if(write) if(write)
{ {
@ -12,10 +24,15 @@ Index: sangam_atm-D7.05.01.00/tn7dsl.c
+#else +#else
+ ret = proc_dostring(ctl, write, buffer, lenp, 0); + ret = proc_dostring(ctl, write, buffer, lenp, 0);
+#endif +#endif
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33)
switch (ctl->ctl_name) switch (ctl->ctl_name)
+#else
+ switch ((long)ctl->extra2)
+#endif
{ {
case DEV_DSLMOD: case DEV_DSLMOD:
@@ -3701,7 +3704,11 @@ ptr = strpbrk(info, " \t");
@@ -3701,14 +3712,29 @@
else else
{ {
len += sprintf(info+len, mod_req); len += sprintf(info+len, mod_req);
@ -27,3 +44,38 @@ Index: sangam_atm-D7.05.01.00/tn7dsl.c
} }
return ret; return ret;
} }
ctl_table dslmod_table[] = {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33)
{DEV_DSLMOD, "dslmod", info, DSL_MOD_SIZE, 0644, NULL, NULL, &dslmod_sysctl, &sysctl_string}
+#else
+ {
+ .procname = "dslmod",
+ .data = info,
+ .maxlen = DSL_MOD_SIZE,
+ .mode = 0644,
+ .proc_handler = &dslmod_sysctl,
+ .extra2 = (void *)DEV_DSLMOD,
+ }
+#endif
,
{0}
};
@@ -3716,7 +3742,16 @@
/* Make sure that /proc/sys/dev is there */
ctl_table dslmod_root_table[] = {
#ifdef CONFIG_PROC_FS
+ #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33)
{CTL_DEV, "dev", NULL, 0, 0555, dslmod_table}
+ #else
+ {
+ .procname = "dev",
+ .maxlen = 0,
+ .mode = 0555,
+ .child = dslmod_table,
+ }
+ #endif
,
#endif /* CONFIG_PROC_FS */
{0}