Re: [PATCH] constify tables in kernel/sysctl_check.c

2007-12-21 Thread Eric W. Biederman
"Jan Beulich" <[EMAIL PROTECTED]> writes:

 Eric W. Biederman <[EMAIL PROTECTED]> 21.12.07 00:05 >>>
>>"Jan Beulich" <[EMAIL PROTECTED]> writes:
>>
>>> Remains the question whether it is intended that many, perhaps even
>>> large, tables are compiled in without ever having a chance to get used,
>>> i.e. whether there shouldn't #ifdef CONFIG_xxx get added.
>>
>>
>>The constification looks good.  The file should be compiled only when
>>we have sysctl support.  We use those tables when we call 
>>register_sysctl_table.  Which we do a lot.
>
> I understand this. Nevertheless, the tables take 23k on 64-bits, and many
> of them are unused when certain subsystems aren't being built (and some
> are even architecture specific). The arlan tables are a particularly good
> example, but the netfilter ones are pretty big and probably not always
> used, too.

The size isn't my favorite thing.  But given how much of a mess sysctl_check.c
has allowed me to clean up and get a handle on I'm not inclined to do
anything that would compromise the checking.

Probably the sanest way to remove table entries is to individually remove and
deprecate parts of the binary sys_sysctl interface so that we don't need the
table entries.

Maybe we could through in a few #ifdefs and #defines so we can reduce
the set of allowed sysctl entries even more base on config options.

I'm not volunteering to do more then is absolutely necessary to keep
sys_sysctl working and correct until we reach a point where everyone
can agree that users of the interface truly have had fair warning and
then I intend to delete all of the code that deals with the binary
sysctl interface.

Eric
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [Jan Beulich] [PATCH] constify tables in kernel/sysctl_check.c

2007-12-21 Thread Eric W. Biederman
Dave Jones <[EMAIL PROTECTED]> writes:

> On Thu, Dec 20, 2007 at 04:14:05PM -0700, Eric W. Biederman wrote:
>
>  > Remains the question whether it is intended that many, perhaps even
>  > large, tables are compiled in without ever having a chance to get used,
>  > i.e. whether there shouldn't #ifdef CONFIG_xxx get added.
>
>  > -static struct trans_ctl_table trans_net_ax25_param_table[] = {
>  > +static const struct trans_ctl_table trans_net_ax25_table[] = {
>
> we lost the _param, which will cause a duplicate definition with ..
>  
>  > -static struct trans_ctl_table trans_net_ax25_table[] = {
>  > +static const struct trans_ctl_table trans_net_ax25_table[] = {
>
> cut-n-paste thinko ?

Thanks, for catching that.

Anyway this patch looks sound in principle but I expect it might conflict
with the bug fix Andrew just merged.

Eric
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] constify tables in kernel/sysctl_check.c (v2, resend)

2007-12-21 Thread Jan Beulich
Remains the question whether it is intended that many, perhaps even
large, tables are compiled in without ever having a chance to get used,
i.e. whether there shouldn't #ifdef CONFIG_xxx get added.

(Cut-n-paste mistake corrected, pointed out by Dave Jones.)

Signed-off-by: Jan Beulich <[EMAIL PROTECTED]>
Acked-by: Eric W. Biederman <[EMAIL PROTECTED]>
Cc: Dave Jones <[EMAIL PROTECTED]>

 kernel/sysctl_check.c |  149 --
 1 file changed, 74 insertions(+), 75 deletions(-)

--- linux-2.6.24-postrc5/kernel/sysctl_check.c  2007-12-12 16:48:47.0 
+0100
+++ 2.6.24-postrc5-const-sysctl-check/kernel/sysctl_check.c 2007-12-06 
14:57:15.0 +0100
@@ -9,10 +9,10 @@
 struct trans_ctl_table {
int ctl_name;
const char  *procname;
-   struct trans_ctl_table  *child;
+   const struct trans_ctl_table *child;
 };
 
-static struct trans_ctl_table trans_random_table[] = {
+static const struct trans_ctl_table trans_random_table[] = {
{ RANDOM_POOLSIZE,  "poolsize" },
{ RANDOM_ENTROPY_COUNT, "entropy_avail" },
{ RANDOM_READ_THRESH,   "read_wakeup_threshold" },
@@ -22,13 +22,13 @@ static struct trans_ctl_table trans_rand
{}
 };
 
-static struct trans_ctl_table trans_pty_table[] = {
+static const struct trans_ctl_table trans_pty_table[] = {
{ PTY_MAX,  "max" },
{ PTY_NR,   "nr" },
{}
 };
 
-static struct trans_ctl_table trans_kern_table[] = {
+static const struct trans_ctl_table trans_kern_table[] = {
{ KERN_OSTYPE,  "ostype" },
{ KERN_OSRELEASE,   "osrelease" },
/* KERN_OSREV not used */
@@ -112,7 +112,7 @@ static struct trans_ctl_table trans_kern
{}
 };
 
-static struct trans_ctl_table trans_vm_table[] = {
+static const struct trans_ctl_table trans_vm_table[] = {
{ VM_OVERCOMMIT_MEMORY, "overcommit_memory" },
{ VM_PAGE_CLUSTER,  "page-cluster" },
{ VM_DIRTY_BACKGROUND,  "dirty_background_ratio" },
@@ -144,7 +144,7 @@ static struct trans_ctl_table trans_vm_t
{}
 };
 
-static struct trans_ctl_table trans_net_core_table[] = {
+static const struct trans_ctl_table trans_net_core_table[] = {
{ NET_CORE_WMEM_MAX,"wmem_max" },
{ NET_CORE_RMEM_MAX,"rmem_max" },
{ NET_CORE_WMEM_DEFAULT,"wmem_default" },
@@ -170,14 +170,14 @@ static struct trans_ctl_table trans_net_
{},
 };
 
-static struct trans_ctl_table trans_net_unix_table[] = {
+static const struct trans_ctl_table trans_net_unix_table[] = {
/* NET_UNIX_DESTROY_DELAY unused */
/* NET_UNIX_DELETE_DELAY unused */
{ NET_UNIX_MAX_DGRAM_QLEN,  "max_dgram_qlen" },
{}
 };
 
-static struct trans_ctl_table trans_net_ipv4_route_table[] = {
+static const struct trans_ctl_table trans_net_ipv4_route_table[] = {
{ NET_IPV4_ROUTE_FLUSH, "flush" },
{ NET_IPV4_ROUTE_MIN_DELAY, "min_delay" },
{ NET_IPV4_ROUTE_MAX_DELAY, "max_delay" },
@@ -200,7 +200,7 @@ static struct trans_ctl_table trans_net_
{}
 };
 
-static struct trans_ctl_table trans_net_ipv4_conf_vars_table[] = {
+static const struct trans_ctl_table trans_net_ipv4_conf_vars_table[] = {
{ NET_IPV4_CONF_FORWARDING, "forwarding" },
{ NET_IPV4_CONF_MC_FORWARDING,  "mc_forwarding" },
 
@@ -227,14 +227,14 @@ static struct trans_ctl_table trans_net_
{}
 };
 
-static struct trans_ctl_table trans_net_ipv4_conf_table[] = {
+static const struct trans_ctl_table trans_net_ipv4_conf_table[] = {
{ NET_PROTO_CONF_ALL,   "all",  
trans_net_ipv4_conf_vars_table },
{ NET_PROTO_CONF_DEFAULT,   "default",  
trans_net_ipv4_conf_vars_table },
{ 0, NULL, trans_net_ipv4_conf_vars_table },
{}
 };
 
-static struct trans_ctl_table trans_net_neigh_vars_table[] = {
+static const struct trans_ctl_table trans_net_neigh_vars_table[] = {
{ NET_NEIGH_MCAST_SOLICIT,  "mcast_solicit" },
{ NET_NEIGH_UCAST_SOLICIT,  "ucast_solicit" },
{ NET_NEIGH_APP_SOLICIT,"app_solicit" },
@@ -256,13 +256,13 @@ static struct trans_ctl_table trans_net_
{}
 };
 
-static struct trans_ctl_table trans_net_neigh_table[] = {
+static const struct trans_ctl_table trans_net_neigh_table[] = {
{ NET_PROTO_CONF_DEFAULT, "default", trans_net_neigh_vars_table },
{ 0, NULL, trans_net_neigh_vars_table },
{}
 };
 
-static struct trans_ctl_table trans_net_ipv4_netfilter_table[] = {
+static const struct trans_ctl_table trans_net_ipv4_netfilter_table[] = {
{ NET_IPV4_NF_CONNTRACK_MAX,
"ip_conntrack_max" },
 
{ NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_SYN_SENT,   
"ip_conntrack_tcp_timeout_syn_sent" },
@@ -299,7 +299,7 

[PATCH] constify tables in kernel/sysctl_check.c (v2, resend)

2007-12-21 Thread Jan Beulich
Remains the question whether it is intended that many, perhaps even
large, tables are compiled in without ever having a chance to get used,
i.e. whether there shouldn't #ifdef CONFIG_xxx get added.

(Cut-n-paste mistake corrected, pointed out by Dave Jones.)

Signed-off-by: Jan Beulich [EMAIL PROTECTED]
Acked-by: Eric W. Biederman [EMAIL PROTECTED]
Cc: Dave Jones [EMAIL PROTECTED]

 kernel/sysctl_check.c |  149 --
 1 file changed, 74 insertions(+), 75 deletions(-)

--- linux-2.6.24-postrc5/kernel/sysctl_check.c  2007-12-12 16:48:47.0 
+0100
+++ 2.6.24-postrc5-const-sysctl-check/kernel/sysctl_check.c 2007-12-06 
14:57:15.0 +0100
@@ -9,10 +9,10 @@
 struct trans_ctl_table {
int ctl_name;
const char  *procname;
-   struct trans_ctl_table  *child;
+   const struct trans_ctl_table *child;
 };
 
-static struct trans_ctl_table trans_random_table[] = {
+static const struct trans_ctl_table trans_random_table[] = {
{ RANDOM_POOLSIZE,  poolsize },
{ RANDOM_ENTROPY_COUNT, entropy_avail },
{ RANDOM_READ_THRESH,   read_wakeup_threshold },
@@ -22,13 +22,13 @@ static struct trans_ctl_table trans_rand
{}
 };
 
-static struct trans_ctl_table trans_pty_table[] = {
+static const struct trans_ctl_table trans_pty_table[] = {
{ PTY_MAX,  max },
{ PTY_NR,   nr },
{}
 };
 
-static struct trans_ctl_table trans_kern_table[] = {
+static const struct trans_ctl_table trans_kern_table[] = {
{ KERN_OSTYPE,  ostype },
{ KERN_OSRELEASE,   osrelease },
/* KERN_OSREV not used */
@@ -112,7 +112,7 @@ static struct trans_ctl_table trans_kern
{}
 };
 
-static struct trans_ctl_table trans_vm_table[] = {
+static const struct trans_ctl_table trans_vm_table[] = {
{ VM_OVERCOMMIT_MEMORY, overcommit_memory },
{ VM_PAGE_CLUSTER,  page-cluster },
{ VM_DIRTY_BACKGROUND,  dirty_background_ratio },
@@ -144,7 +144,7 @@ static struct trans_ctl_table trans_vm_t
{}
 };
 
-static struct trans_ctl_table trans_net_core_table[] = {
+static const struct trans_ctl_table trans_net_core_table[] = {
{ NET_CORE_WMEM_MAX,wmem_max },
{ NET_CORE_RMEM_MAX,rmem_max },
{ NET_CORE_WMEM_DEFAULT,wmem_default },
@@ -170,14 +170,14 @@ static struct trans_ctl_table trans_net_
{},
 };
 
-static struct trans_ctl_table trans_net_unix_table[] = {
+static const struct trans_ctl_table trans_net_unix_table[] = {
/* NET_UNIX_DESTROY_DELAY unused */
/* NET_UNIX_DELETE_DELAY unused */
{ NET_UNIX_MAX_DGRAM_QLEN,  max_dgram_qlen },
{}
 };
 
-static struct trans_ctl_table trans_net_ipv4_route_table[] = {
+static const struct trans_ctl_table trans_net_ipv4_route_table[] = {
{ NET_IPV4_ROUTE_FLUSH, flush },
{ NET_IPV4_ROUTE_MIN_DELAY, min_delay },
{ NET_IPV4_ROUTE_MAX_DELAY, max_delay },
@@ -200,7 +200,7 @@ static struct trans_ctl_table trans_net_
{}
 };
 
-static struct trans_ctl_table trans_net_ipv4_conf_vars_table[] = {
+static const struct trans_ctl_table trans_net_ipv4_conf_vars_table[] = {
{ NET_IPV4_CONF_FORWARDING, forwarding },
{ NET_IPV4_CONF_MC_FORWARDING,  mc_forwarding },
 
@@ -227,14 +227,14 @@ static struct trans_ctl_table trans_net_
{}
 };
 
-static struct trans_ctl_table trans_net_ipv4_conf_table[] = {
+static const struct trans_ctl_table trans_net_ipv4_conf_table[] = {
{ NET_PROTO_CONF_ALL,   all,  
trans_net_ipv4_conf_vars_table },
{ NET_PROTO_CONF_DEFAULT,   default,  
trans_net_ipv4_conf_vars_table },
{ 0, NULL, trans_net_ipv4_conf_vars_table },
{}
 };
 
-static struct trans_ctl_table trans_net_neigh_vars_table[] = {
+static const struct trans_ctl_table trans_net_neigh_vars_table[] = {
{ NET_NEIGH_MCAST_SOLICIT,  mcast_solicit },
{ NET_NEIGH_UCAST_SOLICIT,  ucast_solicit },
{ NET_NEIGH_APP_SOLICIT,app_solicit },
@@ -256,13 +256,13 @@ static struct trans_ctl_table trans_net_
{}
 };
 
-static struct trans_ctl_table trans_net_neigh_table[] = {
+static const struct trans_ctl_table trans_net_neigh_table[] = {
{ NET_PROTO_CONF_DEFAULT, default, trans_net_neigh_vars_table },
{ 0, NULL, trans_net_neigh_vars_table },
{}
 };
 
-static struct trans_ctl_table trans_net_ipv4_netfilter_table[] = {
+static const struct trans_ctl_table trans_net_ipv4_netfilter_table[] = {
{ NET_IPV4_NF_CONNTRACK_MAX,
ip_conntrack_max },
 
{ NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_SYN_SENT,   
ip_conntrack_tcp_timeout_syn_sent },
@@ -299,7 +299,7 @@ static struct trans_ctl_table trans_net_
{}
 };
 

Re: [Jan Beulich] [PATCH] constify tables in kernel/sysctl_check.c

2007-12-21 Thread Eric W. Biederman
Dave Jones [EMAIL PROTECTED] writes:

 On Thu, Dec 20, 2007 at 04:14:05PM -0700, Eric W. Biederman wrote:

   Remains the question whether it is intended that many, perhaps even
   large, tables are compiled in without ever having a chance to get used,
   i.e. whether there shouldn't #ifdef CONFIG_xxx get added.

   -static struct trans_ctl_table trans_net_ax25_param_table[] = {
   +static const struct trans_ctl_table trans_net_ax25_table[] = {

 we lost the _param, which will cause a duplicate definition with ..
  
   -static struct trans_ctl_table trans_net_ax25_table[] = {
   +static const struct trans_ctl_table trans_net_ax25_table[] = {

 cut-n-paste thinko ?

Thanks, for catching that.

Anyway this patch looks sound in principle but I expect it might conflict
with the bug fix Andrew just merged.

Eric
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] constify tables in kernel/sysctl_check.c

2007-12-21 Thread Eric W. Biederman
Jan Beulich [EMAIL PROTECTED] writes:

 Eric W. Biederman [EMAIL PROTECTED] 21.12.07 00:05 
Jan Beulich [EMAIL PROTECTED] writes:

 Remains the question whether it is intended that many, perhaps even
 large, tables are compiled in without ever having a chance to get used,
 i.e. whether there shouldn't #ifdef CONFIG_xxx get added.


The constification looks good.  The file should be compiled only when
we have sysctl support.  We use those tables when we call 
register_sysctl_table.  Which we do a lot.

 I understand this. Nevertheless, the tables take 23k on 64-bits, and many
 of them are unused when certain subsystems aren't being built (and some
 are even architecture specific). The arlan tables are a particularly good
 example, but the netfilter ones are pretty big and probably not always
 used, too.

The size isn't my favorite thing.  But given how much of a mess sysctl_check.c
has allowed me to clean up and get a handle on I'm not inclined to do
anything that would compromise the checking.

Probably the sanest way to remove table entries is to individually remove and
deprecate parts of the binary sys_sysctl interface so that we don't need the
table entries.

Maybe we could through in a few #ifdefs and #defines so we can reduce
the set of allowed sysctl entries even more base on config options.

I'm not volunteering to do more then is absolutely necessary to keep
sys_sysctl working and correct until we reach a point where everyone
can agree that users of the interface truly have had fair warning and
then I intend to delete all of the code that deals with the binary
sysctl interface.

Eric
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] constify tables in kernel/sysctl_check.c

2007-12-20 Thread Jan Beulich
>>> Eric W. Biederman <[EMAIL PROTECTED]> 21.12.07 00:05 >>>
>"Jan Beulich" <[EMAIL PROTECTED]> writes:
>
>> Remains the question whether it is intended that many, perhaps even
>> large, tables are compiled in without ever having a chance to get used,
>> i.e. whether there shouldn't #ifdef CONFIG_xxx get added.
>
>
>The constification looks good.  The file should be compiled only when
>we have sysctl support.  We use those tables when we call 
>register_sysctl_table.  Which we do a lot.

I understand this. Nevertheless, the tables take 23k on 64-bits, and many
of them are unused when certain subsystems aren't being built (and some
are even architecture specific). The arlan tables are a particularly good
example, but the netfilter ones are pretty big and probably not always
used, too.

Jan

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [Jan Beulich] [PATCH] constify tables in kernel/sysctl_check.c

2007-12-20 Thread Jan Beulich
Thanks for catching this!

>>> Dave Jones <[EMAIL PROTECTED]> 21.12.07 03:30 >>>
On Thu, Dec 20, 2007 at 04:14:05PM -0700, Eric W. Biederman wrote:

 > Remains the question whether it is intended that many, perhaps even
 > large, tables are compiled in without ever having a chance to get used,
 > i.e. whether there shouldn't #ifdef CONFIG_xxx get added.

 > -static struct trans_ctl_table trans_net_ax25_param_table[] = {
 > +static const struct trans_ctl_table trans_net_ax25_table[] = {

we lost the _param, which will cause a duplicate definition with ..
 
 > -static struct trans_ctl_table trans_net_ax25_table[] = {
 > +static const struct trans_ctl_table trans_net_ax25_table[] = {

cut-n-paste thinko ?

Dave

-- 
http://www.codemonkey.org.uk

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [Jan Beulich] [PATCH] constify tables in kernel/sysctl_check.c

2007-12-20 Thread Dave Jones
On Thu, Dec 20, 2007 at 04:14:05PM -0700, Eric W. Biederman wrote:

 > Remains the question whether it is intended that many, perhaps even
 > large, tables are compiled in without ever having a chance to get used,
 > i.e. whether there shouldn't #ifdef CONFIG_xxx get added.

 > -static struct trans_ctl_table trans_net_ax25_param_table[] = {
 > +static const struct trans_ctl_table trans_net_ax25_table[] = {

we lost the _param, which will cause a duplicate definition with ..
 
 > -static struct trans_ctl_table trans_net_ax25_table[] = {
 > +static const struct trans_ctl_table trans_net_ax25_table[] = {

cut-n-paste thinko ?

Dave

-- 
http://www.codemonkey.org.uk
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[Jan Beulich] [PATCH] constify tables in kernel/sysctl_check.c

2007-12-20 Thread Eric W. Biederman

From: "Jan Beulich" <[EMAIL PROTECTED]>

Remains the question whether it is intended that many, perhaps even
large, tables are compiled in without ever having a chance to get used,
i.e. whether there shouldn't #ifdef CONFIG_xxx get added.

Signed-off-by: Jan Beulich <[EMAIL PROTECTED]>
Acked-by: "Eric W. Biederman" <[EMAIL PROTECTED]>

---

 kernel/sysctl_check.c |  149 --
 1 file changed, 74 insertions(+), 75 deletions(-)

--- linux-2.6.24-postrc5/kernel/sysctl_check.c  2007-12-12 16:48:47.0 
+0100
+++ 2.6.24-postrc5-const-sysctl-check/kernel/sysctl_check.c 2007-12-06 
14:57:15.0 +0100
@@ -9,10 +9,10 @@
 struct trans_ctl_table {
int ctl_name;
const char  *procname;
-   struct trans_ctl_table  *child;
+   const struct trans_ctl_table *child;
 };
 
-static struct trans_ctl_table trans_random_table[] = {
+static const struct trans_ctl_table trans_random_table[] = {
{ RANDOM_POOLSIZE,  "poolsize" },
{ RANDOM_ENTROPY_COUNT, "entropy_avail" },
{ RANDOM_READ_THRESH,   "read_wakeup_threshold" },
@@ -22,13 +22,13 @@ static struct trans_ctl_table trans_rand
{}
 };
 
-static struct trans_ctl_table trans_pty_table[] = {
+static const struct trans_ctl_table trans_pty_table[] = {
{ PTY_MAX,  "max" },
{ PTY_NR,   "nr" },
{}
 };
 
-static struct trans_ctl_table trans_kern_table[] = {
+static const struct trans_ctl_table trans_kern_table[] = {
{ KERN_OSTYPE,  "ostype" },
{ KERN_OSRELEASE,   "osrelease" },
/* KERN_OSREV not used */
@@ -112,7 +112,7 @@ static struct trans_ctl_table trans_kern
{}
 };
 
-static struct trans_ctl_table trans_vm_table[] = {
+static const struct trans_ctl_table trans_vm_table[] = {
{ VM_OVERCOMMIT_MEMORY, "overcommit_memory" },
{ VM_PAGE_CLUSTER,  "page-cluster" },
{ VM_DIRTY_BACKGROUND,  "dirty_background_ratio" },
@@ -144,7 +144,7 @@ static struct trans_ctl_table trans_vm_t
{}
 };
 
-static struct trans_ctl_table trans_net_core_table[] = {
+static const struct trans_ctl_table trans_net_core_table[] = {
{ NET_CORE_WMEM_MAX,"wmem_max" },
{ NET_CORE_RMEM_MAX,"rmem_max" },
{ NET_CORE_WMEM_DEFAULT,"wmem_default" },
@@ -170,14 +170,14 @@ static struct trans_ctl_table trans_net_
{},
 };
 
-static struct trans_ctl_table trans_net_unix_table[] = {
+static const struct trans_ctl_table trans_net_unix_table[] = {
/* NET_UNIX_DESTROY_DELAY unused */
/* NET_UNIX_DELETE_DELAY unused */
{ NET_UNIX_MAX_DGRAM_QLEN,  "max_dgram_qlen" },
{}
 };
 
-static struct trans_ctl_table trans_net_ipv4_route_table[] = {
+static const struct trans_ctl_table trans_net_ipv4_route_table[] = {
{ NET_IPV4_ROUTE_FLUSH, "flush" },
{ NET_IPV4_ROUTE_MIN_DELAY, "min_delay" },
{ NET_IPV4_ROUTE_MAX_DELAY, "max_delay" },
@@ -200,7 +200,7 @@ static struct trans_ctl_table trans_net_
{}
 };
 
-static struct trans_ctl_table trans_net_ipv4_conf_vars_table[] = {
+static const struct trans_ctl_table trans_net_ipv4_conf_vars_table[] = {
{ NET_IPV4_CONF_FORWARDING, "forwarding" },
{ NET_IPV4_CONF_MC_FORWARDING,  "mc_forwarding" },
 
@@ -227,14 +227,14 @@ static struct trans_ctl_table trans_net_
{}
 };
 
-static struct trans_ctl_table trans_net_ipv4_conf_table[] = {
+static const struct trans_ctl_table trans_net_ipv4_conf_table[] = {
{ NET_PROTO_CONF_ALL,   "all",  
trans_net_ipv4_conf_vars_table },
{ NET_PROTO_CONF_DEFAULT,   "default",  
trans_net_ipv4_conf_vars_table },
{ 0, NULL, trans_net_ipv4_conf_vars_table },
{}
 };
 
-static struct trans_ctl_table trans_net_neigh_vars_table[] = {
+static const struct trans_ctl_table trans_net_neigh_vars_table[] = {
{ NET_NEIGH_MCAST_SOLICIT,  "mcast_solicit" },
{ NET_NEIGH_UCAST_SOLICIT,  "ucast_solicit" },
{ NET_NEIGH_APP_SOLICIT,"app_solicit" },
@@ -256,13 +256,13 @@ static struct trans_ctl_table trans_net_
{}
 };
 
-static struct trans_ctl_table trans_net_neigh_table[] = {
+static const struct trans_ctl_table trans_net_neigh_table[] = {
{ NET_PROTO_CONF_DEFAULT, "default", trans_net_neigh_vars_table },
{ 0, NULL, trans_net_neigh_vars_table },
{}
 };
 
-static struct trans_ctl_table trans_net_ipv4_netfilter_table[] = {
+static const struct trans_ctl_table trans_net_ipv4_netfilter_table[] = {
{ NET_IPV4_NF_CONNTRACK_MAX,
"ip_conntrack_max" },
 
{ NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_SYN_SENT,   
"ip_conntrack_tcp_timeout_syn_sent" },
@@ -299,7 +299,7 @@ static struct trans_ctl_table trans_net_
   

Re: [PATCH] constify tables in kernel/sysctl_check.c

2007-12-20 Thread Eric W. Biederman
"Jan Beulich" <[EMAIL PROTECTED]> writes:

> Remains the question whether it is intended that many, perhaps even
> large, tables are compiled in without ever having a chance to get used,
> i.e. whether there shouldn't #ifdef CONFIG_xxx get added.


The constification looks good.  The file should be compiled only when
we have sysctl support.  We use those tables when we call 
register_sysctl_table.  Which we do a lot.

Eric
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] constify tables in kernel/sysctl_check.c

2007-12-20 Thread Eric W. Biederman
Jan Beulich [EMAIL PROTECTED] writes:

 Remains the question whether it is intended that many, perhaps even
 large, tables are compiled in without ever having a chance to get used,
 i.e. whether there shouldn't #ifdef CONFIG_xxx get added.


The constification looks good.  The file should be compiled only when
we have sysctl support.  We use those tables when we call 
register_sysctl_table.  Which we do a lot.

Eric
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[Jan Beulich] [PATCH] constify tables in kernel/sysctl_check.c

2007-12-20 Thread Eric W. Biederman

From: Jan Beulich [EMAIL PROTECTED]

Remains the question whether it is intended that many, perhaps even
large, tables are compiled in without ever having a chance to get used,
i.e. whether there shouldn't #ifdef CONFIG_xxx get added.

Signed-off-by: Jan Beulich [EMAIL PROTECTED]
Acked-by: Eric W. Biederman [EMAIL PROTECTED]

---

 kernel/sysctl_check.c |  149 --
 1 file changed, 74 insertions(+), 75 deletions(-)

--- linux-2.6.24-postrc5/kernel/sysctl_check.c  2007-12-12 16:48:47.0 
+0100
+++ 2.6.24-postrc5-const-sysctl-check/kernel/sysctl_check.c 2007-12-06 
14:57:15.0 +0100
@@ -9,10 +9,10 @@
 struct trans_ctl_table {
int ctl_name;
const char  *procname;
-   struct trans_ctl_table  *child;
+   const struct trans_ctl_table *child;
 };
 
-static struct trans_ctl_table trans_random_table[] = {
+static const struct trans_ctl_table trans_random_table[] = {
{ RANDOM_POOLSIZE,  poolsize },
{ RANDOM_ENTROPY_COUNT, entropy_avail },
{ RANDOM_READ_THRESH,   read_wakeup_threshold },
@@ -22,13 +22,13 @@ static struct trans_ctl_table trans_rand
{}
 };
 
-static struct trans_ctl_table trans_pty_table[] = {
+static const struct trans_ctl_table trans_pty_table[] = {
{ PTY_MAX,  max },
{ PTY_NR,   nr },
{}
 };
 
-static struct trans_ctl_table trans_kern_table[] = {
+static const struct trans_ctl_table trans_kern_table[] = {
{ KERN_OSTYPE,  ostype },
{ KERN_OSRELEASE,   osrelease },
/* KERN_OSREV not used */
@@ -112,7 +112,7 @@ static struct trans_ctl_table trans_kern
{}
 };
 
-static struct trans_ctl_table trans_vm_table[] = {
+static const struct trans_ctl_table trans_vm_table[] = {
{ VM_OVERCOMMIT_MEMORY, overcommit_memory },
{ VM_PAGE_CLUSTER,  page-cluster },
{ VM_DIRTY_BACKGROUND,  dirty_background_ratio },
@@ -144,7 +144,7 @@ static struct trans_ctl_table trans_vm_t
{}
 };
 
-static struct trans_ctl_table trans_net_core_table[] = {
+static const struct trans_ctl_table trans_net_core_table[] = {
{ NET_CORE_WMEM_MAX,wmem_max },
{ NET_CORE_RMEM_MAX,rmem_max },
{ NET_CORE_WMEM_DEFAULT,wmem_default },
@@ -170,14 +170,14 @@ static struct trans_ctl_table trans_net_
{},
 };
 
-static struct trans_ctl_table trans_net_unix_table[] = {
+static const struct trans_ctl_table trans_net_unix_table[] = {
/* NET_UNIX_DESTROY_DELAY unused */
/* NET_UNIX_DELETE_DELAY unused */
{ NET_UNIX_MAX_DGRAM_QLEN,  max_dgram_qlen },
{}
 };
 
-static struct trans_ctl_table trans_net_ipv4_route_table[] = {
+static const struct trans_ctl_table trans_net_ipv4_route_table[] = {
{ NET_IPV4_ROUTE_FLUSH, flush },
{ NET_IPV4_ROUTE_MIN_DELAY, min_delay },
{ NET_IPV4_ROUTE_MAX_DELAY, max_delay },
@@ -200,7 +200,7 @@ static struct trans_ctl_table trans_net_
{}
 };
 
-static struct trans_ctl_table trans_net_ipv4_conf_vars_table[] = {
+static const struct trans_ctl_table trans_net_ipv4_conf_vars_table[] = {
{ NET_IPV4_CONF_FORWARDING, forwarding },
{ NET_IPV4_CONF_MC_FORWARDING,  mc_forwarding },
 
@@ -227,14 +227,14 @@ static struct trans_ctl_table trans_net_
{}
 };
 
-static struct trans_ctl_table trans_net_ipv4_conf_table[] = {
+static const struct trans_ctl_table trans_net_ipv4_conf_table[] = {
{ NET_PROTO_CONF_ALL,   all,  
trans_net_ipv4_conf_vars_table },
{ NET_PROTO_CONF_DEFAULT,   default,  
trans_net_ipv4_conf_vars_table },
{ 0, NULL, trans_net_ipv4_conf_vars_table },
{}
 };
 
-static struct trans_ctl_table trans_net_neigh_vars_table[] = {
+static const struct trans_ctl_table trans_net_neigh_vars_table[] = {
{ NET_NEIGH_MCAST_SOLICIT,  mcast_solicit },
{ NET_NEIGH_UCAST_SOLICIT,  ucast_solicit },
{ NET_NEIGH_APP_SOLICIT,app_solicit },
@@ -256,13 +256,13 @@ static struct trans_ctl_table trans_net_
{}
 };
 
-static struct trans_ctl_table trans_net_neigh_table[] = {
+static const struct trans_ctl_table trans_net_neigh_table[] = {
{ NET_PROTO_CONF_DEFAULT, default, trans_net_neigh_vars_table },
{ 0, NULL, trans_net_neigh_vars_table },
{}
 };
 
-static struct trans_ctl_table trans_net_ipv4_netfilter_table[] = {
+static const struct trans_ctl_table trans_net_ipv4_netfilter_table[] = {
{ NET_IPV4_NF_CONNTRACK_MAX,
ip_conntrack_max },
 
{ NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_SYN_SENT,   
ip_conntrack_tcp_timeout_syn_sent },
@@ -299,7 +299,7 @@ static struct trans_ctl_table trans_net_
{}
 };
 
-static struct trans_ctl_table 

Re: [Jan Beulich] [PATCH] constify tables in kernel/sysctl_check.c

2007-12-20 Thread Dave Jones
On Thu, Dec 20, 2007 at 04:14:05PM -0700, Eric W. Biederman wrote:

  Remains the question whether it is intended that many, perhaps even
  large, tables are compiled in without ever having a chance to get used,
  i.e. whether there shouldn't #ifdef CONFIG_xxx get added.

  -static struct trans_ctl_table trans_net_ax25_param_table[] = {
  +static const struct trans_ctl_table trans_net_ax25_table[] = {

we lost the _param, which will cause a duplicate definition with ..
 
  -static struct trans_ctl_table trans_net_ax25_table[] = {
  +static const struct trans_ctl_table trans_net_ax25_table[] = {

cut-n-paste thinko ?

Dave

-- 
http://www.codemonkey.org.uk
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [Jan Beulich] [PATCH] constify tables in kernel/sysctl_check.c

2007-12-20 Thread Jan Beulich
Thanks for catching this!

 Dave Jones [EMAIL PROTECTED] 21.12.07 03:30 
On Thu, Dec 20, 2007 at 04:14:05PM -0700, Eric W. Biederman wrote:

  Remains the question whether it is intended that many, perhaps even
  large, tables are compiled in without ever having a chance to get used,
  i.e. whether there shouldn't #ifdef CONFIG_xxx get added.

  -static struct trans_ctl_table trans_net_ax25_param_table[] = {
  +static const struct trans_ctl_table trans_net_ax25_table[] = {

we lost the _param, which will cause a duplicate definition with ..
 
  -static struct trans_ctl_table trans_net_ax25_table[] = {
  +static const struct trans_ctl_table trans_net_ax25_table[] = {

cut-n-paste thinko ?

Dave

-- 
http://www.codemonkey.org.uk

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] constify tables in kernel/sysctl_check.c

2007-12-20 Thread Jan Beulich
 Eric W. Biederman [EMAIL PROTECTED] 21.12.07 00:05 
Jan Beulich [EMAIL PROTECTED] writes:

 Remains the question whether it is intended that many, perhaps even
 large, tables are compiled in without ever having a chance to get used,
 i.e. whether there shouldn't #ifdef CONFIG_xxx get added.


The constification looks good.  The file should be compiled only when
we have sysctl support.  We use those tables when we call 
register_sysctl_table.  Which we do a lot.

I understand this. Nevertheless, the tables take 23k on 64-bits, and many
of them are unused when certain subsystems aren't being built (and some
are even architecture specific). The arlan tables are a particularly good
example, but the netfilter ones are pretty big and probably not always
used, too.

Jan

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/