* [PATCH] netns: move {inc,dec}_net_namespaces into #ifdef
@ 2016-09-23 16:06 Arnd Bergmann
2016-09-23 18:42 ` Eric W. Biederman
0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2016-09-23 16:06 UTC (permalink / raw)
To: David S. Miller
Cc: Arnd Bergmann, Eric W. Biederman, WANG Cong, netdev, linux-kernel
With the newly enforced limit on the number of namespaces,
we get a build warning if CONFIG_NETNS is disabled:
net/core/net_namespace.c:273:13: error: 'dec_net_namespaces' defined but not used [-Werror=unused-function]
net/core/net_namespace.c:268:24: error: 'inc_net_namespaces' defined but not used [-Werror=unused-function]
This moves the two added functions inside the #ifdef that guards
their callers.
Fixes: 703286608a22 ("netns: Add a limit on the number of net namespaces")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
net/core/net_namespace.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c
index d0eb13d3226b..989434f36f96 100644
--- a/net/core/net_namespace.c
+++ b/net/core/net_namespace.c
@@ -265,16 +265,6 @@ struct net *get_net_ns_by_id(struct net *net, int id)
return peer;
}
-static struct ucounts *inc_net_namespaces(struct user_namespace *ns)
-{
- return inc_ucount(ns, current_euid(), UCOUNT_NET_NAMESPACES);
-}
-
-static void dec_net_namespaces(struct ucounts *ucounts)
-{
- dec_ucount(ucounts, UCOUNT_NET_NAMESPACES);
-}
-
/*
* setup_net runs the initializers for the network namespace object.
*/
@@ -319,6 +309,16 @@ static __net_init int setup_net(struct net *net, struct user_namespace *user_ns)
#ifdef CONFIG_NET_NS
+static struct ucounts *inc_net_namespaces(struct user_namespace *ns)
+{
+ return inc_ucount(ns, current_euid(), UCOUNT_NET_NAMESPACES);
+}
+
+static void dec_net_namespaces(struct ucounts *ucounts)
+{
+ dec_ucount(ucounts, UCOUNT_NET_NAMESPACES);
+}
+
static struct kmem_cache *net_cachep;
static struct workqueue_struct *netns_wq;
--
2.9.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] netns: move {inc,dec}_net_namespaces into #ifdef
2016-09-23 16:06 [PATCH] netns: move {inc,dec}_net_namespaces into #ifdef Arnd Bergmann
@ 2016-09-23 18:42 ` Eric W. Biederman
0 siblings, 0 replies; 2+ messages in thread
From: Eric W. Biederman @ 2016-09-23 18:42 UTC (permalink / raw)
To: Arnd Bergmann; +Cc: David S. Miller, WANG Cong, netdev, linux-kernel
Arnd Bergmann <arnd@arndb.de> writes:
> With the newly enforced limit on the number of namespaces,
> we get a build warning if CONFIG_NETNS is disabled:
>
> net/core/net_namespace.c:273:13: error: 'dec_net_namespaces' defined but not used [-Werror=unused-function]
> net/core/net_namespace.c:268:24: error: 'inc_net_namespaces' defined but not used [-Werror=unused-function]
>
> This moves the two added functions inside the #ifdef that guards
> their callers.
>
> Fixes: 703286608a22 ("netns: Add a limit on the number of net namespaces")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Applied to my namespace tree thanks.
This was a hold over from calling those functions in a different location.
Eric
> ---
> net/core/net_namespace.c | 20 ++++++++++----------
> 1 file changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c
> index d0eb13d3226b..989434f36f96 100644
> --- a/net/core/net_namespace.c
> +++ b/net/core/net_namespace.c
> @@ -265,16 +265,6 @@ struct net *get_net_ns_by_id(struct net *net, int id)
> return peer;
> }
>
> -static struct ucounts *inc_net_namespaces(struct user_namespace *ns)
> -{
> - return inc_ucount(ns, current_euid(), UCOUNT_NET_NAMESPACES);
> -}
> -
> -static void dec_net_namespaces(struct ucounts *ucounts)
> -{
> - dec_ucount(ucounts, UCOUNT_NET_NAMESPACES);
> -}
> -
> /*
> * setup_net runs the initializers for the network namespace object.
> */
> @@ -319,6 +309,16 @@ static __net_init int setup_net(struct net *net, struct user_namespace *user_ns)
>
>
> #ifdef CONFIG_NET_NS
> +static struct ucounts *inc_net_namespaces(struct user_namespace *ns)
> +{
> + return inc_ucount(ns, current_euid(), UCOUNT_NET_NAMESPACES);
> +}
> +
> +static void dec_net_namespaces(struct ucounts *ucounts)
> +{
> + dec_ucount(ucounts, UCOUNT_NET_NAMESPACES);
> +}
> +
> static struct kmem_cache *net_cachep;
> static struct workqueue_struct *netns_wq;
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-09-23 18:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-23 16:06 [PATCH] netns: move {inc,dec}_net_namespaces into #ifdef Arnd Bergmann
2016-09-23 18:42 ` Eric W. Biederman
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.