aboutsummaryrefslogtreecommitdiffstats
path: root/include/net
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2013-11-19 09:19:38 -0500
committerDavid S. Miller <davem@davemloft.net>2013-11-19 16:39:06 -0500
commit68eb55031da7c967d954e5f9415cd05f4abdb692 (patch)
tree75751944b0c808ba191bcc6a752389593c41e805 /include/net
parent62b68e99faa802352e9cb2ae91adecd8dfddf1b8 (diff)
genetlink: pass family to functions using groups
This doesn't really change anything, but prepares for the next patch that will change the APIs to pass the group ID within the family, rather than the global group ID. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net')
-rw-r--r--include/net/genetlink.h22
1 files changed, 16 insertions, 6 deletions
diff --git a/include/net/genetlink.h b/include/net/genetlink.h
index 11ac77f6180c..60aef0df386b 100644
--- a/include/net/genetlink.h
+++ b/include/net/genetlink.h
@@ -166,7 +166,8 @@ static inline int _genl_register_family_with_ops(struct genl_family *family,
166int genl_unregister_family(struct genl_family *family); 166int genl_unregister_family(struct genl_family *family);
167int genl_register_mc_group(struct genl_family *family, 167int genl_register_mc_group(struct genl_family *family,
168 struct genl_multicast_group *grp); 168 struct genl_multicast_group *grp);
169void genl_notify(struct sk_buff *skb, struct net *net, u32 portid, 169void genl_notify(struct genl_family *family,
170 struct sk_buff *skb, struct net *net, u32 portid,
170 u32 group, struct nlmsghdr *nlh, gfp_t flags); 171 u32 group, struct nlmsghdr *nlh, gfp_t flags);
171 172
172void *genlmsg_put(struct sk_buff *skb, u32 portid, u32 seq, 173void *genlmsg_put(struct sk_buff *skb, u32 portid, u32 seq,
@@ -246,13 +247,15 @@ static inline void genlmsg_cancel(struct sk_buff *skb, void *hdr)
246 247
247/** 248/**
248 * genlmsg_multicast_netns - multicast a netlink message to a specific netns 249 * genlmsg_multicast_netns - multicast a netlink message to a specific netns
250 * @family: the generic netlink family
249 * @net: the net namespace 251 * @net: the net namespace
250 * @skb: netlink message as socket buffer 252 * @skb: netlink message as socket buffer
251 * @portid: own netlink portid to avoid sending to yourself 253 * @portid: own netlink portid to avoid sending to yourself
252 * @group: multicast group id 254 * @group: multicast group id
253 * @flags: allocation flags 255 * @flags: allocation flags
254 */ 256 */
255static inline int genlmsg_multicast_netns(struct net *net, struct sk_buff *skb, 257static inline int genlmsg_multicast_netns(struct genl_family *family,
258 struct net *net, struct sk_buff *skb,
256 u32 portid, unsigned int group, gfp_t flags) 259 u32 portid, unsigned int group, gfp_t flags)
257{ 260{
258 return nlmsg_multicast(net->genl_sock, skb, portid, group, flags); 261 return nlmsg_multicast(net->genl_sock, skb, portid, group, flags);
@@ -260,19 +263,23 @@ static inline int genlmsg_multicast_netns(struct net *net, struct sk_buff *skb,
260 263
261/** 264/**
262 * genlmsg_multicast - multicast a netlink message to the default netns 265 * genlmsg_multicast - multicast a netlink message to the default netns
266 * @family: the generic netlink family
263 * @skb: netlink message as socket buffer 267 * @skb: netlink message as socket buffer
264 * @portid: own netlink portid to avoid sending to yourself 268 * @portid: own netlink portid to avoid sending to yourself
265 * @group: multicast group id 269 * @group: multicast group id
266 * @flags: allocation flags 270 * @flags: allocation flags
267 */ 271 */
268static inline int genlmsg_multicast(struct sk_buff *skb, u32 portid, 272static inline int genlmsg_multicast(struct genl_family *family,
273 struct sk_buff *skb, u32 portid,
269 unsigned int group, gfp_t flags) 274 unsigned int group, gfp_t flags)
270{ 275{
271 return genlmsg_multicast_netns(&init_net, skb, portid, group, flags); 276 return genlmsg_multicast_netns(family, &init_net, skb,
277 portid, group, flags);
272} 278}
273 279
274/** 280/**
275 * genlmsg_multicast_allns - multicast a netlink message to all net namespaces 281 * genlmsg_multicast_allns - multicast a netlink message to all net namespaces
282 * @family: the generic netlink family
276 * @skb: netlink message as socket buffer 283 * @skb: netlink message as socket buffer
277 * @portid: own netlink portid to avoid sending to yourself 284 * @portid: own netlink portid to avoid sending to yourself
278 * @group: multicast group id 285 * @group: multicast group id
@@ -280,7 +287,8 @@ static inline int genlmsg_multicast(struct sk_buff *skb, u32 portid,
280 * 287 *
281 * This function must hold the RTNL or rcu_read_lock(). 288 * This function must hold the RTNL or rcu_read_lock().
282 */ 289 */
283int genlmsg_multicast_allns(struct sk_buff *skb, u32 portid, 290int genlmsg_multicast_allns(struct genl_family *family,
291 struct sk_buff *skb, u32 portid,
284 unsigned int group, gfp_t flags); 292 unsigned int group, gfp_t flags);
285 293
286/** 294/**
@@ -353,6 +361,7 @@ static inline struct sk_buff *genlmsg_new(size_t payload, gfp_t flags)
353 361
354/** 362/**
355 * genl_set_err - report error to genetlink broadcast listeners 363 * genl_set_err - report error to genetlink broadcast listeners
364 * @family: the generic netlink family
356 * @net: the network namespace to report the error to 365 * @net: the network namespace to report the error to
357 * @portid: the PORTID of a process that we want to skip (if any) 366 * @portid: the PORTID of a process that we want to skip (if any)
358 * @group: the broadcast group that will notice the error 367 * @group: the broadcast group that will notice the error
@@ -361,7 +370,8 @@ static inline struct sk_buff *genlmsg_new(size_t payload, gfp_t flags)
361 * This function returns the number of broadcast listeners that have set the 370 * This function returns the number of broadcast listeners that have set the
362 * NETLINK_RECV_NO_ENOBUFS socket option. 371 * NETLINK_RECV_NO_ENOBUFS socket option.
363 */ 372 */
364static inline int genl_set_err(struct net *net, u32 portid, u32 group, int code) 373static inline int genl_set_err(struct genl_family *family, struct net *net,
374 u32 portid, u32 group, int code)
365{ 375{
366 return netlink_set_err(net->genl_sock, portid, group, code); 376 return netlink_set_err(net->genl_sock, portid, group, code);
367} 377}