aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/genetlink.h
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2012-09-07 16:12:54 -0400
committerDavid S. Miller <davem@davemloft.net>2012-09-10 15:30:41 -0400
commit15e473046cb6e5d18a4d0057e61d76315230382b (patch)
tree893d2df5d46a6ce156933ac57a1398f0ad22b889 /include/net/genetlink.h
parent9f00d9776bc5beb92e8bfc884a7e96ddc5589e2e (diff)
netlink: Rename pid to portid to avoid confusion
It is a frequent mistake to confuse the netlink port identifier with a process identifier. Try to reduce this confusion by renaming fields that hold port identifiers portid instead of pid. I have carefully avoided changing the structures exported to userspace to avoid changing the userspace API. I have successfully built an allyesconfig kernel with this change. Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com> Acked-by: Stephen Hemminger <shemminger@vyatta.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/genetlink.h')
-rw-r--r--include/net/genetlink.h34
1 files changed, 17 insertions, 17 deletions
diff --git a/include/net/genetlink.h b/include/net/genetlink.h
index 48905cd3884c..bdfbe68c1c3b 100644
--- a/include/net/genetlink.h
+++ b/include/net/genetlink.h
@@ -65,7 +65,7 @@ struct genl_family {
65/** 65/**
66 * struct genl_info - receiving information 66 * struct genl_info - receiving information
67 * @snd_seq: sending sequence number 67 * @snd_seq: sending sequence number
68 * @snd_pid: netlink pid of sender 68 * @snd_portid: netlink portid of sender
69 * @nlhdr: netlink message header 69 * @nlhdr: netlink message header
70 * @genlhdr: generic netlink message header 70 * @genlhdr: generic netlink message header
71 * @userhdr: user specific header 71 * @userhdr: user specific header
@@ -75,7 +75,7 @@ struct genl_family {
75 */ 75 */
76struct genl_info { 76struct genl_info {
77 u32 snd_seq; 77 u32 snd_seq;
78 u32 snd_pid; 78 u32 snd_portid;
79 struct nlmsghdr * nlhdr; 79 struct nlmsghdr * nlhdr;
80 struct genlmsghdr * genlhdr; 80 struct genlmsghdr * genlhdr;
81 void * userhdr; 81 void * userhdr;
@@ -130,10 +130,10 @@ extern int genl_register_mc_group(struct genl_family *family,
130 struct genl_multicast_group *grp); 130 struct genl_multicast_group *grp);
131extern void genl_unregister_mc_group(struct genl_family *family, 131extern void genl_unregister_mc_group(struct genl_family *family,
132 struct genl_multicast_group *grp); 132 struct genl_multicast_group *grp);
133extern void genl_notify(struct sk_buff *skb, struct net *net, u32 pid, 133extern void genl_notify(struct sk_buff *skb, struct net *net, u32 portid,
134 u32 group, struct nlmsghdr *nlh, gfp_t flags); 134 u32 group, struct nlmsghdr *nlh, gfp_t flags);
135 135
136void *genlmsg_put(struct sk_buff *skb, u32 pid, u32 seq, 136void *genlmsg_put(struct sk_buff *skb, u32 portid, u32 seq,
137 struct genl_family *family, int flags, u8 cmd); 137 struct genl_family *family, int flags, u8 cmd);
138 138
139/** 139/**
@@ -183,7 +183,7 @@ static inline void *genlmsg_put_reply(struct sk_buff *skb,
183 struct genl_family *family, 183 struct genl_family *family,
184 int flags, u8 cmd) 184 int flags, u8 cmd)
185{ 185{
186 return genlmsg_put(skb, info->snd_pid, info->snd_seq, family, 186 return genlmsg_put(skb, info->snd_portid, info->snd_seq, family,
187 flags, cmd); 187 flags, cmd);
188} 188}
189 189
@@ -212,49 +212,49 @@ static inline void genlmsg_cancel(struct sk_buff *skb, void *hdr)
212 * genlmsg_multicast_netns - multicast a netlink message to a specific netns 212 * genlmsg_multicast_netns - multicast a netlink message to a specific netns
213 * @net: the net namespace 213 * @net: the net namespace
214 * @skb: netlink message as socket buffer 214 * @skb: netlink message as socket buffer
215 * @pid: own netlink pid to avoid sending to yourself 215 * @portid: own netlink portid to avoid sending to yourself
216 * @group: multicast group id 216 * @group: multicast group id
217 * @flags: allocation flags 217 * @flags: allocation flags
218 */ 218 */
219static inline int genlmsg_multicast_netns(struct net *net, struct sk_buff *skb, 219static inline int genlmsg_multicast_netns(struct net *net, struct sk_buff *skb,
220 u32 pid, unsigned int group, gfp_t flags) 220 u32 portid, unsigned int group, gfp_t flags)
221{ 221{
222 return nlmsg_multicast(net->genl_sock, skb, pid, group, flags); 222 return nlmsg_multicast(net->genl_sock, skb, portid, group, flags);
223} 223}
224 224
225/** 225/**
226 * genlmsg_multicast - multicast a netlink message to the default netns 226 * genlmsg_multicast - multicast a netlink message to the default netns
227 * @skb: netlink message as socket buffer 227 * @skb: netlink message as socket buffer
228 * @pid: own netlink pid to avoid sending to yourself 228 * @portid: own netlink portid to avoid sending to yourself
229 * @group: multicast group id 229 * @group: multicast group id
230 * @flags: allocation flags 230 * @flags: allocation flags
231 */ 231 */
232static inline int genlmsg_multicast(struct sk_buff *skb, u32 pid, 232static inline int genlmsg_multicast(struct sk_buff *skb, u32 portid,
233 unsigned int group, gfp_t flags) 233 unsigned int group, gfp_t flags)
234{ 234{
235 return genlmsg_multicast_netns(&init_net, skb, pid, group, flags); 235 return genlmsg_multicast_netns(&init_net, skb, portid, group, flags);
236} 236}
237 237
238/** 238/**
239 * genlmsg_multicast_allns - multicast a netlink message to all net namespaces 239 * genlmsg_multicast_allns - multicast a netlink message to all net namespaces
240 * @skb: netlink message as socket buffer 240 * @skb: netlink message as socket buffer
241 * @pid: own netlink pid to avoid sending to yourself 241 * @portid: own netlink portid to avoid sending to yourself
242 * @group: multicast group id 242 * @group: multicast group id
243 * @flags: allocation flags 243 * @flags: allocation flags
244 * 244 *
245 * This function must hold the RTNL or rcu_read_lock(). 245 * This function must hold the RTNL or rcu_read_lock().
246 */ 246 */
247int genlmsg_multicast_allns(struct sk_buff *skb, u32 pid, 247int genlmsg_multicast_allns(struct sk_buff *skb, u32 portid,
248 unsigned int group, gfp_t flags); 248 unsigned int group, gfp_t flags);
249 249
250/** 250/**
251 * genlmsg_unicast - unicast a netlink message 251 * genlmsg_unicast - unicast a netlink message
252 * @skb: netlink message as socket buffer 252 * @skb: netlink message as socket buffer
253 * @pid: netlink pid of the destination socket 253 * @portid: netlink portid of the destination socket
254 */ 254 */
255static inline int genlmsg_unicast(struct net *net, struct sk_buff *skb, u32 pid) 255static inline int genlmsg_unicast(struct net *net, struct sk_buff *skb, u32 portid)
256{ 256{
257 return nlmsg_unicast(net->genl_sock, skb, pid); 257 return nlmsg_unicast(net->genl_sock, skb, portid);
258} 258}
259 259
260/** 260/**
@@ -264,7 +264,7 @@ static inline int genlmsg_unicast(struct net *net, struct sk_buff *skb, u32 pid)
264 */ 264 */
265static inline int genlmsg_reply(struct sk_buff *skb, struct genl_info *info) 265static inline int genlmsg_reply(struct sk_buff *skb, struct genl_info *info)
266{ 266{
267 return genlmsg_unicast(genl_info_net(info), skb, info->snd_pid); 267 return genlmsg_unicast(genl_info_net(info), skb, info->snd_portid);
268} 268}
269 269
270/** 270/**