[NETNS]: Merge ifdef CONFIG_NET in include/net/net_namespace.h.
[firefly-linux-kernel-4.4.55.git] / include / net / net_namespace.h
index 923f2b8b909600b3962035f714308ddc5e8acf9d..4a37037b1d17c7e73edc5c851fe066dbe3bc0170 100644 (file)
@@ -8,6 +8,7 @@
 #include <linux/workqueue.h>
 #include <linux/list.h>
 
+#include <net/netns/core.h>
 #include <net/netns/unix.h>
 #include <net/netns/packet.h>
 #include <net/netns/ipv4.h>
@@ -46,10 +47,7 @@ struct net {
 
        struct sock             *rtnl;                  /* rtnetlink socket */
 
-       /* core sysctls */
-       struct ctl_table_header *sysctl_core_hdr;
-       int                     sysctl_somaxconn;
-
+       struct netns_core       core;
        struct netns_packet     packet;
        struct netns_unix       unx;
        struct netns_ipv4       ipv4;
@@ -61,25 +59,27 @@ struct net {
 #endif
 };
 
+
 #ifdef CONFIG_NET
 /* Init's network namespace */
 extern struct net init_net;
 #define INIT_NET_NS(net_ns) .net_ns = &init_net,
-#else
-#define INIT_NET_NS(net_ns)
-#endif
-
-extern struct list_head net_namespace_list;
 
-#ifdef CONFIG_NET
 extern struct net *copy_net_ns(unsigned long flags, struct net *net_ns);
-#else
+
+#else /* CONFIG_NET */
+
+#define INIT_NET_NS(net_ns)
+
 static inline struct net *copy_net_ns(unsigned long flags, struct net *net_ns)
 {
        /* There is nothing to copy so this is a noop */
        return net_ns;
 }
-#endif
+#endif /* CONFIG_NET */
+
+
+extern struct list_head net_namespace_list;
 
 #ifdef CONFIG_NET_NS
 extern void __put_net(struct net *net);
@@ -118,6 +118,12 @@ static inline void release_net(struct net *net)
 {
        atomic_dec(&net->use_count);
 }
+
+static inline
+int net_eq(const struct net *net1, const struct net *net2)
+{
+       return net1 == net2;
+}
 #else
 static inline struct net *get_net(struct net *net)
 {
@@ -141,6 +147,12 @@ static inline struct net *maybe_get_net(struct net *net)
 {
        return net;
 }
+
+static inline
+int net_eq(const struct net *net1, const struct net *net2)
+{
+       return 1;
+}
 #endif
 
 #define for_each_net(VAR)                              \