* [PATCH 12/24] sysctl: cookie: share event_sysctl_table between nets
From: Lucian Adrian Grijincu @ 2011-04-02 2:53 UTC (permalink / raw)
To: 'David S . Miller', Alexey Dobriyan, Eric W . Biederman,
Octavian Purdila, linux-kernel
Cc: Lucian Adrian Grijincu
In-Reply-To: <cover.1301711868.git.lucian.grijincu@gmail.com>
Signed-off-by: Lucian Adrian Grijincu <lucian.grijincu@gmail.com>
---
net/netfilter/nf_conntrack_ecache.c | 30 +++++-------------------------
1 files changed, 5 insertions(+), 25 deletions(-)
diff --git a/net/netfilter/nf_conntrack_ecache.c b/net/netfilter/nf_conntrack_ecache.c
index 63a1b91..b799e9e 100644
--- a/net/netfilter/nf_conntrack_ecache.c
+++ b/net/netfilter/nf_conntrack_ecache.c
@@ -163,14 +163,14 @@ static struct ctl_table event_sysctl_table[] = {
.data = &init_net.ct.sysctl_events,
.maxlen = sizeof(unsigned int),
.mode = 0644,
- .proc_handler = proc_dointvec,
+ .proc_handler = netns_proc_dointvec,
},
{
.procname = "nf_conntrack_events_retry_timeout",
.data = &init_net.ct.sysctl_events_retry_timeout,
.maxlen = sizeof(unsigned int),
.mode = 0644,
- .proc_handler = proc_dointvec_jiffies,
+ .proc_handler = netns_proc_dointvec_jiffies,
},
{}
};
@@ -185,38 +185,18 @@ static struct nf_ct_ext_type event_extend __read_mostly = {
#ifdef CONFIG_SYSCTL
static int nf_conntrack_event_init_sysctl(struct net *net)
{
- struct ctl_table *table;
-
- table = kmemdup(event_sysctl_table, sizeof(event_sysctl_table),
- GFP_KERNEL);
- if (!table)
- goto out;
-
- table[0].data = &net->ct.sysctl_events;
- table[1].data = &net->ct.sysctl_events_retry_timeout;
-
- net->ct.event_sysctl_header =
- register_net_sysctl_table(net,
- nf_net_netfilter_sysctl_path, table);
+ net->ct.event_sysctl_header = register_net_sysctl_table(net,
+ nf_net_netfilter_sysctl_path, event_sysctl_table);
if (!net->ct.event_sysctl_header) {
printk(KERN_ERR "nf_ct_event: can't register to sysctl.\n");
- goto out_register;
+ return -ENOMEM;
}
return 0;
-
-out_register:
- kfree(table);
-out:
- return -ENOMEM;
}
static void nf_conntrack_event_fini_sysctl(struct net *net)
{
- struct ctl_table *table;
-
- table = net->ct.event_sysctl_header->ctl_table_arg;
unregister_net_sysctl_table(net->ct.event_sysctl_header);
- kfree(table);
}
#else
static int nf_conntrack_event_init_sysctl(struct net *net)
--
1.7.5.rc0
^ permalink raw reply related
* [PATCH 11/24] sysctl: cookie: share acct_sysctl_table table between nets
From: Lucian Adrian Grijincu @ 2011-04-02 2:53 UTC (permalink / raw)
To: 'David S . Miller', Alexey Dobriyan, Eric W . Biederman,
Octavian Purdila, linux-kernel
Cc: Lucian Adrian Grijincu
In-Reply-To: <cover.1301711868.git.lucian.grijincu@gmail.com>
Signed-off-by: Lucian Adrian Grijincu <lucian.grijincu@gmail.com>
---
net/netfilter/nf_conntrack_acct.c | 24 +++---------------------
1 files changed, 3 insertions(+), 21 deletions(-)
diff --git a/net/netfilter/nf_conntrack_acct.c b/net/netfilter/nf_conntrack_acct.c
index 5178c69..8f37d96 100644
--- a/net/netfilter/nf_conntrack_acct.c
+++ b/net/netfilter/nf_conntrack_acct.c
@@ -29,7 +29,7 @@ static struct ctl_table acct_sysctl_table[] = {
.data = &init_net.ct.sysctl_acct,
.maxlen = sizeof(unsigned int),
.mode = 0644,
- .proc_handler = proc_dointvec,
+ .proc_handler = netns_proc_dointvec,
},
{}
};
@@ -59,36 +59,18 @@ static struct nf_ct_ext_type acct_extend __read_mostly = {
#ifdef CONFIG_SYSCTL
static int nf_conntrack_acct_init_sysctl(struct net *net)
{
- struct ctl_table *table;
-
- table = kmemdup(acct_sysctl_table, sizeof(acct_sysctl_table),
- GFP_KERNEL);
- if (!table)
- goto out;
-
- table[0].data = &net->ct.sysctl_acct;
-
net->ct.acct_sysctl_header = register_net_sysctl_table(net,
- nf_net_netfilter_sysctl_path, table);
+ nf_net_netfilter_sysctl_path, acct_sysctl_table);
if (!net->ct.acct_sysctl_header) {
printk(KERN_ERR "nf_conntrack_acct: can't register to sysctl.\n");
- goto out_register;
+ return -ENOMEM;
}
return 0;
-
-out_register:
- kfree(table);
-out:
- return -ENOMEM;
}
static void nf_conntrack_acct_fini_sysctl(struct net *net)
{
- struct ctl_table *table;
-
- table = net->ct.acct_sysctl_header->ctl_table_arg;
unregister_net_sysctl_table(net->ct.acct_sysctl_header);
- kfree(table);
}
#else
static int nf_conntrack_acct_init_sysctl(struct net *net)
--
1.7.5.rc0
^ permalink raw reply related
* [PATCH 10/24] sysctl: cookie: share ip6_ctl_table, ipv6_icmp_table and ipv6_route_table between nets
From: Lucian Adrian Grijincu @ 2011-04-02 2:53 UTC (permalink / raw)
To: 'David S . Miller', Alexey Dobriyan, Eric W . Biederman,
Octavian Purdila, linux-kernel
Cc: Lucian Adrian Grijincu
In-Reply-To: <cover.1301711868.git.lucian.grijincu@gmail.com>
Signed-off-by: Lucian Adrian Grijincu <lucian.grijincu@gmail.com>
---
include/net/ipv6.h | 6 +---
net/ipv6/icmp.c | 17 +-----------
net/ipv6/route.c | 58 +++++++++++------------------------------
net/ipv6/sysctl_net_ipv6.c | 61 ++++++--------------------------------------
4 files changed, 28 insertions(+), 114 deletions(-)
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index 34200f9..bd73439 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -656,11 +656,9 @@ static inline int snmp6_unregister_dev(struct inet6_dev *idev) { return 0; }
#endif
#ifdef CONFIG_SYSCTL
-extern ctl_table ipv6_route_table_template[];
-extern ctl_table ipv6_icmp_table_template[];
+extern ctl_table ipv6_route_table[];
+extern ctl_table ipv6_icmp_table[];
-extern struct ctl_table *ipv6_icmp_sysctl_init(struct net *net);
-extern struct ctl_table *ipv6_route_sysctl_init(struct net *net);
extern int ipv6_sysctl_register(void);
extern void ipv6_sysctl_unregister(void);
extern int ipv6_static_sysctl_register(void);
diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c
index 83cb4f9..26cdb9b 100644
--- a/net/ipv6/icmp.c
+++ b/net/ipv6/icmp.c
@@ -954,29 +954,16 @@ int icmpv6_err_convert(u8 type, u8 code, int *err)
EXPORT_SYMBOL(icmpv6_err_convert);
#ifdef CONFIG_SYSCTL
-ctl_table ipv6_icmp_table_template[] = {
+ctl_table ipv6_icmp_table[] = {
{
.procname = "ratelimit",
.data = &init_net.ipv6.sysctl.icmpv6_time,
.maxlen = sizeof(int),
.mode = 0644,
- .proc_handler = proc_dointvec_ms_jiffies,
+ .proc_handler = netns_proc_dointvec_ms_jiffies,
},
{ },
};
-struct ctl_table * __net_init ipv6_icmp_sysctl_init(struct net *net)
-{
- struct ctl_table *table;
-
- table = kmemdup(ipv6_icmp_table_template,
- sizeof(ipv6_icmp_table_template),
- GFP_KERNEL);
-
- if (table)
- table[0].data = &net->ipv6.sysctl.icmpv6_time;
-
- return table;
-}
#endif
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 48ec0b7..a110204 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -2592,120 +2592,94 @@ static const struct file_operations rt6_stats_seq_fops = {
#ifdef CONFIG_SYSCTL
-static
-int ipv6_sysctl_rtcache_flush(ctl_table *ctl, int write, void __user *buffer,
- size_t *lenp, loff_t *ppos, void *cookie)
+static int netns_ipv6_sysctl_rtcache_flush(ctl_table *ctl, int write,
+ void __user *buffer, size_t *lenp,
+ loff_t *ppos, void *cookie)
{
- struct net *net;
- int delay;
+ struct net *net = (struct net *) cookie;
+ int delay = net->ipv6.sysctl.flush_delay;
if (!write)
return -EINVAL;
- net = (struct net *)ctl->extra1;
- delay = net->ipv6.sysctl.flush_delay;
proc_dointvec(ctl, write, buffer, lenp, ppos, NULL);
fib6_run_gc(delay <= 0 ? ~0UL : (unsigned long)delay, net);
return 0;
}
-ctl_table ipv6_route_table_template[] = {
+ctl_table ipv6_route_table[] = {
{
.procname = "flush",
.data = &init_net.ipv6.sysctl.flush_delay,
.maxlen = sizeof(int),
.mode = 0200,
- .proc_handler = ipv6_sysctl_rtcache_flush
+ .proc_handler = netns_ipv6_sysctl_rtcache_flush,
},
{
.procname = "gc_thresh",
.data = &ip6_dst_ops_template.gc_thresh,
.maxlen = sizeof(int),
.mode = 0644,
- .proc_handler = proc_dointvec,
+ .proc_handler = netns_proc_dointvec,
},
{
.procname = "max_size",
.data = &init_net.ipv6.sysctl.ip6_rt_max_size,
.maxlen = sizeof(int),
.mode = 0644,
- .proc_handler = proc_dointvec,
+ .proc_handler = netns_proc_dointvec,
},
{
.procname = "gc_min_interval",
.data = &init_net.ipv6.sysctl.ip6_rt_gc_min_interval,
.maxlen = sizeof(int),
.mode = 0644,
- .proc_handler = proc_dointvec_jiffies,
+ .proc_handler = netns_proc_dointvec_jiffies,
},
{
.procname = "gc_timeout",
.data = &init_net.ipv6.sysctl.ip6_rt_gc_timeout,
.maxlen = sizeof(int),
.mode = 0644,
- .proc_handler = proc_dointvec_jiffies,
+ .proc_handler = netns_proc_dointvec_jiffies,
},
{
.procname = "gc_interval",
.data = &init_net.ipv6.sysctl.ip6_rt_gc_interval,
.maxlen = sizeof(int),
.mode = 0644,
- .proc_handler = proc_dointvec_jiffies,
+ .proc_handler = netns_proc_dointvec_jiffies,
},
{
.procname = "gc_elasticity",
.data = &init_net.ipv6.sysctl.ip6_rt_gc_elasticity,
.maxlen = sizeof(int),
.mode = 0644,
- .proc_handler = proc_dointvec,
+ .proc_handler = netns_proc_dointvec,
},
{
.procname = "mtu_expires",
.data = &init_net.ipv6.sysctl.ip6_rt_mtu_expires,
.maxlen = sizeof(int),
.mode = 0644,
- .proc_handler = proc_dointvec_jiffies,
+ .proc_handler = netns_proc_dointvec_jiffies,
},
{
.procname = "min_adv_mss",
.data = &init_net.ipv6.sysctl.ip6_rt_min_advmss,
.maxlen = sizeof(int),
.mode = 0644,
- .proc_handler = proc_dointvec,
+ .proc_handler = netns_proc_dointvec,
},
{
.procname = "gc_min_interval_ms",
.data = &init_net.ipv6.sysctl.ip6_rt_gc_min_interval,
.maxlen = sizeof(int),
.mode = 0644,
- .proc_handler = proc_dointvec_ms_jiffies,
+ .proc_handler = netns_proc_dointvec_ms_jiffies,
},
{ }
};
-struct ctl_table * __net_init ipv6_route_sysctl_init(struct net *net)
-{
- struct ctl_table *table;
-
- table = kmemdup(ipv6_route_table_template,
- sizeof(ipv6_route_table_template),
- GFP_KERNEL);
-
- if (table) {
- table[0].data = &net->ipv6.sysctl.flush_delay;
- table[0].extra1 = net;
- table[1].data = &net->ipv6.ip6_dst_ops.gc_thresh;
- table[2].data = &net->ipv6.sysctl.ip6_rt_max_size;
- table[3].data = &net->ipv6.sysctl.ip6_rt_gc_min_interval;
- table[4].data = &net->ipv6.sysctl.ip6_rt_gc_timeout;
- table[5].data = &net->ipv6.sysctl.ip6_rt_gc_interval;
- table[6].data = &net->ipv6.sysctl.ip6_rt_gc_elasticity;
- table[7].data = &net->ipv6.sysctl.ip6_rt_mtu_expires;
- table[8].data = &net->ipv6.sysctl.ip6_rt_min_advmss;
- table[9].data = &net->ipv6.sysctl.ip6_rt_gc_min_interval;
- }
-
- return table;
-}
#endif
static int __net_init ip6_route_net_init(struct net *net)
diff --git a/net/ipv6/sysctl_net_ipv6.c b/net/ipv6/sysctl_net_ipv6.c
index 6dcf5e7..1b6f6fd 100644
--- a/net/ipv6/sysctl_net_ipv6.c
+++ b/net/ipv6/sysctl_net_ipv6.c
@@ -27,25 +27,25 @@ static ctl_table ipv6_static_skeleton[] = {
{ }
};
-static ctl_table ipv6_table_template[] = {
+static ctl_table ipv6_table[] = {
{
.procname = "route",
.maxlen = 0,
.mode = 0555,
- .child = ipv6_route_table_template
+ .child = ipv6_route_table
},
{
.procname = "icmp",
.maxlen = 0,
.mode = 0555,
- .child = ipv6_icmp_table_template
+ .child = ipv6_icmp_table
},
{
.procname = "bindv6only",
.data = &init_net.ipv6.sysctl.bindv6only,
.maxlen = sizeof(int),
.mode = 0644,
- .proc_handler = proc_dointvec
+ .proc_handler = netns_proc_dointvec,
},
{ }
};
@@ -70,62 +70,17 @@ EXPORT_SYMBOL_GPL(net_ipv6_ctl_path);
static int __net_init ipv6_sysctl_net_init(struct net *net)
{
- struct ctl_table *ipv6_table;
- struct ctl_table *ipv6_route_table;
- struct ctl_table *ipv6_icmp_table;
- int err;
-
- err = -ENOMEM;
- ipv6_table = kmemdup(ipv6_table_template, sizeof(ipv6_table_template),
- GFP_KERNEL);
- if (!ipv6_table)
- goto out;
-
- ipv6_route_table = ipv6_route_sysctl_init(net);
- if (!ipv6_route_table)
- goto out_ipv6_table;
- ipv6_table[0].child = ipv6_route_table;
-
- ipv6_icmp_table = ipv6_icmp_sysctl_init(net);
- if (!ipv6_icmp_table)
- goto out_ipv6_route_table;
- ipv6_table[1].child = ipv6_icmp_table;
-
- ipv6_table[2].data = &net->ipv6.sysctl.bindv6only;
-
- net->ipv6.sysctl.table = register_net_sysctl_table(net, net_ipv6_ctl_path,
- ipv6_table);
+ net->ipv6.sysctl.table = register_net_sysctl_table(net,
+ net_ipv6_ctl_path, ipv6_table);
if (!net->ipv6.sysctl.table)
- goto out_ipv6_icmp_table;
-
- err = 0;
-out:
- return err;
+ return -ENOMEM;
-out_ipv6_icmp_table:
- kfree(ipv6_icmp_table);
-out_ipv6_route_table:
- kfree(ipv6_route_table);
-out_ipv6_table:
- kfree(ipv6_table);
- goto out;
+ return 0;
}
static void __net_exit ipv6_sysctl_net_exit(struct net *net)
{
- struct ctl_table *ipv6_table;
- struct ctl_table *ipv6_route_table;
- struct ctl_table *ipv6_icmp_table;
-
- ipv6_table = net->ipv6.sysctl.table->ctl_table_arg;
- ipv6_route_table = ipv6_table[0].child;
- ipv6_icmp_table = ipv6_table[1].child;
-
unregister_net_sysctl_table(net->ipv6.sysctl.table);
-
- kfree(ipv6_table);
- kfree(ipv6_route_table);
- kfree(ipv6_icmp_table);
}
static struct pernet_operations ipv6_sysctl_net_ops = {
--
1.7.5.rc0
^ permalink raw reply related
* [PATCH 09/24] sysctl: cookie: share ip6_frags_ns_ctl_table between nets
From: Lucian Adrian Grijincu @ 2011-04-02 2:53 UTC (permalink / raw)
To: 'David S . Miller', Alexey Dobriyan, Eric W . Biederman,
Octavian Purdila, linux-kernel
Cc: Lucian Adrian Grijincu
In-Reply-To: <cover.1301711868.git.lucian.grijincu@gmail.com>
Signed-off-by: Lucian Adrian Grijincu <lucian.grijincu@gmail.com>
---
net/ipv6/reassembly.c | 34 ++++++----------------------------
1 files changed, 6 insertions(+), 28 deletions(-)
diff --git a/net/ipv6/reassembly.c b/net/ipv6/reassembly.c
index 07beeb0..405dc11 100644
--- a/net/ipv6/reassembly.c
+++ b/net/ipv6/reassembly.c
@@ -600,21 +600,21 @@ static struct ctl_table ip6_frags_ns_ctl_table[] = {
.data = &init_net.ipv6.frags.high_thresh,
.maxlen = sizeof(int),
.mode = 0644,
- .proc_handler = proc_dointvec
+ .proc_handler = netns_proc_dointvec,
},
{
.procname = "ip6frag_low_thresh",
.data = &init_net.ipv6.frags.low_thresh,
.maxlen = sizeof(int),
.mode = 0644,
- .proc_handler = proc_dointvec
+ .proc_handler = netns_proc_dointvec,
},
{
.procname = "ip6frag_time",
.data = &init_net.ipv6.frags.timeout,
.maxlen = sizeof(int),
.mode = 0644,
- .proc_handler = proc_dointvec_jiffies,
+ .proc_handler = netns_proc_dointvec_jiffies,
},
{ }
};
@@ -632,42 +632,20 @@ static struct ctl_table ip6_frags_ctl_table[] = {
static int __net_init ip6_frags_ns_sysctl_register(struct net *net)
{
- struct ctl_table *table;
struct ctl_table_header *hdr;
- table = ip6_frags_ns_ctl_table;
- if (!net_eq(net, &init_net)) {
- table = kmemdup(table, sizeof(ip6_frags_ns_ctl_table), GFP_KERNEL);
- if (table == NULL)
- goto err_alloc;
-
- table[0].data = &net->ipv6.frags.high_thresh;
- table[1].data = &net->ipv6.frags.low_thresh;
- table[2].data = &net->ipv6.frags.timeout;
- }
-
- hdr = register_net_sysctl_table(net, net_ipv6_ctl_path, table);
+ hdr = register_net_sysctl_table(net, net_ipv6_ctl_path,
+ ip6_frags_ns_ctl_table);
if (hdr == NULL)
- goto err_reg;
+ return -ENOMEM;
net->ipv6.sysctl.frags_hdr = hdr;
return 0;
-
-err_reg:
- if (!net_eq(net, &init_net))
- kfree(table);
-err_alloc:
- return -ENOMEM;
}
static void __net_exit ip6_frags_ns_sysctl_unregister(struct net *net)
{
- struct ctl_table *table;
-
- table = net->ipv6.sysctl.frags_hdr->ctl_table_arg;
unregister_net_sysctl_table(net->ipv6.sysctl.frags_hdr);
- if (!net_eq(net, &init_net))
- kfree(table);
}
static struct ctl_table_header *ip6_ctl_header;
--
1.7.5.rc0
^ permalink raw reply related
* [PATCH 08/24] sysctl: cookie: share ipv4_net_table between nets
From: Lucian Adrian Grijincu @ 2011-04-02 2:53 UTC (permalink / raw)
To: 'David S . Miller', Alexey Dobriyan, Eric W . Biederman,
Octavian Purdila, linux-kernel
Cc: Lucian Adrian Grijincu
In-Reply-To: <cover.1301711868.git.lucian.grijincu@gmail.com>
Signed-off-by: Lucian Adrian Grijincu <lucian.grijincu@gmail.com>
---
net/ipv4/sysctl_net_ipv4.c | 53 +++++++------------------------------------
1 files changed, 9 insertions(+), 44 deletions(-)
diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c
index 1766d2e..b7b8dbd 100644
--- a/net/ipv4/sysctl_net_ipv4.c
+++ b/net/ipv4/sysctl_net_ipv4.c
@@ -635,49 +635,49 @@ static struct ctl_table ipv4_net_table[] = {
.data = &init_net.ipv4.sysctl_icmp_echo_ignore_all,
.maxlen = sizeof(int),
.mode = 0644,
- .proc_handler = proc_dointvec
+ .proc_handler = netns_proc_dointvec,
},
{
.procname = "icmp_echo_ignore_broadcasts",
.data = &init_net.ipv4.sysctl_icmp_echo_ignore_broadcasts,
.maxlen = sizeof(int),
.mode = 0644,
- .proc_handler = proc_dointvec
+ .proc_handler = netns_proc_dointvec,
},
{
.procname = "icmp_ignore_bogus_error_responses",
.data = &init_net.ipv4.sysctl_icmp_ignore_bogus_error_responses,
.maxlen = sizeof(int),
.mode = 0644,
- .proc_handler = proc_dointvec
+ .proc_handler = netns_proc_dointvec,
},
{
.procname = "icmp_errors_use_inbound_ifaddr",
.data = &init_net.ipv4.sysctl_icmp_errors_use_inbound_ifaddr,
.maxlen = sizeof(int),
.mode = 0644,
- .proc_handler = proc_dointvec
+ .proc_handler = netns_proc_dointvec,
},
{
.procname = "icmp_ratelimit",
.data = &init_net.ipv4.sysctl_icmp_ratelimit,
.maxlen = sizeof(int),
.mode = 0644,
- .proc_handler = proc_dointvec_ms_jiffies,
+ .proc_handler = netns_proc_dointvec_ms_jiffies,
},
{
.procname = "icmp_ratemask",
.data = &init_net.ipv4.sysctl_icmp_ratemask,
.maxlen = sizeof(int),
.mode = 0644,
- .proc_handler = proc_dointvec
+ .proc_handler = netns_proc_dointvec,
},
{
.procname = "rt_cache_rebuild_count",
.data = &init_net.ipv4.sysctl_rt_cache_rebuild_count,
.maxlen = sizeof(int),
.mode = 0644,
- .proc_handler = proc_dointvec
+ .proc_handler = netns_proc_dointvec,
},
{ }
};
@@ -691,53 +691,18 @@ EXPORT_SYMBOL_GPL(net_ipv4_ctl_path);
static __net_init int ipv4_sysctl_init_net(struct net *net)
{
- struct ctl_table *table;
-
- table = ipv4_net_table;
- if (!net_eq(net, &init_net)) {
- table = kmemdup(table, sizeof(ipv4_net_table), GFP_KERNEL);
- if (table == NULL)
- goto err_alloc;
-
- table[0].data =
- &net->ipv4.sysctl_icmp_echo_ignore_all;
- table[1].data =
- &net->ipv4.sysctl_icmp_echo_ignore_broadcasts;
- table[2].data =
- &net->ipv4.sysctl_icmp_ignore_bogus_error_responses;
- table[3].data =
- &net->ipv4.sysctl_icmp_errors_use_inbound_ifaddr;
- table[4].data =
- &net->ipv4.sysctl_icmp_ratelimit;
- table[5].data =
- &net->ipv4.sysctl_icmp_ratemask;
- table[6].data =
- &net->ipv4.sysctl_rt_cache_rebuild_count;
- }
-
net->ipv4.sysctl_rt_cache_rebuild_count = 4;
net->ipv4.ipv4_hdr = register_net_sysctl_table(net,
- net_ipv4_ctl_path, table);
+ net_ipv4_ctl_path, ipv4_net_table);
if (net->ipv4.ipv4_hdr == NULL)
- goto err_reg;
-
+ return -ENOMEM;
return 0;
-
-err_reg:
- if (!net_eq(net, &init_net))
- kfree(table);
-err_alloc:
- return -ENOMEM;
}
static __net_exit void ipv4_sysctl_exit_net(struct net *net)
{
- struct ctl_table *table;
-
- table = net->ipv4.ipv4_hdr->ctl_table_arg;
unregister_net_sysctl_table(net->ipv4.ipv4_hdr);
- kfree(table);
}
static __net_initdata struct pernet_operations ipv4_sysctl_ops = {
--
1.7.5.rc0
^ permalink raw reply related
* [PATCH 07/24] sysctl: cookie: share ipv4_route_flush_table between nets
From: Lucian Adrian Grijincu @ 2011-04-02 2:53 UTC (permalink / raw)
To: 'David S . Miller', Alexey Dobriyan, Eric W . Biederman,
Octavian Purdila, linux-kernel
Cc: Lucian Adrian Grijincu
In-Reply-To: <cover.1301711868.git.lucian.grijincu@gmail.com>
Signed-off-by: Lucian Adrian Grijincu <lucian.grijincu@gmail.com>
---
net/ipv4/route.c | 30 ++++--------------------------
1 files changed, 4 insertions(+), 26 deletions(-)
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 0c66ea6..1e99f01 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -3015,13 +3015,12 @@ static int ipv4_sysctl_rtcache_flush(ctl_table *__ctl, int write,
if (write) {
int flush_delay;
ctl_table ctl;
- struct net *net;
+ struct net *net = (struct net *) cookie;
memcpy(&ctl, __ctl, sizeof(ctl));
ctl.data = &flush_delay;
proc_dointvec(&ctl, write, buffer, lenp, ppos, NULL);
- net = (struct net *)__ctl->extra1;
rt_cache_flush(net, flush_delay);
return 0;
}
@@ -3176,37 +3175,16 @@ static __net_initdata struct ctl_path ipv4_route_path[] = {
static __net_init int sysctl_route_net_init(struct net *net)
{
- struct ctl_table *tbl;
-
- tbl = ipv4_route_flush_table;
- if (!net_eq(net, &init_net)) {
- tbl = kmemdup(tbl, sizeof(ipv4_route_flush_table), GFP_KERNEL);
- if (tbl == NULL)
- goto err_dup;
- }
- tbl[0].extra1 = net;
-
- net->ipv4.route_hdr =
- register_net_sysctl_table(net, ipv4_route_path, tbl);
+ net->ipv4.route_hdr = register_net_sysctl_table(net,
+ ipv4_route_path, ipv4_route_flush_table);
if (net->ipv4.route_hdr == NULL)
- goto err_reg;
+ return -ENOMEM;
return 0;
-
-err_reg:
- if (tbl != ipv4_route_flush_table)
- kfree(tbl);
-err_dup:
- return -ENOMEM;
}
static __net_exit void sysctl_route_net_exit(struct net *net)
{
- struct ctl_table *tbl;
-
- tbl = net->ipv4.route_hdr->ctl_table_arg;
unregister_net_sysctl_table(net->ipv4.route_hdr);
- BUG_ON(tbl == ipv4_route_flush_table);
- kfree(tbl);
}
static __net_initdata struct pernet_operations sysctl_route_ops = {
--
1.7.5.rc0
^ permalink raw reply related
* [PATCH 06/24] sysctl: cookie: share netns_core_table between nets
From: Lucian Adrian Grijincu @ 2011-04-02 2:53 UTC (permalink / raw)
To: 'David S . Miller', Alexey Dobriyan, Eric W . Biederman,
Octavian Purdila, linux-kernel
Cc: Lucian Adrian Grijincu
In-Reply-To: <cover.1301711868.git.lucian.grijincu@gmail.com>
Signed-off-by: Lucian Adrian Grijincu <lucian.grijincu@gmail.com>
---
net/core/sysctl_net_core.c | 28 +++-------------------------
1 files changed, 3 insertions(+), 25 deletions(-)
diff --git a/net/core/sysctl_net_core.c b/net/core/sysctl_net_core.c
index 923ae0f..c4571cc 100644
--- a/net/core/sysctl_net_core.c
+++ b/net/core/sysctl_net_core.c
@@ -183,7 +183,7 @@ static struct ctl_table netns_core_table[] = {
.data = &init_net.core.sysctl_somaxconn,
.maxlen = sizeof(int),
.mode = 0644,
- .proc_handler = proc_dointvec
+ .proc_handler = netns_proc_dointvec,
},
{ }
};
@@ -196,41 +196,19 @@ __net_initdata struct ctl_path net_core_path[] = {
static __net_init int sysctl_core_net_init(struct net *net)
{
- struct ctl_table *tbl;
-
net->core.sysctl_somaxconn = SOMAXCONN;
- tbl = netns_core_table;
- if (!net_eq(net, &init_net)) {
- tbl = kmemdup(tbl, sizeof(netns_core_table), GFP_KERNEL);
- if (tbl == NULL)
- goto err_dup;
-
- tbl[0].data = &net->core.sysctl_somaxconn;
- }
-
net->core.sysctl_hdr = register_net_sysctl_table(net,
- net_core_path, tbl);
+ net_core_path, netns_core_table);
if (net->core.sysctl_hdr == NULL)
- goto err_reg;
+ return -ENOMEM;
return 0;
-
-err_reg:
- if (tbl != netns_core_table)
- kfree(tbl);
-err_dup:
- return -ENOMEM;
}
static __net_exit void sysctl_core_net_exit(struct net *net)
{
- struct ctl_table *tbl;
-
- tbl = net->core.sysctl_hdr->ctl_table_arg;
unregister_net_sysctl_table(net->core.sysctl_hdr);
- BUG_ON(tbl == netns_core_table);
- kfree(tbl);
}
static __net_initdata struct pernet_operations sysctl_core_ops = {
--
1.7.5.rc0
^ permalink raw reply related
* [PATCH 05/24] sysctl: cookie: share ip4_frags_ns_ctl_table between nets
From: Lucian Adrian Grijincu @ 2011-04-02 2:53 UTC (permalink / raw)
To: 'David S . Miller', Alexey Dobriyan, Eric W . Biederman,
Octavian Purdila, linux-kernel
Cc: Lucian Adrian Grijincu
In-Reply-To: <cover.1301711868.git.lucian.grijincu@gmail.com>
We were creating a copy of this table was to set ctl_table->data to
point to data from within the newly created 'struct net*'.
The netns_proc_* handlers do this dynamically.
Also change register_net_sysctl_table() to send the net as a cookie.
Signed-off-by: Lucian Adrian Grijincu <lucian.grijincu@gmail.com>
---
net/ipv4/ip_fragment.c | 34 ++++++----------------------------
net/sysctl_net.c | 2 +-
2 files changed, 7 insertions(+), 29 deletions(-)
diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c
index a1151b8..f8fd613 100644
--- a/net/ipv4/ip_fragment.c
+++ b/net/ipv4/ip_fragment.c
@@ -677,21 +677,21 @@ static struct ctl_table ip4_frags_ns_ctl_table[] = {
.data = &init_net.ipv4.frags.high_thresh,
.maxlen = sizeof(int),
.mode = 0644,
- .proc_handler = proc_dointvec
+ .proc_handler = netns_proc_dointvec
},
{
.procname = "ipfrag_low_thresh",
.data = &init_net.ipv4.frags.low_thresh,
.maxlen = sizeof(int),
.mode = 0644,
- .proc_handler = proc_dointvec
+ .proc_handler = netns_proc_dointvec
},
{
.procname = "ipfrag_time",
.data = &init_net.ipv4.frags.timeout,
.maxlen = sizeof(int),
.mode = 0644,
- .proc_handler = proc_dointvec_jiffies,
+ .proc_handler = netns_proc_dointvec_jiffies,
},
{ }
};
@@ -717,41 +717,19 @@ static struct ctl_table ip4_frags_ctl_table[] = {
static int __net_init ip4_frags_ns_ctl_register(struct net *net)
{
- struct ctl_table *table;
struct ctl_table_header *hdr;
-
- table = ip4_frags_ns_ctl_table;
- if (!net_eq(net, &init_net)) {
- table = kmemdup(table, sizeof(ip4_frags_ns_ctl_table), GFP_KERNEL);
- if (table == NULL)
- goto err_alloc;
-
- table[0].data = &net->ipv4.frags.high_thresh;
- table[1].data = &net->ipv4.frags.low_thresh;
- table[2].data = &net->ipv4.frags.timeout;
- }
-
- hdr = register_net_sysctl_table(net, net_ipv4_ctl_path, table);
+ hdr = register_net_sysctl_table(net, net_ipv4_ctl_path,
+ ip4_frags_ns_ctl_table);
if (hdr == NULL)
- goto err_reg;
+ return -ENOMEM;
net->ipv4.frags_hdr = hdr;
return 0;
-
-err_reg:
- if (!net_eq(net, &init_net))
- kfree(table);
-err_alloc:
- return -ENOMEM;
}
static void __net_exit ip4_frags_ns_ctl_unregister(struct net *net)
{
- struct ctl_table *table;
-
- table = net->ipv4.frags_hdr->ctl_table_arg;
unregister_net_sysctl_table(net->ipv4.frags_hdr);
- kfree(table);
}
static void ip4_frags_ctl_register(void)
diff --git a/net/sysctl_net.c b/net/sysctl_net.c
index dfff9a3..7447d6e 100644
--- a/net/sysctl_net.c
+++ b/net/sysctl_net.c
@@ -110,7 +110,7 @@ struct ctl_table_header *register_net_sysctl_table(struct net *net,
namespaces = *current->nsproxy;
namespaces.net_ns = net;
return __register_sysctl_paths(&net_sysctl_root, &namespaces, path,
- table, NULL);
+ table, net);
}
EXPORT_SYMBOL_GPL(register_net_sysctl_table);
--
1.7.5.rc0
^ permalink raw reply related
* [PATCH 04/24] sysctl: cookie: add netns_proc_dointvec and other netns_proc_* proc_handlers
From: Lucian Adrian Grijincu @ 2011-04-02 2:53 UTC (permalink / raw)
To: 'David S . Miller', Alexey Dobriyan, Eric W . Biederman,
Octavian Purdila, linux-kernel
Cc: Lucian Adrian Grijincu
In-Reply-To: <cover.1301711868.git.lucian.grijincu@gmail.com>
Use these handlers when you want to change a netns dependant
variable. The following restrictions apply:
- these handlers must receive as cookie a 'struct net*'
- the data field of ctl_table* must be at a constant offset from
the init_net structure. e.g.: &init_net.member1.member2..memberN
- these handlers will call their equivalent handler with a
ctl_table with data of the form: net->member1.member2..memberN
Signed-off-by: Lucian Adrian Grijincu <lucian.grijincu@gmail.com>
---
include/net/net_namespace.h | 33 +++++++++++++++++++++++++++++++++
net/sysctl_net.c | 22 ++++++++++++++++++++++
2 files changed, 55 insertions(+), 0 deletions(-)
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
index 3ae4919..86c6e57 100644
--- a/include/net/net_namespace.h
+++ b/include/net/net_namespace.h
@@ -278,4 +278,37 @@ extern struct ctl_table_header *register_net_sysctl_rotable(
const struct ctl_path *path, struct ctl_table *table);
extern void unregister_net_sysctl_table(struct ctl_table_header *header);
+
+
+/*
+ * Use these handlers when you want to change a netns dependant
+ * variable. The following restrictions apply:
+ *
+ * - these handlers must receive as cookie a 'struct net*'
+ *
+ * - the data field of ctl_table* must be at a constant offset from
+ * the init_net structure. e.g.: &init_net.member1.member2..memberN
+ *
+ * - these handlers will call their equivalent handler with a
+ * ctl_table with data of the form: net->member1.member2..memberN
+ */
+extern int netns_proc_dostring(struct ctl_table *,
+ int, void __user *, size_t *, loff_t *, void *net);
+extern int netns_proc_dointvec(struct ctl_table *, int,
+ void __user *, size_t *, loff_t *, void *net);
+extern int netns_proc_dointvec_minmax(struct ctl_table *, int,
+ void __user *, size_t *, loff_t *, void *net);
+extern int netns_proc_dointvec_jiffies(struct ctl_table *, int,
+ void __user *, size_t *, loff_t *, void *net);
+extern int netns_proc_dointvec_userhz_jiffies(struct ctl_table *, int,
+ void __user *, size_t *, loff_t *, void *net);
+extern int netns_proc_dointvec_ms_jiffies(struct ctl_table *, int,
+ void __user *, size_t *, loff_t *, void *net);
+extern int netns_proc_doulongvec_minmax(struct ctl_table *, int,
+ void __user *, size_t *, loff_t *, void *net);
+extern int netns_proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int,
+ void __user *, size_t *, loff_t *, void *net);
+extern int netns_proc_do_large_bitmap(struct ctl_table *, int,
+ void __user *, size_t *, loff_t *, void *net);
+
#endif /* __NET_NET_NAMESPACE_H */
diff --git a/net/sysctl_net.c b/net/sysctl_net.c
index 9dadd17..dfff9a3 100644
--- a/net/sysctl_net.c
+++ b/net/sysctl_net.c
@@ -127,3 +127,25 @@ void unregister_net_sysctl_table(struct ctl_table_header *header)
unregister_sysctl_table(header);
}
EXPORT_SYMBOL_GPL(unregister_net_sysctl_table);
+
+
+
+#define EXPORT_NETNS_PROC_HANDLER(handler) \
+ int netns_##handler(struct ctl_table *table, int write, \
+ void __user *buffer, size_t *lenp, \
+ loff_t *ppos, void *net) \
+ { \
+ struct ctl_table t = *table; \
+ t.data += (char *)net - (char *)&init_net; \
+ return handler(&t, write, buffer, lenp, ppos, NULL); \
+ } \
+ EXPORT_SYMBOL_GPL(netns_##handler);
+
+EXPORT_NETNS_PROC_HANDLER(proc_dointvec);
+EXPORT_NETNS_PROC_HANDLER(proc_dointvec_minmax);
+EXPORT_NETNS_PROC_HANDLER(proc_dointvec_jiffies);
+EXPORT_NETNS_PROC_HANDLER(proc_dointvec_userhz_jiffies);
+EXPORT_NETNS_PROC_HANDLER(proc_dointvec_ms_jiffies);
+EXPORT_NETNS_PROC_HANDLER(proc_doulongvec_minmax)
+EXPORT_NETNS_PROC_HANDLER(proc_doulongvec_ms_jiffies_minmax);
+EXPORT_NETNS_PROC_HANDLER(proc_do_large_bitmap);
--
1.7.5.rc0
^ permalink raw reply related
* [PATCH 03/24] sysctl: cookie: pass ctl_header_cookie to proc_handler
From: Lucian Adrian Grijincu @ 2011-04-02 2:53 UTC (permalink / raw)
To: 'David S . Miller', Alexey Dobriyan, Eric W . Biederman,
Octavian Purdila, linux-kernel
Cc: Lucian Adrian Grijincu
In-Reply-To: <cover.1301711868.git.lucian.grijincu@gmail.com>
The bulk of this patch changes all proc_handlers in the kernel to
receive the cookie.
Signed-off-by: Lucian Adrian Grijincu <lucian.grijincu@gmail.com>
---
arch/frv/kernel/pm.c | 22 ++++----
arch/frv/kernel/sysctl.c | 4 +-
arch/mips/lasat/sysctl.c | 28 ++++++------
arch/s390/appldata/appldata_base.c | 15 +++---
arch/s390/kernel/debug.c | 6 +-
arch/s390/mm/cmm.c | 4 +-
drivers/cdrom/cdrom.c | 12 ++--
drivers/char/random.c | 6 +-
drivers/macintosh/mac_hid.c | 4 +-
drivers/parport/procfs.c | 29 +++++------
drivers/s390/char/sclp_async.c | 2 +-
fs/dcache.c | 4 +-
fs/drop_caches.c | 5 +-
fs/file_table.c | 10 ++--
fs/fscache/main.c | 6 +-
fs/inode.c | 6 +-
fs/pipe.c | 4 +-
fs/proc/proc_sysctl.c | 3 +-
fs/quota/dquot.c | 5 +-
fs/xfs/linux-2.6/xfs_sysctl.c | 10 ++--
include/linux/compaction.h | 6 ++-
include/linux/fs.h | 12 ++--
include/linux/ftrace.h | 4 +-
include/linux/hugetlb.h | 13 +++--
include/linux/kprobes.h | 6 +-
include/linux/mm.h | 4 +-
include/linux/mmzone.h | 23 +++++----
include/linux/nmi.h | 4 +-
include/linux/perf_event.h | 2 +-
include/linux/pipe_fs_i.h | 2 +-
include/linux/sched.h | 16 +++---
include/linux/security.h | 3 +-
include/linux/swap.h | 4 +-
include/linux/sysctl.h | 30 ++++++++----
include/linux/writeback.h | 18 ++-----
include/net/ndisc.h | 7 ++-
ipc/ipc_sysctl.c | 21 +++++----
ipc/mq_sysctl.c | 11 ++--
kernel/hung_task.c | 6 +-
kernel/kprobes.c | 4 +-
kernel/perf_event.c | 4 +-
kernel/sched.c | 4 +-
kernel/sched_fair.c | 4 +-
kernel/sysctl.c | 91 +++++++++++++++++++++++------------
kernel/trace/ftrace.c | 4 +-
kernel/trace/trace_stack.c | 4 +-
kernel/utsname_sysctl.c | 6 +-
kernel/watchdog.c | 11 ++--
mm/compaction.c | 8 ++-
mm/hugetlb.c | 24 +++++----
mm/page-writeback.c | 24 ++++------
mm/page_alloc.c | 25 +++++-----
mm/vmscan.c | 6 +-
net/bridge/br_netfilter.c | 6 +-
net/core/sysctl_net_core.c | 5 +-
net/decnet/dn_dev.c | 10 ++--
net/decnet/sysctl_net_decnet.c | 8 ++--
net/ipv4/devinet.c | 18 ++++----
net/ipv4/route.c | 6 +-
net/ipv4/sysctl_net_ipv4.c | 25 +++++-----
net/ipv6/addrconf.c | 12 ++--
net/ipv6/ndisc.c | 14 +++--
net/ipv6/route.c | 6 +-
net/irda/irsysctl.c | 12 ++--
net/netfilter/ipvs/ip_vs_ctl.c | 12 ++--
net/netfilter/nf_log.c | 5 +-
net/phonet/sysctl.c | 6 +-
net/sunrpc/sysctl.c | 9 ++--
net/sunrpc/xprtrdma/svc_rdma.c | 2 +-
security/min_addr.c | 5 +-
70 files changed, 405 insertions(+), 352 deletions(-)
diff --git a/arch/frv/kernel/pm.c b/arch/frv/kernel/pm.c
index 5fa3889..a929ffb 100644
--- a/arch/frv/kernel/pm.c
+++ b/arch/frv/kernel/pm.c
@@ -150,8 +150,8 @@ static int user_atoi(char __user *ubuf, size_t len)
/*
* Send us to sleep.
*/
-static int sysctl_pm_do_suspend(ctl_table *ctl, int write,
- void __user *buffer, size_t *lenp, loff_t *fpos)
+static int sysctl_pm_do_suspend(ctl_table *ctl, int write, void __user *buffer,
+ size_t *lenp, loff_t *fpos, void *cookie)
{
int retval, mode;
@@ -198,13 +198,13 @@ static int try_set_cmode(int new_cmode)
}
-static int cmode_procctl(ctl_table *ctl, int write,
- void __user *buffer, size_t *lenp, loff_t *fpos)
+static int cmode_procctl(ctl_table *ctl, int write, void __user *buffer,
+ size_t *lenp, loff_t *fpos, void *cookie)
{
int new_cmode;
if (!write)
- return proc_dointvec(ctl, write, buffer, lenp, fpos);
+ return proc_dointvec(ctl, write, buffer, lenp, fpos, NULL);
new_cmode = user_atoi(buffer, *lenp);
@@ -270,26 +270,26 @@ static int try_set_cm(int new_cm)
return 0;
}
-static int p0_procctl(ctl_table *ctl, int write,
- void __user *buffer, size_t *lenp, loff_t *fpos)
+static int p0_procctl(ctl_table *ctl, int write, void __user *buffer,
+ size_t *lenp, loff_t *fpos, void *cookie)
{
int new_p0;
if (!write)
- return proc_dointvec(ctl, write, buffer, lenp, fpos);
+ return proc_dointvec(ctl, write, buffer, lenp, fpos, NULL);
new_p0 = user_atoi(buffer, *lenp);
return try_set_p0(new_p0)?:*lenp;
}
-static int cm_procctl(ctl_table *ctl, int write,
- void __user *buffer, size_t *lenp, loff_t *fpos)
+static int cm_procctl(ctl_table *ctl, int write, void __user *buffer,
+ size_t *lenp, loff_t *fpos, void *cookie)
{
int new_cm;
if (!write)
- return proc_dointvec(ctl, write, buffer, lenp, fpos);
+ return proc_dointvec(ctl, write, buffer, lenp, fpos, NULL);
new_cm = user_atoi(buffer, *lenp);
diff --git a/arch/frv/kernel/sysctl.c b/arch/frv/kernel/sysctl.c
index 6c155d6..e2be463 100644
--- a/arch/frv/kernel/sysctl.c
+++ b/arch/frv/kernel/sysctl.c
@@ -48,7 +48,7 @@ static void frv_change_dcache_mode(unsigned long newmode)
*/
static int procctl_frv_cachemode(ctl_table *table, int write,
void __user *buffer, size_t *lenp,
- loff_t *ppos)
+ loff_t *ppos, void *cookie)
{
unsigned long hsr0;
char buff[8];
@@ -123,7 +123,7 @@ static int procctl_frv_cachemode(ctl_table *table, int write,
#ifdef CONFIG_MMU
static int procctl_frv_pin_cxnr(ctl_table *table, int write,
void __user *buffer, size_t *lenp,
- loff_t *ppos)
+ loff_t *ppos, void *cookie)
{
pid_t pid;
char buff[16], *p;
diff --git a/arch/mips/lasat/sysctl.c b/arch/mips/lasat/sysctl.c
index d87ffd0..33f408c 100644
--- a/arch/mips/lasat/sysctl.c
+++ b/arch/mips/lasat/sysctl.c
@@ -39,12 +39,12 @@
/* And the same for proc */
-int proc_dolasatstring(ctl_table *table, int write,
- void *buffer, size_t *lenp, loff_t *ppos)
+int proc_dolasatstring(ctl_table *table, int write, void *buffer,
+ size_t *lenp, loff_t *ppos, void *cookie)
{
int r;
- r = proc_dostring(table, write, buffer, lenp, ppos);
+ r = proc_dostring(table, write, buffer, lenp, ppos, NULL);
if ((!write) || r)
return r;
@@ -54,12 +54,12 @@ int proc_dolasatstring(ctl_table *table, int write,
}
/* proc function to write EEPROM after changing int entry */
-int proc_dolasatint(ctl_table *table, int write,
- void *buffer, size_t *lenp, loff_t *ppos)
+int proc_dolasatint(ctl_table *table, int write, void *buffer,
+ size_t *lenp, loff_t *ppos, void *cookie)
{
int r;
- r = proc_dointvec(table, write, buffer, lenp, ppos);
+ r = proc_dointvec(table, write, buffer, lenp, ppos, NULL);
if ((!write) || r)
return r;
@@ -72,8 +72,8 @@ int proc_dolasatint(ctl_table *table, int write,
static int rtctmp;
/* proc function to read/write RealTime Clock */
-int proc_dolasatrtc(ctl_table *table, int write,
- void *buffer, size_t *lenp, loff_t *ppos)
+int proc_dolasatrtc(ctl_table *table, int write, void *buffer,
+ size_t *lenp, loff_t *ppos, void *cookie)
{
struct timespec ts;
int r;
@@ -85,7 +85,7 @@ int proc_dolasatrtc(ctl_table *table, int write,
if (rtctmp < 0)
rtctmp = 0;
}
- r = proc_dointvec(table, write, buffer, lenp, ppos);
+ r = proc_dointvec(table, write, buffer, lenp, ppos, NULL);
if (r)
return r;
@@ -97,8 +97,8 @@ int proc_dolasatrtc(ctl_table *table, int write,
#endif
#ifdef CONFIG_INET
-int proc_lasat_ip(ctl_table *table, int write,
- void *buffer, size_t *lenp, loff_t *ppos)
+int proc_lasat_ip(ctl_table *table, int write, void *buffer,
+ size_t *lenp, loff_t *ppos, void *cookie)
{
unsigned int ip;
char *p, c;
@@ -157,12 +157,12 @@ int proc_lasat_ip(ctl_table *table, int write,
}
#endif
-int proc_lasat_prid(ctl_table *table, int write,
- void *buffer, size_t *lenp, loff_t *ppos)
+int proc_lasat_prid(ctl_table *table, int write, void *buffer,
+ size_t *lenp, loff_t *ppos, void *cookie)
{
int r;
- r = proc_dointvec(table, write, buffer, lenp, ppos);
+ r = proc_dointvec(table, write, buffer, lenp, ppos, NULL);
if (r < 0)
return r;
if (write) {
diff --git a/arch/s390/appldata/appldata_base.c b/arch/s390/appldata/appldata_base.c
index 5c91995..866d8c0 100644
--- a/arch/s390/appldata/appldata_base.c
+++ b/arch/s390/appldata/appldata_base.c
@@ -51,10 +51,11 @@ static struct platform_device *appldata_pdev;
*/
static const char appldata_proc_name[APPLDATA_PROC_NAME_LENGTH] = "appldata";
static int appldata_timer_handler(ctl_table *ctl, int write,
- void __user *buffer, size_t *lenp, loff_t *ppos);
+ void __user *buffer, size_t *lenp,
+ loff_t *ppos, void *cookie);
static int appldata_interval_handler(ctl_table *ctl, int write,
- void __user *buffer,
- size_t *lenp, loff_t *ppos);
+ void __user *buffer, size_t *lenp,
+ loff_t *ppos, void *cookie);
static struct ctl_table_header *appldata_sysctl_header;
static struct ctl_table appldata_table[] = {
@@ -246,8 +247,8 @@ __appldata_vtimer_setup(int cmd)
* Start/Stop timer, show status of timer (0 = not active, 1 = active)
*/
static int
-appldata_timer_handler(ctl_table *ctl, int write,
- void __user *buffer, size_t *lenp, loff_t *ppos)
+appldata_timer_handler(ctl_table *ctl, int write, void __user *buffer,
+ size_t *lenp, loff_t *ppos, void *cookie)
{
int len;
char buf[2];
@@ -334,8 +335,8 @@ out:
* monitoring (0 = not in process, 1 = in process)
*/
static int
-appldata_generic_handler(ctl_table *ctl, int write,
- void __user *buffer, size_t *lenp, loff_t *ppos)
+appldata_generic_handler(ctl_table *ctl, int write, void __user *buffer,
+ size_t *lenp, loff_t *ppos, void *cookie)
{
struct appldata_ops *ops = NULL, *tmp_ops;
int rc, len, found;
diff --git a/arch/s390/kernel/debug.c b/arch/s390/kernel/debug.c
index 5ad6bc0..bcd28c3 100644
--- a/arch/s390/kernel/debug.c
+++ b/arch/s390/kernel/debug.c
@@ -884,11 +884,11 @@ static int debug_active=1;
* if debug_active is already off
*/
static int
-s390dbf_procactive(ctl_table *table, int write,
- void __user *buffer, size_t *lenp, loff_t *ppos)
+s390dbf_procactive(ctl_table *table, int write, void __user *buffer,
+ size_t *lenp, loff_t *ppos, void *cookie)
{
if (!write || debug_stoppable || !debug_active)
- return proc_dointvec(table, write, buffer, lenp, ppos);
+ return proc_dointvec(table, write, buffer, lenp, ppos, NULL);
else
return 0;
}
diff --git a/arch/s390/mm/cmm.c b/arch/s390/mm/cmm.c
index c66ffd8..1fe48f7 100644
--- a/arch/s390/mm/cmm.c
+++ b/arch/s390/mm/cmm.c
@@ -254,7 +254,7 @@ static int cmm_skip_blanks(char *cp, char **endp)
static struct ctl_table cmm_table[];
static int cmm_pages_handler(ctl_table *ctl, int write, void __user *buffer,
- size_t *lenp, loff_t *ppos)
+ size_t *lenp, loff_t *ppos, void *cookie)
{
char buf[16], *p;
long nr;
@@ -294,7 +294,7 @@ static int cmm_pages_handler(ctl_table *ctl, int write, void __user *buffer,
}
static int cmm_timeout_handler(ctl_table *ctl, int write, void __user *buffer,
- size_t *lenp, loff_t *ppos)
+ size_t *lenp, loff_t *ppos, void *cookie)
{
char buf[64], *p;
long nr, seconds;
diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c
index e2c48a7..2c3d2d5 100644
--- a/drivers/cdrom/cdrom.c
+++ b/drivers/cdrom/cdrom.c
@@ -3469,8 +3469,8 @@ static int cdrom_print_info(const char *header, int val, char *info,
return 0;
}
-static int cdrom_sysctl_info(ctl_table *ctl, int write,
- void __user *buffer, size_t *lenp, loff_t *ppos)
+static int cdrom_sysctl_info(ctl_table *ctl, int write, void __user *buffer,
+ size_t *lenp, loff_t *ppos, void *cookie)
{
int pos;
char *info = cdrom_sysctl_settings.info;
@@ -3546,7 +3546,7 @@ static int cdrom_sysctl_info(ctl_table *ctl, int write,
goto done;
doit:
mutex_unlock(&cdrom_mutex);
- return proc_dostring(ctl, write, buffer, lenp, ppos);
+ return proc_dostring(ctl, write, buffer, lenp, ppos, NULL);
done:
pr_info("info buffer too small\n");
goto doit;
@@ -3582,12 +3582,12 @@ static void cdrom_update_settings(void)
mutex_unlock(&cdrom_mutex);
}
-static int cdrom_sysctl_handler(ctl_table *ctl, int write,
- void __user *buffer, size_t *lenp, loff_t *ppos)
+static int cdrom_sysctl_handler(ctl_table *ctl, int write, void __user *buffer,
+ size_t *lenp, loff_t *ppos, void *cookie)
{
int ret;
- ret = proc_dointvec(ctl, write, buffer, lenp, ppos);
+ ret = proc_dointvec(ctl, write, buffer, lenp, ppos, NULL);
if (write) {
diff --git a/drivers/char/random.c b/drivers/char/random.c
index 5e29e80..2e54a13 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -1227,8 +1227,8 @@ static char sysctl_bootid[16];
* as an ASCII string in the standard UUID format. If accesses via the
* sysctl system call, it is returned as 16 bytes of binary data.
*/
-static int proc_do_uuid(ctl_table *table, int write,
- void __user *buffer, size_t *lenp, loff_t *ppos)
+static int proc_do_uuid(ctl_table *table, int write, void __user *buffer,
+ size_t *lenp, loff_t *ppos, void *cookie)
{
ctl_table fake_table;
unsigned char buf[64], tmp_uuid[16], *uuid;
@@ -1246,7 +1246,7 @@ static int proc_do_uuid(ctl_table *table, int write,
fake_table.data = buf;
fake_table.maxlen = sizeof(buf);
- return proc_dostring(&fake_table, write, buffer, lenp, ppos);
+ return proc_dostring(&fake_table, write, buffer, lenp, ppos, NULL);
}
static int sysctl_poolsize = INPUT_POOL_WORDS * 32;
diff --git a/drivers/macintosh/mac_hid.c b/drivers/macintosh/mac_hid.c
index 6a82388..76ff0f7 100644
--- a/drivers/macintosh/mac_hid.c
+++ b/drivers/macintosh/mac_hid.c
@@ -183,7 +183,7 @@ static void mac_hid_stop_emulation(void)
static int mac_hid_toggle_emumouse(ctl_table *table, int write,
void __user *buffer, size_t *lenp,
- loff_t *ppos)
+ loff_t *ppos, void *cookie)
{
int *valp = table->data;
int old_val = *valp;
@@ -193,7 +193,7 @@ static int mac_hid_toggle_emumouse(ctl_table *table, int write,
if (rc)
return rc;
- rc = proc_dointvec(table, write, buffer, lenp, ppos);
+ rc = proc_dointvec(table, write, buffer, lenp, ppos, NULL);
if (rc == 0 && write && *valp != old_val) {
if (*valp == 1)
diff --git a/drivers/parport/procfs.c b/drivers/parport/procfs.c
index 3f56bc0..fc4aa33 100644
--- a/drivers/parport/procfs.c
+++ b/drivers/parport/procfs.c
@@ -31,8 +31,8 @@
#define PARPORT_MIN_SPINTIME_VALUE 1
#define PARPORT_MAX_SPINTIME_VALUE 1000
-static int do_active_device(ctl_table *table, int write,
- void __user *result, size_t *lenp, loff_t *ppos)
+static int do_active_device(ctl_table *table, int write, void __user *result,
+ size_t *lenp, loff_t *ppos, void *cookie)
{
struct parport *port = (struct parport *)table->extra1;
char buffer[256];
@@ -68,8 +68,8 @@ static int do_active_device(ctl_table *table, int write,
}
#ifdef CONFIG_PARPORT_1284
-static int do_autoprobe(ctl_table *table, int write,
- void __user *result, size_t *lenp, loff_t *ppos)
+static int do_autoprobe(ctl_table *table, int write, void __user *result,
+ size_t *lenp, loff_t *ppos, void *cookie)
{
struct parport_device_info *info = table->extra2;
const char *str;
@@ -110,9 +110,9 @@ static int do_autoprobe(ctl_table *table, int write,
}
#endif /* IEEE1284.3 support. */
-static int do_hardware_base_addr (ctl_table *table, int write,
- void __user *result,
- size_t *lenp, loff_t *ppos)
+static int do_hardware_base_addr(ctl_table *table, int write,
+ void __user *result, size_t *lenp,
+ loff_t *ppos, void *cookie)
{
struct parport *port = (struct parport *)table->extra1;
char buffer[20];
@@ -138,9 +138,8 @@ static int do_hardware_base_addr (ctl_table *table, int write,
return copy_to_user(result, buffer, len) ? -EFAULT : 0;
}
-static int do_hardware_irq (ctl_table *table, int write,
- void __user *result,
- size_t *lenp, loff_t *ppos)
+static int do_hardware_irq(ctl_table *table, int write, void __user *result,
+ size_t *lenp, loff_t *ppos, void *cookie)
{
struct parport *port = (struct parport *)table->extra1;
char buffer[20];
@@ -166,9 +165,8 @@ static int do_hardware_irq (ctl_table *table, int write,
return copy_to_user(result, buffer, len) ? -EFAULT : 0;
}
-static int do_hardware_dma (ctl_table *table, int write,
- void __user *result,
- size_t *lenp, loff_t *ppos)
+static int do_hardware_dma(ctl_table *table, int write, void __user *result,
+ size_t *lenp, loff_t *ppos, void *cookie)
{
struct parport *port = (struct parport *)table->extra1;
char buffer[20];
@@ -194,9 +192,8 @@ static int do_hardware_dma (ctl_table *table, int write,
return copy_to_user(result, buffer, len) ? -EFAULT : 0;
}
-static int do_hardware_modes (ctl_table *table, int write,
- void __user *result,
- size_t *lenp, loff_t *ppos)
+static int do_hardware_modes(ctl_table *table, int write, void __user *result,
+ size_t *lenp, loff_t *ppos, void *cookie)
{
struct parport *port = (struct parport *)table->extra1;
char buffer[40];
diff --git a/drivers/s390/char/sclp_async.c b/drivers/s390/char/sclp_async.c
index 7ad30e7..c4da7ea 100644
--- a/drivers/s390/char/sclp_async.c
+++ b/drivers/s390/char/sclp_async.c
@@ -65,7 +65,7 @@ static struct notifier_block call_home_panic_nb = {
static int proc_handler_callhome(struct ctl_table *ctl, int write,
void __user *buffer, size_t *count,
- loff_t *ppos)
+ loff_t *ppos, void *cookie)
{
unsigned long val;
int len, rc;
diff --git a/fs/dcache.c b/fs/dcache.c
index ad25c4c..38b78c4 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -140,10 +140,10 @@ static int get_nr_dentry(void)
}
int proc_nr_dentry(ctl_table *table, int write, void __user *buffer,
- size_t *lenp, loff_t *ppos)
+ size_t *lenp, loff_t *ppos, void *cookie)
{
dentry_stat.nr_dentry = get_nr_dentry();
- return proc_dointvec(table, write, buffer, lenp, ppos);
+ return proc_dointvec(table, write, buffer, lenp, ppos, NULL);
}
#endif
diff --git a/fs/drop_caches.c b/fs/drop_caches.c
index 98b77c8..78f1ce4 100644
--- a/fs/drop_caches.c
+++ b/fs/drop_caches.c
@@ -47,11 +47,12 @@ static void drop_slab(void)
}
int drop_caches_sysctl_handler(ctl_table *table, int write,
- void __user *buffer, size_t *length, loff_t *ppos)
+ void __user *buffer, size_t *length,
+ loff_t *ppos, void *cookie)
{
int ret;
- ret = proc_dointvec_minmax(table, write, buffer, length, ppos);
+ ret = proc_dointvec_minmax(table, write, buffer, length, ppos, NULL);
if (ret)
return ret;
if (write) {
diff --git a/fs/file_table.c b/fs/file_table.c
index 01e4c1e..d18b9d9 100644
--- a/fs/file_table.c
+++ b/fs/file_table.c
@@ -78,15 +78,15 @@ EXPORT_SYMBOL_GPL(get_max_files);
* Handle nr_files sysctl
*/
#if defined(CONFIG_SYSCTL) && defined(CONFIG_PROC_FS)
-int proc_nr_files(ctl_table *table, int write,
- void __user *buffer, size_t *lenp, loff_t *ppos)
+int proc_nr_files(ctl_table *table, int write, void __user *buffer,
+ size_t *lenp, loff_t *ppos, void *cookie)
{
files_stat.nr_files = get_nr_files();
- return proc_doulongvec_minmax(table, write, buffer, lenp, ppos);
+ return proc_doulongvec_minmax(table, write, buffer, lenp, ppos, NULL);
}
#else
-int proc_nr_files(ctl_table *table, int write,
- void __user *buffer, size_t *lenp, loff_t *ppos)
+int proc_nr_files(ctl_table *table, int write, void __user *buffer,
+ size_t *lenp, loff_t *ppos, void *cookie)
{
return -ENOSYS;
}
diff --git a/fs/fscache/main.c b/fs/fscache/main.c
index f9d8567..00415f6 100644
--- a/fs/fscache/main.c
+++ b/fs/fscache/main.c
@@ -54,14 +54,14 @@ static unsigned fscache_op_max_active = 2;
static struct ctl_table_header *fscache_sysctl_header;
static int fscache_max_active_sysctl(struct ctl_table *table, int write,
- void __user *buffer,
- size_t *lenp, loff_t *ppos)
+ void __user *buffer, size_t *lenp,
+ loff_t *ppos, void *cookie)
{
struct workqueue_struct **wqp = table->extra1;
unsigned int *datap = table->data;
int ret;
- ret = proc_dointvec(table, write, buffer, lenp, ppos);
+ ret = proc_dointvec(table, write, buffer, lenp, ppos, NULL);
if (ret == 0)
workqueue_set_max_active(*wqp, *datap);
return ret;
diff --git a/fs/inode.c b/fs/inode.c
index 5f4e11a..ec96079 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -158,11 +158,11 @@ int get_nr_dirty_inodes(void)
* Handle nr_inode sysctl
*/
#ifdef CONFIG_SYSCTL
-int proc_nr_inodes(ctl_table *table, int write,
- void __user *buffer, size_t *lenp, loff_t *ppos)
+int proc_nr_inodes(ctl_table *table, int write, void __user *buffer,
+ size_t *lenp, loff_t *ppos, void *cookie)
{
inodes_stat.nr_inodes = get_nr_inodes();
- return proc_dointvec(table, write, buffer, lenp, ppos);
+ return proc_dointvec(table, write, buffer, lenp, ppos, NULL);
}
#endif
diff --git a/fs/pipe.c b/fs/pipe.c
index da42f7d..c37413bd 100644
--- a/fs/pipe.c
+++ b/fs/pipe.c
@@ -1186,11 +1186,11 @@ static inline unsigned int round_pipe_size(unsigned int size)
* will return an error.
*/
int pipe_proc_fn(struct ctl_table *table, int write, void __user *buf,
- size_t *lenp, loff_t *ppos)
+ size_t *lenp, loff_t *ppos, void *cookie)
{
int ret;
- ret = proc_dointvec_minmax(table, write, buf, lenp, ppos);
+ ret = proc_dointvec_minmax(table, write, buf, lenp, ppos, NULL);
if (ret < 0 || !write)
return ret;
diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c
index f50133c..f1e91e7 100644
--- a/fs/proc/proc_sysctl.c
+++ b/fs/proc/proc_sysctl.c
@@ -155,7 +155,8 @@ static ssize_t proc_sys_call_handler(struct file *filp, void __user *buf,
/* careful: calling conventions are nasty here */
res = count;
- error = table->proc_handler(table, write, buf, &res, ppos);
+ error = table->proc_handler(table, write, buf, &res,
+ ppos, head->ctl_header_cookie);
if (!error)
error = res;
out:
diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
index fcc8ae7..894ed7b 100644
--- a/fs/quota/dquot.c
+++ b/fs/quota/dquot.c
@@ -2517,14 +2517,15 @@ const struct quotactl_ops dquot_quotactl_ops = {
EXPORT_SYMBOL(dquot_quotactl_ops);
static int do_proc_dqstats(struct ctl_table *table, int write,
- void __user *buffer, size_t *lenp, loff_t *ppos)
+ void __user *buffer, size_t *lenp,
+ loff_t *ppos, void *cookie)
{
unsigned int type = (int *)table->data - dqstats.stat;
/* Update global table */
dqstats.stat[type] =
percpu_counter_sum_positive(&dqstats.counter[type]);
- return proc_dointvec(table, write, buffer, lenp, ppos);
+ return proc_dointvec(table, write, buffer, lenp, ppos, NULL);
}
static ctl_table fs_dqstats_table[] = {
diff --git a/fs/xfs/linux-2.6/xfs_sysctl.c b/fs/xfs/linux-2.6/xfs_sysctl.c
index ee2d2ad..1d2a781 100644
--- a/fs/xfs/linux-2.6/xfs_sysctl.c
+++ b/fs/xfs/linux-2.6/xfs_sysctl.c
@@ -29,12 +29,13 @@ xfs_stats_clear_proc_handler(
int write,
void __user *buffer,
size_t *lenp,
- loff_t *ppos)
+ loff_t *ppos,
+ void *cookie)
{
int c, ret, *valp = ctl->data;
__uint32_t vn_active;
- ret = proc_dointvec_minmax(ctl, write, buffer, lenp, ppos);
+ ret = proc_dointvec_minmax(ctl, write, buffer, lenp, ppos, NULL);
if (!ret && write && *valp) {
xfs_notice(NULL, "Clearing xfsstats");
@@ -59,11 +60,12 @@ xfs_panic_mask_proc_handler(
int write,
void __user *buffer,
size_t *lenp,
- loff_t *ppos)
+ loff_t *ppos,
+ void *cookie)
{
int ret, *valp = ctl->data;
- ret = proc_dointvec_minmax(ctl, write, buffer, lenp, ppos);
+ ret = proc_dointvec_minmax(ctl, write, buffer, lenp, ppos, NULL);
if (!ret && write) {
xfs_panic_mask = *valp;
#ifdef DEBUG
diff --git a/include/linux/compaction.h b/include/linux/compaction.h
index cc9f7a4..aa898e5 100644
--- a/include/linux/compaction.h
+++ b/include/linux/compaction.h
@@ -14,10 +14,12 @@
#ifdef CONFIG_COMPACTION
extern int sysctl_compact_memory;
extern int sysctl_compaction_handler(struct ctl_table *table, int write,
- void __user *buffer, size_t *length, loff_t *ppos);
+ void __user *buffer, size_t *length,
+ loff_t *ppos, void *cookie);
extern int sysctl_extfrag_threshold;
extern int sysctl_extfrag_handler(struct ctl_table *table, int write,
- void __user *buffer, size_t *length, loff_t *ppos);
+ void __user *buffer, size_t *length,
+ loff_t *ppos, void *cookie);
extern int fragmentation_index(struct zone *zone, unsigned int order);
extern unsigned long try_to_compact_pages(struct zonelist *zonelist,
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 52f283c..1096299 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -2562,12 +2562,12 @@ ssize_t simple_attr_write(struct file *file, const char __user *buf,
size_t len, loff_t *ppos);
struct ctl_table;
-int proc_nr_files(struct ctl_table *table, int write,
- void __user *buffer, size_t *lenp, loff_t *ppos);
-int proc_nr_dentry(struct ctl_table *table, int write,
- void __user *buffer, size_t *lenp, loff_t *ppos);
-int proc_nr_inodes(struct ctl_table *table, int write,
- void __user *buffer, size_t *lenp, loff_t *ppos);
+int proc_nr_files(struct ctl_table *table, int write, void __user *buffer,
+ size_t *lenp, loff_t *ppos, void *cookie);
+int proc_nr_dentry(struct ctl_table *table, int write, void __user *buffer,
+ size_t *lenp, loff_t *ppos, void *cookie);
+int proc_nr_inodes(struct ctl_table *table, int write, void __user *buffer,
+ size_t *lenp, loff_t *ppos, void *cookie);
int __init get_filesystem_list(char *buf);
#define __FMODE_EXEC ((__force int) FMODE_EXEC)
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index ca29e03..6e3a3d9 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -25,7 +25,7 @@ extern int ftrace_enabled;
extern int
ftrace_enable_sysctl(struct ctl_table *table, int write,
void __user *buffer, size_t *lenp,
- loff_t *ppos);
+ loff_t *ppos, void *cookie);
typedef void (*ftrace_func_t)(unsigned long ip, unsigned long parent_ip);
@@ -104,7 +104,7 @@ extern int stack_tracer_enabled;
int
stack_trace_sysctl(struct ctl_table *table, int write,
void __user *buffer, size_t *lenp,
- loff_t *ppos);
+ loff_t *ppos, void *cookie);
#endif
struct ftrace_func_command {
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index 943c76b..4bb40ca 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -16,13 +16,16 @@ struct user_struct;
int PageHuge(struct page *page);
void reset_vma_resv_huge_pages(struct vm_area_struct *vma);
-int hugetlb_sysctl_handler(struct ctl_table *, int, void __user *, size_t *, loff_t *);
-int hugetlb_overcommit_handler(struct ctl_table *, int, void __user *, size_t *, loff_t *);
-int hugetlb_treat_movable_handler(struct ctl_table *, int, void __user *, size_t *, loff_t *);
+int hugetlb_sysctl_handler(struct ctl_table *, int, void __user *,
+ size_t *, loff_t *, void *);
+int hugetlb_overcommit_handler(struct ctl_table *, int, void __user *,
+ size_t *, loff_t *, void *);
+int hugetlb_treat_movable_handler(struct ctl_table *, int, void __user *,
+ size_t *, loff_t *, void *);
#ifdef CONFIG_NUMA
-int hugetlb_mempolicy_sysctl_handler(struct ctl_table *, int,
- void __user *, size_t *, loff_t *);
+int hugetlb_mempolicy_sysctl_handler(struct ctl_table *, int, void __user *,
+ size_t *, loff_t *, void *);
#endif
int copy_hugetlb_page_range(struct mm_struct *, struct mm_struct *, struct vm_area_struct *);
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h
index dd7c12e..f5c5357 100644
--- a/include/linux/kprobes.h
+++ b/include/linux/kprobes.h
@@ -288,9 +288,9 @@ extern void opt_pre_handler(struct kprobe *p, struct pt_regs *regs);
#ifdef CONFIG_SYSCTL
extern int sysctl_kprobes_optimization;
-extern int proc_kprobes_optimization_handler(struct ctl_table *table,
- int write, void __user *buffer,
- size_t *length, loff_t *ppos);
+extern int proc_kprobes_optimization_handler(struct ctl_table *table, int write,
+ void __user *buffer, size_t *len,
+ loff_t *ppos, void *cookie);
#endif
#endif /* CONFIG_OPTPROBES */
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 7606d7d..b0793e5 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -1602,8 +1602,8 @@ int in_gate_area_no_mm(unsigned long addr);
#define in_gate_area(mm, addr) ({(void)mm; in_gate_area_no_mm(addr);})
#endif /* __HAVE_ARCH_GATE_AREA */
-int drop_caches_sysctl_handler(struct ctl_table *, int,
- void __user *, size_t *, loff_t *);
+int drop_caches_sysctl_handler(struct ctl_table *, int, void __user *,
+ size_t *, loff_t *, void *);
unsigned long shrink_slab(unsigned long scanned, gfp_t gfp_mask,
unsigned long lru_pages);
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index e56f835..7592afd 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -764,20 +764,21 @@ static inline int is_dma(struct zone *zone)
/* These two functions are used to setup the per zone pages min values */
struct ctl_table;
-int min_free_kbytes_sysctl_handler(struct ctl_table *, int,
- void __user *, size_t *, loff_t *);
+int min_free_kbytes_sysctl_handler(struct ctl_table *, int, void __user *,
+ size_t *, loff_t *, void *);
extern int sysctl_lowmem_reserve_ratio[MAX_NR_ZONES-1];
-int lowmem_reserve_ratio_sysctl_handler(struct ctl_table *, int,
- void __user *, size_t *, loff_t *);
+int lowmem_reserve_ratio_sysctl_handler(struct ctl_table *, int, void __user *,
+ size_t *, loff_t *, void *);
int percpu_pagelist_fraction_sysctl_handler(struct ctl_table *, int,
- void __user *, size_t *, loff_t *);
+ void __user *, size_t *,
+ loff_t *, void *);
int sysctl_min_unmapped_ratio_sysctl_handler(struct ctl_table *, int,
- void __user *, size_t *, loff_t *);
-int sysctl_min_slab_ratio_sysctl_handler(struct ctl_table *, int,
- void __user *, size_t *, loff_t *);
-
-extern int numa_zonelist_order_handler(struct ctl_table *, int,
- void __user *, size_t *, loff_t *);
+ void __user *, size_t *,
+ loff_t *, void *);
+int sysctl_min_slab_ratio_sysctl_handler(struct ctl_table *, int, void __user *,
+ size_t *, loff_t *, void *);
+int numa_zonelist_order_handler(struct ctl_table *, int, void __user *,
+ size_t *, loff_t *, void *);
extern char numa_zonelist_order[];
#define NUMA_ZONELIST_ORDER_LEN 16 /* string buffer size */
diff --git a/include/linux/nmi.h b/include/linux/nmi.h
index c536f85..96eb9c7 100644
--- a/include/linux/nmi.h
+++ b/include/linux/nmi.h
@@ -48,8 +48,8 @@ int hw_nmi_is_cpu_stuck(struct pt_regs *);
u64 hw_nmi_get_sample_period(void);
extern int watchdog_enabled;
struct ctl_table;
-extern int proc_dowatchdog_enabled(struct ctl_table *, int ,
- void __user *, size_t *, loff_t *);
+extern int proc_dowatchdog_enabled(struct ctl_table *, int, void __user *,
+ size_t *, loff_t *, void *);
#endif
#endif
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 311b4dc..840c93b 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -1119,7 +1119,7 @@ extern int sysctl_perf_event_sample_rate;
extern int perf_proc_update_handler(struct ctl_table *table, int write,
void __user *buffer, size_t *lenp,
- loff_t *ppos);
+ loff_t *ppos, void *cookie);
static inline bool perf_paranoid_tracepoint_raw(void)
{
diff --git a/include/linux/pipe_fs_i.h b/include/linux/pipe_fs_i.h
index 77257c9..b79fc92 100644
--- a/include/linux/pipe_fs_i.h
+++ b/include/linux/pipe_fs_i.h
@@ -141,7 +141,7 @@ void pipe_unlock(struct pipe_inode_info *);
void pipe_double_lock(struct pipe_inode_info *, struct pipe_inode_info *);
extern unsigned int pipe_max_size, pipe_min_size;
-int pipe_proc_fn(struct ctl_table *, int, void __user *, size_t *, loff_t *);
+int pipe_proc_fn(struct ctl_table *, int, void __user *, size_t *, loff_t *, void *);
/* Drop the inode semaphore and wait for a pipe event, atomically */
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 83bd2e2..0f7ee29 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -312,8 +312,8 @@ extern void touch_softlockup_watchdog(void);
extern void touch_softlockup_watchdog_sync(void);
extern void touch_all_softlockup_watchdogs(void);
extern int proc_dowatchdog_thresh(struct ctl_table *table, int write,
- void __user *buffer,
- size_t *lenp, loff_t *ppos);
+ void __user *buffer, size_t *lenp,
+ loff_t *ppos, void *cookie);
extern unsigned int softlockup_panic;
extern int softlockup_thresh;
void lockup_detector_init(void);
@@ -338,8 +338,8 @@ extern unsigned long sysctl_hung_task_check_count;
extern unsigned long sysctl_hung_task_timeout_secs;
extern unsigned long sysctl_hung_task_warnings;
extern int proc_dohung_task_timeout_secs(struct ctl_table *table, int write,
- void __user *buffer,
- size_t *lenp, loff_t *ppos);
+ void __user *buffer, size_t *lenp,
+ loff_t *ppos, void *cookie);
#else
/* Avoid need for ifdefs elsewhere in the code */
enum { sysctl_hung_task_timeout_secs = 0 };
@@ -1929,8 +1929,8 @@ extern unsigned int sysctl_timer_migration;
extern unsigned int sysctl_sched_shares_window;
int sched_proc_update_handler(struct ctl_table *table, int write,
- void __user *buffer, size_t *length,
- loff_t *ppos);
+ void __user *buffer, size_t *length,
+ loff_t *ppos, void *cookie);
#endif
#ifdef CONFIG_SCHED_DEBUG
static inline unsigned int get_sysctl_timer_migration(void)
@@ -1947,8 +1947,8 @@ extern unsigned int sysctl_sched_rt_period;
extern int sysctl_sched_rt_runtime;
int sched_rt_handler(struct ctl_table *table, int write,
- void __user *buffer, size_t *lenp,
- loff_t *ppos);
+ void __user *buffer, size_t *lenp,
+ loff_t *ppos, void *cookie);
#ifdef CONFIG_SCHED_AUTOGROUP
extern unsigned int sysctl_sched_autogroup_enabled;
diff --git a/include/linux/security.h b/include/linux/security.h
index ca02f17..cc2e816 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -144,7 +144,8 @@ static inline unsigned long round_hint_to_min(unsigned long hint)
return hint;
}
extern int mmap_min_addr_handler(struct ctl_table *table, int write,
- void __user *buffer, size_t *lenp, loff_t *ppos);
+ void __user *buffer, size_t *lenp,
+ loff_t *ppos, void *cookie);
#endif
#ifdef CONFIG_SECURITY
diff --git a/include/linux/swap.h b/include/linux/swap.h
index a5c6da5..921b3b4 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -281,8 +281,8 @@ extern int page_evictable(struct page *page, struct vm_area_struct *vma);
extern void scan_mapping_unevictable_pages(struct address_space *);
extern unsigned long scan_unevictable_pages;
-extern int scan_unevictable_handler(struct ctl_table *, int,
- void __user *, size_t *, loff_t *);
+extern int scan_unevictable_handler(struct ctl_table *, int, void __user *,
+ size_t *, loff_t *, void *);
#ifdef CONFIG_NUMA
extern int scan_unevictable_register_node(struct node *node);
extern void scan_unevictable_unregister_node(struct node *node);
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index f82d456..f0eb817 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -963,26 +963,36 @@ extern int sysctl_perm(struct ctl_table_root *root,
typedef struct ctl_table ctl_table;
typedef int proc_handler (struct ctl_table *ctl, int write,
- void __user *buffer, size_t *lenp, loff_t *ppos);
+ void __user *buffer, size_t *lenp,
+ loff_t *ppos, void *cookie);
extern int proc_dostring(struct ctl_table *, int,
- void __user *, size_t *, loff_t *);
+ void __user *, size_t *,
+ loff_t *, void *);
extern int proc_dointvec(struct ctl_table *, int,
- void __user *, size_t *, loff_t *);
+ void __user *, size_t *,
+ loff_t *, void *);
extern int proc_dointvec_minmax(struct ctl_table *, int,
- void __user *, size_t *, loff_t *);
+ void __user *, size_t *,
+ loff_t *, void *);
extern int proc_dointvec_jiffies(struct ctl_table *, int,
- void __user *, size_t *, loff_t *);
+ void __user *, size_t *,
+ loff_t *, void *);
extern int proc_dointvec_userhz_jiffies(struct ctl_table *, int,
- void __user *, size_t *, loff_t *);
+ void __user *, size_t *,
+ loff_t *, void *);
extern int proc_dointvec_ms_jiffies(struct ctl_table *, int,
- void __user *, size_t *, loff_t *);
+ void __user *, size_t *,
+ loff_t *, void *);
extern int proc_doulongvec_minmax(struct ctl_table *, int,
- void __user *, size_t *, loff_t *);
+ void __user *, size_t *,
+ loff_t *, void *);
extern int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int,
- void __user *, size_t *, loff_t *);
+ void __user *, size_t *,
+ loff_t *, void *);
extern int proc_do_large_bitmap(struct ctl_table *, int,
- void __user *, size_t *, loff_t *);
+ void __user *, size_t *,
+ loff_t *, void *);
/*
* Register a set of sysctl names by calling register_sysctl_table
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index 17e7ccc..6bd24aa 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -108,21 +108,15 @@ extern int laptop_mode;
extern unsigned long determine_dirtyable_memory(void);
extern int dirty_background_ratio_handler(struct ctl_table *table, int write,
- void __user *buffer, size_t *lenp,
- loff_t *ppos);
+ void __user *buffer, size_t *lenp, loff_t *ppos, void *cookie);
extern int dirty_background_bytes_handler(struct ctl_table *table, int write,
- void __user *buffer, size_t *lenp,
- loff_t *ppos);
+ void __user *buffer, size_t *lenp, loff_t *ppos, void *cookie);
extern int dirty_ratio_handler(struct ctl_table *table, int write,
- void __user *buffer, size_t *lenp,
- loff_t *ppos);
+ void __user *buffer, size_t *lenp, loff_t *ppos, void *cookie);
extern int dirty_bytes_handler(struct ctl_table *table, int write,
- void __user *buffer, size_t *lenp,
- loff_t *ppos);
-
-struct ctl_table;
-int dirty_writeback_centisecs_handler(struct ctl_table *, int,
- void __user *, size_t *, loff_t *);
+ void __user *buffer, size_t *lenp, loff_t *ppos, void *cookie);
+extern int dirty_writeback_centisecs_handler(struct ctl_table *table, int write,
+ void __user *buffer, size_t *lenp, loff_t *ppos, void *cookie);
void global_dirty_limits(unsigned long *pbackground, unsigned long *pdirty);
unsigned long bdi_dirty_limit(struct backing_dev_info *bdi,
diff --git a/include/net/ndisc.h b/include/net/ndisc.h
index e0e594f..35837cd 100644
--- a/include/net/ndisc.h
+++ b/include/net/ndisc.h
@@ -137,10 +137,13 @@ extern int ndisc_ifinfo_sysctl_change(struct ctl_table *ctl,
int write,
void __user *buffer,
size_t *lenp,
- loff_t *ppos);
+ loff_t *ppos,
+ void *cookie);
+
int ndisc_ifinfo_sysctl_strategy(ctl_table *ctl,
void __user *oldval, size_t __user *oldlenp,
- void __user *newval, size_t newlen);
+ void __user *newval, size_t newlen,
+ void *cookie);
#endif
extern void inet6_ifinfo_notify(int event,
diff --git a/ipc/ipc_sysctl.c b/ipc/ipc_sysctl.c
index 56410fa..f44cb1a 100644
--- a/ipc/ipc_sysctl.c
+++ b/ipc/ipc_sysctl.c
@@ -27,18 +27,19 @@ static void *get_ipc(ctl_table *table)
}
#ifdef CONFIG_PROC_SYSCTL
-static int proc_ipc_dointvec(ctl_table *table, int write,
- void __user *buffer, size_t *lenp, loff_t *ppos)
+static int proc_ipc_dointvec(ctl_table *table, int write, void __user *buffer,
+ size_t *lenp, loff_t *ppos, void *cookie)
{
struct ctl_table ipc_table;
memcpy(&ipc_table, table, sizeof(ipc_table));
ipc_table.data = get_ipc(table);
- return proc_dointvec(&ipc_table, write, buffer, lenp, ppos);
+ return proc_dointvec(&ipc_table, write, buffer, lenp, ppos, NULL);
}
static int proc_ipc_callback_dointvec(ctl_table *table, int write,
- void __user *buffer, size_t *lenp, loff_t *ppos)
+ void __user *buffer, size_t *lenp,
+ loff_t *ppos, void *cookie)
{
struct ctl_table ipc_table;
size_t lenp_bef = *lenp;
@@ -47,7 +48,7 @@ static int proc_ipc_callback_dointvec(ctl_table *table, int write,
memcpy(&ipc_table, table, sizeof(ipc_table));
ipc_table.data = get_ipc(table);
- rc = proc_dointvec(&ipc_table, write, buffer, lenp, ppos);
+ rc = proc_dointvec(&ipc_table, write, buffer, lenp, ppos, NULL);
if (write && !rc && lenp_bef == *lenp)
/*
@@ -61,14 +62,15 @@ static int proc_ipc_callback_dointvec(ctl_table *table, int write,
}
static int proc_ipc_doulongvec_minmax(ctl_table *table, int write,
- void __user *buffer, size_t *lenp, loff_t *ppos)
+ void __user *buffer, size_t *lenp,
+ loff_t *ppos, void *cookie)
{
struct ctl_table ipc_table;
memcpy(&ipc_table, table, sizeof(ipc_table));
ipc_table.data = get_ipc(table);
return proc_doulongvec_minmax(&ipc_table, write, buffer,
- lenp, ppos);
+ lenp, ppos, NULL);
}
/*
@@ -95,7 +97,8 @@ static void ipc_auto_callback(int val)
}
static int proc_ipcauto_dointvec_minmax(ctl_table *table, int write,
- void __user *buffer, size_t *lenp, loff_t *ppos)
+ void __user *buffer, size_t *lenp,
+ loff_t *ppos, void *cookie)
{
struct ctl_table ipc_table;
size_t lenp_bef = *lenp;
@@ -106,7 +109,7 @@ static int proc_ipcauto_dointvec_minmax(ctl_table *table, int write,
ipc_table.data = get_ipc(table);
oldval = *((int *)(ipc_table.data));
- rc = proc_dointvec_minmax(&ipc_table, write, buffer, lenp, ppos);
+ rc = proc_dointvec_minmax(&ipc_table, write, buffer, lenp, ppos, NULL);
if (write && !rc && lenp_bef == *lenp) {
int newval = *((int *)(ipc_table.data));
diff --git a/ipc/mq_sysctl.c b/ipc/mq_sysctl.c
index 0c09366..384af7d 100644
--- a/ipc/mq_sysctl.c
+++ b/ipc/mq_sysctl.c
@@ -31,25 +31,26 @@ static void *get_mq(ctl_table *table)
return which;
}
-static int proc_mq_dointvec(ctl_table *table, int write,
- void __user *buffer, size_t *lenp, loff_t *ppos)
+static int proc_mq_dointvec(ctl_table *table, int write, void __user *buffer,
+ size_t *lenp, loff_t *ppos, void *cookie)
{
struct ctl_table mq_table;
memcpy(&mq_table, table, sizeof(mq_table));
mq_table.data = get_mq(table);
- return proc_dointvec(&mq_table, write, buffer, lenp, ppos);
+ return proc_dointvec(&mq_table, write, buffer, lenp, ppos, NULL);
}
static int proc_mq_dointvec_minmax(ctl_table *table, int write,
- void __user *buffer, size_t *lenp, loff_t *ppos)
+ void __user *buffer, size_t *lenp,
+ loff_t *ppos, void *cookie)
{
struct ctl_table mq_table;
memcpy(&mq_table, table, sizeof(mq_table));
mq_table.data = get_mq(table);
return proc_dointvec_minmax(&mq_table, write, buffer,
- lenp, ppos);
+ lenp, ppos, NULL);
}
#else
#define proc_mq_dointvec NULL
diff --git a/kernel/hung_task.c b/kernel/hung_task.c
index 53ead17..edae933 100644
--- a/kernel/hung_task.c
+++ b/kernel/hung_task.c
@@ -171,12 +171,12 @@ static unsigned long timeout_jiffies(unsigned long timeout)
* Process updating of timeout sysctl
*/
int proc_dohung_task_timeout_secs(struct ctl_table *table, int write,
- void __user *buffer,
- size_t *lenp, loff_t *ppos)
+ void __user *buffer, size_t *lenp,
+ loff_t *ppos, void *cookie)
{
int ret;
- ret = proc_doulongvec_minmax(table, write, buffer, lenp, ppos);
+ ret = proc_doulongvec_minmax(table, write, buffer, lenp, ppos, NULL);
if (ret || !write)
goto out;
diff --git a/kernel/kprobes.c b/kernel/kprobes.c
index 7798181..8fce3c7 100644
--- a/kernel/kprobes.c
+++ b/kernel/kprobes.c
@@ -826,13 +826,13 @@ static void __kprobes unoptimize_all_kprobes(void)
int sysctl_kprobes_optimization;
int proc_kprobes_optimization_handler(struct ctl_table *table, int write,
void __user *buffer, size_t *length,
- loff_t *ppos)
+ loff_t *ppos, void *cookie)
{
int ret;
mutex_lock(&kprobe_mutex);
sysctl_kprobes_optimization = kprobes_allow_optimization ? 1 : 0;
- ret = proc_dointvec_minmax(table, write, buffer, length, ppos);
+ ret = proc_dointvec_minmax(table, write, buffer, length, ppos, NULL);
if (sysctl_kprobes_optimization)
optimize_all_kprobes();
diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index c75925c..fc00e0e 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -158,9 +158,9 @@ static int max_samples_per_tick __read_mostly =
int perf_proc_update_handler(struct ctl_table *table, int write,
void __user *buffer, size_t *lenp,
- loff_t *ppos)
+ loff_t *ppos, void *cookie)
{
- int ret = proc_dointvec(table, write, buffer, lenp, ppos);
+ int ret = proc_dointvec(table, write, buffer, lenp, ppos, NULL);
if (ret || !write)
return ret;
diff --git a/kernel/sched.c b/kernel/sched.c
index f592ce6..c787ddf 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -8982,7 +8982,7 @@ static int sched_rt_global_constraints(void)
int sched_rt_handler(struct ctl_table *table, int write,
void __user *buffer, size_t *lenp,
- loff_t *ppos)
+ loff_t *ppos, void *cookie)
{
int ret;
int old_period, old_runtime;
@@ -8992,7 +8992,7 @@ int sched_rt_handler(struct ctl_table *table, int write,
old_period = sysctl_sched_rt_period;
old_runtime = sysctl_sched_rt_runtime;
- ret = proc_dointvec(table, write, buffer, lenp, ppos);
+ ret = proc_dointvec(table, write, buffer, lenp, ppos, NULL);
if (!ret && write) {
ret = sched_rt_global_constraints();
diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index 3f7ec9e..28ee577 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -448,9 +448,9 @@ static struct sched_entity *__pick_last_entity(struct cfs_rq *cfs_rq)
int sched_proc_update_handler(struct ctl_table *table, int write,
void __user *buffer, size_t *lenp,
- loff_t *ppos)
+ loff_t *ppos, void *cookie)
{
- int ret = proc_dointvec_minmax(table, write, buffer, lenp, ppos);
+ int ret = proc_dointvec_minmax(table, write, buffer, lenp, ppos, NULL);
int factor = get_update_sysctl_factor();
if (ret || !write)
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index dd3d061..cd7340d 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -165,14 +165,17 @@ extern int unaligned_dump_stack;
#ifdef CONFIG_PROC_SYSCTL
static int proc_do_cad_pid(struct ctl_table *table, int write,
- void __user *buffer, size_t *lenp, loff_t *ppos);
+ void __user *buffer, size_t *lenp,
+ loff_t *ppos, void *cookie);
static int proc_taint(struct ctl_table *table, int write,
- void __user *buffer, size_t *lenp, loff_t *ppos);
+ void __user *buffer, size_t *lenp,
+ loff_t *ppos, void *cookie);
#endif
#ifdef CONFIG_PRINTK
static int proc_dmesg_restrict(struct ctl_table *table, int write,
- void __user *buffer, size_t *lenp, loff_t *ppos);
+ void __user *buffer, size_t *lenp,
+ loff_t *ppos, void *cookie);
#endif
#ifdef CONFIG_MAGIC_SYSRQ
@@ -181,11 +184,11 @@ static int __sysrq_enabled = SYSRQ_DEFAULT_ENABLE;
static int sysrq_sysctl_handler(ctl_table *table, int write,
void __user *buffer, size_t *lenp,
- loff_t *ppos)
+ loff_t *ppos, void *cookie)
{
int error;
- error = proc_dointvec(table, write, buffer, lenp, ppos);
+ error = proc_dointvec(table, write, buffer, lenp, ppos, NULL);
if (error)
return error;
@@ -2089,6 +2092,7 @@ static int _proc_do_string(void* data, int maxlen, int write,
* @buffer: the user buffer
* @lenp: the size of the user buffer
* @ppos: file position
+ * @cookie: ignored by this handler
*
* Reads/writes a string from/to the user buffer. If the kernel
* buffer provided is not large enough to hold the string, the
@@ -2100,7 +2104,8 @@ static int _proc_do_string(void* data, int maxlen, int write,
* Returns 0 on success.
*/
int proc_dostring(struct ctl_table *table, int write,
- void __user *buffer, size_t *lenp, loff_t *ppos)
+ void __user *buffer, size_t *lenp,
+ loff_t *ppos, void *cookie)
{
return _proc_do_string(table->data, table->maxlen, write,
buffer, lenp, ppos);
@@ -2355,6 +2360,7 @@ static int do_proc_dointvec(struct ctl_table *table, int write,
* @buffer: the user buffer
* @lenp: the size of the user buffer
* @ppos: file position
+ * @cookie: ignored by this handler
*
* Reads/writes up to table->maxlen/sizeof(unsigned int) integer
* values from/to the user buffer, treated as an ASCII string.
@@ -2362,7 +2368,8 @@ static int do_proc_dointvec(struct ctl_table *table, int write,
* Returns 0 on success.
*/
int proc_dointvec(struct ctl_table *table, int write,
- void __user *buffer, size_t *lenp, loff_t *ppos)
+ void __user *buffer, size_t *lenp,
+ loff_t *ppos, void *cookie)
{
return do_proc_dointvec(table,write,buffer,lenp,ppos,
NULL,NULL);
@@ -2373,7 +2380,8 @@ int proc_dointvec(struct ctl_table *table, int write,
* This means we can safely use a temporary.
*/
static int proc_taint(struct ctl_table *table, int write,
- void __user *buffer, size_t *lenp, loff_t *ppos)
+ void __user *buffer, size_t *lenp,
+ loff_t *ppos, void *cookie)
{
struct ctl_table t;
unsigned long tmptaint = get_taint();
@@ -2384,7 +2392,7 @@ static int proc_taint(struct ctl_table *table, int write,
t = *table;
t.data = &tmptaint;
- err = proc_doulongvec_minmax(&t, write, buffer, lenp, ppos);
+ err = proc_doulongvec_minmax(&t, write, buffer, lenp, ppos, NULL);
if (err < 0)
return err;
@@ -2405,12 +2413,13 @@ static int proc_taint(struct ctl_table *table, int write,
#ifdef CONFIG_PRINTK
static int proc_dmesg_restrict(struct ctl_table *table, int write,
- void __user *buffer, size_t *lenp, loff_t *ppos)
+ void __user *buffer, size_t *lenp,
+ loff_t *ppos, void *cookie)
{
if (write && !capable(CAP_SYS_ADMIN))
return -EPERM;
- return proc_dointvec_minmax(table, write, buffer, lenp, ppos);
+ return proc_dointvec_minmax(table, write, buffer, lenp, ppos, NULL);
}
#endif
@@ -2450,6 +2459,7 @@ static int do_proc_dointvec_minmax_conv(bool *negp, unsigned long *lvalp,
* @buffer: the user buffer
* @lenp: the size of the user buffer
* @ppos: file position
+ * @cookie: ignored by this handler
*
* Reads/writes up to table->maxlen/sizeof(unsigned int) integer
* values from/to the user buffer, treated as an ASCII string.
@@ -2460,7 +2470,8 @@ static int do_proc_dointvec_minmax_conv(bool *negp, unsigned long *lvalp,
* Returns 0 on success.
*/
int proc_dointvec_minmax(struct ctl_table *table, int write,
- void __user *buffer, size_t *lenp, loff_t *ppos)
+ void __user *buffer, size_t *lenp,
+ loff_t *ppos, void *cookie)
{
struct do_proc_dointvec_minmax_conv_param param = {
.min = (int *) table->extra1,
@@ -2567,6 +2578,7 @@ static int do_proc_doulongvec_minmax(struct ctl_table *table, int write,
* @buffer: the user buffer
* @lenp: the size of the user buffer
* @ppos: file position
+ * @cookie: ignored by this handler
*
* Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
* values from/to the user buffer, treated as an ASCII string.
@@ -2577,7 +2589,8 @@ static int do_proc_doulongvec_minmax(struct ctl_table *table, int write,
* Returns 0 on success.
*/
int proc_doulongvec_minmax(struct ctl_table *table, int write,
- void __user *buffer, size_t *lenp, loff_t *ppos)
+ void __user *buffer, size_t *lenp,
+ loff_t *ppos, void *cookie)
{
return do_proc_doulongvec_minmax(table, write, buffer, lenp, ppos, 1l, 1l);
}
@@ -2589,6 +2602,7 @@ int proc_doulongvec_minmax(struct ctl_table *table, int write,
* @buffer: the user buffer
* @lenp: the size of the user buffer
* @ppos: file position
+ * @cookie: ignored by this handler
*
* Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
* values from/to the user buffer, treated as an ASCII string. The values
@@ -2600,8 +2614,8 @@ int proc_doulongvec_minmax(struct ctl_table *table, int write,
* Returns 0 on success.
*/
int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,
- void __user *buffer,
- size_t *lenp, loff_t *ppos)
+ void __user *buffer, size_t *lenp,
+ loff_t *ppos, void *cookie)
{
return do_proc_doulongvec_minmax(table, write, buffer,
lenp, ppos, HZ, 1000l);
@@ -2682,6 +2696,7 @@ static int do_proc_dointvec_ms_jiffies_conv(bool *negp, unsigned long *lvalp,
* @buffer: the user buffer
* @lenp: the size of the user buffer
* @ppos: file position
+ * @cookie: ignored by this handler
*
* Reads/writes up to table->maxlen/sizeof(unsigned int) integer
* values from/to the user buffer, treated as an ASCII string.
@@ -2691,7 +2706,8 @@ static int do_proc_dointvec_ms_jiffies_conv(bool *negp, unsigned long *lvalp,
* Returns 0 on success.
*/
int proc_dointvec_jiffies(struct ctl_table *table, int write,
- void __user *buffer, size_t *lenp, loff_t *ppos)
+ void __user *buffer, size_t *lenp,
+ loff_t *ppos, void *cookie)
{
return do_proc_dointvec(table,write,buffer,lenp,ppos,
do_proc_dointvec_jiffies_conv,NULL);
@@ -2703,7 +2719,8 @@ int proc_dointvec_jiffies(struct ctl_table *table, int write,
* @write: %TRUE if this is a write to the sysctl file
* @buffer: the user buffer
* @lenp: the size of the user buffer
- * @ppos: pointer to the file position
+ * @ppos: file position
+ * @cookie: ignored by this handler
*
* Reads/writes up to table->maxlen/sizeof(unsigned int) integer
* values from/to the user buffer, treated as an ASCII string.
@@ -2713,7 +2730,8 @@ int proc_dointvec_jiffies(struct ctl_table *table, int write,
* Returns 0 on success.
*/
int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write,
- void __user *buffer, size_t *lenp, loff_t *ppos)
+ void __user *buffer, size_t *lenp,
+ loff_t *ppos, void *cookie)
{
return do_proc_dointvec(table,write,buffer,lenp,ppos,
do_proc_dointvec_userhz_jiffies_conv,NULL);
@@ -2726,7 +2744,7 @@ int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write,
* @buffer: the user buffer
* @lenp: the size of the user buffer
* @ppos: file position
- * @ppos: the current position in the file
+ * @cookie: ignored by this handler
*
* Reads/writes up to table->maxlen/sizeof(unsigned int) integer
* values from/to the user buffer, treated as an ASCII string.
@@ -2736,14 +2754,16 @@ int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write,
* Returns 0 on success.
*/
int proc_dointvec_ms_jiffies(struct ctl_table *table, int write,
- void __user *buffer, size_t *lenp, loff_t *ppos)
+ void __user *buffer, size_t *lenp,
+ loff_t *ppos, void *cookie)
{
return do_proc_dointvec(table, write, buffer, lenp, ppos,
do_proc_dointvec_ms_jiffies_conv, NULL);
}
static int proc_do_cad_pid(struct ctl_table *table, int write,
- void __user *buffer, size_t *lenp, loff_t *ppos)
+ void __user *buffer, size_t *lenp,
+ loff_t *ppos, void *cookie)
{
struct pid *new_pid;
pid_t tmp;
@@ -2771,6 +2791,7 @@ static int proc_do_cad_pid(struct ctl_table *table, int write,
* @buffer: the user buffer
* @lenp: the size of the user buffer
* @ppos: file position
+ * @cookie: ignored by this handler
*
* The bitmap is stored at table->data and the bitmap length (in bits)
* in table->maxlen.
@@ -2782,7 +2803,8 @@ static int proc_do_cad_pid(struct ctl_table *table, int write,
* Returns 0 on success.
*/
int proc_do_large_bitmap(struct ctl_table *table, int write,
- void __user *buffer, size_t *lenp, loff_t *ppos)
+ void __user *buffer, size_t *lenp,
+ loff_t *ppos, void *cookie)
{
int err = 0;
bool first = 1;
@@ -2918,50 +2940,57 @@ int proc_do_large_bitmap(struct ctl_table *table, int write,
#else /* CONFIG_PROC_SYSCTL */
int proc_dostring(struct ctl_table *table, int write,
- void __user *buffer, size_t *lenp, loff_t *ppos)
+ void __user *buffer, size_t *lenp,
+ loff_t *ppos, void *cookie)
{
return -ENOSYS;
}
int proc_dointvec(struct ctl_table *table, int write,
- void __user *buffer, size_t *lenp, loff_t *ppos)
+ void __user *buffer, size_t *lenp,
+ loff_t *ppos, void *cookie)
{
return -ENOSYS;
}
int proc_dointvec_minmax(struct ctl_table *table, int write,
- void __user *buffer, size_t *lenp, loff_t *ppos)
+ void __user *buffer, size_t *lenp,
+ loff_t *ppos, void *cookie)
{
return -ENOSYS;
}
int proc_dointvec_jiffies(struct ctl_table *table, int write,
- void __user *buffer, size_t *lenp, loff_t *ppos)
+ void __user *buffer, size_t *lenp,
+ loff_t *ppos, void *cookie)
{
return -ENOSYS;
}
int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write,
- void __user *buffer, size_t *lenp, loff_t *ppos)
+ void __user *buffer, size_t *lenp,
+ loff_t *ppos, void *cookie)
{
return -ENOSYS;
}
int proc_dointvec_ms_jiffies(struct ctl_table *table, int write,
- void __user *buffer, size_t *lenp, loff_t *ppos)
+ void __user *buffer, size_t *lenp,
+ loff_t *ppos, void *cookie)
{
return -ENOSYS;
}
int proc_doulongvec_minmax(struct ctl_table *table, int write,
- void __user *buffer, size_t *lenp, loff_t *ppos)
+ void __user *buffer, size_t *lenp,
+ loff_t *ppos, void *cookie)
{
return -ENOSYS;
}
int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,
- void __user *buffer,
- size_t *lenp, loff_t *ppos)
+ void __user *buffer, size_t *lenp,
+ loff_t *ppos, void *cookie)
{
return -ENOSYS;
}
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index c075f4e..91a4d03 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -3178,7 +3178,7 @@ int unregister_ftrace_function(struct ftrace_ops *ops)
int
ftrace_enable_sysctl(struct ctl_table *table, int write,
void __user *buffer, size_t *lenp,
- loff_t *ppos)
+ loff_t *ppos, void *cookie)
{
int ret;
@@ -3187,7 +3187,7 @@ ftrace_enable_sysctl(struct ctl_table *table, int write,
mutex_lock(&ftrace_lock);
- ret = proc_dointvec(table, write, buffer, lenp, ppos);
+ ret = proc_dointvec(table, write, buffer, lenp, ppos, NULL);
if (ret || !write || (last_ftrace_enabled == !!ftrace_enabled))
goto out;
diff --git a/kernel/trace/trace_stack.c b/kernel/trace/trace_stack.c
index 4c5dead..9ac91f2 100644
--- a/kernel/trace/trace_stack.c
+++ b/kernel/trace/trace_stack.c
@@ -322,13 +322,13 @@ static const struct file_operations stack_trace_fops = {
int
stack_trace_sysctl(struct ctl_table *table, int write,
void __user *buffer, size_t *lenp,
- loff_t *ppos)
+ loff_t *ppos, void *cookie)
{
int ret;
mutex_lock(&stack_sysctl_mutex);
- ret = proc_dointvec(table, write, buffer, lenp, ppos);
+ ret = proc_dointvec(table, write, buffer, lenp, ppos, NULL);
if (ret || !write ||
(last_stack_tracer_enabled == !!stack_tracer_enabled))
diff --git a/kernel/utsname_sysctl.c b/kernel/utsname_sysctl.c
index a2cd77e..a4d0d8c 100644
--- a/kernel/utsname_sysctl.c
+++ b/kernel/utsname_sysctl.c
@@ -42,14 +42,14 @@ static void put_uts(ctl_table *table, int write, void *which)
* Special case of dostring for the UTS structure. This has locks
* to observe. Should this be in kernel/sys.c ????
*/
-static int proc_do_uts_string(ctl_table *table, int write,
- void __user *buffer, size_t *lenp, loff_t *ppos)
+static int proc_do_uts_string(ctl_table *table, int write, void __user *buffer,
+ size_t *lenp, loff_t *ppos, void *cookie)
{
struct ctl_table uts_table;
int r;
memcpy(&uts_table, table, sizeof(uts_table));
uts_table.data = get_uts(table, write);
- r = proc_dostring(&uts_table,write,buffer,lenp, ppos);
+ r = proc_dostring(&uts_table,write,buffer,lenp, ppos, NULL);
put_uts(table, write, uts_table.data);
return r;
}
diff --git a/kernel/watchdog.c b/kernel/watchdog.c
index 140dce7..23f78c0 100644
--- a/kernel/watchdog.c
+++ b/kernel/watchdog.c
@@ -502,9 +502,10 @@ static void watchdog_disable_all_cpus(void)
*/
int proc_dowatchdog_enabled(struct ctl_table *table, int write,
- void __user *buffer, size_t *length, loff_t *ppos)
+ void __user *buffer, size_t *length,
+ loff_t *ppos, void *cookie)
{
- proc_dointvec(table, write, buffer, length, ppos);
+ proc_dointvec(table, write, buffer, length, ppos, NULL);
if (write) {
if (watchdog_enabled)
@@ -516,10 +517,10 @@ int proc_dowatchdog_enabled(struct ctl_table *table, int write,
}
int proc_dowatchdog_thresh(struct ctl_table *table, int write,
- void __user *buffer,
- size_t *lenp, loff_t *ppos)
+ void __user *buffer, size_t *lenp,
+ loff_t *ppos, void *cookie)
{
- return proc_dointvec_minmax(table, write, buffer, lenp, ppos);
+ return proc_dointvec_minmax(table, write, buffer, lenp, ppos, NULL);
}
#endif /* CONFIG_SYSCTL */
diff --git a/mm/compaction.c b/mm/compaction.c
index 021a296..18dd3e7 100644
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -676,7 +676,8 @@ int sysctl_compact_memory;
/* This is the entry point for compacting all nodes via /proc/sys/vm */
int sysctl_compaction_handler(struct ctl_table *table, int write,
- void __user *buffer, size_t *length, loff_t *ppos)
+ void __user *buffer, size_t *length,
+ loff_t *ppos, void *cookie)
{
if (write)
return compact_nodes();
@@ -685,9 +686,10 @@ int sysctl_compaction_handler(struct ctl_table *table, int write,
}
int sysctl_extfrag_handler(struct ctl_table *table, int write,
- void __user *buffer, size_t *length, loff_t *ppos)
+ void __user *buffer, size_t *length,
+ loff_t *ppos, void *cookie)
{
- proc_dointvec_minmax(table, write, buffer, length, ppos);
+ proc_dointvec_minmax(table, write, buffer, length, ppos, NULL);
return 0;
}
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 06de5aa..2f3f60e 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -1879,7 +1879,7 @@ static int hugetlb_sysctl_handler_common(bool obey_mempolicy,
table->data = &tmp;
table->maxlen = sizeof(unsigned long);
- ret = proc_doulongvec_minmax(table, write, buffer, length, ppos);
+ ret = proc_doulongvec_minmax(table, write, buffer, length, ppos, NULL);
if (ret)
goto out;
@@ -1901,27 +1901,29 @@ out:
}
int hugetlb_sysctl_handler(struct ctl_table *table, int write,
- void __user *buffer, size_t *length, loff_t *ppos)
+ void __user *buffer, size_t *length,
+ loff_t *ppos, void *cookie)
{
return hugetlb_sysctl_handler_common(false, table, write,
- buffer, length, ppos);
+ buffer, length, ppos);
}
#ifdef CONFIG_NUMA
int hugetlb_mempolicy_sysctl_handler(struct ctl_table *table, int write,
- void __user *buffer, size_t *length, loff_t *ppos)
+ void __user *buffer, size_t *length,
+ loff_t *ppos, void *cookie)
{
return hugetlb_sysctl_handler_common(true, table, write,
- buffer, length, ppos);
+ buffer, length, ppos);
}
#endif /* CONFIG_NUMA */
int hugetlb_treat_movable_handler(struct ctl_table *table, int write,
- void __user *buffer,
- size_t *length, loff_t *ppos)
+ void __user *buffer, size_t *length,
+ loff_t *ppos, void *cookie)
{
- proc_dointvec(table, write, buffer, length, ppos);
+ proc_dointvec(table, write, buffer, length, ppos, NULL);
if (hugepages_treat_as_movable)
htlb_alloc_mask = GFP_HIGHUSER_MOVABLE;
else
@@ -1930,8 +1932,8 @@ int hugetlb_treat_movable_handler(struct ctl_table *table, int write,
}
int hugetlb_overcommit_handler(struct ctl_table *table, int write,
- void __user *buffer,
- size_t *length, loff_t *ppos)
+ void __user *buffer, size_t *length,
+ loff_t *ppos, void *cookie)
{
struct hstate *h = &default_hstate;
unsigned long tmp;
@@ -1944,7 +1946,7 @@ int hugetlb_overcommit_handler(struct ctl_table *table, int write,
table->data = &tmp;
table->maxlen = sizeof(unsigned long);
- ret = proc_doulongvec_minmax(table, write, buffer, length, ppos);
+ ret = proc_doulongvec_minmax(table, write, buffer, length, ppos, NULL);
if (ret)
goto out;
diff --git a/mm/page-writeback.c b/mm/page-writeback.c
index 31f6988..b8cb0b0 100644
--- a/mm/page-writeback.c
+++ b/mm/page-writeback.c
@@ -159,37 +159,34 @@ static void update_completion_period(void)
}
int dirty_background_ratio_handler(struct ctl_table *table, int write,
- void __user *buffer, size_t *lenp,
- loff_t *ppos)
+ void __user *buffer, size_t *lenp, loff_t *ppos, void *cookie)
{
int ret;
- ret = proc_dointvec_minmax(table, write, buffer, lenp, ppos);
+ ret = proc_dointvec_minmax(table, write, buffer, lenp, ppos, NULL);
if (ret == 0 && write)
dirty_background_bytes = 0;
return ret;
}
int dirty_background_bytes_handler(struct ctl_table *table, int write,
- void __user *buffer, size_t *lenp,
- loff_t *ppos)
+ void __user *buffer, size_t *lenp, loff_t *ppos, void *cookie)
{
int ret;
- ret = proc_doulongvec_minmax(table, write, buffer, lenp, ppos);
+ ret = proc_doulongvec_minmax(table, write, buffer, lenp, ppos, NULL);
if (ret == 0 && write)
dirty_background_ratio = 0;
return ret;
}
int dirty_ratio_handler(struct ctl_table *table, int write,
- void __user *buffer, size_t *lenp,
- loff_t *ppos)
+ void __user *buffer, size_t *lenp, loff_t *ppos, void *cookie)
{
int old_ratio = vm_dirty_ratio;
int ret;
- ret = proc_dointvec_minmax(table, write, buffer, lenp, ppos);
+ ret = proc_dointvec_minmax(table, write, buffer, lenp, ppos, NULL);
if (ret == 0 && write && vm_dirty_ratio != old_ratio) {
update_completion_period();
vm_dirty_bytes = 0;
@@ -199,13 +196,12 @@ int dirty_ratio_handler(struct ctl_table *table, int write,
int dirty_bytes_handler(struct ctl_table *table, int write,
- void __user *buffer, size_t *lenp,
- loff_t *ppos)
+ void __user *buffer, size_t *lenp, loff_t *ppos, void *cookie)
{
unsigned long old_bytes = vm_dirty_bytes;
int ret;
- ret = proc_doulongvec_minmax(table, write, buffer, lenp, ppos);
+ ret = proc_doulongvec_minmax(table, write, buffer, lenp, ppos, NULL);
if (ret == 0 && write && vm_dirty_bytes != old_bytes) {
update_completion_period();
vm_dirty_ratio = 0;
@@ -684,9 +680,9 @@ void throttle_vm_writeout(gfp_t gfp_mask)
* sysctl handler for /proc/sys/vm/dirty_writeback_centisecs
*/
int dirty_writeback_centisecs_handler(ctl_table *table, int write,
- void __user *buffer, size_t *length, loff_t *ppos)
+ void __user *buffer, size_t *lenp, loff_t *ppos, void *cookie)
{
- proc_dointvec(table, write, buffer, length, ppos);
+ proc_dointvec(table, write, buffer, lenp, ppos, NULL);
bdi_arm_supers_timer();
return 0;
}
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index d6e7ba7..0e46115 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -2721,8 +2721,7 @@ early_param("numa_zonelist_order", setup_numa_zonelist_order);
* sysctl handler for numa_zonelist_order
*/
int numa_zonelist_order_handler(ctl_table *table, int write,
- void __user *buffer, size_t *length,
- loff_t *ppos)
+ void __user *buffer, size_t *length, loff_t *ppos, void *cookie)
{
char saved_string[NUMA_ZONELIST_ORDER_LEN];
int ret;
@@ -2731,7 +2730,7 @@ int numa_zonelist_order_handler(ctl_table *table, int write,
mutex_lock(&zl_order_mutex);
if (write)
strcpy(saved_string, (char*)table->data);
- ret = proc_dostring(table, write, buffer, length, ppos);
+ ret = proc_dostring(table, write, buffer, length, ppos, NULL);
if (ret)
goto out;
if (write) {
@@ -5142,9 +5141,9 @@ module_init(init_per_zone_wmark_min)
* changes.
*/
int min_free_kbytes_sysctl_handler(ctl_table *table, int write,
- void __user *buffer, size_t *length, loff_t *ppos)
+ void __user *buffer, size_t *length, loff_t *ppos, void *cookie)
{
- proc_dointvec(table, write, buffer, length, ppos);
+ proc_dointvec(table, write, buffer, length, ppos, NULL);
if (write)
setup_per_zone_wmarks();
return 0;
@@ -5152,12 +5151,12 @@ int min_free_kbytes_sysctl_handler(ctl_table *table, int write,
#ifdef CONFIG_NUMA
int sysctl_min_unmapped_ratio_sysctl_handler(ctl_table *table, int write,
- void __user *buffer, size_t *length, loff_t *ppos)
+ void __user *buffer, size_t *length, loff_t *ppos, void *cookie)
{
struct zone *zone;
int rc;
- rc = proc_dointvec_minmax(table, write, buffer, length, ppos);
+ rc = proc_dointvec_minmax(table, write, buffer, length, ppos, NULL);
if (rc)
return rc;
@@ -5168,12 +5167,12 @@ int sysctl_min_unmapped_ratio_sysctl_handler(ctl_table *table, int write,
}
int sysctl_min_slab_ratio_sysctl_handler(ctl_table *table, int write,
- void __user *buffer, size_t *length, loff_t *ppos)
+ void __user *buffer, size_t *length, loff_t *ppos, void *cookie)
{
struct zone *zone;
int rc;
- rc = proc_dointvec_minmax(table, write, buffer, length, ppos);
+ rc = proc_dointvec_minmax(table, write, buffer, length, ppos, NULL);
if (rc)
return rc;
@@ -5194,9 +5193,9 @@ int sysctl_min_slab_ratio_sysctl_handler(ctl_table *table, int write,
* if in function of the boot time zone sizes.
*/
int lowmem_reserve_ratio_sysctl_handler(ctl_table *table, int write,
- void __user *buffer, size_t *length, loff_t *ppos)
+ void __user *buffer, size_t *length, loff_t *ppos, void *cookie)
{
- proc_dointvec_minmax(table, write, buffer, length, ppos);
+ proc_dointvec_minmax(table, write, buffer, length, ppos, NULL);
setup_per_zone_lowmem_reserve();
return 0;
}
@@ -5208,13 +5207,13 @@ int lowmem_reserve_ratio_sysctl_handler(ctl_table *table, int write,
*/
int percpu_pagelist_fraction_sysctl_handler(ctl_table *table, int write,
- void __user *buffer, size_t *length, loff_t *ppos)
+ void __user *buffer, size_t *length, loff_t *ppos, void *cookie)
{
struct zone *zone;
unsigned int cpu;
int ret;
- ret = proc_dointvec_minmax(table, write, buffer, length, ppos);
+ ret = proc_dointvec_minmax(table, write, buffer, length, ppos, NULL);
if (!write || (ret == -EINVAL))
return ret;
for_each_populated_zone(zone) {
diff --git a/mm/vmscan.c b/mm/vmscan.c
index f73b865..6a578af 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -3273,10 +3273,10 @@ static void scan_all_zones_unevictable_pages(void)
unsigned long scan_unevictable_pages;
int scan_unevictable_handler(struct ctl_table *table, int write,
- void __user *buffer,
- size_t *length, loff_t *ppos)
+ void __user *buffer, size_t *length,
+ loff_t *ppos, void *cookie)
{
- proc_doulongvec_minmax(table, write, buffer, length, ppos);
+ proc_doulongvec_minmax(table, write, buffer, length, ppos, NULL);
if (write && *(unsigned long *)table->data)
scan_all_zones_unevictable_pages();
diff --git a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c
index 008ff6c..5d5ac11 100644
--- a/net/bridge/br_netfilter.c
+++ b/net/bridge/br_netfilter.c
@@ -932,12 +932,12 @@ static struct nf_hook_ops br_nf_ops[] __read_mostly = {
#ifdef CONFIG_SYSCTL
static
-int brnf_sysctl_call_tables(ctl_table * ctl, int write,
- void __user * buffer, size_t * lenp, loff_t * ppos)
+int brnf_sysctl_call_tables(ctl_table * ctl, int write, void __user * buffer,
+ size_t * lenp, loff_t * ppos, void * cookie)
{
int ret;
- ret = proc_dointvec(ctl, write, buffer, lenp, ppos);
+ ret = proc_dointvec(ctl, write, buffer, lenp, ppos, NULL);
if (write && *(int *)(ctl->data))
*(int *)(ctl->data) = 1;
diff --git a/net/core/sysctl_net_core.c b/net/core/sysctl_net_core.c
index 385b609..923ae0f 100644
--- a/net/core/sysctl_net_core.c
+++ b/net/core/sysctl_net_core.c
@@ -20,7 +20,8 @@
#ifdef CONFIG_RPS
static int rps_sock_flow_sysctl(ctl_table *table, int write,
- void __user *buffer, size_t *lenp, loff_t *ppos)
+ void __user *buffer, size_t *lenp,
+ loff_t *ppos, void *cookie)
{
unsigned int orig_size, size;
int ret, i;
@@ -38,7 +39,7 @@ static int rps_sock_flow_sysctl(ctl_table *table, int write,
lockdep_is_held(&sock_flow_mutex));
size = orig_size = orig_sock_table ? orig_sock_table->mask + 1 : 0;
- ret = proc_dointvec(&tmp, write, buffer, lenp, ppos);
+ ret = proc_dointvec(&tmp, write, buffer, lenp, ppos, NULL);
if (write) {
if (size) {
diff --git a/net/decnet/dn_dev.c b/net/decnet/dn_dev.c
index 0dcaa90..6935f42 100644
--- a/net/decnet/dn_dev.c
+++ b/net/decnet/dn_dev.c
@@ -159,8 +159,8 @@ static int max_t3[] = { 8191 }; /* Must fit in 16 bits when multiplied by BCT3MU
static int min_priority[1];
static int max_priority[] = { 127 }; /* From DECnet spec */
-static int dn_forwarding_proc(ctl_table *, int,
- void __user *, size_t *, loff_t *);
+static int dn_forwarding_proc(ctl_table *, int, void __user *,
+ size_t *, loff_t *, void *);
static struct dn_dev_sysctl_table {
struct ctl_table_header *sysctl_header;
ctl_table dn_dev_vars[5];
@@ -255,8 +255,8 @@ static void dn_dev_sysctl_unregister(struct dn_dev_parms *parms)
}
static int dn_forwarding_proc(ctl_table *table, int write,
- void __user *buffer,
- size_t *lenp, loff_t *ppos)
+ void __user *buffer, size_t *lenp,
+ loff_t *ppos, void *cookie)
{
#ifdef CONFIG_DECNET_ROUTER
struct net_device *dev = table->extra1;
@@ -270,7 +270,7 @@ static int dn_forwarding_proc(ctl_table *table, int write,
dn_db = rcu_dereference_raw(dev->dn_ptr);
old = dn_db->parms.forwarding;
- err = proc_dointvec(table, write, buffer, lenp, ppos);
+ err = proc_dointvec(table, write, buffer, lenp, ppos, NULL);
if ((err >= 0) && write) {
if (dn_db->parms.forwarding < 0)
diff --git a/net/decnet/sysctl_net_decnet.c b/net/decnet/sysctl_net_decnet.c
index 28f8b5e..90e87a7 100644
--- a/net/decnet/sysctl_net_decnet.c
+++ b/net/decnet/sysctl_net_decnet.c
@@ -132,8 +132,8 @@ static int parse_addr(__le16 *addr, char *str)
}
static int dn_node_address_handler(ctl_table *table, int write,
- void __user *buffer,
- size_t *lenp, loff_t *ppos)
+ void __user *buffer, size_t *lenp,
+ loff_t *ppos, void *cookie)
{
char addr[DN_ASCBUF_LEN];
size_t len;
@@ -183,8 +183,8 @@ static int dn_node_address_handler(ctl_table *table, int write,
}
static int dn_def_dev_handler(ctl_table *table, int write,
- void __user *buffer,
- size_t *lenp, loff_t *ppos)
+ void __user *buffer, size_t *lenp,
+ loff_t *ppos, void *cookie)
{
size_t len;
struct net_device *dev;
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index cd9ca08..551786f 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -1487,10 +1487,10 @@ static void inet_forward_change(struct net *net)
}
static int devinet_conf_proc(ctl_table *ctl, int write,
- void __user *buffer,
- size_t *lenp, loff_t *ppos)
+ void __user *buffer, size_t *lenp,
+ loff_t *ppos, void *cookie)
{
- int ret = proc_dointvec(ctl, write, buffer, lenp, ppos);
+ int ret = proc_dointvec(ctl, write, buffer, lenp, ppos, NULL);
if (write) {
struct ipv4_devconf *cnf = ctl->extra1;
@@ -1507,13 +1507,13 @@ static int devinet_conf_proc(ctl_table *ctl, int write,
}
static int devinet_sysctl_forward(ctl_table *ctl, int write,
- void __user *buffer,
- size_t *lenp, loff_t *ppos)
+ void __user *buffer, size_t *lenp,
+ loff_t *ppos, void *cookie)
{
int *valp = ctl->data;
int val = *valp;
loff_t pos = *ppos;
- int ret = proc_dointvec(ctl, write, buffer, lenp, ppos);
+ int ret = proc_dointvec(ctl, write, buffer, lenp, ppos, NULL);
if (write && *valp != val) {
struct net *net = ctl->extra2;
@@ -1542,12 +1542,12 @@ static int devinet_sysctl_forward(ctl_table *ctl, int write,
}
static int ipv4_doint_and_flush(ctl_table *ctl, int write,
- void __user *buffer,
- size_t *lenp, loff_t *ppos)
+ void __user *buffer, size_t *lenp,
+ loff_t *ppos, void *cookie)
{
int *valp = ctl->data;
int val = *valp;
- int ret = proc_dointvec(ctl, write, buffer, lenp, ppos);
+ int ret = proc_dointvec(ctl, write, buffer, lenp, ppos, NULL);
struct net *net = ctl->extra2;
if (write && *valp != val)
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 4b0c811..0c66ea6 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -3009,8 +3009,8 @@ void ip_rt_multicast_event(struct in_device *in_dev)
#ifdef CONFIG_SYSCTL
static int ipv4_sysctl_rtcache_flush(ctl_table *__ctl, int write,
- void __user *buffer,
- size_t *lenp, loff_t *ppos)
+ void __user *buffer, size_t *lenp,
+ loff_t *ppos, void *cookie)
{
if (write) {
int flush_delay;
@@ -3019,7 +3019,7 @@ static int ipv4_sysctl_rtcache_flush(ctl_table *__ctl, int write,
memcpy(&ctl, __ctl, sizeof(ctl));
ctl.data = &flush_delay;
- proc_dointvec(&ctl, write, buffer, lenp, ppos);
+ proc_dointvec(&ctl, write, buffer, lenp, ppos, NULL);
net = (struct net *)__ctl->extra1;
rt_cache_flush(net, flush_delay);
diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c
index 1a45665..1766d2e 100644
--- a/net/ipv4/sysctl_net_ipv4.c
+++ b/net/ipv4/sysctl_net_ipv4.c
@@ -42,8 +42,8 @@ static void set_local_port_range(int range[2])
/* Validate changes from /proc interface. */
static int ipv4_local_port_range(ctl_table *table, int write,
- void __user *buffer,
- size_t *lenp, loff_t *ppos)
+ void __user *buffer, size_t *lenp,
+ loff_t *ppos, void *cookie)
{
int ret;
int range[2];
@@ -56,7 +56,7 @@ static int ipv4_local_port_range(ctl_table *table, int write,
};
inet_get_local_port_range(range, range + 1);
- ret = proc_dointvec_minmax(&tmp, write, buffer, lenp, ppos);
+ ret = proc_dointvec_minmax(&tmp, write, buffer, lenp, ppos, NULL);
if (write && ret == 0) {
if (range[1] < range[0])
@@ -69,7 +69,8 @@ static int ipv4_local_port_range(ctl_table *table, int write,
}
static int proc_tcp_congestion_control(ctl_table *ctl, int write,
- void __user *buffer, size_t *lenp, loff_t *ppos)
+ void __user *buffer, size_t *lenp,
+ loff_t *ppos, void *cookie)
{
char val[TCP_CA_NAME_MAX];
ctl_table tbl = {
@@ -80,16 +81,15 @@ static int proc_tcp_congestion_control(ctl_table *ctl, int write,
tcp_get_default_congestion_control(val);
- ret = proc_dostring(&tbl, write, buffer, lenp, ppos);
+ ret = proc_dostring(&tbl, write, buffer, lenp, ppos, NULL);
if (write && ret == 0)
ret = tcp_set_default_congestion_control(val);
return ret;
}
-static int proc_tcp_available_congestion_control(ctl_table *ctl,
- int write,
+static int proc_tcp_available_congestion_control(ctl_table *ctl, int write,
void __user *buffer, size_t *lenp,
- loff_t *ppos)
+ loff_t *ppos, void *cookie)
{
ctl_table tbl = { .maxlen = TCP_CA_BUF_MAX, };
int ret;
@@ -98,15 +98,14 @@ static int proc_tcp_available_congestion_control(ctl_table *ctl,
if (!tbl.data)
return -ENOMEM;
tcp_get_available_congestion_control(tbl.data, TCP_CA_BUF_MAX);
- ret = proc_dostring(&tbl, write, buffer, lenp, ppos);
+ ret = proc_dostring(&tbl, write, buffer, lenp, ppos, NULL);
kfree(tbl.data);
return ret;
}
-static int proc_allowed_congestion_control(ctl_table *ctl,
- int write,
+static int proc_allowed_congestion_control(ctl_table *ctl, int write,
void __user *buffer, size_t *lenp,
- loff_t *ppos)
+ loff_t *ppos, void *cookie)
{
ctl_table tbl = { .maxlen = TCP_CA_BUF_MAX };
int ret;
@@ -116,7 +115,7 @@ static int proc_allowed_congestion_control(ctl_table *ctl,
return -ENOMEM;
tcp_get_allowed_congestion_control(tbl.data, tbl.maxlen);
- ret = proc_dostring(&tbl, write, buffer, lenp, ppos);
+ ret = proc_dostring(&tbl, write, buffer, lenp, ppos, NULL);
if (write && ret == 0)
ret = tcp_set_allowed_congestion_control(tbl.data);
kfree(tbl.data);
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index b1654a4..4a28442 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -4156,15 +4156,15 @@ static void ipv6_ifa_notify(int event, struct inet6_ifaddr *ifp)
#ifdef CONFIG_SYSCTL
static
-int addrconf_sysctl_forward(ctl_table *ctl, int write,
- void __user *buffer, size_t *lenp, loff_t *ppos)
+int addrconf_sysctl_forward(ctl_table *ctl, int write, void __user *buffer,
+ size_t *lenp, loff_t *ppos, void *cookie)
{
int *valp = ctl->data;
int val = *valp;
loff_t pos = *ppos;
int ret;
- ret = proc_dointvec(ctl, write, buffer, lenp, ppos);
+ ret = proc_dointvec(ctl, write, buffer, lenp, ppos, NULL);
if (write)
ret = addrconf_fixup_forwarding(ctl, valp, val);
@@ -4229,15 +4229,15 @@ static int addrconf_disable_ipv6(struct ctl_table *table, int *p, int old)
}
static
-int addrconf_sysctl_disable(ctl_table *ctl, int write,
- void __user *buffer, size_t *lenp, loff_t *ppos)
+int addrconf_sysctl_disable(ctl_table *ctl, int write, void __user *buffer,
+ size_t *lenp, loff_t *ppos, void *cookie)
{
int *valp = ctl->data;
int val = *valp;
loff_t pos = *ppos;
int ret;
- ret = proc_dointvec(ctl, write, buffer, lenp, ppos);
+ ret = proc_dointvec(ctl, write, buffer, lenp, ppos, NULL);
if (write)
ret = addrconf_disable_ipv6(ctl, valp, val);
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index 0e49c9d..61ff29b 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -1751,7 +1751,9 @@ static void ndisc_warn_deprecated_sysctl(struct ctl_table *ctl,
}
}
-int ndisc_ifinfo_sysctl_change(struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos)
+int ndisc_ifinfo_sysctl_change(struct ctl_table *ctl, int write,
+ void __user *buffer, size_t *lenp,
+ loff_t *ppos, void *cookie)
{
struct net_device *dev = ctl->extra1;
struct inet6_dev *idev;
@@ -1762,16 +1764,16 @@ int ndisc_ifinfo_sysctl_change(struct ctl_table *ctl, int write, void __user *bu
ndisc_warn_deprecated_sysctl(ctl, "syscall", dev ? dev->name : "default");
if (strcmp(ctl->procname, "retrans_time") == 0)
- ret = proc_dointvec(ctl, write, buffer, lenp, ppos);
+ ret = proc_dointvec(ctl, write, buffer, lenp, ppos, NULL);
else if (strcmp(ctl->procname, "base_reachable_time") == 0)
- ret = proc_dointvec_jiffies(ctl, write,
- buffer, lenp, ppos);
+ ret = proc_dointvec_jiffies(ctl, write, buffer,
+ lenp, ppos, NULL);
else if ((strcmp(ctl->procname, "retrans_time_ms") == 0) ||
(strcmp(ctl->procname, "base_reachable_time_ms") == 0))
- ret = proc_dointvec_ms_jiffies(ctl, write,
- buffer, lenp, ppos);
+ ret = proc_dointvec_ms_jiffies(ctl, write, buffer,
+ lenp, ppos, NULL);
else
ret = -1;
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 843406f..48ec0b7 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -2593,8 +2593,8 @@ static const struct file_operations rt6_stats_seq_fops = {
#ifdef CONFIG_SYSCTL
static
-int ipv6_sysctl_rtcache_flush(ctl_table *ctl, int write,
- void __user *buffer, size_t *lenp, loff_t *ppos)
+int ipv6_sysctl_rtcache_flush(ctl_table *ctl, int write, void __user *buffer,
+ size_t *lenp, loff_t *ppos, void *cookie)
{
struct net *net;
int delay;
@@ -2603,7 +2603,7 @@ int ipv6_sysctl_rtcache_flush(ctl_table *ctl, int write,
net = (struct net *)ctl->extra1;
delay = net->ipv6.sysctl.flush_delay;
- proc_dointvec(ctl, write, buffer, lenp, ppos);
+ proc_dointvec(ctl, write, buffer, lenp, ppos, NULL);
fib6_run_gc(delay <= 0 ? ~0UL : (unsigned long)delay, net);
return 0;
}
diff --git a/net/irda/irsysctl.c b/net/irda/irsysctl.c
index d0b70da..1ee0226 100644
--- a/net/irda/irsysctl.c
+++ b/net/irda/irsysctl.c
@@ -73,12 +73,12 @@ static int min_lap_keepalive_time = 100; /* 100us */
/* For other sysctl, I've no idea of the range. Maybe Dag could help
* us on that - Jean II */
-static int do_devname(ctl_table *table, int write,
- void __user *buffer, size_t *lenp, loff_t *ppos)
+static int do_devname(ctl_table *table, int write, void __user *buffer,
+ size_t *lenp, loff_t *ppos, void *cookie)
{
int ret;
- ret = proc_dostring(table, write, buffer, lenp, ppos);
+ ret = proc_dostring(table, write, buffer, lenp, ppos, NULL);
if (ret == 0 && write) {
struct ias_value *val;
@@ -90,12 +90,12 @@ static int do_devname(ctl_table *table, int write,
}
-static int do_discovery(ctl_table *table, int write,
- void __user *buffer, size_t *lenp, loff_t *ppos)
+static int do_discovery(ctl_table *table, int write, void __user *buffer,
+ size_t *lenp, loff_t *ppos, void *cookie)
{
int ret;
- ret = proc_dointvec(table, write, buffer, lenp, ppos);
+ ret = proc_dointvec(table, write, buffer, lenp, ppos, NULL);
if (ret)
return ret;
diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c
index 33733c8..6269b13 100644
--- a/net/netfilter/ipvs/ip_vs_ctl.c
+++ b/net/netfilter/ipvs/ip_vs_ctl.c
@@ -1514,15 +1514,15 @@ static int ip_vs_zero_all(struct net *net)
#ifdef CONFIG_SYSCTL
static int
-proc_do_defense_mode(ctl_table *table, int write,
- void __user *buffer, size_t *lenp, loff_t *ppos)
+proc_do_defense_mode(ctl_table *table, int write, void __user *buffer,
+ size_t *lenp, loff_t *ppos, void *cookie)
{
struct net *net = current->nsproxy->net_ns;
int *valp = table->data;
int val = *valp;
int rc;
- rc = proc_dointvec(table, write, buffer, lenp, ppos);
+ rc = proc_dointvec(table, write, buffer, lenp, ppos, NULL);
if (write && (*valp != val)) {
if ((*valp < 0) || (*valp > 3)) {
/* Restore the correct value */
@@ -1535,8 +1535,8 @@ proc_do_defense_mode(ctl_table *table, int write,
}
static int
-proc_do_sync_threshold(ctl_table *table, int write,
- void __user *buffer, size_t *lenp, loff_t *ppos)
+proc_do_sync_threshold(ctl_table *table, int write, void __user *buffer,
+ size_t *lenp, loff_t *ppos, void *cookie)
{
int *valp = table->data;
int val[2];
@@ -1545,7 +1545,7 @@ proc_do_sync_threshold(ctl_table *table, int write,
/* backup the value first */
memcpy(val, valp, sizeof(val));
- rc = proc_dointvec(table, write, buffer, lenp, ppos);
+ rc = proc_dointvec(table, write, buffer, lenp, ppos, NULL);
if (write && (valp[0] < 0 || valp[1] < 0 || valp[0] >= valp[1])) {
/* Restore the correct value */
memcpy(valp, val, sizeof(val));
diff --git a/net/netfilter/nf_log.c b/net/netfilter/nf_log.c
index 20714ed..9bd1f90 100644
--- a/net/netfilter/nf_log.c
+++ b/net/netfilter/nf_log.c
@@ -226,7 +226,8 @@ static struct ctl_table nf_log_sysctl_table[NFPROTO_NUMPROTO+1];
static struct ctl_table_header *nf_log_dir_header;
static int nf_log_proc_dostring(ctl_table *table, int write,
- void __user *buffer, size_t *lenp, loff_t *ppos)
+ void __user *buffer, size_t *lenp,
+ loff_t *ppos, void *cookie)
{
const struct nf_logger *logger;
char buf[NFLOGGER_NAME_LEN];
@@ -260,7 +261,7 @@ static int nf_log_proc_dostring(ctl_table *table, int write,
table->data = "NONE";
else
table->data = logger->name;
- r = proc_dostring(table, write, buffer, lenp, ppos);
+ r = proc_dostring(table, write, buffer, lenp, ppos, NULL);
mutex_unlock(&nf_log_mutex);
}
diff --git a/net/phonet/sysctl.c b/net/phonet/sysctl.c
index cea1c7d..7bdaf3e 100644
--- a/net/phonet/sysctl.c
+++ b/net/phonet/sysctl.c
@@ -57,8 +57,8 @@ void phonet_get_local_port_range(int *min, int *max)
}
static int proc_local_port_range(ctl_table *table, int write,
- void __user *buffer,
- size_t *lenp, loff_t *ppos)
+ void __user *buffer, size_t *lenp,
+ loff_t *ppos, void *cookie)
{
int ret;
int range[2] = {local_port_range[0], local_port_range[1]};
@@ -70,7 +70,7 @@ static int proc_local_port_range(ctl_table *table, int write,
.extra2 = &local_port_range_max,
};
- ret = proc_dointvec_minmax(&tmp, write, buffer, lenp, ppos);
+ ret = proc_dointvec_minmax(&tmp, write, buffer, lenp, ppos, NULL);
if (write && ret == 0) {
if (range[1] < range[0])
diff --git a/net/sunrpc/sysctl.c b/net/sunrpc/sysctl.c
index e65dcc6..30fc555 100644
--- a/net/sunrpc/sysctl.c
+++ b/net/sunrpc/sysctl.c
@@ -56,8 +56,8 @@ rpc_unregister_sysctl(void)
}
}
-static int proc_do_xprt(ctl_table *table, int write,
- void __user *buffer, size_t *lenp, loff_t *ppos)
+static int proc_do_xprt(ctl_table *table, int write, void __user *buffer,
+ size_t *lenp, loff_t *ppos, void *cookie)
{
char tmpbuf[256];
size_t len;
@@ -70,9 +70,8 @@ static int proc_do_xprt(ctl_table *table, int write,
return simple_read_from_buffer(buffer, *lenp, ppos, tmpbuf, len);
}
-static int
-proc_dodebug(ctl_table *table, int write,
- void __user *buffer, size_t *lenp, loff_t *ppos)
+static int proc_dodebug(ctl_table *table, int write, void __user *buffer,
+ size_t *lenp, loff_t *ppos, void *cookie)
{
char tmpbuf[20], c, *s;
char __user *p;
diff --git a/net/sunrpc/xprtrdma/svc_rdma.c b/net/sunrpc/xprtrdma/svc_rdma.c
index 09af4fa..fef4bf7 100644
--- a/net/sunrpc/xprtrdma/svc_rdma.c
+++ b/net/sunrpc/xprtrdma/svc_rdma.c
@@ -85,7 +85,7 @@ struct workqueue_struct *svc_rdma_wq;
*/
static int read_reset_stat(ctl_table *table, int write,
void __user *buffer, size_t *lenp,
- loff_t *ppos)
+ loff_t *ppos, void *cookie)
{
atomic_t *stat = (atomic_t *)table->data;
diff --git a/security/min_addr.c b/security/min_addr.c
index f728728..340ae41 100644
--- a/security/min_addr.c
+++ b/security/min_addr.c
@@ -29,14 +29,15 @@ static void update_mmap_min_addr(void)
* calls update_mmap_min_addr() so non MAP_FIXED hints get rounded properly
*/
int mmap_min_addr_handler(struct ctl_table *table, int write,
- void __user *buffer, size_t *lenp, loff_t *ppos)
+ void __user *buffer, size_t *lenp,
+ loff_t *ppos, void *cookie)
{
int ret;
if (write && !capable(CAP_SYS_RAWIO))
return -EPERM;
- ret = proc_doulongvec_minmax(table, write, buffer, lenp, ppos);
+ ret = proc_doulongvec_minmax(table, write, buffer, lenp, ppos, NULL);
update_mmap_min_addr();
--
1.7.5.rc0
^ permalink raw reply related
* [PATCH 02/24] sysctl: cookie: add ctl_header_cookie
From: Lucian Adrian Grijincu @ 2011-04-02 2:53 UTC (permalink / raw)
To: 'David S . Miller', Alexey Dobriyan, Eric W . Biederman,
Octavian Purdila, linux-kernel
Cc: Lucian Adrian Grijincu
In-Reply-To: <cover.1301711868.git.lucian.grijincu@gmail.com>
Signed-off-by: Lucian Adrian Grijincu <lucian.grijincu@gmail.com>
---
include/linux/sysctl.h | 5 ++++-
kernel/sysctl.c | 12 ++++++++----
net/sysctl_net.c | 6 +++---
3 files changed, 15 insertions(+), 8 deletions(-)
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index 11684d9..f82d456 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -1054,6 +1054,9 @@ struct ctl_table_header
struct ctl_table *attached_by;
struct ctl_table *attached_to;
struct ctl_table_header *parent;
+ /* Pointer to data that outlives this ctl_table_header.
+ * Caller responsible to free the cookie. */
+ void *ctl_header_cookie;
};
/* struct ctl_path describes where in the hierarchy a table is added */
@@ -1064,7 +1067,7 @@ struct ctl_path {
void register_sysctl_root(struct ctl_table_root *root);
struct ctl_table_header *__register_sysctl_paths(
struct ctl_table_root *root, struct nsproxy *namespaces,
- const struct ctl_path *path, struct ctl_table *table);
+ const struct ctl_path *path, struct ctl_table *table, void *cookie);
struct ctl_table_header *register_sysctl_table(struct ctl_table * table);
struct ctl_table_header *register_sysctl_paths(const struct ctl_path *path,
struct ctl_table *table);
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index c0bb324..dd3d061 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -205,6 +205,7 @@ static struct ctl_table_header root_table_header = {
.ctl_entry = LIST_HEAD_INIT(sysctl_table_root.default_set.list),}},
.root = &sysctl_table_root,
.set = &sysctl_table_root.default_set,
+ .ctl_header_cookie = NULL,
};
static struct ctl_table_root sysctl_table_root = {
.root_list = LIST_HEAD_INIT(sysctl_table_root.root_list),
@@ -1781,6 +1782,9 @@ static void try_attach(struct ctl_table_header *p, struct ctl_table_header *q)
* @namespaces: Data to compute which lists of sysctl entries are visible
* @path: The path to the directory the sysctl table is in.
* @table: the top-level table structure
+ * @cookie: Pointer to user provided data that must be accessible
+ * until unregister_sysctl_table. This cookie will be passed to the
+ * proc_handler.
*
* Register a sysctl table hierarchy. @table should be a filled in ctl_table
* array. A completely 0 filled entry terminates the table.
@@ -1829,9 +1833,8 @@ static void try_attach(struct ctl_table_header *p, struct ctl_table_header *q)
* to the table header on success.
*/
struct ctl_table_header *__register_sysctl_paths(
- struct ctl_table_root *root,
- struct nsproxy *namespaces,
- const struct ctl_path *path, struct ctl_table *table)
+ struct ctl_table_root *root, struct nsproxy *namespaces,
+ const struct ctl_path *path, struct ctl_table *table, void *cookie)
{
struct ctl_table_header *header;
struct ctl_table *new, **prevp;
@@ -1878,6 +1881,7 @@ struct ctl_table_header *__register_sysctl_paths(
header->root = root;
sysctl_set_parent(NULL, header->ctl_table);
header->count = 1;
+ header->ctl_header_cookie = cookie;
#ifdef CONFIG_SYSCTL_SYSCALL_CHECK
if (sysctl_check_table(namespaces, header->ctl_table)) {
kfree(header);
@@ -1918,7 +1922,7 @@ struct ctl_table_header *register_sysctl_paths(const struct ctl_path *path,
struct ctl_table *table)
{
return __register_sysctl_paths(&sysctl_table_root, current->nsproxy,
- path, table);
+ path, table, NULL);
}
/**
diff --git a/net/sysctl_net.c b/net/sysctl_net.c
index ca84212..9dadd17 100644
--- a/net/sysctl_net.c
+++ b/net/sysctl_net.c
@@ -109,8 +109,8 @@ struct ctl_table_header *register_net_sysctl_table(struct net *net,
struct nsproxy namespaces;
namespaces = *current->nsproxy;
namespaces.net_ns = net;
- return __register_sysctl_paths(&net_sysctl_root,
- &namespaces, path, table);
+ return __register_sysctl_paths(&net_sysctl_root, &namespaces, path,
+ table, NULL);
}
EXPORT_SYMBOL_GPL(register_net_sysctl_table);
@@ -118,7 +118,7 @@ struct ctl_table_header *register_net_sysctl_rotable(const
struct ctl_path *path, struct ctl_table *table)
{
return __register_sysctl_paths(&net_sysctl_ro_root,
- &init_nsproxy, path, table);
+ &init_nsproxy, path, table, NULL);
}
EXPORT_SYMBOL_GPL(register_net_sysctl_rotable);
--
1.7.5.rc0
^ permalink raw reply related
* [PATCH 01/24] sysctl: net: call unregister_net_sysctl_table where needed
From: Lucian Adrian Grijincu @ 2011-04-02 2:53 UTC (permalink / raw)
To: 'David S . Miller', Alexey Dobriyan, Eric W . Biederman,
Octavian Purdila, linux-kernel
Cc: Lucian Adrian Grijincu
In-Reply-To: <cover.1301711868.git.lucian.grijincu@gmail.com>
ctl_table_headers registered with register_net_sysctl_table should
have been unregistered with the equivalent unregister_net_sysctl_table
Signed-off-by: Lucian Adrian Grijincu <lucian.grijincu@gmail.com>
---
net/ipv4/devinet.c | 2 +-
net/ipv6/addrconf.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index 5345b0b..cd9ca08 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -1680,7 +1680,7 @@ static void __devinet_sysctl_unregister(struct ipv4_devconf *cnf)
return;
cnf->sysctl = NULL;
- unregister_sysctl_table(t->sysctl_header);
+ unregister_net_sysctl_table(t->sysctl_header);
kfree(t->dev_name);
kfree(t);
}
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 3daaf3c..b1654a4 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -4537,7 +4537,7 @@ static void __addrconf_sysctl_unregister(struct ipv6_devconf *p)
t = p->sysctl;
p->sysctl = NULL;
- unregister_sysctl_table(t->sysctl_header);
+ unregister_net_sysctl_table(t->sysctl_header);
kfree(t->dev_name);
kfree(t);
}
--
1.7.5.rc0
^ permalink raw reply related
* [PATCH 00/24] v1: sysctl header cookies + private children
From: Lucian Adrian Grijincu @ 2011-04-02 2:53 UTC (permalink / raw)
To: 'David S . Miller', Alexey Dobriyan, Eric W . Biederman,
Octavian Purdila, linux-kernel
Cc: Lucian Adrian Grijincu
Hi,
The first patches in this series add a 'cookie' to the struct
ctl_table_header. This cookie is used to store some data and is
passed to proc_handlers. The 'cookie' part series has already been
posted on netdev/lkml, but it was dropped because sysctl has a bigger
problem: an inefficient algorithm to add new tables.
This is where part two comes along: private ctl_table_header nodes.
Not all sysctl headers are the same: while some of them are at a high
level and have lots of other headers attached to them, most other
headers are children of another header and will never have a child
attached to them. With this in mind, we designate some of these
headers to be 'private children' (I don't really like this terminology
- I'm open to suggestions) of another header.
Performance suffers because every header is consulted:
- when we add a new header (to attach the new header somewhere)
- when lookup failed in a table: we consult every other header to see
whether it was attached to this table.
Neither of these actions are performed for private children. With more
header registered as private, the number of headers consulted in these
steps lowers and performance is better.
Adding nodes for:
- /proc/sys/net/ipv4/conf/DEVNAME
- /proc/sys/net/ipv6/conf/DEVNAME
- /proc/sys/net/ipv4/neigh/DEVNAME
- /proc/sys/net/ipv6/neigh/DEVNAME
as private children has this effect:
$ time modprobe dummy numdummies=$n
Without these patches:
- n=5000 => 17:31 minutes
- n=2000 => 2:23 minutes
- n=1000 => 0:25 minutes
With these patches:
- n=5000 => 12.50 seconds
- n=2000 => 1.59 seconds
- n=1000 => 0.44 seconds
I'll follow up with another series adding the cookie in a few more
places and removing some fields in ctl_table, but I'd like some
feedback for these patches.
Patches are against 2.6.39-rc1.
Lucian Adrian Grijincu (24):
sysctl: net: call unregister_net_sysctl_table where needed
sysctl: cookie: add ctl_header_cookie
sysctl: cookie: pass ctl_header_cookie to proc_handler
sysctl: cookie: add netns_proc_dointvec and other netns_proc_*
proc_handlers
sysctl: cookie: share ip4_frags_ns_ctl_table between nets
sysctl: cookie: share netns_core_table between nets
sysctl: cookie: share ipv4_route_flush_table between nets
sysctl: cookie: share ipv4_net_table between nets
sysctl: cookie: share ip6_frags_ns_ctl_table between nets
sysctl: cookie: share ip6_ctl_table, ipv6_icmp_table and
ipv6_route_table between nets
sysctl: cookie: share acct_sysctl_table table between nets
sysctl: cookie: share event_sysctl_table between nets
sysctl: cookie: share nf_ct_sysctl_table between nets
sysctl: cookie: share unix_table between nets
sysctl: cookie: share xfrm_table between nets
sysctl: add support for private_children headers
sysctl: add register_net_sysctl_table_with_parent
sysctl: ipv4: register /proc/sys/net/ipv4/conf empty directory
sysctl: ipv4: register devinet tables as private children
sysctl: ipv6: register /proc/sys/net/ipv6/conf empty directory
sysctl: ipv6: register addrconf tables as private children
sysctl: ipv4: register /proc/sys/net/ipv4/neigh empty directory
sysctl: ipv6: register /proc/sys/net/ipv6/neigh empty directory
sysctl: neigh: ipv4 and ipv6 neigh tables as private children
arch/frv/kernel/pm.c | 22 ++--
arch/frv/kernel/sysctl.c | 4 +-
arch/mips/lasat/sysctl.c | 28 +++---
arch/s390/appldata/appldata_base.c | 15 ++--
arch/s390/kernel/debug.c | 6 +-
arch/s390/mm/cmm.c | 4 +-
drivers/cdrom/cdrom.c | 12 +-
drivers/char/random.c | 6 +-
drivers/macintosh/mac_hid.c | 4 +-
drivers/parport/procfs.c | 29 +++---
drivers/s390/char/sclp_async.c | 2 +-
fs/dcache.c | 4 +-
fs/drop_caches.c | 5 +-
fs/file_table.c | 10 +-
fs/fscache/main.c | 6 +-
fs/inode.c | 6 +-
fs/pipe.c | 4 +-
fs/proc/proc_sysctl.c | 24 ++++-
fs/quota/dquot.c | 5 +-
fs/xfs/linux-2.6/xfs_sysctl.c | 10 +-
include/linux/compaction.h | 6 +-
include/linux/fs.h | 12 +-
include/linux/ftrace.h | 4 +-
include/linux/hugetlb.h | 13 ++-
include/linux/kprobes.h | 6 +-
include/linux/mm.h | 4 +-
include/linux/mmzone.h | 23 ++--
include/linux/nmi.h | 4 +-
include/linux/perf_event.h | 2 +-
include/linux/pipe_fs_i.h | 2 +-
include/linux/sched.h | 16 ++--
include/linux/security.h | 3 +-
include/linux/swap.h | 4 +-
include/linux/sysctl.h | 45 ++++++--
include/linux/writeback.h | 18 +--
include/net/ipv6.h | 8 +-
include/net/ndisc.h | 7 +-
include/net/neighbour.h | 9 +-
include/net/net_namespace.h | 36 +++++++
include/net/netns/ipv4.h | 10 +-
include/net/netns/ipv6.h | 4 +-
ipc/ipc_sysctl.c | 21 ++--
ipc/mq_sysctl.c | 11 +-
kernel/hung_task.c | 6 +-
kernel/kprobes.c | 4 +-
kernel/perf_event.c | 4 +-
kernel/sched.c | 4 +-
kernel/sched_fair.c | 4 +-
kernel/sysctl.c | 171 +++++++++++++++++++++++--------
kernel/trace/ftrace.c | 4 +-
kernel/trace/trace_stack.c | 4 +-
kernel/utsname_sysctl.c | 6 +-
kernel/watchdog.c | 11 +-
mm/compaction.c | 8 +-
mm/hugetlb.c | 24 +++--
mm/page-writeback.c | 24 ++---
mm/page_alloc.c | 25 ++---
mm/vmscan.c | 6 +-
net/bridge/br_netfilter.c | 6 +-
net/core/neighbour.c | 6 +-
net/core/sysctl_net_core.c | 33 +-----
net/decnet/dn_dev.c | 10 +-
net/decnet/sysctl_net_decnet.c | 8 +-
net/ipv4/arp.c | 71 ++++++++++++-
net/ipv4/devinet.c | 52 +++++++---
net/ipv4/ip_fragment.c | 34 +-----
net/ipv4/route.c | 49 +++-------
net/ipv4/sysctl_net_ipv4.c | 78 ++++----------
net/ipv6/addrconf.c | 50 +++++++--
net/ipv6/af_inet6.c | 12 --
net/ipv6/icmp.c | 17 +---
net/ipv6/ndisc.c | 91 ++++++++++++----
net/ipv6/reassembly.c | 34 +-----
net/ipv6/route.c | 60 +++--------
net/ipv6/sysctl_net_ipv6.c | 88 ++--------------
net/irda/irsysctl.c | 12 +-
net/netfilter/ipvs/ip_vs_ctl.c | 12 +-
net/netfilter/nf_conntrack_acct.c | 24 +----
net/netfilter/nf_conntrack_ecache.c | 30 +-----
net/netfilter/nf_conntrack_standalone.c | 30 +-----
net/netfilter/nf_log.c | 5 +-
net/phonet/sysctl.c | 6 +-
net/sunrpc/sysctl.c | 9 +-
net/sunrpc/xprtrdma/svc_rdma.c | 2 +-
net/sysctl_net.c | 46 ++++++++-
net/unix/sysctl_net_unix.c | 22 +----
net/xfrm/xfrm_sysctl.c | 37 ++-----
security/min_addr.c | 5 +-
88 files changed, 879 insertions(+), 839 deletions(-)
--
1.7.5.rc0
^ permalink raw reply
* RE: [PATCH] net: ethtool support to configure number of channels
From: Amit Salecha @ 2011-04-02 2:36 UTC (permalink / raw)
To: Ben Hutchings
Cc: davem@davemloft.net, netdev@vger.kernel.org, Ameen Rahman,
Sucheta Chakraborty, Anirban Chakraborty
In-Reply-To: <1301677824.4679.10.camel@bwh-desktop>
> I'm not sure why you reduced this to a single count. If if the driver
> or hardware doesn't allow certain combinations of counts, it might be
> necessary to configure several types at the same time
>
> > +/* Channel ID is made up of a type */
> > +enum ethtool_channel_id {
> > + ETH_CHAN_TYPE_RX = 0x1,
> > + ETH_CHAN_TYPE_TX = 0x2
> > +};
> [...]
>
> enum ethtool_channel_id was meant to be an identifier of a specific
> channel. An enumeration of channel types should be named differently.
>
I will name it as ethtool_channel_type. Any other suggestion ?
> This also omits the 'combined' and 'other' types. Most multiqueue
> drivers pair up RX and TX queues so that most channels combine RX and
> TX
> work.
'combined' is ok, what is use of 'other' ?
-amit
This message and any attached documents contain information from QLogic Corporation or its wholly-owned subsidiaries that may be confidential. If you are not the intended recipient, you may not read, copy, distribute, or use this information. If you have received this transmission in error, please notify the sender immediately by reply e-mail and then delete this message.
^ permalink raw reply
* Re: [PATCH 1/9 net-next-2.6] qlcnic: Make PCI info available in all modes
From: Anirban Chakraborty @ 2011-04-02 2:14 UTC (permalink / raw)
To: David Miller
Cc: netdev@vger.kernel.org, Amit Salecha, Ameen Rahman, Sony Chacko
In-Reply-To: <20110401.182048.39186298.davem@davemloft.net>
On Apr 1, 2011, at 6:20 PM, David Miller wrote:
> From: David Miller <davem@davemloft.net>
> Date: Fri, 01 Apr 2011 18:18:13 -0700 (PDT)
>
>>
>> davemloft.com is not my email domain, it's davemloft.org
>
> See, I can't even get it right, it's davemloft.net :-)
It must be my influence! :-)
-Anirban
This message and any attached documents contain information from QLogic Corporation or its wholly-owned subsidiaries that may be confidential. If you are not the intended recipient, you may not read, copy, distribute, or use this information. If you have received this transmission in error, please notify the sender immediately by reply e-mail and then delete this message.
^ permalink raw reply
* extending feature word.
From: Mahesh Bandewar @ 2011-04-02 2:07 UTC (permalink / raw)
To: linux-netdev, Ben Hutchings, Michał Mirosław,
David Miller
Thanks for your comments on my loop-back patch. I was looking at the
code today from the perspective of extending various "features" for
word to an array of words and as Michael has pointed out, it's a huge
change. So I'm thinking on the following lines
(include/linux/netdevice.h)
+#define DEV_FEATURE_WORDS 2
+#define LEGACY_FEATURE_WORD 0
/* currently active device features */
- u32 features;
+ u32 features[DEV_FEATURE_WORDS];
/* user-changeable features */
- u32 hw_features;
+ u32 hw_features[DEV_FEATURE_WORDS];
/* user-requested features */
- u32 wanted_features;
+ u32 wanted_features[DEV_FEATURE_WORDS];
/* VLAN feature mask */
- u32 vlan_features;
+ u32 vlan_features[DEV_FEATURE_WORDS];
+#define legacy_features features[LEGACY_FEATURE_WORD]
+#define legacy_hw_features hw_features[LEGACY_FEATURE_WORD]
+#define legacy_wanted_features wanted_features[LEGACY_FEATURE_WORD]
+#define legacy_vlan_features vlan_features[LEGACY_FEATURE_WORD]
So that it will be a matter of -
s/features/legacy_features/
s/hw_features/legacy_hw_features/
s/wanted_features/legacy_wanted_features/
s/vlan_features/legacy_vlan_features/
to start with as a first step. Once this is done, legacy_* can be
changed with respective arrays and modified as per the need. Comments?
--mahesh..
^ permalink raw reply
* Re: bnx2 vlan issue
From: Jesse Gross @ 2011-04-02 2:01 UTC (permalink / raw)
To: Seblu; +Cc: netdev
In-Reply-To: <AANLkTi=gsP3ZZyEwO+CcM3uB6G5-QswYEfqdtiy8oOyv@mail.gmail.com>
On Thu, Mar 24, 2011 at 5:26 PM, Seblu <seblu@seblu.net> wrote:
> On Thu, Mar 24, 2011 at 8:55 PM, Jesse Gross <jesse@nicira.com> wrote:
>> On Thu, Mar 24, 2011 at 5:58 AM, Seblu <seblu@seblu.net> wrote:
>>>> I don't necessarily disagree that there should be a better way to do
>>>> this, though as of the moment the above is probably your best bet.
>>>>
>>>> To me, the most important thing is to have consistent behavior across
>>>> different cards.
>>>
>>> Speaking of that, i've tryed 2.6.38 on my station (dell opitplex 980)
>>> to use the new bridging schema and it doesn't work.
>>> Exactly the case previously described: ip on br0 (eth0+eth1) and ip on
>>> br0.42. eth0 driver is e1000e and eth1 is tg3. br0.42 don't receive
>>> traffic.
>>> I have to open a bug report?
>>
>> The change was deliberate, not an accidental mistake, so don't expect
>> 2.6.38 to suddenly switch back to the previous behavior. There's no
>> need to file a bug report - the new behavior is known (I was the one
>> who changed it in the first place). I will look into nicer semantics
>> in the future.
>>
> Maybe i was not enough clear. It seems to me that new behaviour, with
> vlan on top of bridge rather than above interface in bridge is not
> functional.
> In other words, i cannot use vlan and bridge together in 2.6.38 (with e1000e).
Sorry, I misunderstood what you were saying before. Can you try and
see where the packets are getting lost or improperly handled by
running tcpdump on the various interfaces? For example, check that
packets are coming in with tags on the physical interfaces, have tags
on the bridge interface, no tag on the vlan interface, etc.
^ permalink raw reply
* Re: [RFC PATCH] vlan: convert VLAN devices to use hw_features
From: Jesse Gross @ 2011-04-02 1:55 UTC (permalink / raw)
To: Michał Mirosław
Cc: netdev, Patrick McHardy, David S. Miller, John Fastabend,
Eric Dumazet
In-Reply-To: <20110331110135.19BE6138DD@rere.qmqm.pl>
2011/3/31 Michał Mirosław <mirq-linux@rere.qmqm.pl>:
> diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
> index e34ea9e..b84a46b 100644
> --- a/net/8021q/vlan_dev.c
> +++ b/net/8021q/vlan_dev.c
> @@ -704,8 +704,8 @@ static int vlan_dev_init(struct net_device *dev)
> (1<<__LINK_STATE_DORMANT))) |
> (1<<__LINK_STATE_PRESENT);
>
> - dev->features |= real_dev->features & real_dev->vlan_features;
> - dev->features |= NETIF_F_LLTX;
> + dev->hw_features = real_dev->vlan_features & NETIF_F_ALL_TX_OFFLOADS;
> + dev->features |= real_dev->vlan_features | NETIF_F_LLTX;
Shouldn't this continue to use real_dev->feaures &
real_dev->vlan_features? In some places capabilities are blindly
added to vlan_features on the assumption that they will later be ANDed
with the real capabilities of the hardware (for example, see
register_netdevice()).
^ permalink raw reply
* (unknown),
From: Webmail HelpDesk @ 2011-04-01 21:40 UTC (permalink / raw)
The Helpdesk Program that periodically checks the size of your e-mail
space is sending you this information. The program runs weekly to
ensure your inbox does not grow too large, thus preventing you from
receiving or sending new e-mail. As this message is being sent, you
have 18 megabytes (MB) or more stored in your inbox. To help us reset
your space in our database, please enter your current
user name(_________________) password (_______________)
You will receive a periodic alert if your inbox size is between 18 and
20 MB. If your inbox size is 20 MB, a program on your Webmail will
move your oldest e-mails to a folder in your home directory to ensure
you can continue receiving incoming e-mail. You will be notified this
has taken place.
If your inbox grows to 25 MB, you will be unable to receive new e-mail
and it will be returned to sender. All this is programmed to ensure
your e-mail continues to function well.
Thank you for your cooperation.
Help Desk.
Important: Email Account Verification Update ! ! !
^ permalink raw reply
* Re: [PATCH] vlan: Fix duplicate delivery of vlan 0 packets to ETH_P_ALL packet sockets
From: Jesse Gross @ 2011-04-02 1:41 UTC (permalink / raw)
To: Eric W. Biederman
Cc: David Miller, netdev, Michał Mirosław, Ben Hutchings,
Eric Dumazet, John Fastabend
In-Reply-To: <m1zkoh9ixx.fsf@fess.ebiederm.org>
On Sat, Mar 26, 2011 at 11:27 PM, Eric W. Biederman
<ebiederm@xmission.com> wrote:
> Jesse Gross <jesse@nicira.com> writes:
>
>> On Mon, Mar 21, 2011 at 2:35 PM, Eric W. Biederman
>> <ebiederm@xmission.com> wrote:
>>>
>>> For vlan data coming in from nics without vlan hardware accelleration we
>>> get two copies of vlan packets with vlan id 0 on pf_packet sockets, causing
>>> userspace to break. This is caused by delivering the same packet to the same
>>> networking device more than once.
>>
>> I agree that this is a problem and the code consolidation is very nice
>> but I'm concerned that there is extra complexity for the rest of the
>> system to counterbalance what is saved here.
>>
>>> diff --git a/net/8021q/vlan_core.c b/net/8021q/vlan_core.c
>>> index ce8e3ab..a0849b9 100644
>>> --- a/net/8021q/vlan_core.c
>>> +++ b/net/8021q/vlan_core.c
>>> +void emulate_vlan_hwaccel(struct sk_buff *skb)
>>> +{
>>> + struct vlan_hdr *vhdr = (struct vlan_hdr *)skb->data;
>>> + __be16 proto;
>>> +
>>> + if (!pskb_may_pull(skb, VLAN_HLEN))
>>> + return;
>>> +
>>> + __vlan_hwaccel_put_tag(skb, vhdr->h_vlan_TCI);
>>> + skb_pull_rcsum(skb, VLAN_HLEN);
>>
>> Doesn't this break things which push the header back on? Bridging
>> pushes ETH_HLEN before forwarding but here it will be a garbage value
>> due to the extra vlan header. AF_PACKET pushes the mac header back
>> on, which in this case includes the original vlan header. However,
>> since we've also put the tag in skb->vlan_tci, won't it appear to be
>> double tagged?
>
> Probably that part does indeed look like a bug, and my testing certainly
> shows that there are problems with my patch.
>
>> More generally, even though we pull the tag off the skb it's pretty
>> common on the receive path to look backwards into previous headers.
>> Given that this can happen, I think it's somewhat confusing/fragile to
>> have packet data which effectively should not be there. It also adds
>> a third case to any generic vlan handling code: tag in packet (can
>> still happen, such as on transmit), received on vlan accelerated NIC -
>> tag in skb but not in packet, receive on non-vlan accelerated NIC -
>> tag in both skb and packet.
>>
>> If we actually removed the tag in the emulated case that would avoid
>> these concerns but would, of course, add extra overhead in some
>> situations.
>
> The only extra overhead I can really see is the need to put the vlan
> tag back on in a few instances. Moving the ethernet addresses around
> in the packet (the cost of adding/removing the vlan header) since they
> are in a hot cacheline doesn't concern me very much.
Yes, you're probably right. It likely rare that we hit this path at
all, unlikely that we'll need to put it back, and, as you say, it's in
a hot cacheline. In that case, it seems like a reasonable approach to
me.
>
> But we definitely need to do something to fix the regression for
> pf_packet sockets.
I agree.
^ permalink raw reply
* Re: [PATCH 1/9 net-next-2.6] qlcnic: Make PCI info available in all modes
From: David Miller @ 2011-04-02 1:20 UTC (permalink / raw)
To: anirban.chakraborty
Cc: davem, netdev, amit.salecha, ameen.rahman, sony.chacko
In-Reply-To: <20110401.181813.183055009.davem@davemloft.net>
From: David Miller <davem@davemloft.net>
Date: Fri, 01 Apr 2011 18:18:13 -0700 (PDT)
>
> davemloft.com is not my email domain, it's davemloft.org
See, I can't even get it right, it's davemloft.net :-)
^ permalink raw reply
* Re: [PATCH 1/9 net-next-2.6] qlcnic: Make PCI info available in all modes
From: David Miller @ 2011-04-02 1:18 UTC (permalink / raw)
To: anirban.chakraborty
Cc: davem, netdev, amit.salecha, ameen.rahman, sony.chacko
In-Reply-To: <1301704067-4233-1-git-send-email-anirban.chakraborty@qlogic.com>
davemloft.com is not my email domain, it's davemloft.org
^ permalink raw reply
* [PATCH 9/9 net-next-2.6] qlcnic: Update version number to 5.0.16
From: anirban.chakraborty @ 2011-04-02 0:28 UTC (permalink / raw)
To: davem; +Cc: netdev, amit.salecha, ameen.rahman, Anirban Chakraborty
From: Anirban Chakraborty <anirban.chakraborty@qlogic.com>
Bumped up version number to 5.0.16
Signed-off-by: Anirban Chakraborty <anirban.chakraborty@qlogic.com>
---
drivers/net/qlcnic/qlcnic.h | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/qlcnic/qlcnic.h b/drivers/net/qlcnic/qlcnic.h
index d9dd2c4..dc6f7c6 100644
--- a/drivers/net/qlcnic/qlcnic.h
+++ b/drivers/net/qlcnic/qlcnic.h
@@ -36,8 +36,8 @@
#define _QLCNIC_LINUX_MAJOR 5
#define _QLCNIC_LINUX_MINOR 0
-#define _QLCNIC_LINUX_SUBVERSION 15
-#define QLCNIC_LINUX_VERSIONID "5.0.15"
+#define _QLCNIC_LINUX_SUBVERSION 16
+#define QLCNIC_LINUX_VERSIONID "5.0.16"
#define QLCNIC_DRV_IDC_VER 0x01
#define QLCNIC_DRIVER_VERSION ((_QLCNIC_LINUX_MAJOR << 16) |\
(_QLCNIC_LINUX_MINOR << 8) | (_QLCNIC_LINUX_SUBVERSION))
--
1.7.1
^ permalink raw reply related
* [PATCH 8/9 net-next-2.6] qlcnic: Fix LRO disable
From: anirban.chakraborty @ 2011-04-02 0:28 UTC (permalink / raw)
To: davem; +Cc: netdev, amit.salecha, ameen.rahman, Rajesh Borundia
From: Rajesh Borundia <Rajesh.Borundia@qlogic.com>
o In dev->open LRO was enabled by default, enable it depending
upon netdev->features , kernel may have disabled it.
o Configure LRO when interface is up.
Signed-off-by: Rajesh Borundia <Rajesh.Borundia@qlogic.com>
Signed-off-by: Anirban Chakraborty <Anirban.Chakraborty@qlogic.com>
---
drivers/net/qlcnic/qlcnic_ethtool.c | 26 ++++++++++++++++----------
drivers/net/qlcnic/qlcnic_hw.c | 6 ++++++
drivers/net/qlcnic/qlcnic_main.c | 3 ++-
3 files changed, 24 insertions(+), 11 deletions(-)
diff --git a/drivers/net/qlcnic/qlcnic_ethtool.c b/drivers/net/qlcnic/qlcnic_ethtool.c
index 24a79a6..6be4d5a 100644
--- a/drivers/net/qlcnic/qlcnic_ethtool.c
+++ b/drivers/net/qlcnic/qlcnic_ethtool.c
@@ -998,22 +998,28 @@ static int qlcnic_set_flags(struct net_device *netdev, u32 data)
if (ethtool_invalid_flags(netdev, data, ETH_FLAG_LRO))
return -EINVAL;
- if (!(adapter->capabilities & QLCNIC_FW_CAPABILITY_HW_LRO))
- return -EINVAL;
+ if (data & ETH_FLAG_LRO) {
- if (!adapter->rx_csum) {
- dev_info(&adapter->pdev->dev, "rx csum is off, "
- "cannot toggle lro\n");
- return -EINVAL;
- }
+ if (netdev->features & NETIF_F_LRO)
+ return 0;
- if ((data & ETH_FLAG_LRO) && (netdev->features & NETIF_F_LRO))
- return 0;
+ if (!(adapter->capabilities & QLCNIC_FW_CAPABILITY_HW_LRO))
+ return -EINVAL;
+
+ if (!adapter->rx_csum) {
+ dev_info(&adapter->pdev->dev, "rx csum is off, "
+ "cannot toggle lro\n");
+ return -EINVAL;
+ }
- if (data & ETH_FLAG_LRO) {
hw_lro = QLCNIC_LRO_ENABLED;
netdev->features |= NETIF_F_LRO;
+
} else {
+
+ if (!(netdev->features & NETIF_F_LRO))
+ return 0;
+
hw_lro = 0;
netdev->features &= ~NETIF_F_LRO;
}
diff --git a/drivers/net/qlcnic/qlcnic_hw.c b/drivers/net/qlcnic/qlcnic_hw.c
index 3901be8..498cca9 100644
--- a/drivers/net/qlcnic/qlcnic_hw.c
+++ b/drivers/net/qlcnic/qlcnic_hw.c
@@ -566,6 +566,9 @@ int qlcnic_config_hw_lro(struct qlcnic_adapter *adapter, int enable)
u64 word;
int rv;
+ if (!test_bit(__QLCNIC_FW_ATTACHED, &adapter->state))
+ return 0;
+
memset(&req, 0, sizeof(struct qlcnic_nic_req));
req.qhdr = cpu_to_le64(QLCNIC_HOST_REQUEST << 23);
@@ -711,6 +714,9 @@ int qlcnic_send_lro_cleanup(struct qlcnic_adapter *adapter)
u64 word;
int rv;
+ if (!test_bit(__QLCNIC_FW_ATTACHED, &adapter->state))
+ return 0;
+
memset(&req, 0, sizeof(struct qlcnic_nic_req));
req.qhdr = cpu_to_le64(QLCNIC_HOST_REQUEST << 23);
diff --git a/drivers/net/qlcnic/qlcnic_main.c b/drivers/net/qlcnic/qlcnic_main.c
index 8bf9a96..7f9edb2 100644
--- a/drivers/net/qlcnic/qlcnic_main.c
+++ b/drivers/net/qlcnic/qlcnic_main.c
@@ -773,7 +773,8 @@ qlcnic_set_netdev_features(struct qlcnic_adapter *adapter,
features |= (NETIF_F_TSO | NETIF_F_TSO6);
vlan_features |= (NETIF_F_TSO | NETIF_F_TSO6);
}
- if (adapter->capabilities & QLCNIC_FW_CAPABILITY_HW_LRO)
+
+ if (netdev->features & NETIF_F_LRO)
features |= NETIF_F_LRO;
if (esw_cfg->offload_flags & BIT_0) {
--
1.7.4.1
^ permalink raw reply related
* [PATCH 7/9 net-next-2.6] qlcnic: Use flt method to determine flash fw region
From: anirban.chakraborty @ 2011-04-02 0:28 UTC (permalink / raw)
To: davem; +Cc: netdev, amit.salecha, ameen.rahman, Sritej Velaga
From: Sritej Velaga <sritej.velaga@qlogic.com>
Use flash layout table to get flash fw starting address and its size.
If that fails, use legacy method.
Signed-off-by: Sritej Velaga <sritej.velaga@qlogic.com>
Signed-off-by: Anirban Chakraborty <anirban.chakraborty@qlogic.com>
---
drivers/net/qlcnic/qlcnic.h | 3 ++-
drivers/net/qlcnic/qlcnic_init.c | 17 ++++++++++++++---
2 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/drivers/net/qlcnic/qlcnic.h b/drivers/net/qlcnic/qlcnic.h
index 9d2e630..d9dd2c4 100644
--- a/drivers/net/qlcnic/qlcnic.h
+++ b/drivers/net/qlcnic/qlcnic.h
@@ -292,6 +292,7 @@ struct uni_data_desc{
/* Flash Defines and Structures */
#define QLCNIC_FLT_LOCATION 0x3F1000
#define QLCNIC_FW_IMAGE_REGION 0x74
+#define QLCNIC_BOOTLD_REGION 0X72
struct qlcnic_flt_header {
u16 version;
u16 len;
@@ -306,7 +307,7 @@ struct qlcnic_flt_entry {
u8 reserved1;
u32 size;
u32 start_addr;
- u32 end_add;
+ u32 end_addr;
};
/* Magic number to let user know flash is programmed */
diff --git a/drivers/net/qlcnic/qlcnic_init.c b/drivers/net/qlcnic/qlcnic_init.c
index 74ec96d..4ec0eeb 100644
--- a/drivers/net/qlcnic/qlcnic_init.c
+++ b/drivers/net/qlcnic/qlcnic_init.c
@@ -1130,9 +1130,20 @@ qlcnic_load_firmware(struct qlcnic_adapter *adapter)
} else {
u64 data;
u32 hi, lo;
-
- size = (QLCNIC_IMAGE_START - QLCNIC_BOOTLD_START) / 8;
- flashaddr = QLCNIC_BOOTLD_START;
+ int ret;
+ struct qlcnic_flt_entry bootld_entry;
+
+ ret = qlcnic_get_flt_entry(adapter, QLCNIC_BOOTLD_REGION,
+ &bootld_entry);
+ if (!ret) {
+ size = bootld_entry.size / 8;
+ flashaddr = bootld_entry.start_addr;
+ } else {
+ size = (QLCNIC_IMAGE_START - QLCNIC_BOOTLD_START) / 8;
+ flashaddr = QLCNIC_BOOTLD_START;
+ dev_info(&pdev->dev,
+ "using legacy method to get flash fw region");
+ }
for (i = 0; i < size; i++) {
if (qlcnic_rom_fast_read(adapter,
--
1.7.1
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox