]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - include/net/net_namespace.h
Merge git://git.infradead.org/battery-2.6
[linux-2.6-omap-h63xx.git] / include / net / net_namespace.h
index f880b0f9f1070ea1e6dae1fc17c343bc87806d8f..aa540e6be502b49c5b7322e6ee57f630e6fa584a 100644 (file)
@@ -26,9 +26,11 @@ struct net {
        atomic_t                count;          /* To decided when the network
                                                 *  namespace should be freed.
                                                 */
+#ifdef NETNS_REFCNT_DEBUG
        atomic_t                use_count;      /* To track references we
                                                 * destroy on demand
                                                 */
+#endif
        struct list_head        list;           /* list of network namespaces */
        struct work_struct      work;           /* work struct for freeing */
 
@@ -117,17 +119,6 @@ static inline void put_net(struct net *net)
                __put_net(net);
 }
 
-static inline struct net *hold_net(struct net *net)
-{
-       atomic_inc(&net->use_count);
-       return net;
-}
-
-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)
 {
@@ -143,27 +134,44 @@ static inline void put_net(struct net *net)
 {
 }
 
+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
+
+
+#ifdef NETNS_REFCNT_DEBUG
 static inline struct net *hold_net(struct net *net)
 {
+       if (net)
+               atomic_inc(&net->use_count);
        return net;
 }
 
 static inline void release_net(struct net *net)
 {
+       if (net)
+               atomic_dec(&net->use_count);
 }
-
-static inline struct net *maybe_get_net(struct net *net)
+#else
+static inline struct net *hold_net(struct net *net)
 {
        return net;
 }
 
-static inline
-int net_eq(const struct net *net1, const struct net *net2)
+static inline void release_net(struct net *net)
 {
-       return 1;
 }
 #endif
 
+
 #define for_each_net(VAR)                              \
        list_for_each_entry(VAR, &net_namespace_list, list)