netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] adjust __net_exit
@ 2012-03-08  9:37 Jan Beulich
  2012-03-17  5:18 ` David Miller
  0 siblings, 1 reply; 8+ messages in thread
From: Jan Beulich @ 2012-03-08  9:37 UTC (permalink / raw)
  To: davem; +Cc: netdev, netfilter-devel

__net_exit, judging by the majority of its uses, was intended to serve
as an abstraction to allow calling such annotated functions from both
__init and __exit functions. Using the (bogus and unused elsewhere)
__exit_refok to implement this is inefficient - any non-modular code
really can reside in __init (as non-modular __exit code is never used).

Therefore, adjust __net_exit to resolve to nothing (i.e. normal .text)
in modules, and __init in the core kernel.

A few other adjustments are necessary/possible with this done - those
were likely just oversights when added originally.

Signed-off-by: Jan Beulich <jbeulich@suse.com>

---
 include/net/net_namespace.h    |    6 +++++-
 net/ipv4/fib_frontend.c        |    2 +-
 net/netfilter/ipvs/ip_vs_ctl.c |    8 ++++----
 3 files changed, 10 insertions(+), 6 deletions(-)

--- 3.3-rc6/include/net/net_namespace.h
+++ 3.3-rc6-net-exit/include/net/net_namespace.h
@@ -242,7 +242,11 @@ static inline struct net *read_pnet(stru
 #define __net_initdata
 #else
 #define __net_init	__init
-#define __net_exit	__exit_refok
+#ifdef MODULE
+#define __net_exit
+#else
+#define __net_exit	__init
+#endif
 #define __net_initdata	__initdata
 #endif
 
--- 3.3-rc6/net/ipv4/fib_frontend.c
+++ 3.3-rc6-net-exit/net/ipv4/fib_frontend.c
@@ -1062,7 +1062,7 @@ fail:
 	return err;
 }
 
-static void ip_fib_net_exit(struct net *net)
+static void __net_exit ip_fib_net_exit(struct net *net)
 {
 	unsigned int i;
 
--- 3.3-rc6/net/netfilter/ipvs/ip_vs_ctl.c
+++ 3.3-rc6-net-exit/net/netfilter/ipvs/ip_vs_ctl.c
@@ -3621,7 +3621,7 @@ static void ip_vs_genl_unregister(void)
  * per netns intit/exit func.
  */
 #ifdef CONFIG_SYSCTL
-int __net_init ip_vs_control_net_init_sysctl(struct net *net)
+static int __net_init ip_vs_control_net_init_sysctl(struct net *net)
 {
 	int idx;
 	struct netns_ipvs *ipvs = net_ipvs(net);
@@ -3680,7 +3680,7 @@ int __net_init ip_vs_control_net_init_sy
 	return 0;
 }
 
-void __net_init ip_vs_control_net_cleanup_sysctl(struct net *net)
+static void __net_exit ip_vs_control_net_cleanup_sysctl(struct net *net)
 {
 	struct netns_ipvs *ipvs = net_ipvs(net);
 
@@ -3691,8 +3691,8 @@ void __net_init ip_vs_control_net_cleanu
 
 #else
 
-int __net_init ip_vs_control_net_init_sysctl(struct net *net) { return 0; }
-void __net_init ip_vs_control_net_cleanup_sysctl(struct net *net) { }
+static int __net_init ip_vs_control_net_init_sysctl(struct net *net) { return 0; }
+static void __net_exit ip_vs_control_net_cleanup_sysctl(struct net *net) { }
 
 #endif
 




^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2012-03-20  2:17 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-08  9:37 [PATCH] adjust __net_exit Jan Beulich
2012-03-17  5:18 ` David Miller
2012-03-17 23:03   ` Sam Ravnborg
2012-03-19  0:41     ` Eric W. Biederman
2012-03-19  8:14     ` Jan Beulich
2012-03-19  8:47       ` Sam Ravnborg
2012-03-19  9:09         ` Jan Beulich
2012-03-20  2:17           ` Eric W. Biederman

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).