diff options
Diffstat (limited to 'include/net/netns/generic.h')
| -rw-r--r-- | include/net/netns/generic.h | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/include/net/netns/generic.h b/include/net/netns/generic.h index 0c04fd2a700..0931618c0f7 100644 --- a/include/net/netns/generic.h +++ b/include/net/netns/generic.h @@ -5,6 +5,7 @@ #ifndef __NET_GENERIC_H__ #define __NET_GENERIC_H__ +#include <linux/bug.h> #include <linux/rcupdate.h> /* @@ -12,11 +13,10 @@ * stuff on the struct net without explicit struct net modification * * The rules are simple: - * 1. register the ops with register_pernet_gen_device to get the id - * of your private pointer; - * 2. call net_assign_generic() to put the private data on the struct - * net (most preferably this should be done in the ->init callback - * of the ops registered); + * 1. set pernet_operations->id. After register_pernet_device you + * will have the id of your private pointer. + * 2. set pernet_operations->size to have the code allocate and free + * a private structure pointed to from struct net. * 3. do not change this pointer while the net is alive; * 4. do not try to have any private reference on the net_generic object. * @@ -31,7 +31,7 @@ struct net_generic { void *ptr[0]; }; -static inline void *net_generic(struct net *net, int id) +static inline void *net_generic(const struct net *net, int id) { struct net_generic *ng; void *ptr; @@ -42,8 +42,7 @@ static inline void *net_generic(struct net *net, int id) ptr = ng->ptr[id - 1]; rcu_read_unlock(); + BUG_ON(!ptr); return ptr; } - -extern int net_assign_generic(struct net *net, int id, void *data); #endif |
