mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 03:27:44 -04:00
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" <[email protected]> Acked-by: Stephen Hemminger <[email protected]> Signed-off-by: David S. Miller <[email protected]>
This commit is contained in:
parent
9f00d9776b
commit
15e473046c
75 changed files with 728 additions and 728 deletions
|
|
@ -667,12 +667,12 @@ static inline size_t dn_ifaddr_nlmsg_size(void)
|
|||
}
|
||||
|
||||
static int dn_nl_fill_ifaddr(struct sk_buff *skb, struct dn_ifaddr *ifa,
|
||||
u32 pid, u32 seq, int event, unsigned int flags)
|
||||
u32 portid, u32 seq, int event, unsigned int flags)
|
||||
{
|
||||
struct ifaddrmsg *ifm;
|
||||
struct nlmsghdr *nlh;
|
||||
|
||||
nlh = nlmsg_put(skb, pid, seq, event, sizeof(*ifm), flags);
|
||||
nlh = nlmsg_put(skb, portid, seq, event, sizeof(*ifm), flags);
|
||||
if (nlh == NULL)
|
||||
return -EMSGSIZE;
|
||||
|
||||
|
|
@ -753,7 +753,7 @@ static int dn_nl_dump_ifaddr(struct sk_buff *skb, struct netlink_callback *cb)
|
|||
if (dn_idx < skip_naddr)
|
||||
continue;
|
||||
|
||||
if (dn_nl_fill_ifaddr(skb, ifa, NETLINK_CB(cb->skb).pid,
|
||||
if (dn_nl_fill_ifaddr(skb, ifa, NETLINK_CB(cb->skb).portid,
|
||||
cb->nlh->nlmsg_seq, RTM_NEWADDR,
|
||||
NLM_F_MULTI) < 0)
|
||||
goto done;
|
||||
|
|
|
|||
|
|
@ -1543,7 +1543,7 @@ static int dn_route_input(struct sk_buff *skb)
|
|||
return dn_route_input_slow(skb);
|
||||
}
|
||||
|
||||
static int dn_rt_fill_info(struct sk_buff *skb, u32 pid, u32 seq,
|
||||
static int dn_rt_fill_info(struct sk_buff *skb, u32 portid, u32 seq,
|
||||
int event, int nowait, unsigned int flags)
|
||||
{
|
||||
struct dn_route *rt = (struct dn_route *)skb_dst(skb);
|
||||
|
|
@ -1551,7 +1551,7 @@ static int dn_rt_fill_info(struct sk_buff *skb, u32 pid, u32 seq,
|
|||
struct nlmsghdr *nlh;
|
||||
long expires;
|
||||
|
||||
nlh = nlmsg_put(skb, pid, seq, event, sizeof(*r), flags);
|
||||
nlh = nlmsg_put(skb, portid, seq, event, sizeof(*r), flags);
|
||||
if (!nlh)
|
||||
return -EMSGSIZE;
|
||||
|
||||
|
|
@ -1685,7 +1685,7 @@ static int dn_cache_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh, void
|
|||
if (rtm->rtm_flags & RTM_F_NOTIFY)
|
||||
rt->rt_flags |= RTCF_NOTIFY;
|
||||
|
||||
err = dn_rt_fill_info(skb, NETLINK_CB(in_skb).pid, nlh->nlmsg_seq, RTM_NEWROUTE, 0, 0);
|
||||
err = dn_rt_fill_info(skb, NETLINK_CB(in_skb).portid, nlh->nlmsg_seq, RTM_NEWROUTE, 0, 0);
|
||||
|
||||
if (err == 0)
|
||||
goto out_free;
|
||||
|
|
@ -1694,7 +1694,7 @@ static int dn_cache_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh, void
|
|||
goto out_free;
|
||||
}
|
||||
|
||||
return rtnl_unicast(skb, &init_net, NETLINK_CB(in_skb).pid);
|
||||
return rtnl_unicast(skb, &init_net, NETLINK_CB(in_skb).portid);
|
||||
|
||||
out_free:
|
||||
kfree_skb(skb);
|
||||
|
|
@ -1737,7 +1737,7 @@ int dn_cache_dump(struct sk_buff *skb, struct netlink_callback *cb)
|
|||
if (idx < s_idx)
|
||||
continue;
|
||||
skb_dst_set(skb, dst_clone(&rt->dst));
|
||||
if (dn_rt_fill_info(skb, NETLINK_CB(cb->skb).pid,
|
||||
if (dn_rt_fill_info(skb, NETLINK_CB(cb->skb).portid,
|
||||
cb->nlh->nlmsg_seq, RTM_NEWROUTE,
|
||||
1, NLM_F_MULTI) <= 0) {
|
||||
skb_dst_drop(skb);
|
||||
|
|
|
|||
|
|
@ -291,14 +291,14 @@ static inline size_t dn_fib_nlmsg_size(struct dn_fib_info *fi)
|
|||
return payload;
|
||||
}
|
||||
|
||||
static int dn_fib_dump_info(struct sk_buff *skb, u32 pid, u32 seq, int event,
|
||||
static int dn_fib_dump_info(struct sk_buff *skb, u32 portid, u32 seq, int event,
|
||||
u32 tb_id, u8 type, u8 scope, void *dst, int dst_len,
|
||||
struct dn_fib_info *fi, unsigned int flags)
|
||||
{
|
||||
struct rtmsg *rtm;
|
||||
struct nlmsghdr *nlh;
|
||||
|
||||
nlh = nlmsg_put(skb, pid, seq, event, sizeof(*rtm), flags);
|
||||
nlh = nlmsg_put(skb, portid, seq, event, sizeof(*rtm), flags);
|
||||
if (!nlh)
|
||||
return -EMSGSIZE;
|
||||
|
||||
|
|
@ -374,14 +374,14 @@ static void dn_rtmsg_fib(int event, struct dn_fib_node *f, int z, u32 tb_id,
|
|||
struct nlmsghdr *nlh, struct netlink_skb_parms *req)
|
||||
{
|
||||
struct sk_buff *skb;
|
||||
u32 pid = req ? req->pid : 0;
|
||||
u32 portid = req ? req->portid : 0;
|
||||
int err = -ENOBUFS;
|
||||
|
||||
skb = nlmsg_new(dn_fib_nlmsg_size(DN_FIB_INFO(f)), GFP_KERNEL);
|
||||
if (skb == NULL)
|
||||
goto errout;
|
||||
|
||||
err = dn_fib_dump_info(skb, pid, nlh->nlmsg_seq, event, tb_id,
|
||||
err = dn_fib_dump_info(skb, portid, nlh->nlmsg_seq, event, tb_id,
|
||||
f->fn_type, f->fn_scope, &f->fn_key, z,
|
||||
DN_FIB_INFO(f), 0);
|
||||
if (err < 0) {
|
||||
|
|
@ -390,7 +390,7 @@ static void dn_rtmsg_fib(int event, struct dn_fib_node *f, int z, u32 tb_id,
|
|||
kfree_skb(skb);
|
||||
goto errout;
|
||||
}
|
||||
rtnl_notify(skb, &init_net, pid, RTNLGRP_DECnet_ROUTE, nlh, GFP_KERNEL);
|
||||
rtnl_notify(skb, &init_net, portid, RTNLGRP_DECnet_ROUTE, nlh, GFP_KERNEL);
|
||||
return;
|
||||
errout:
|
||||
if (err < 0)
|
||||
|
|
@ -411,7 +411,7 @@ static __inline__ int dn_hash_dump_bucket(struct sk_buff *skb,
|
|||
continue;
|
||||
if (f->fn_state & DN_S_ZOMBIE)
|
||||
continue;
|
||||
if (dn_fib_dump_info(skb, NETLINK_CB(cb->skb).pid,
|
||||
if (dn_fib_dump_info(skb, NETLINK_CB(cb->skb).portid,
|
||||
cb->nlh->nlmsg_seq,
|
||||
RTM_NEWROUTE,
|
||||
tb->n,
|
||||
|
|
|
|||
Loading…
Reference in a new issue