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>
This commit is contained in:

committed by
David S. Miller

vanhempi
9f00d9776b
commit
15e473046c
@@ -1886,7 +1886,7 @@ static int team_nl_cmd_noop(struct sk_buff *skb, struct genl_info *info)
|
||||
if (!msg)
|
||||
return -ENOMEM;
|
||||
|
||||
hdr = genlmsg_put(msg, info->snd_pid, info->snd_seq,
|
||||
hdr = genlmsg_put(msg, info->snd_portid, info->snd_seq,
|
||||
&team_nl_family, 0, TEAM_CMD_NOOP);
|
||||
if (IS_ERR(hdr)) {
|
||||
err = PTR_ERR(hdr);
|
||||
@@ -1895,7 +1895,7 @@ static int team_nl_cmd_noop(struct sk_buff *skb, struct genl_info *info)
|
||||
|
||||
genlmsg_end(msg, hdr);
|
||||
|
||||
return genlmsg_unicast(genl_info_net(info), msg, info->snd_pid);
|
||||
return genlmsg_unicast(genl_info_net(info), msg, info->snd_portid);
|
||||
|
||||
err_msg_put:
|
||||
nlmsg_free(msg);
|
||||
@@ -1952,7 +1952,7 @@ static int team_nl_send_generic(struct genl_info *info, struct team *team,
|
||||
if (err < 0)
|
||||
goto err_fill;
|
||||
|
||||
err = genlmsg_unicast(genl_info_net(info), skb, info->snd_pid);
|
||||
err = genlmsg_unicast(genl_info_net(info), skb, info->snd_portid);
|
||||
return err;
|
||||
|
||||
err_fill:
|
||||
@@ -1961,11 +1961,11 @@ err_fill:
|
||||
}
|
||||
|
||||
typedef int team_nl_send_func_t(struct sk_buff *skb,
|
||||
struct team *team, u32 pid);
|
||||
struct team *team, u32 portid);
|
||||
|
||||
static int team_nl_send_unicast(struct sk_buff *skb, struct team *team, u32 pid)
|
||||
static int team_nl_send_unicast(struct sk_buff *skb, struct team *team, u32 portid)
|
||||
{
|
||||
return genlmsg_unicast(dev_net(team->dev), skb, pid);
|
||||
return genlmsg_unicast(dev_net(team->dev), skb, portid);
|
||||
}
|
||||
|
||||
static int team_nl_fill_one_option_get(struct sk_buff *skb, struct team *team,
|
||||
@@ -2050,13 +2050,13 @@ nest_cancel:
|
||||
}
|
||||
|
||||
static int __send_and_alloc_skb(struct sk_buff **pskb,
|
||||
struct team *team, u32 pid,
|
||||
struct team *team, u32 portid,
|
||||
team_nl_send_func_t *send_func)
|
||||
{
|
||||
int err;
|
||||
|
||||
if (*pskb) {
|
||||
err = send_func(*pskb, team, pid);
|
||||
err = send_func(*pskb, team, portid);
|
||||
if (err)
|
||||
return err;
|
||||
}
|
||||
@@ -2066,7 +2066,7 @@ static int __send_and_alloc_skb(struct sk_buff **pskb,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int team_nl_send_options_get(struct team *team, u32 pid, u32 seq,
|
||||
static int team_nl_send_options_get(struct team *team, u32 portid, u32 seq,
|
||||
int flags, team_nl_send_func_t *send_func,
|
||||
struct list_head *sel_opt_inst_list)
|
||||
{
|
||||
@@ -2083,11 +2083,11 @@ static int team_nl_send_options_get(struct team *team, u32 pid, u32 seq,
|
||||
struct team_option_inst, tmp_list);
|
||||
|
||||
start_again:
|
||||
err = __send_and_alloc_skb(&skb, team, pid, send_func);
|
||||
err = __send_and_alloc_skb(&skb, team, portid, send_func);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
hdr = genlmsg_put(skb, pid, seq, &team_nl_family, flags | NLM_F_MULTI,
|
||||
hdr = genlmsg_put(skb, portid, seq, &team_nl_family, flags | NLM_F_MULTI,
|
||||
TEAM_CMD_OPTIONS_GET);
|
||||
if (IS_ERR(hdr))
|
||||
return PTR_ERR(hdr);
|
||||
@@ -2120,15 +2120,15 @@ start_again:
|
||||
goto start_again;
|
||||
|
||||
send_done:
|
||||
nlh = nlmsg_put(skb, pid, seq, NLMSG_DONE, 0, flags | NLM_F_MULTI);
|
||||
nlh = nlmsg_put(skb, portid, seq, NLMSG_DONE, 0, flags | NLM_F_MULTI);
|
||||
if (!nlh) {
|
||||
err = __send_and_alloc_skb(&skb, team, pid, send_func);
|
||||
err = __send_and_alloc_skb(&skb, team, portid, send_func);
|
||||
if (err)
|
||||
goto errout;
|
||||
goto send_done;
|
||||
}
|
||||
|
||||
return send_func(skb, team, pid);
|
||||
return send_func(skb, team, portid);
|
||||
|
||||
nla_put_failure:
|
||||
err = -EMSGSIZE;
|
||||
@@ -2151,7 +2151,7 @@ static int team_nl_cmd_options_get(struct sk_buff *skb, struct genl_info *info)
|
||||
|
||||
list_for_each_entry(opt_inst, &team->option_inst_list, list)
|
||||
list_add_tail(&opt_inst->tmp_list, &sel_opt_inst_list);
|
||||
err = team_nl_send_options_get(team, info->snd_pid, info->snd_seq,
|
||||
err = team_nl_send_options_get(team, info->snd_portid, info->snd_seq,
|
||||
NLM_F_ACK, team_nl_send_unicast,
|
||||
&sel_opt_inst_list);
|
||||
|
||||
@@ -2305,7 +2305,7 @@ team_put:
|
||||
}
|
||||
|
||||
static int team_nl_fill_port_list_get(struct sk_buff *skb,
|
||||
u32 pid, u32 seq, int flags,
|
||||
u32 portid, u32 seq, int flags,
|
||||
struct team *team,
|
||||
bool fillall)
|
||||
{
|
||||
@@ -2313,7 +2313,7 @@ static int team_nl_fill_port_list_get(struct sk_buff *skb,
|
||||
void *hdr;
|
||||
struct team_port *port;
|
||||
|
||||
hdr = genlmsg_put(skb, pid, seq, &team_nl_family, flags,
|
||||
hdr = genlmsg_put(skb, portid, seq, &team_nl_family, flags,
|
||||
TEAM_CMD_PORT_LIST_GET);
|
||||
if (IS_ERR(hdr))
|
||||
return PTR_ERR(hdr);
|
||||
@@ -2362,7 +2362,7 @@ static int team_nl_fill_port_list_get_all(struct sk_buff *skb,
|
||||
struct genl_info *info, int flags,
|
||||
struct team *team)
|
||||
{
|
||||
return team_nl_fill_port_list_get(skb, info->snd_pid,
|
||||
return team_nl_fill_port_list_get(skb, info->snd_portid,
|
||||
info->snd_seq, NLM_F_ACK,
|
||||
team, true);
|
||||
}
|
||||
@@ -2415,7 +2415,7 @@ static struct genl_multicast_group team_change_event_mcgrp = {
|
||||
};
|
||||
|
||||
static int team_nl_send_multicast(struct sk_buff *skb,
|
||||
struct team *team, u32 pid)
|
||||
struct team *team, u32 portid)
|
||||
{
|
||||
return genlmsg_multicast_netns(dev_net(team->dev), skb, 0,
|
||||
team_change_event_mcgrp.id, GFP_KERNEL);
|
||||
|
Viittaa uudesa ongelmassa
Block a user