[Devel] [PATCH RH9 33/33] ve/proc/net: virtualize all the network proc entries
Andrey Zhadchenko
andrey.zhadchenko at virtuozzo.com
Thu Sep 23 22:08:36 MSK 2021
From: Stanislav Kinsburskiy <skinsbursky at virtuozzo.com>
Directories should be created via proc_net_mkdir(),
files via proc_net_create() or proc_net_create_data() to become visible in a
container.
Signed-off-by: Konstantin Khlebnikov <khlebnikov at openvz.org>
Signed-off-by: Stanislav Kinsburskiy <skinsbursky at virtuozzo.com>
khorenko@: TODO: helpers are to be renamed.
Rebased to vz9:
- since commit d56c0d45f0e2 ("proc: decouple proc from VFS with "struct proc_ops"")
proc_create() now uses struct proc_ops instead of struct file_operations.
Change accordingly.
(cherry picked from vz8 commit 8537747aac81b4c3a8ce80389fe5fb53013d21e5)
Signed-off-by: Andrey Zhadchenko <andrey.zhadchenko at virtuozzo.com>
---
drivers/net/bonding/bond_procfs.c | 5 +++--
drivers/net/ppp/pppoe.c | 2 +-
include/linux/proc_fs.h | 8 ++++----
net/8021q/vlanproc.c | 4 ++--
net/bluetooth/af_bluetooth.c | 2 +-
net/core/net-procfs.c | 8 ++++----
net/core/pktgen.c | 2 +-
net/core/sock.c | 2 +-
net/ipv4/arp.c | 2 +-
net/ipv4/fib_trie.c | 6 +++---
net/ipv4/igmp.c | 4 ++--
net/ipv4/ipmr.c | 4 ++--
net/ipv4/netfilter/ipt_CLUSTERIP.c | 2 +-
net/ipv4/ping.c | 2 +-
net/ipv4/proc.c | 6 +++---
net/ipv4/raw.c | 2 +-
net/ipv4/route.c | 6 +++---
net/ipv4/tcp_ipv4.c | 2 +-
net/ipv4/udp.c | 2 +-
net/ipv6/addrconf.c | 2 +-
net/ipv6/anycast.c | 2 +-
net/ipv6/ip6_flowlabel.c | 2 +-
net/ipv6/ip6mr.c | 4 ++--
net/ipv6/mcast.c | 4 ++--
net/ipv6/proc.c | 8 ++++----
net/ipv6/raw.c | 2 +-
net/ipv6/route.c | 4 ++--
net/key/af_key.c | 2 +-
net/l2tp/l2tp_ppp.c | 2 +-
net/netfilter/ipvs/ip_vs_app.c | 2 +-
net/netfilter/ipvs/ip_vs_conn.c | 4 ++--
net/netfilter/ipvs/ip_vs_ctl.c | 6 +++---
net/netfilter/nf_conntrack_expect.c | 2 +-
net/netfilter/nf_conntrack_standalone.c | 4 ++--
net/netfilter/nf_synproxy_core.c | 2 +-
net/netfilter/x_tables.c | 6 +++---
net/netfilter/xt_hashlimit.c | 6 +++---
net/netfilter/xt_recent.c | 4 ++--
net/netlink/af_netlink.c | 2 +-
net/packet/af_packet.c | 2 +-
net/phonet/pn_dev.c | 2 +-
net/sched/sch_api.c | 2 +-
net/sctp/objcnt.c | 2 +-
net/sctp/proc.c | 8 ++++----
net/sunrpc/cache.c | 8 ++++----
net/sunrpc/stats.c | 4 ++--
net/unix/af_unix.c | 2 +-
net/wireless/wext-proc.c | 2 +-
net/xfrm/xfrm_proc.c | 2 +-
49 files changed, 88 insertions(+), 87 deletions(-)
diff --git a/drivers/net/bonding/bond_procfs.c b/drivers/net/bonding/bond_procfs.c
index 0fb1da3..d7d5ae5a 100644
--- a/drivers/net/bonding/bond_procfs.c
+++ b/drivers/net/bonding/bond_procfs.c
@@ -267,7 +267,7 @@ void bond_create_proc_entry(struct bonding *bond)
struct bond_net *bn = net_generic(dev_net(bond_dev), bond_net_id);
if (bn->proc_dir) {
- bond->proc_entry = proc_create_seq_data(bond_dev->name, 0444,
+ bond->proc_entry = proc_net_create_seq_data(bond_dev->name, 0444,
bn->proc_dir, &bond_info_seq_ops, bond);
if (bond->proc_entry == NULL)
netdev_warn(bond_dev, "Cannot create /proc/net/%s/%s\n",
@@ -295,7 +295,8 @@ void bond_remove_proc_entry(struct bonding *bond)
void __net_init bond_create_proc_dir(struct bond_net *bn)
{
if (!bn->proc_dir) {
- bn->proc_dir = proc_mkdir(DRV_NAME, bn->net->proc_net);
+ bn->proc_dir = proc_net_mkdir(bn->net, DRV_NAME,
+ bn->net->proc_net);
if (!bn->proc_dir)
pr_warn("Warning: Cannot create /proc/net/%s\n",
DRV_NAME);
diff --git a/drivers/net/ppp/pppoe.c b/drivers/net/ppp/pppoe.c
index 7d20af8..4b18dc9 100644
--- a/drivers/net/ppp/pppoe.c
+++ b/drivers/net/ppp/pppoe.c
@@ -1177,7 +1177,7 @@ static __net_init int pppoe_init_net(struct net *net)
rwlock_init(&pn->hash_lock);
- pde = proc_create_net("pppoe", 0444, net->proc_net,
+ pde = proc_net_create_net("pppoe", 0444, net->proc_net,
&pppoe_seq_ops, sizeof(struct seq_net_private));
#ifdef CONFIG_PROC_FS
if (!pde)
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h
index e89d4bf..5150469 100644
--- a/include/linux/proc_fs.h
+++ b/include/linux/proc_fs.h
@@ -211,16 +211,16 @@ static inline struct proc_dir_entry *proc_net_mkdir(
static inline struct proc_dir_entry *proc_net_create_data(const char *name,
umode_t mode, struct proc_dir_entry *parent,
- const struct file_operations *fops, void *data)
+ const struct proc_ops *proc_ops, void *data)
{
- return proc_create_data(name, S_ISVTX | mode, parent, fops, data);
+ return proc_create_data(name, S_ISVTX | mode, parent, proc_ops, data);
}
static inline struct proc_dir_entry *proc_net_create(const char *name,
umode_t mode, struct proc_dir_entry *parent,
- const struct file_operations *fops)
+ const struct proc_ops *proc_ops)
{
- return proc_net_create_data(name, mode, parent, fops, NULL);
+ return proc_net_create_data(name, mode, parent, proc_ops, NULL);
}
static inline struct proc_dir_entry *proc_net_create_seq_private(
diff --git a/net/8021q/vlanproc.c b/net/8021q/vlanproc.c
index ec87dea..cafdde5 100644
--- a/net/8021q/vlanproc.c
+++ b/net/8021q/vlanproc.c
@@ -116,7 +116,7 @@ int __net_init vlan_proc_init(struct net *net)
if (!vn->proc_vlan_dir)
goto err;
- vn->proc_vlan_conf = proc_create_net(name_conf, S_IFREG | 0600,
+ vn->proc_vlan_conf = proc_net_create_net(name_conf, S_IFREG | 0600,
vn->proc_vlan_dir, &vlan_seq_ops,
sizeof(struct seq_net_private));
if (!vn->proc_vlan_conf)
@@ -140,7 +140,7 @@ int vlan_proc_add_dev(struct net_device *vlandev)
if (!strcmp(vlandev->name, name_conf))
return -EINVAL;
- vlan->dent = proc_create_single_data(vlandev->name, S_IFREG | 0600,
+ vlan->dent = proc_net_create_single_data(vlandev->name, S_IFREG | 0600,
vn->proc_vlan_dir, vlandev_seq_show, vlandev);
if (!vlan->dent)
return -ENOBUFS;
diff --git a/net/bluetooth/af_bluetooth.c b/net/bluetooth/af_bluetooth.c
index 1661979..0932cec 100644
--- a/net/bluetooth/af_bluetooth.c
+++ b/net/bluetooth/af_bluetooth.c
@@ -682,7 +682,7 @@ int bt_procfs_init(struct net *net, const char *name,
{
sk_list->custom_seq_show = seq_show;
- if (!proc_create_seq_data(name, 0, net->proc_net, &bt_seq_ops, sk_list))
+ if (!proc_net_create_seq_data(name, 0, net->proc_net, &bt_seq_ops, sk_list))
return -ENOMEM;
return 0;
}
diff --git a/net/core/net-procfs.c b/net/core/net-procfs.c
index d8b9dba..38b4fc3 100644
--- a/net/core/net-procfs.c
+++ b/net/core/net-procfs.c
@@ -284,13 +284,13 @@ static int __net_init dev_proc_net_init(struct net *net)
{
int rc = -ENOMEM;
- if (!proc_create_net("dev", 0444, net->proc_net, &dev_seq_ops,
+ if (!proc_net_create_net("dev", 0444, net->proc_net, &dev_seq_ops,
sizeof(struct seq_net_private)))
goto out;
- if (!proc_create_seq("softnet_stat", 0444, net->proc_net,
+ if (!proc_net_create_seq("softnet_stat", 0444, net->proc_net,
&softnet_seq_ops))
goto out_dev;
- if (!proc_create_net("ptype", 0444, net->proc_net, &ptype_seq_ops,
+ if (!proc_net_create_net("ptype", 0444, net->proc_net, &ptype_seq_ops,
sizeof(struct seq_net_private)))
goto out_softnet;
@@ -350,7 +350,7 @@ static int dev_mc_seq_show(struct seq_file *seq, void *v)
static int __net_init dev_mc_net_init(struct net *net)
{
- if (!proc_create_net("dev_mcast", 0, net->proc_net, &dev_mc_seq_ops,
+ if (!proc_net_create_net("dev_mcast", 0, net->proc_net, &dev_mc_seq_ops,
sizeof(struct seq_net_private)))
return -ENOMEM;
return 0;
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index 7e258d2..eabab0f 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -3776,7 +3776,7 @@ static int __net_init pg_net_init(struct net *net)
pn->net = net;
INIT_LIST_HEAD(&pn->pktgen_threads);
pn->pktgen_exiting = false;
- pn->proc_dir = proc_mkdir(PG_PROC_DIR, pn->net->proc_net);
+ pn->proc_dir = proc_net_mkdir(pn->net, PG_PROC_DIR, pn->net->proc_net);
if (!pn->proc_dir) {
pr_warn("cannot create /proc/net/%s\n", PG_PROC_DIR);
return -ENODEV;
diff --git a/net/core/sock.c b/net/core/sock.c
index a3eea6e..29c9076 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -3783,7 +3783,7 @@ static int proto_seq_show(struct seq_file *seq, void *v)
static __net_init int proto_init_net(struct net *net)
{
- if (!proc_create_net("protocols", 0444, net->proc_net, &proto_seq_ops,
+ if (!proc_net_create_net("protocols", 0444, net->proc_net, &proto_seq_ops,
sizeof(struct seq_net_private)))
return -ENOMEM;
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
index 922dd73..45f7f7d 100644
--- a/net/ipv4/arp.c
+++ b/net/ipv4/arp.c
@@ -1426,7 +1426,7 @@ static void *arp_seq_start(struct seq_file *seq, loff_t *pos)
static int __net_init arp_net_init(struct net *net)
{
- if (!proc_create_net("arp", 0444, net->proc_net, &arp_seq_ops,
+ if (!proc_net_create_net("arp", 0444, net->proc_net, &arp_seq_ops,
sizeof(struct neigh_seq_state)))
return -ENOMEM;
return 0;
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
index 25cf387..6611ed3 100644
--- a/net/ipv4/fib_trie.c
+++ b/net/ipv4/fib_trie.c
@@ -3014,15 +3014,15 @@ static int fib_route_seq_show(struct seq_file *seq, void *v)
int __net_init fib_proc_init(struct net *net)
{
- if (!proc_create_net("fib_trie", 0444, net->proc_net, &fib_trie_seq_ops,
+ if (!proc_net_create_net("fib_trie", 0444, net->proc_net, &fib_trie_seq_ops,
sizeof(struct fib_trie_iter)))
goto out1;
- if (!proc_create_net_single("fib_triestat", 0444, net->proc_net,
+ if (!proc_net_create_net_single("fib_triestat", 0444, net->proc_net,
fib_triestat_seq_show, NULL))
goto out2;
- if (!proc_create_net("route", 0444, net->proc_net, &fib_route_seq_ops,
+ if (!proc_net_create_net("route", 0444, net->proc_net, &fib_route_seq_ops,
sizeof(struct fib_route_iter)))
goto out3;
diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c
index 00576ba..2138da3 100644
--- a/net/ipv4/igmp.c
+++ b/net/ipv4/igmp.c
@@ -3003,11 +3003,11 @@ static int __net_init igmp_net_init(struct net *net)
struct proc_dir_entry *pde;
int err;
- pde = proc_create_net("igmp", 0444, net->proc_net, &igmp_mc_seq_ops,
+ pde = proc_net_create_net("igmp", 0444, net->proc_net, &igmp_mc_seq_ops,
sizeof(struct igmp_mc_iter_state));
if (!pde)
goto out_igmp;
- pde = proc_create_net("mcfilter", 0444, net->proc_net,
+ pde = proc_net_create_net("mcfilter", 0444, net->proc_net,
&igmp_mcf_seq_ops, sizeof(struct igmp_mcf_iter_state));
if (!pde)
goto out_mcfilter;
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
index 2dda856..2b3db4e 100644
--- a/net/ipv4/ipmr.c
+++ b/net/ipv4/ipmr.c
@@ -3066,10 +3066,10 @@ static int __net_init ipmr_net_init(struct net *net)
#ifdef CONFIG_PROC_FS
err = -ENOMEM;
- if (!proc_create_net("ip_mr_vif", 0, net->proc_net, &ipmr_vif_seq_ops,
+ if (!proc_net_create_net("ip_mr_vif", 0, net->proc_net, &ipmr_vif_seq_ops,
sizeof(struct mr_vif_iter)))
goto proc_vif_fail;
- if (!proc_create_net("ip_mr_cache", 0, net->proc_net, &ipmr_mfc_seq_ops,
+ if (!proc_net_create_net("ip_mr_cache", 0, net->proc_net, &ipmr_mfc_seq_ops,
sizeof(struct mr_mfc_iter)))
goto proc_cache_fail;
#endif
diff --git a/net/ipv4/netfilter/ipt_CLUSTERIP.c b/net/ipv4/netfilter/ipt_CLUSTERIP.c
index 8f7ca67..46d8c23 100644
--- a/net/ipv4/netfilter/ipt_CLUSTERIP.c
+++ b/net/ipv4/netfilter/ipt_CLUSTERIP.c
@@ -828,7 +828,7 @@ static int clusterip_net_init(struct net *net)
return ret;
#ifdef CONFIG_PROC_FS
- cn->procdir = proc_mkdir("ipt_CLUSTERIP", net->proc_net);
+ cn->procdir = proc_net_mkdir(net, "ipt_CLUSTERIP", net->proc_net);
if (!cn->procdir) {
nf_unregister_net_hook(net, &cip_arp_ops);
pr_err("Unable to proc dir entry\n");
diff --git a/net/ipv4/ping.c b/net/ipv4/ping.c
index 1e44a43..846ddcf 100644
--- a/net/ipv4/ping.c
+++ b/net/ipv4/ping.c
@@ -1140,7 +1140,7 @@ static int ping_v4_seq_show(struct seq_file *seq, void *v)
static int __net_init ping_v4_proc_init_net(struct net *net)
{
- if (!proc_create_net("icmp", 0444, net->proc_net, &ping_v4_seq_ops,
+ if (!proc_net_create_net("icmp", 0444, net->proc_net, &ping_v4_seq_ops,
sizeof(struct ping_iter_state)))
return -ENOMEM;
return 0;
diff --git a/net/ipv4/proc.c b/net/ipv4/proc.c
index b0d3a09..0774383 100644
--- a/net/ipv4/proc.c
+++ b/net/ipv4/proc.c
@@ -519,13 +519,13 @@ static int netstat_seq_show(struct seq_file *seq, void *v)
static __net_init int ip_proc_init_net(struct net *net)
{
- if (!proc_create_net_single("sockstat", 0444, net->proc_net,
+ if (!proc_net_create_net_single("sockstat", 0444, net->proc_net,
sockstat_seq_show, NULL))
goto out_sockstat;
- if (!proc_create_net_single("netstat", 0444, net->proc_net,
+ if (!proc_net_create_net_single("netstat", 0444, net->proc_net,
netstat_seq_show, NULL))
goto out_netstat;
- if (!proc_create_net_single("snmp", 0444, net->proc_net, snmp_seq_show,
+ if (!proc_net_create_net_single("snmp", 0444, net->proc_net, snmp_seq_show,
NULL))
goto out_snmp;
diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c
index bb446e6..60ed42e 100644
--- a/net/ipv4/raw.c
+++ b/net/ipv4/raw.c
@@ -1083,7 +1083,7 @@ static int raw_seq_show(struct seq_file *seq, void *v)
static __net_init int raw_init_net(struct net *net)
{
- if (!proc_create_net_data("raw", 0444, net->proc_net, &raw_seq_ops,
+ if (!proc_net_create_net_data("raw", 0444, net->proc_net, &raw_seq_ops,
sizeof(struct raw_iter_state), &raw_v4_hashinfo))
return -ENOMEM;
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index a6f20ee..56f8bf4 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -342,18 +342,18 @@ static int __net_init ip_rt_do_proc_init(struct net *net)
{
struct proc_dir_entry *pde;
- pde = proc_create_seq("rt_cache", 0444, net->proc_net,
+ pde = proc_net_create_seq("rt_cache", 0444, net->proc_net,
&rt_cache_seq_ops);
if (!pde)
goto err1;
- pde = proc_create_seq("rt_cache", 0444, net->proc_net_stat,
+ pde = proc_net_create_seq("rt_cache", 0444, net->proc_net_stat,
&rt_cpu_seq_ops);
if (!pde)
goto err2;
#ifdef CONFIG_IP_ROUTE_CLASSID
- pde = proc_create_single("rt_acct", 0, net->proc_net,
+ pde = proc_net_create_single("rt_acct", 0, net->proc_net,
rt_acct_proc_show);
if (!pde)
goto err3;
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index a692626..0bbd56d 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -2767,7 +2767,7 @@ static void bpf_iter_tcp_seq_stop(struct seq_file *seq, void *v)
static int __net_init tcp4_proc_init_net(struct net *net)
{
- if (!proc_create_net_data("tcp", 0444, net->proc_net, &tcp4_seq_ops,
+ if (!proc_net_create_net_data("tcp", 0444, net->proc_net, &tcp4_seq_ops,
sizeof(struct tcp_iter_state), &tcp4_seq_afinfo))
return -ENOMEM;
return 0;
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 1a742b7..4983a4c 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -3149,7 +3149,7 @@ static void bpf_iter_udp_seq_stop(struct seq_file *seq, void *v)
static int __net_init udp4_proc_init_net(struct net *net)
{
- if (!proc_create_net_data("udp", 0444, net->proc_net, &udp_seq_ops,
+ if (!proc_net_create_net_data("udp", 0444, net->proc_net, &udp_seq_ops,
sizeof(struct udp_iter_state), &udp4_seq_afinfo))
return -ENOMEM;
return 0;
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 3bf685f..db00087 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -4343,7 +4343,7 @@ static int if6_seq_show(struct seq_file *seq, void *v)
static int __net_init if6_proc_net_init(struct net *net)
{
- if (!proc_create_net("if_inet6", 0444, net->proc_net, &if6_seq_ops,
+ if (!proc_net_create_net("if_inet6", 0444, net->proc_net, &if6_seq_ops,
sizeof(struct if6_iter_state)))
return -ENOMEM;
return 0;
diff --git a/net/ipv6/anycast.c b/net/ipv6/anycast.c
index dacdea7..40a3846 100644
--- a/net/ipv6/anycast.c
+++ b/net/ipv6/anycast.c
@@ -584,7 +584,7 @@ static int ac6_seq_show(struct seq_file *seq, void *v)
int __net_init ac6_proc_init(struct net *net)
{
- if (!proc_create_net("anycast6", 0444, net->proc_net, &ac6_seq_ops,
+ if (!proc_net_create_net("anycast6", 0444, net->proc_net, &ac6_seq_ops,
sizeof(struct ac6_iter_state)))
return -ENOMEM;
diff --git a/net/ipv6/ip6_flowlabel.c b/net/ipv6/ip6_flowlabel.c
index aa673a6..8bb246f 100644
--- a/net/ipv6/ip6_flowlabel.c
+++ b/net/ipv6/ip6_flowlabel.c
@@ -863,7 +863,7 @@ static int ip6fl_seq_show(struct seq_file *seq, void *v)
static int __net_init ip6_flowlabel_proc_init(struct net *net)
{
- if (!proc_create_net("ip6_flowlabel", 0444, net->proc_net,
+ if (!proc_net_create_net("ip6_flowlabel", 0444, net->proc_net,
&ip6fl_seq_ops, sizeof(struct ip6fl_iter_state)))
return -ENOMEM;
return 0;
diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c
index 06b0d2c..520dbb4 100644
--- a/net/ipv6/ip6mr.c
+++ b/net/ipv6/ip6mr.c
@@ -1314,10 +1314,10 @@ static int __net_init ip6mr_net_init(struct net *net)
#ifdef CONFIG_PROC_FS
err = -ENOMEM;
- if (!proc_create_net("ip6_mr_vif", 0, net->proc_net, &ip6mr_vif_seq_ops,
+ if (!proc_net_create_net("ip6_mr_vif", 0, net->proc_net, &ip6mr_vif_seq_ops,
sizeof(struct mr_vif_iter)))
goto proc_vif_fail;
- if (!proc_create_net("ip6_mr_cache", 0, net->proc_net, &ipmr_mfc_seq_ops,
+ if (!proc_net_create_net("ip6_mr_cache", 0, net->proc_net, &ipmr_mfc_seq_ops,
sizeof(struct mr_mfc_iter)))
goto proc_cache_fail;
#endif
diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c
index 54ec163..1892eb8 100644
--- a/net/ipv6/mcast.c
+++ b/net/ipv6/mcast.c
@@ -3095,10 +3095,10 @@ static int __net_init igmp6_proc_init(struct net *net)
int err;
err = -ENOMEM;
- if (!proc_create_net("igmp6", 0444, net->proc_net, &igmp6_mc_seq_ops,
+ if (!proc_net_create_net("igmp6", 0444, net->proc_net, &igmp6_mc_seq_ops,
sizeof(struct igmp6_mc_iter_state)))
goto out;
- if (!proc_create_net("mcfilter6", 0444, net->proc_net,
+ if (!proc_net_create_net("mcfilter6", 0444, net->proc_net,
&igmp6_mcf_seq_ops,
sizeof(struct igmp6_mcf_iter_state)))
goto out_proc_net_igmp6;
diff --git a/net/ipv6/proc.c b/net/ipv6/proc.c
index d6306aa..51f71b3 100644
--- a/net/ipv6/proc.c
+++ b/net/ipv6/proc.c
@@ -253,7 +253,7 @@ int snmp6_register_dev(struct inet6_dev *idev)
if (!net->mib.proc_net_devsnmp6)
return -ENOENT;
- p = proc_create_single_data(idev->dev->name, 0444,
+ p = proc_net_create_single_data(idev->dev->name, 0444,
net->mib.proc_net_devsnmp6, snmp6_dev_seq_show, idev);
if (!p)
return -ENOMEM;
@@ -276,15 +276,15 @@ int snmp6_unregister_dev(struct inet6_dev *idev)
static int __net_init ipv6_proc_init_net(struct net *net)
{
- if (!proc_create_net_single("sockstat6", 0444, net->proc_net,
+ if (!proc_net_create_net_single("sockstat6", 0444, net->proc_net,
sockstat6_seq_show, NULL))
return -ENOMEM;
- if (!proc_create_net_single("snmp6", 0444, net->proc_net,
+ if (!proc_net_create_net_single("snmp6", 0444, net->proc_net,
snmp6_seq_show, NULL))
goto proc_snmp6_fail;
- net->mib.proc_net_devsnmp6 = proc_mkdir("dev_snmp6", net->proc_net);
+ net->mib.proc_net_devsnmp6 = proc_net_mkdir(net, "dev_snmp6", net->proc_net);
if (!net->mib.proc_net_devsnmp6)
goto proc_dev_snmp6_fail;
return 0;
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c
index 60f1e4f..bc020d6 100644
--- a/net/ipv6/raw.c
+++ b/net/ipv6/raw.c
@@ -1277,7 +1277,7 @@ static int raw6_seq_show(struct seq_file *seq, void *v)
static int __net_init raw6_init_net(struct net *net)
{
- if (!proc_create_net_data("raw6", 0444, net->proc_net, &raw6_seq_ops,
+ if (!proc_net_create_net_data("raw6", 0444, net->proc_net, &raw6_seq_ops,
sizeof(struct raw_iter_state), &raw_v6_hashinfo))
return -ENOMEM;
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index c5e8ecb..772de1c 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -6529,9 +6529,9 @@ static void __net_exit ip6_route_net_exit(struct net *net)
static int __net_init ip6_route_net_init_late(struct net *net)
{
#ifdef CONFIG_PROC_FS
- proc_create_net("ipv6_route", 0, net->proc_net, &ipv6_route_seq_ops,
+ proc_net_create_net("ipv6_route", 0, net->proc_net, &ipv6_route_seq_ops,
sizeof(struct ipv6_route_iter));
- proc_create_net_single("rt6_stats", 0444, net->proc_net,
+ proc_net_create_net_single("rt6_stats", 0444, net->proc_net,
rt6_stats_seq_show, NULL);
#endif
return 0;
diff --git a/net/key/af_key.c b/net/key/af_key.c
index de24a7d..bb9d8cd 100644
--- a/net/key/af_key.c
+++ b/net/key/af_key.c
@@ -3807,7 +3807,7 @@ static int __net_init pfkey_init_proc(struct net *net)
{
struct proc_dir_entry *e;
- e = proc_create_net("pfkey", 0, net->proc_net, &pfkey_seq_ops,
+ e = proc_net_create_net("pfkey", 0, net->proc_net, &pfkey_seq_ops,
sizeof(struct seq_net_private));
if (e == NULL)
return -ENOMEM;
diff --git a/net/l2tp/l2tp_ppp.c b/net/l2tp/l2tp_ppp.c
index 9494212..9121c91 100644
--- a/net/l2tp/l2tp_ppp.c
+++ b/net/l2tp/l2tp_ppp.c
@@ -1618,7 +1618,7 @@ static __net_init int pppol2tp_init_net(struct net *net)
struct proc_dir_entry *pde;
int err = 0;
- pde = proc_create_net("pppol2tp", 0444, net->proc_net,
+ pde = proc_net_create_net("pppol2tp", 0444, net->proc_net,
&pppol2tp_seq_ops, sizeof(struct pppol2tp_seq_data));
if (!pde) {
err = -ENOMEM;
diff --git a/net/netfilter/ipvs/ip_vs_app.c b/net/netfilter/ipvs/ip_vs_app.c
index f9b16f2..8644d2f 100644
--- a/net/netfilter/ipvs/ip_vs_app.c
+++ b/net/netfilter/ipvs/ip_vs_app.c
@@ -599,7 +599,7 @@ static int ip_vs_app_seq_show(struct seq_file *seq, void *v)
int __net_init ip_vs_app_net_init(struct netns_ipvs *ipvs)
{
INIT_LIST_HEAD(&ipvs->app_list);
- proc_create_net("ip_vs_app", 0, ipvs->net->proc_net, &ip_vs_app_seq_ops,
+ proc_net_create_net("ip_vs_app", 0, ipvs->net->proc_net, &ip_vs_app_seq_ops,
sizeof(struct seq_net_private));
return 0;
}
diff --git a/net/netfilter/ipvs/ip_vs_conn.c b/net/netfilter/ipvs/ip_vs_conn.c
index c100c6b..a159c75 100644
--- a/net/netfilter/ipvs/ip_vs_conn.c
+++ b/net/netfilter/ipvs/ip_vs_conn.c
@@ -1447,9 +1447,9 @@ int __net_init ip_vs_conn_net_init(struct netns_ipvs *ipvs)
{
atomic_set(&ipvs->conn_count, 0);
- proc_create_net("ip_vs_conn", 0, ipvs->net->proc_net,
+ proc_net_create_net("ip_vs_conn", 0, ipvs->net->proc_net,
&ip_vs_conn_seq_ops, sizeof(struct ip_vs_iter_state));
- proc_create_net("ip_vs_conn_sync", 0, ipvs->net->proc_net,
+ proc_net_create_net("ip_vs_conn_sync", 0, ipvs->net->proc_net,
&ip_vs_conn_sync_seq_ops,
sizeof(struct ip_vs_iter_state));
return 0;
diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c
index 14e26a7..21e6d70 100644
--- a/net/netfilter/ipvs/ip_vs_ctl.c
+++ b/net/netfilter/ipvs/ip_vs_ctl.c
@@ -4168,13 +4168,13 @@ int __net_init ip_vs_control_net_init(struct netns_ipvs *ipvs)
spin_lock_init(&ipvs->tot_stats.lock);
#ifdef CONFIG_PROC_FS
- if (!proc_create_net("ip_vs", 0, ipvs->net->proc_net,
+ if (!proc_net_create_net("ip_vs", 0, ipvs->net->proc_net,
&ip_vs_info_seq_ops, sizeof(struct ip_vs_iter)))
goto err_vs;
- if (!proc_create_net_single("ip_vs_stats", 0, ipvs->net->proc_net,
+ if (!proc_net_create_net_single("ip_vs_stats", 0, ipvs->net->proc_net,
ip_vs_stats_show, NULL))
goto err_stats;
- if (!proc_create_net_single("ip_vs_stats_percpu", 0,
+ if (!proc_net_create_net_single("ip_vs_stats_percpu", 0,
ipvs->net->proc_net,
ip_vs_stats_percpu_show, NULL))
goto err_percpu;
diff --git a/net/netfilter/nf_conntrack_expect.c b/net/netfilter/nf_conntrack_expect.c
index 1e851bc..13c071f 100644
--- a/net/netfilter/nf_conntrack_expect.c
+++ b/net/netfilter/nf_conntrack_expect.c
@@ -671,7 +671,7 @@ static int exp_proc_init(struct net *net)
kuid_t root_uid;
kgid_t root_gid;
- proc = proc_create_net("nf_conntrack_expect", 0440, net->proc_net,
+ proc = proc_net_create_net("nf_conntrack_expect", 0440, net->proc_net,
&exp_seq_ops, sizeof(struct ct_expect_iter_state));
if (!proc)
return -ENOMEM;
diff --git a/net/netfilter/nf_conntrack_standalone.c b/net/netfilter/nf_conntrack_standalone.c
index e84b499..615ecfa 100644
--- a/net/netfilter/nf_conntrack_standalone.c
+++ b/net/netfilter/nf_conntrack_standalone.c
@@ -472,7 +472,7 @@ static int nf_conntrack_standalone_init_proc(struct net *net)
kuid_t root_uid;
kgid_t root_gid;
- pde = proc_create_net("nf_conntrack", 0440, net->proc_net, &ct_seq_ops,
+ pde = proc_net_create_net("nf_conntrack", 0440, net->proc_net, &ct_seq_ops,
sizeof(struct ct_iter_state));
if (!pde)
goto out_nf_conntrack;
@@ -482,7 +482,7 @@ static int nf_conntrack_standalone_init_proc(struct net *net)
if (uid_valid(root_uid) && gid_valid(root_gid))
proc_set_user(pde, root_uid, root_gid);
- pde = proc_create_net("nf_conntrack", 0444, net->proc_net_stat,
+ pde = proc_net_create_net("nf_conntrack", 0444, net->proc_net_stat,
&ct_cpu_seq_ops, sizeof(struct seq_net_private));
if (!pde)
goto out_stat_nf_conntrack;
diff --git a/net/netfilter/nf_synproxy_core.c b/net/netfilter/nf_synproxy_core.c
index 3d6d494..5759f14 100644
--- a/net/netfilter/nf_synproxy_core.c
+++ b/net/netfilter/nf_synproxy_core.c
@@ -311,7 +311,7 @@ static int synproxy_cpu_seq_show(struct seq_file *seq, void *v)
static int __net_init synproxy_proc_init(struct net *net)
{
- if (!proc_create_net("synproxy", 0444, net->proc_net_stat,
+ if (!proc_net_create_net("synproxy", 0444, net->proc_net_stat,
&synproxy_cpu_seq_ops, sizeof(struct seq_net_private)))
return -ENOMEM;
return 0;
diff --git a/net/netfilter/x_tables.c b/net/netfilter/x_tables.c
index 84e58ee..c507a7f 100644
--- a/net/netfilter/x_tables.c
+++ b/net/netfilter/x_tables.c
@@ -1768,7 +1768,7 @@ int xt_proto_init(struct net *net, u_int8_t af)
strlcpy(buf, xt_prefix[af], sizeof(buf));
strlcat(buf, FORMAT_TABLES, sizeof(buf));
- proc = proc_create_net_data(buf, 0440, net->proc_net, &xt_table_seq_ops,
+ proc = proc_net_create_net_data(buf, 0440, net->proc_net, &xt_table_seq_ops,
sizeof(struct seq_net_private),
(void *)(unsigned long)af);
if (!proc)
@@ -1778,7 +1778,7 @@ int xt_proto_init(struct net *net, u_int8_t af)
strlcpy(buf, xt_prefix[af], sizeof(buf));
strlcat(buf, FORMAT_MATCHES, sizeof(buf));
- proc = proc_create_seq_private(buf, 0440, net->proc_net,
+ proc = proc_net_create_seq_private(buf, 0440, net->proc_net,
&xt_match_seq_ops, sizeof(struct nf_mttg_trav),
(void *)(unsigned long)af);
if (!proc)
@@ -1788,7 +1788,7 @@ int xt_proto_init(struct net *net, u_int8_t af)
strlcpy(buf, xt_prefix[af], sizeof(buf));
strlcat(buf, FORMAT_TARGETS, sizeof(buf));
- proc = proc_create_seq_private(buf, 0440, net->proc_net,
+ proc = proc_net_create_seq_private(buf, 0440, net->proc_net,
&xt_target_seq_ops, sizeof(struct nf_mttg_trav),
(void *)(unsigned long)af);
if (!proc)
diff --git a/net/netfilter/xt_hashlimit.c b/net/netfilter/xt_hashlimit.c
index 9c5cfd7..0138121 100644
--- a/net/netfilter/xt_hashlimit.c
+++ b/net/netfilter/xt_hashlimit.c
@@ -338,7 +338,7 @@ static int htable_create(struct net *net, struct hashlimit_cfg3 *cfg,
ops = &dl_seq_ops;
}
- hinfo->pde = proc_create_seq_data(name, 0,
+ hinfo->pde = proc_net_create_seq_data(name, 0,
(family == NFPROTO_IPV4) ?
hashlimit_net->ipt_hashlimit : hashlimit_net->ip6t_hashlimit,
ops, hinfo);
@@ -1234,11 +1234,11 @@ static int __net_init hashlimit_proc_net_init(struct net *net)
{
struct hashlimit_net *hashlimit_net = hashlimit_pernet(net);
- hashlimit_net->ipt_hashlimit = proc_mkdir("ipt_hashlimit", net->proc_net);
+ hashlimit_net->ipt_hashlimit = proc_net_mkdir(net, "ipt_hashlimit", net->proc_net);
if (!hashlimit_net->ipt_hashlimit)
return -ENOMEM;
#if IS_ENABLED(CONFIG_IP6_NF_IPTABLES)
- hashlimit_net->ip6t_hashlimit = proc_mkdir("ip6t_hashlimit", net->proc_net);
+ hashlimit_net->ip6t_hashlimit = proc_net_mkdir(net, "ip6t_hashlimit", net->proc_net);
if (!hashlimit_net->ip6t_hashlimit) {
remove_proc_entry("ipt_hashlimit", net->proc_net);
return -ENOMEM;
diff --git a/net/netfilter/xt_recent.c b/net/netfilter/xt_recent.c
index 0446307..c84efe7 100644
--- a/net/netfilter/xt_recent.c
+++ b/net/netfilter/xt_recent.c
@@ -412,7 +412,7 @@ static int recent_mt_check(const struct xt_mtchk_param *par,
ret = -EINVAL;
goto out;
}
- pde = proc_create_data(t->name, ip_list_perms, recent_net->xt_recent,
+ pde = proc_net_create_data(t->name, ip_list_perms, recent_net->xt_recent,
&recent_mt_proc_ops, t);
if (pde == NULL) {
recent_table_free(t);
@@ -636,7 +636,7 @@ static int __net_init recent_proc_net_init(struct net *net)
{
struct recent_net *recent_net = recent_pernet(net);
- recent_net->xt_recent = proc_mkdir("xt_recent", net->proc_net);
+ recent_net->xt_recent = proc_net_mkdir(net, "xt_recent", net->proc_net);
if (!recent_net->xt_recent)
return -ENOMEM;
return 0;
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index e8cece8..528f4359 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -2801,7 +2801,7 @@ int netlink_unregister_notifier(struct notifier_block *nb)
static int __net_init netlink_net_init(struct net *net)
{
#ifdef CONFIG_PROC_FS
- if (!proc_create_net("netlink", 0, net->proc_net, &netlink_seq_ops,
+ if (!proc_net_create_net("netlink", 0, net->proc_net, &netlink_seq_ops,
sizeof(struct nl_seq_iter)))
return -ENOMEM;
#endif
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index 57a1971..99bb7b3 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -4644,7 +4644,7 @@ static int __net_init packet_net_init(struct net *net)
INIT_HLIST_HEAD(&net->packet.sklist);
#ifdef CONFIG_PROC_FS
- if (!proc_create_net("packet", 0, net->proc_net, &packet_seq_ops,
+ if (!proc_net_create_net("packet", 0, net->proc_net, &packet_seq_ops,
sizeof(struct seq_net_private)))
return -ENOMEM;
#endif /* CONFIG_PROC_FS */
diff --git a/net/phonet/pn_dev.c b/net/phonet/pn_dev.c
index ac0fae0..15ad278 100644
--- a/net/phonet/pn_dev.c
+++ b/net/phonet/pn_dev.c
@@ -305,7 +305,7 @@ static int __net_init phonet_init_net(struct net *net)
{
struct phonet_net *pnn = phonet_pernet(net);
- if (!proc_create_net("phonet", 0, net->proc_net, &pn_sock_seq_ops,
+ if (!proc_net_create_net("phonet", 0, net->proc_net, &pn_sock_seq_ops,
sizeof(struct seq_net_private)))
return -ENOMEM;
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c
index f87d077..b39bcee 100644
--- a/net/sched/sch_api.c
+++ b/net/sched/sch_api.c
@@ -2245,7 +2245,7 @@ static int __net_init psched_net_init(struct net *net)
{
struct proc_dir_entry *e;
- e = proc_create_single("psched", 0, net->proc_net, psched_show);
+ e = proc_net_create_single("psched", 0, net->proc_net, psched_show);
if (e == NULL)
return -ENOMEM;
diff --git a/net/sctp/objcnt.c b/net/sctp/objcnt.c
index 0400c96..3c60e0b 100644
--- a/net/sctp/objcnt.c
+++ b/net/sctp/objcnt.c
@@ -98,7 +98,7 @@ void sctp_dbg_objcnt_init(struct net *net)
{
struct proc_dir_entry *ent;
- ent = proc_create_seq("sctp_dbg_objcnt", 0,
+ ent = proc_net_create_seq("sctp_dbg_objcnt", 0,
net->sctp.proc_net_sctp, &sctp_objcnt_seq_ops);
if (!ent)
pr_warn("sctp_dbg_objcnt: Unable to create /proc entry.\n");
diff --git a/net/sctp/proc.c b/net/sctp/proc.c
index 982a87b..2e5ff30 100644
--- a/net/sctp/proc.c
+++ b/net/sctp/proc.c
@@ -380,16 +380,16 @@ int __net_init sctp_proc_init(struct net *net)
net->sctp.proc_net_sctp = proc_net_mkdir(net, "sctp", net->proc_net);
if (!net->sctp.proc_net_sctp)
return -ENOMEM;
- if (!proc_create_net_single("snmp", 0444, net->sctp.proc_net_sctp,
+ if (!proc_net_create_net_single("snmp", 0444, net->sctp.proc_net_sctp,
sctp_snmp_seq_show, NULL))
goto cleanup;
- if (!proc_create_net("eps", 0444, net->sctp.proc_net_sctp,
+ if (!proc_net_create_net("eps", 0444, net->sctp.proc_net_sctp,
&sctp_eps_ops, sizeof(struct seq_net_private)))
goto cleanup;
- if (!proc_create_net("assocs", 0444, net->sctp.proc_net_sctp,
+ if (!proc_net_create_net("assocs", 0444, net->sctp.proc_net_sctp,
&sctp_assoc_ops, sizeof(struct sctp_ht_iter)))
goto cleanup;
- if (!proc_create_net("remaddr", 0444, net->sctp.proc_net_sctp,
+ if (!proc_net_create_net("remaddr", 0444, net->sctp.proc_net_sctp,
&sctp_remaddr_ops, sizeof(struct sctp_ht_iter)))
goto cleanup;
return 0;
diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c
index 1a2c1c4..b4d0ec6 100644
--- a/net/sunrpc/cache.c
+++ b/net/sunrpc/cache.c
@@ -1664,23 +1664,23 @@ static int create_cache_proc_entries(struct cache_detail *cd, struct net *net)
struct sunrpc_net *sn;
sn = net_generic(net, sunrpc_net_id);
- cd->procfs = proc_mkdir(cd->name, sn->proc_net_rpc);
+ cd->procfs = proc_net_mkdir(net, cd->name, sn->proc_net_rpc);
if (cd->procfs == NULL)
goto out_nomem;
- p = proc_create_data("flush", S_IFREG | 0600,
+ p = proc_net_create_data("flush", S_IFREG | 0600,
cd->procfs, &cache_flush_proc_ops, cd);
if (p == NULL)
goto out_nomem;
if (cd->cache_request || cd->cache_parse) {
- p = proc_create_data("channel", S_IFREG | 0600, cd->procfs,
+ p = proc_net_create_data("channel", S_IFREG | 0600, cd->procfs,
&cache_channel_proc_ops, cd);
if (p == NULL)
goto out_nomem;
}
if (cd->cache_show) {
- p = proc_create_data("content", S_IFREG | 0400, cd->procfs,
+ p = proc_net_create_data("content", S_IFREG | 0400, cd->procfs,
&content_proc_ops, cd);
if (p == NULL)
goto out_nomem;
diff --git a/net/sunrpc/stats.c b/net/sunrpc/stats.c
index c964b48..77434b2 100644
--- a/net/sunrpc/stats.c
+++ b/net/sunrpc/stats.c
@@ -286,7 +286,7 @@ void rpc_clnt_show_stats(struct seq_file *seq, struct rpc_clnt *clnt)
dprintk("RPC: registering /proc/net/rpc/%s\n", name);
sn = net_generic(net, sunrpc_net_id);
- return proc_create_data(name, 0, sn->proc_net_rpc, proc_ops, data);
+ return proc_net_create_data(name, 0, sn->proc_net_rpc, proc_ops, data);
}
struct proc_dir_entry *
@@ -329,7 +329,7 @@ int rpc_proc_init(struct net *net)
dprintk("RPC: registering /proc/net/rpc\n");
sn = net_generic(net, sunrpc_net_id);
- sn->proc_net_rpc = proc_mkdir("rpc", net->proc_net);
+ sn->proc_net_rpc = proc_net_mkdir(net, "rpc", net->proc_net);
if (sn->proc_net_rpc == NULL)
return -ENOMEM;
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index ba7ced9..db07531 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -2936,7 +2936,7 @@ static int __net_init unix_net_init(struct net *net)
goto out;
#ifdef CONFIG_PROC_FS
- if (!proc_create_net("unix", 0, net->proc_net, &unix_seq_ops,
+ if (!proc_net_create_net("unix", 0, net->proc_net, &unix_seq_ops,
sizeof(struct seq_net_private))) {
unix_sysctl_unregister(net);
goto out;
diff --git a/net/wireless/wext-proc.c b/net/wireless/wext-proc.c
index cadcf86..81e35aa 100644
--- a/net/wireless/wext-proc.c
+++ b/net/wireless/wext-proc.c
@@ -129,7 +129,7 @@ static void wireless_dev_seq_stop(struct seq_file *seq, void *v)
int __net_init wext_proc_init(struct net *net)
{
/* Create /proc/net/wireless entry */
- if (!proc_create_net("wireless", 0444, net->proc_net,
+ if (!proc_net_create_net("wireless", 0444, net->proc_net,
&wireless_seq_ops, sizeof(struct seq_net_private)))
return -ENOMEM;
diff --git a/net/xfrm/xfrm_proc.c b/net/xfrm/xfrm_proc.c
index fee9b5c..b8fa6523 100644
--- a/net/xfrm/xfrm_proc.c
+++ b/net/xfrm/xfrm_proc.c
@@ -63,7 +63,7 @@ static int xfrm_statistics_seq_show(struct seq_file *seq, void *v)
int __net_init xfrm_proc_init(struct net *net)
{
- if (!proc_create_net_single("xfrm_stat", 0444, net->proc_net,
+ if (!proc_net_create_net_single("xfrm_stat", 0444, net->proc_net,
xfrm_statistics_seq_show, NULL))
return -ENOMEM;
return 0;
--
1.8.3.1
More information about the Devel
mailing list