From 595e6076dfc08c60d6165d109af8eb9553cb3a0d Mon Sep 17 00:00:00 2001 From: Pavel Emelyanov Date: Mon, 14 Jan 2008 05:36:50 -0800 Subject: [PATCH] --- yaml --- r: 78795 b: refs/heads/master c: a308da1627d711fd0c7542bfe892abc78d65d215 h: refs/heads/master i: 78793: df2f4908be907d203f97572902883e4aae1ebfcc 78791: ac17cecd77a756d2d99dee03dd63ff4771da9520 v: v3 --- [refs] | 2 +- trunk/net/ipv4/raw.c | 22 +++++++++++++++++++--- trunk/net/ipv6/raw.c | 22 +++++++++++++++++++--- 3 files changed, 39 insertions(+), 7 deletions(-) diff --git a/[refs] b/[refs] index b077dbbaba06..f1465fb00034 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: e5ba31f11f6cae785e893d5d10abd612fef0b6bc +refs/heads/master: a308da1627d711fd0c7542bfe892abc78d65d215 diff --git a/trunk/net/ipv4/raw.c b/trunk/net/ipv4/raw.c index 206c869db921..91a52184351d 100644 --- a/trunk/net/ipv4/raw.c +++ b/trunk/net/ipv4/raw.c @@ -1003,15 +1003,31 @@ static const struct file_operations raw_seq_fops = { .release = seq_release_net, }; -int __init raw_proc_init(void) +static __net_init int raw_init_net(struct net *net) { - if (!proc_net_fops_create(&init_net, "raw", S_IRUGO, &raw_seq_fops)) + if (!proc_net_fops_create(net, "raw", S_IRUGO, &raw_seq_fops)) return -ENOMEM; + return 0; } +static __net_exit void raw_exit_net(struct net *net) +{ + proc_net_remove(net, "raw"); +} + +static __net_initdata struct pernet_operations raw_net_ops = { + .init = raw_init_net, + .exit = raw_exit_net, +}; + +int __init raw_proc_init(void) +{ + return register_pernet_subsys(&raw_net_ops); +} + void __init raw_proc_exit(void) { - proc_net_remove(&init_net, "raw"); + unregister_pernet_subsys(&raw_net_ops); } #endif /* CONFIG_PROC_FS */ diff --git a/trunk/net/ipv6/raw.c b/trunk/net/ipv6/raw.c index 970529e4754a..4d880551fe6a 100644 --- a/trunk/net/ipv6/raw.c +++ b/trunk/net/ipv6/raw.c @@ -1270,16 +1270,32 @@ static const struct file_operations raw6_seq_fops = { .release = seq_release_net, }; -int __init raw6_proc_init(void) +static int raw6_init_net(struct net *net) { - if (!proc_net_fops_create(&init_net, "raw6", S_IRUGO, &raw6_seq_fops)) + if (!proc_net_fops_create(net, "raw6", S_IRUGO, &raw6_seq_fops)) return -ENOMEM; + return 0; } +static void raw6_exit_net(struct net *net) +{ + proc_net_remove(net, "raw6"); +} + +static struct pernet_operations raw6_net_ops = { + .init = raw6_init_net, + .exit = raw6_exit_net, +}; + +int __init raw6_proc_init(void) +{ + return register_pernet_subsys(&raw6_net_ops); +} + void raw6_proc_exit(void) { - proc_net_remove(&init_net, "raw6"); + unregister_pernet_subsys(&raw6_net_ops); } #endif /* CONFIG_PROC_FS */