Skip to content

Commit

Permalink
net: proc: change proc_net_fops_create to proc_create
Browse files Browse the repository at this point in the history
Right now, some modules such as bonding use proc_create
to create proc entries under /proc/net/, and other modules
such as ipv4 use proc_net_fops_create.

It looks a little chaos.this patch changes all of
proc_net_fops_create to proc_create. we can remove
proc_net_fops_create after this patch.

Signed-off-by: Gao feng <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Gao feng authored and davem330 committed Feb 18, 2013
1 parent 510a1e7 commit d4beaa6
Show file tree
Hide file tree
Showing 52 changed files with 100 additions and 86 deletions.
2 changes: 1 addition & 1 deletion drivers/connector/connector.c
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ static int cn_init(void)

cn_already_initialized = 1;

proc_net_fops_create(&init_net, "connector", S_IRUGO, &cn_file_ops);
proc_create("connector", S_IRUGO, init_net.proc_net, &cn_file_ops);

return 0;
}
Expand Down
3 changes: 2 additions & 1 deletion drivers/net/hamradio/bpqether.c
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,8 @@ static int bpq_device_event(struct notifier_block *this,unsigned long event, voi
static int __init bpq_init_driver(void)
{
#ifdef CONFIG_PROC_FS
if (!proc_net_fops_create(&init_net, "bpqether", S_IRUGO, &bpq_info_fops)) {
if (!proc_create("bpqether", S_IRUGO, init_net.proc_net,
&bpq_info_fops)) {
printk(KERN_ERR
"bpq: cannot create /proc/net/bpqether entry.\n");
return -ENOENT;
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/hamradio/scc.c
Original file line number Diff line number Diff line change
Expand Up @@ -2118,7 +2118,7 @@ static int __init scc_init_driver (void)
}
rtnl_unlock();

proc_net_fops_create(&init_net, "z8530drv", 0, &scc_net_seq_fops);
proc_create("z8530drv", 0, init_net.proc_net, &scc_net_seq_fops);

return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/hamradio/yam.c
Original file line number Diff line number Diff line change
Expand Up @@ -1167,7 +1167,7 @@ static int __init yam_init_driver(void)
yam_timer.expires = jiffies + HZ / 100;
add_timer(&yam_timer);

proc_net_fops_create(&init_net, "yam", S_IRUGO, &yam_info_fops);
proc_create("yam", S_IRUGO, init_net.proc_net, &yam_info_fops);
return 0;
error:
while (--i >= 0) {
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/ppp/pppoe.c
Original file line number Diff line number Diff line change
Expand Up @@ -1134,7 +1134,7 @@ static __net_init int pppoe_init_net(struct net *net)

rwlock_init(&pn->hash_lock);

pde = proc_net_fops_create(net, "pppoe", S_IRUGO, &pppoe_seq_fops);
pde = proc_create("pppoe", S_IRUGO, net->proc_net, &pppoe_seq_fops);
#ifdef CONFIG_PROC_FS
if (!pde)
return -ENOMEM;
Expand Down
7 changes: 4 additions & 3 deletions net/ax25/af_ax25.c
Original file line number Diff line number Diff line change
Expand Up @@ -1992,9 +1992,10 @@ static int __init ax25_init(void)
dev_add_pack(&ax25_packet_type);
register_netdevice_notifier(&ax25_dev_notifier);

proc_net_fops_create(&init_net, "ax25_route", S_IRUGO, &ax25_route_fops);
proc_net_fops_create(&init_net, "ax25", S_IRUGO, &ax25_info_fops);
proc_net_fops_create(&init_net, "ax25_calls", S_IRUGO, &ax25_uid_fops);
proc_create("ax25_route", S_IRUGO, init_net.proc_net,
&ax25_route_fops);
proc_create("ax25", S_IRUGO, init_net.proc_net, &ax25_info_fops);
proc_create("ax25_calls", S_IRUGO, init_net.proc_net, &ax25_uid_fops);
out:
return rc;
}
Expand Down
2 changes: 1 addition & 1 deletion net/bluetooth/af_bluetooth.c
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,7 @@ int bt_procfs_init(struct module* module, struct net *net, const char *name,
sk_list->fops.llseek = seq_lseek;
sk_list->fops.release = seq_release_private;

pde = proc_net_fops_create(net, name, 0, &sk_list->fops);
pde = proc_create(name, 0, net->proc_net, &sk_list->fops);
if (!pde)
return -ENOMEM;

Expand Down
7 changes: 4 additions & 3 deletions net/core/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -4518,11 +4518,12 @@ static int __net_init dev_proc_net_init(struct net *net)
{
int rc = -ENOMEM;

if (!proc_net_fops_create(net, "dev", S_IRUGO, &dev_seq_fops))
if (!proc_create("dev", S_IRUGO, net->proc_net, &dev_seq_fops))
goto out;
if (!proc_net_fops_create(net, "softnet_stat", S_IRUGO, &softnet_seq_fops))
if (!proc_create("softnet_stat", S_IRUGO, net->proc_net,
&softnet_seq_fops))
goto out_dev;
if (!proc_net_fops_create(net, "ptype", S_IRUGO, &ptype_seq_fops))
if (!proc_create("ptype", S_IRUGO, net->proc_net, &ptype_seq_fops))
goto out_softnet;

if (wext_proc_init(net))
Expand Down
2 changes: 1 addition & 1 deletion net/core/dev_addr_lists.c
Original file line number Diff line number Diff line change
Expand Up @@ -780,7 +780,7 @@ static const struct file_operations dev_mc_seq_fops = {

static int __net_init dev_mc_net_init(struct net *net)
{
if (!proc_net_fops_create(net, "dev_mcast", 0, &dev_mc_seq_fops))
if (!proc_create("dev_mcast", 0, net->proc_net, &dev_mc_seq_fops))
return -ENOMEM;
return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion net/core/sock.c
Original file line number Diff line number Diff line change
Expand Up @@ -2836,7 +2836,7 @@ static const struct file_operations proto_seq_fops = {

static __net_init int proto_init_net(struct net *net)
{
if (!proc_net_fops_create(net, "protocols", S_IRUGO, &proto_seq_fops))
if (!proc_create("protocols", S_IRUGO, net->proc_net, &proto_seq_fops))
return -ENOMEM;

return 0;
Expand Down
2 changes: 1 addition & 1 deletion net/dccp/probe.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ static __init int dccpprobe_init(void)
spin_lock_init(&dccpw.lock);
if (kfifo_alloc(&dccpw.fifo, bufsize, GFP_KERNEL))
return ret;
if (!proc_net_fops_create(&init_net, procname, S_IRUSR, &dccpprobe_fops))
if (!proc_create(procname, S_IRUSR, init_net.proc_net, &dccpprobe_fops))
goto err0;

ret = setup_jprobe();
Expand Down
2 changes: 1 addition & 1 deletion net/decnet/af_decnet.c
Original file line number Diff line number Diff line change
Expand Up @@ -2384,7 +2384,7 @@ static int __init decnet_init(void)
dev_add_pack(&dn_dix_packet_type);
register_netdevice_notifier(&dn_dev_notifier);

proc_net_fops_create(&init_net, "decnet", S_IRUGO, &dn_socket_seq_fops);
proc_create("decnet", S_IRUGO, init_net.proc_net, &dn_socket_seq_fops);
dn_register_sysctl();
out:
return rc;
Expand Down
2 changes: 1 addition & 1 deletion net/decnet/dn_dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -1412,7 +1412,7 @@ void __init dn_dev_init(void)
rtnl_register(PF_DECnet, RTM_DELADDR, dn_nl_deladdr, NULL, NULL);
rtnl_register(PF_DECnet, RTM_GETADDR, NULL, dn_nl_dump_ifaddr, NULL);

proc_net_fops_create(&init_net, "decnet_dev", S_IRUGO, &dn_dev_seq_fops);
proc_create("decnet_dev", S_IRUGO, init_net.proc_net, &dn_dev_seq_fops);

#ifdef CONFIG_SYSCTL
{
Expand Down
3 changes: 2 additions & 1 deletion net/decnet/dn_neigh.c
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,8 @@ static const struct file_operations dn_neigh_seq_fops = {
void __init dn_neigh_init(void)
{
neigh_table_init(&dn_neigh_table);
proc_net_fops_create(&init_net, "decnet_neigh", S_IRUGO, &dn_neigh_seq_fops);
proc_create("decnet_neigh", S_IRUGO, init_net.proc_net,
&dn_neigh_seq_fops);
}

void __exit dn_neigh_cleanup(void)
Expand Down
3 changes: 2 additions & 1 deletion net/decnet/dn_route.c
Original file line number Diff line number Diff line change
Expand Up @@ -1901,7 +1901,8 @@ void __init dn_route_init(void)

dn_dst_ops.gc_thresh = (dn_rt_hash_mask + 1);

proc_net_fops_create(&init_net, "decnet_cache", S_IRUGO, &dn_rt_cache_seq_fops);
proc_create("decnet_cache", S_IRUGO, init_net.proc_net,
&dn_rt_cache_seq_fops);

#ifdef CONFIG_DECNET_ROUTER
rtnl_register(PF_DECnet, RTM_GETROUTE, dn_cache_getroute,
Expand Down
2 changes: 1 addition & 1 deletion net/ipv4/arp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1405,7 +1405,7 @@ static const struct file_operations arp_seq_fops = {

static int __net_init arp_net_init(struct net *net)
{
if (!proc_net_fops_create(net, "arp", S_IRUGO, &arp_seq_fops))
if (!proc_create("arp", S_IRUGO, net->proc_net, &arp_seq_fops))
return -ENOMEM;
return 0;
}
Expand Down
8 changes: 4 additions & 4 deletions net/ipv4/fib_trie.c
Original file line number Diff line number Diff line change
Expand Up @@ -2607,14 +2607,14 @@ static const struct file_operations fib_route_fops = {

int __net_init fib_proc_init(struct net *net)
{
if (!proc_net_fops_create(net, "fib_trie", S_IRUGO, &fib_trie_fops))
if (!proc_create("fib_trie", S_IRUGO, net->proc_net, &fib_trie_fops))
goto out1;

if (!proc_net_fops_create(net, "fib_triestat", S_IRUGO,
&fib_triestat_fops))
if (!proc_create("fib_triestat", S_IRUGO, net->proc_net,
&fib_triestat_fops))
goto out2;

if (!proc_net_fops_create(net, "route", S_IRUGO, &fib_route_fops))
if (!proc_create("route", S_IRUGO, net->proc_net, &fib_route_fops))
goto out3;

return 0;
Expand Down
5 changes: 3 additions & 2 deletions net/ipv4/igmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -2646,10 +2646,11 @@ static int __net_init igmp_net_init(struct net *net)
{
struct proc_dir_entry *pde;

pde = proc_net_fops_create(net, "igmp", S_IRUGO, &igmp_mc_seq_fops);
pde = proc_create("igmp", S_IRUGO, net->proc_net, &igmp_mc_seq_fops);
if (!pde)
goto out_igmp;
pde = proc_net_fops_create(net, "mcfilter", S_IRUGO, &igmp_mcf_seq_fops);
pde = proc_create("mcfilter", S_IRUGO, net->proc_net,
&igmp_mcf_seq_fops);
if (!pde)
goto out_mcfilter;
return 0;
Expand Down
2 changes: 1 addition & 1 deletion net/ipv4/ipconfig.c
Original file line number Diff line number Diff line change
Expand Up @@ -1394,7 +1394,7 @@ static int __init ip_auto_config(void)
unsigned int i;

#ifdef CONFIG_PROC_FS
proc_net_fops_create(&init_net, "pnp", S_IRUGO, &pnp_seq_fops);
proc_create("pnp", S_IRUGO, init_net.proc_net, &pnp_seq_fops);
#endif /* CONFIG_PROC_FS */

if (!ic_enable)
Expand Down
4 changes: 2 additions & 2 deletions net/ipv4/ipmr.c
Original file line number Diff line number Diff line change
Expand Up @@ -2703,9 +2703,9 @@ static int __net_init ipmr_net_init(struct net *net)

#ifdef CONFIG_PROC_FS
err = -ENOMEM;
if (!proc_net_fops_create(net, "ip_mr_vif", 0, &ipmr_vif_fops))
if (!proc_create("ip_mr_vif", 0, net->proc_net, &ipmr_vif_fops))
goto proc_vif_fail;
if (!proc_net_fops_create(net, "ip_mr_cache", 0, &ipmr_mfc_fops))
if (!proc_create("ip_mr_cache", 0, net->proc_net, &ipmr_mfc_fops))
goto proc_cache_fail;
#endif
return 0;
Expand Down
6 changes: 3 additions & 3 deletions net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -417,12 +417,12 @@ static int __net_init ip_conntrack_net_init(struct net *net)
{
struct proc_dir_entry *proc, *proc_exp, *proc_stat;

proc = proc_net_fops_create(net, "ip_conntrack", 0440, &ct_file_ops);
proc = proc_create("ip_conntrack", 0440, net->proc_net, &ct_file_ops);
if (!proc)
goto err1;

proc_exp = proc_net_fops_create(net, "ip_conntrack_expect", 0440,
&ip_exp_file_ops);
proc_exp = proc_create("ip_conntrack_expect", 0440, net->proc_net,
&ip_exp_file_ops);
if (!proc_exp)
goto err2;

Expand Down
2 changes: 1 addition & 1 deletion net/ipv4/ping.c
Original file line number Diff line number Diff line change
Expand Up @@ -889,7 +889,7 @@ static int ping_proc_register(struct net *net)
struct proc_dir_entry *p;
int rc = 0;

p = proc_net_fops_create(net, "icmp", S_IRUGO, &ping_seq_fops);
p = proc_create("icmp", S_IRUGO, net->proc_net, &ping_seq_fops);
if (!p)
rc = -ENOMEM;
return rc;
Expand Down
7 changes: 4 additions & 3 deletions net/ipv4/proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -471,11 +471,12 @@ static const struct file_operations netstat_seq_fops = {

static __net_init int ip_proc_init_net(struct net *net)
{
if (!proc_net_fops_create(net, "sockstat", S_IRUGO, &sockstat_seq_fops))
if (!proc_create("sockstat", S_IRUGO, net->proc_net,
&sockstat_seq_fops))
goto out_sockstat;
if (!proc_net_fops_create(net, "netstat", S_IRUGO, &netstat_seq_fops))
if (!proc_create("netstat", S_IRUGO, net->proc_net, &netstat_seq_fops))
goto out_netstat;
if (!proc_net_fops_create(net, "snmp", S_IRUGO, &snmp_seq_fops))
if (!proc_create("snmp", S_IRUGO, net->proc_net, &snmp_seq_fops))
goto out_snmp;

return 0;
Expand Down
2 changes: 1 addition & 1 deletion net/ipv4/raw.c
Original file line number Diff line number Diff line change
Expand Up @@ -1050,7 +1050,7 @@ static const struct file_operations raw_seq_fops = {

static __net_init int raw_init_net(struct net *net)
{
if (!proc_net_fops_create(net, "raw", S_IRUGO, &raw_seq_fops))
if (!proc_create("raw", S_IRUGO, net->proc_net, &raw_seq_fops))
return -ENOMEM;

return 0;
Expand Down
4 changes: 2 additions & 2 deletions net/ipv4/route.c
Original file line number Diff line number Diff line change
Expand Up @@ -384,8 +384,8 @@ static int __net_init ip_rt_do_proc_init(struct net *net)
{
struct proc_dir_entry *pde;

pde = proc_net_fops_create(net, "rt_cache", S_IRUGO,
&rt_cache_seq_fops);
pde = proc_create("rt_cache", S_IRUGO, net->proc_net,
&rt_cache_seq_fops);
if (!pde)
goto err1;

Expand Down
2 changes: 1 addition & 1 deletion net/ipv4/tcp_probe.c
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ static __init int tcpprobe_init(void)
if (!tcp_probe.log)
goto err0;

if (!proc_net_fops_create(&init_net, procname, S_IRUSR, &tcpprobe_fops))
if (!proc_create(procname, S_IRUSR, init_net.proc_net, &tcpprobe_fops))
goto err0;

ret = register_jprobe(&tcp_jprobe);
Expand Down
2 changes: 1 addition & 1 deletion net/ipv6/addrconf.c
Original file line number Diff line number Diff line change
Expand Up @@ -3325,7 +3325,7 @@ static const struct file_operations if6_fops = {

static int __net_init if6_proc_net_init(struct net *net)
{
if (!proc_net_fops_create(net, "if_inet6", S_IRUGO, &if6_fops))
if (!proc_create("if_inet6", S_IRUGO, net->proc_net, &if6_fops))
return -ENOMEM;
return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion net/ipv6/anycast.c
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ static const struct file_operations ac6_seq_fops = {

int __net_init ac6_proc_init(struct net *net)
{
if (!proc_net_fops_create(net, "anycast6", S_IRUGO, &ac6_seq_fops))
if (!proc_create("anycast6", S_IRUGO, net->proc_net, &ac6_seq_fops))
return -ENOMEM;

return 0;
Expand Down
4 changes: 2 additions & 2 deletions net/ipv6/ip6_flowlabel.c
Original file line number Diff line number Diff line change
Expand Up @@ -806,8 +806,8 @@ static const struct file_operations ip6fl_seq_fops = {

static int __net_init ip6_flowlabel_proc_init(struct net *net)
{
if (!proc_net_fops_create(net, "ip6_flowlabel",
S_IRUGO, &ip6fl_seq_fops))
if (!proc_create("ip6_flowlabel", S_IRUGO, net->proc_net,
&ip6fl_seq_fops))
return -ENOMEM;
return 0;
}
Expand Down
4 changes: 2 additions & 2 deletions net/ipv6/ip6mr.c
Original file line number Diff line number Diff line change
Expand Up @@ -1359,9 +1359,9 @@ static int __net_init ip6mr_net_init(struct net *net)

#ifdef CONFIG_PROC_FS
err = -ENOMEM;
if (!proc_net_fops_create(net, "ip6_mr_vif", 0, &ip6mr_vif_fops))
if (!proc_create("ip6_mr_vif", 0, net->proc_net, &ip6mr_vif_fops))
goto proc_vif_fail;
if (!proc_net_fops_create(net, "ip6_mr_cache", 0, &ip6mr_mfc_fops))
if (!proc_create("ip6_mr_cache", 0, net->proc_net, &ip6mr_mfc_fops))
goto proc_cache_fail;
#endif

Expand Down
6 changes: 3 additions & 3 deletions net/ipv6/mcast.c
Original file line number Diff line number Diff line change
Expand Up @@ -2599,10 +2599,10 @@ static int __net_init igmp6_proc_init(struct net *net)
int err;

err = -ENOMEM;
if (!proc_net_fops_create(net, "igmp6", S_IRUGO, &igmp6_mc_seq_fops))
if (!proc_create("igmp6", S_IRUGO, net->proc_net, &igmp6_mc_seq_fops))
goto out;
if (!proc_net_fops_create(net, "mcfilter6", S_IRUGO,
&igmp6_mcf_seq_fops))
if (!proc_create("mcfilter6", S_IRUGO, net->proc_net,
&igmp6_mcf_seq_fops))
goto out_proc_net_igmp6;

err = 0;
Expand Down
6 changes: 3 additions & 3 deletions net/ipv6/proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -295,11 +295,11 @@ int snmp6_unregister_dev(struct inet6_dev *idev)

static int __net_init ipv6_proc_init_net(struct net *net)
{
if (!proc_net_fops_create(net, "sockstat6", S_IRUGO,
&sockstat6_seq_fops))
if (!proc_create("sockstat6", S_IRUGO, net->proc_net,
&sockstat6_seq_fops))
return -ENOMEM;

if (!proc_net_fops_create(net, "snmp6", S_IRUGO, &snmp6_seq_fops))
if (!proc_create("snmp6", S_IRUGO, net->proc_net, &snmp6_seq_fops))
goto proc_snmp6_fail;

net->mib.proc_net_devsnmp6 = proc_mkdir("dev_snmp6", net->proc_net);
Expand Down
2 changes: 1 addition & 1 deletion net/ipv6/raw.c
Original file line number Diff line number Diff line change
Expand Up @@ -1292,7 +1292,7 @@ static const struct file_operations raw6_seq_fops = {

static int __net_init raw6_init_net(struct net *net)
{
if (!proc_net_fops_create(net, "raw6", S_IRUGO, &raw6_seq_fops))
if (!proc_create("raw6", S_IRUGO, net->proc_net, &raw6_seq_fops))
return -ENOMEM;

return 0;
Expand Down
4 changes: 2 additions & 2 deletions net/ipv6/route.c
Original file line number Diff line number Diff line change
Expand Up @@ -2995,8 +2995,8 @@ 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_net_fops_create(net, "ipv6_route", 0, &ipv6_route_proc_fops);
proc_net_fops_create(net, "rt6_stats", S_IRUGO, &rt6_stats_seq_fops);
proc_create("ipv6_route", 0, net->proc_net, &ipv6_route_proc_fops);
proc_create("rt6_stats", S_IRUGO, net->proc_net, &rt6_stats_seq_fops);
#endif
return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion net/key/af_key.c
Original file line number Diff line number Diff line change
Expand Up @@ -3740,7 +3740,7 @@ static int __net_init pfkey_init_proc(struct net *net)
{
struct proc_dir_entry *e;

e = proc_net_fops_create(net, "pfkey", 0, &pfkey_proc_ops);
e = proc_create("pfkey", 0, net->proc_net, &pfkey_proc_ops);
if (e == NULL)
return -ENOMEM;

Expand Down
3 changes: 2 additions & 1 deletion net/l2tp/l2tp_ppp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1783,7 +1783,8 @@ static __net_init int pppol2tp_init_net(struct net *net)
struct proc_dir_entry *pde;
int err = 0;

pde = proc_net_fops_create(net, "pppol2tp", S_IRUGO, &pppol2tp_proc_fops);
pde = proc_create("pppol2tp", S_IRUGO, net->proc_net,
&pppol2tp_proc_fops);
if (!pde) {
err = -ENOMEM;
goto out;
Expand Down
Loading

0 comments on commit d4beaa6

Please sign in to comment.