From: Pavel Emelyanov <xemul@openvz.org>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>,
Linux Netdev List <netdev@vger.kernel.org>,
Linux Containers <containers@lists.osdl.org>,
Daniel Lezcano <dlezcano@fr.ibm.com>
Subject: [PATCH 1/4 net-2.6.25][UNIX] Extend unix_sysctl_(un)register prototypes
Date: Fri, 30 Nov 2007 19:26:51 +0300 [thread overview]
Message-ID: <475039CB.5010204@openvz.org> (raw)
In-Reply-To: <47503919.8060103@openvz.org>
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: Pavel Emelyanov <xemul@openvz.org>
---
diff --git a/include/net/af_unix.h b/include/net/af_unix.h
index a1c805d..e0fba26 100644
--- a/include/net/af_unix.h
+++ b/include/net/af_unix.h
@@ -60,11 +60,11 @@ struct unix_sock {
#ifdef CONFIG_SYSCTL
extern int sysctl_unix_max_dgram_qlen;
-extern void unix_sysctl_register(void);
-extern void unix_sysctl_unregister(void);
+extern int unix_sysctl_register(struct net *net);
+extern void unix_sysctl_unregister(struct net *net);
#else
-static inline void unix_sysctl_register(void) {}
-static inline void unix_sysctl_unregister(void) {}
+static inline int unix_sysctl_register(struct net *net) { return 0; }
+static inline void unix_sysctl_unregister(struct net *net) {}
#endif
#endif
#endif
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index 393197a..a0aa6d3 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -2175,7 +2175,7 @@ static int __init af_unix_init(void)
sock_register(&unix_family_ops);
register_pernet_subsys(&unix_net_ops);
- unix_sysctl_register();
+ unix_sysctl_register(&init_net);
out:
return rc;
}
@@ -2183,7 +2183,7 @@ out:
static void __exit af_unix_exit(void)
{
sock_unregister(PF_UNIX);
- unix_sysctl_unregister();
+ unix_sysctl_unregister(&init_net);
proto_unregister(&unix_proto);
unregister_pernet_subsys(&unix_net_ops);
}
diff --git a/net/unix/sysctl_net_unix.c b/net/unix/sysctl_net_unix.c
index eb0bd57..b2e0407 100644
--- a/net/unix/sysctl_net_unix.c
+++ b/net/unix/sysctl_net_unix.c
@@ -48,12 +48,13 @@ static ctl_table unix_root_table[] = {
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);
+ 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);
}
--
1.5.3.4
next prev parent reply other threads:[~2007-11-30 16:27 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-30 16:23 [PATCH 0/4 net-2.6.15][UNIX] Make unix sysctls per-namespace Pavel Emelyanov
2007-11-30 16:26 ` Pavel Emelyanov [this message]
2007-11-30 16:29 ` [PATCH 2/4 net-2.6.25][UNIX] Move the sysctl_unix_max_dgram_qlen on struct net Pavel Emelyanov
2007-11-30 16:30 ` [PATCH 3/4 net-2.6.25][UNIX] Use ctl paths to register unix ctl tables Pavel Emelyanov
2007-11-30 16:34 ` [PATCH 4/4 net-2.6.25][UNIX] Make the unix sysctl tables per-namespace Pavel Emelyanov
2007-11-30 16:37 ` [PATCH 4/4 (resent) " Pavel Emelyanov
2007-12-01 12:57 ` Herbert Xu
[not found] ` <20071201125726.GC15910-lOAM2aK0SrRLBo1qDEOMRrpzq4S04n8Q@public.gmane.org>
2007-12-01 13:07 ` Denis V. Lunev
2007-12-01 13:19 ` Pavel Emelyanov
2007-12-01 19:32 ` Eric W. Biederman
2007-11-30 22:23 ` [PATCH 0/4 net-2.6.15][UNIX] Make unix sysctls per-namespace Eric W. Biederman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=475039CB.5010204@openvz.org \
--to=xemul@openvz.org \
--cc=containers@lists.osdl.org \
--cc=dlezcano@fr.ibm.com \
--cc=ebiederm@xmission.com \
--cc=herbert@gondor.apana.org.au \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).