Commit 97577e38 authored by Pavel Emelyanov's avatar Pavel Emelyanov Committed by David S. Miller

[UNIX]: Extend unix_sysctl_(un)register prototypes

Add the struct net * argument to both of them to use in
the future. Also make the register one return an error code.

It is useless right now, but will make the future patches
much simpler.
Signed-off-by: default avatarPavel Emelyanov <xemul@openvz.org>
Acked-by: default avatarEric W. Biederman <ebiederm@xmission.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent dd885909
...@@ -60,11 +60,11 @@ struct unix_sock { ...@@ -60,11 +60,11 @@ struct unix_sock {
#ifdef CONFIG_SYSCTL #ifdef CONFIG_SYSCTL
extern int sysctl_unix_max_dgram_qlen; extern int sysctl_unix_max_dgram_qlen;
extern void unix_sysctl_register(void); extern int unix_sysctl_register(struct net *net);
extern void unix_sysctl_unregister(void); extern void unix_sysctl_unregister(struct net *net);
#else #else
static inline void unix_sysctl_register(void) {} static inline int unix_sysctl_register(struct net *net) { return 0; }
static inline void unix_sysctl_unregister(void) {} static inline void unix_sysctl_unregister(struct net *net) {}
#endif #endif
#endif #endif
#endif #endif
...@@ -2175,7 +2175,7 @@ static int __init af_unix_init(void) ...@@ -2175,7 +2175,7 @@ static int __init af_unix_init(void)
sock_register(&unix_family_ops); sock_register(&unix_family_ops);
register_pernet_subsys(&unix_net_ops); register_pernet_subsys(&unix_net_ops);
unix_sysctl_register(); unix_sysctl_register(&init_net);
out: out:
return rc; return rc;
} }
...@@ -2183,7 +2183,7 @@ static int __init af_unix_init(void) ...@@ -2183,7 +2183,7 @@ static int __init af_unix_init(void)
static void __exit af_unix_exit(void) static void __exit af_unix_exit(void)
{ {
sock_unregister(PF_UNIX); sock_unregister(PF_UNIX);
unix_sysctl_unregister(); unix_sysctl_unregister(&init_net);
proto_unregister(&unix_proto); proto_unregister(&unix_proto);
unregister_pernet_subsys(&unix_net_ops); unregister_pernet_subsys(&unix_net_ops);
} }
......
...@@ -48,12 +48,13 @@ static ctl_table unix_root_table[] = { ...@@ -48,12 +48,13 @@ static ctl_table unix_root_table[] = {
static struct ctl_table_header * unix_sysctl_header; static struct ctl_table_header * unix_sysctl_header;
void unix_sysctl_register(void) int unix_sysctl_register(struct net *net)
{ {
unix_sysctl_header = register_sysctl_table(unix_root_table); unix_sysctl_header = register_sysctl_table(unix_root_table);
return unix_sysctl_header == NULL ? -ENOMEM : 0;
} }
void unix_sysctl_unregister(void) void unix_sysctl_unregister(struct net *net)
{ {
unregister_sysctl_table(unix_sysctl_header); unregister_sysctl_table(unix_sysctl_header);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment