aboutsummaryrefslogtreecommitdiffstats
path: root/net/sched/sch_api.c
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 /net/sched/sch_api.c
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 'net/sched/sch_api.c')
-rw-r--r--net/sched/sch_api.c44
1 files changed, 22 insertions, 22 deletions
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c
index a08b4ab3e421..a18d975db59c 100644
--- a/net/sched/sch_api.c
+++ b/net/sched/sch_api.c
@@ -1185,7 +1185,7 @@ graft:
1185} 1185}
1186 1186
1187static int tc_fill_qdisc(struct sk_buff *skb, struct Qdisc *q, u32 clid, 1187static int tc_fill_qdisc(struct sk_buff *skb, struct Qdisc *q, u32 clid,
1188 u32 pid, u32 seq, u16 flags, int event) 1188 u32 portid, u32 seq, u16 flags, int event)
1189{ 1189{
1190 struct tcmsg *tcm; 1190 struct tcmsg *tcm;
1191 struct nlmsghdr *nlh; 1191 struct nlmsghdr *nlh;
@@ -1193,7 +1193,7 @@ static int tc_fill_qdisc(struct sk_buff *skb, struct Qdisc *q, u32 clid,
1193 struct gnet_dump d; 1193 struct gnet_dump d;
1194 struct qdisc_size_table *stab; 1194 struct qdisc_size_table *stab;
1195 1195
1196 nlh = nlmsg_put(skb, pid, seq, event, sizeof(*tcm), flags); 1196 nlh = nlmsg_put(skb, portid, seq, event, sizeof(*tcm), flags);
1197 if (!nlh) 1197 if (!nlh)
1198 goto out_nlmsg_trim; 1198 goto out_nlmsg_trim;
1199 tcm = nlmsg_data(nlh); 1199 tcm = nlmsg_data(nlh);
@@ -1248,25 +1248,25 @@ static int qdisc_notify(struct net *net, struct sk_buff *oskb,
1248 struct Qdisc *old, struct Qdisc *new) 1248 struct Qdisc *old, struct Qdisc *new)
1249{ 1249{
1250 struct sk_buff *skb; 1250 struct sk_buff *skb;
1251 u32 pid = oskb ? NETLINK_CB(oskb).pid : 0; 1251 u32 portid = oskb ? NETLINK_CB(oskb).portid : 0;
1252 1252
1253 skb = alloc_skb(NLMSG_GOODSIZE, GFP_KERNEL); 1253 skb = alloc_skb(NLMSG_GOODSIZE, GFP_KERNEL);
1254 if (!skb) 1254 if (!skb)
1255 return -ENOBUFS; 1255 return -ENOBUFS;
1256 1256
1257 if (old && !tc_qdisc_dump_ignore(old)) { 1257 if (old && !tc_qdisc_dump_ignore(old)) {
1258 if (tc_fill_qdisc(skb, old, clid, pid, n->nlmsg_seq, 1258 if (tc_fill_qdisc(skb, old, clid, portid, n->nlmsg_seq,
1259 0, RTM_DELQDISC) < 0) 1259 0, RTM_DELQDISC) < 0)
1260 goto err_out; 1260 goto err_out;
1261 } 1261 }
1262 if (new && !tc_qdisc_dump_ignore(new)) { 1262 if (new && !tc_qdisc_dump_ignore(new)) {
1263 if (tc_fill_qdisc(skb, new, clid, pid, n->nlmsg_seq, 1263 if (tc_fill_qdisc(skb, new, clid, portid, n->nlmsg_seq,
1264 old ? NLM_F_REPLACE : 0, RTM_NEWQDISC) < 0) 1264 old ? NLM_F_REPLACE : 0, RTM_NEWQDISC) < 0)
1265 goto err_out; 1265 goto err_out;
1266 } 1266 }
1267 1267
1268 if (skb->len) 1268 if (skb->len)
1269 return rtnetlink_send(skb, net, pid, RTNLGRP_TC, 1269 return rtnetlink_send(skb, net, portid, RTNLGRP_TC,
1270 n->nlmsg_flags & NLM_F_ECHO); 1270 n->nlmsg_flags & NLM_F_ECHO);
1271 1271
1272err_out: 1272err_out:
@@ -1289,7 +1289,7 @@ static int tc_dump_qdisc_root(struct Qdisc *root, struct sk_buff *skb,
1289 q_idx++; 1289 q_idx++;
1290 } else { 1290 } else {
1291 if (!tc_qdisc_dump_ignore(q) && 1291 if (!tc_qdisc_dump_ignore(q) &&
1292 tc_fill_qdisc(skb, q, q->parent, NETLINK_CB(cb->skb).pid, 1292 tc_fill_qdisc(skb, q, q->parent, NETLINK_CB(cb->skb).portid,
1293 cb->nlh->nlmsg_seq, NLM_F_MULTI, RTM_NEWQDISC) <= 0) 1293 cb->nlh->nlmsg_seq, NLM_F_MULTI, RTM_NEWQDISC) <= 0)
1294 goto done; 1294 goto done;
1295 q_idx++; 1295 q_idx++;
@@ -1300,7 +1300,7 @@ static int tc_dump_qdisc_root(struct Qdisc *root, struct sk_buff *skb,
1300 continue; 1300 continue;
1301 } 1301 }
1302 if (!tc_qdisc_dump_ignore(q) && 1302 if (!tc_qdisc_dump_ignore(q) &&
1303 tc_fill_qdisc(skb, q, q->parent, NETLINK_CB(cb->skb).pid, 1303 tc_fill_qdisc(skb, q, q->parent, NETLINK_CB(cb->skb).portid,
1304 cb->nlh->nlmsg_seq, NLM_F_MULTI, RTM_NEWQDISC) <= 0) 1304 cb->nlh->nlmsg_seq, NLM_F_MULTI, RTM_NEWQDISC) <= 0)
1305 goto done; 1305 goto done;
1306 q_idx++; 1306 q_idx++;
@@ -1375,7 +1375,7 @@ static int tc_ctl_tclass(struct sk_buff *skb, struct nlmsghdr *n, void *arg)
1375 const struct Qdisc_class_ops *cops; 1375 const struct Qdisc_class_ops *cops;
1376 unsigned long cl = 0; 1376 unsigned long cl = 0;
1377 unsigned long new_cl; 1377 unsigned long new_cl;
1378 u32 pid = tcm->tcm_parent; 1378 u32 portid = tcm->tcm_parent;
1379 u32 clid = tcm->tcm_handle; 1379 u32 clid = tcm->tcm_handle;
1380 u32 qid = TC_H_MAJ(clid); 1380 u32 qid = TC_H_MAJ(clid);
1381 int err; 1381 int err;
@@ -1403,8 +1403,8 @@ static int tc_ctl_tclass(struct sk_buff *skb, struct nlmsghdr *n, void *arg)
1403 1403
1404 /* Step 1. Determine qdisc handle X:0 */ 1404 /* Step 1. Determine qdisc handle X:0 */
1405 1405
1406 if (pid != TC_H_ROOT) { 1406 if (portid != TC_H_ROOT) {
1407 u32 qid1 = TC_H_MAJ(pid); 1407 u32 qid1 = TC_H_MAJ(portid);
1408 1408
1409 if (qid && qid1) { 1409 if (qid && qid1) {
1410 /* If both majors are known, they must be identical. */ 1410 /* If both majors are known, they must be identical. */
@@ -1418,10 +1418,10 @@ static int tc_ctl_tclass(struct sk_buff *skb, struct nlmsghdr *n, void *arg)
1418 /* Now qid is genuine qdisc handle consistent 1418 /* Now qid is genuine qdisc handle consistent
1419 * both with parent and child. 1419 * both with parent and child.
1420 * 1420 *
1421 * TC_H_MAJ(pid) still may be unspecified, complete it now. 1421 * TC_H_MAJ(portid) still may be unspecified, complete it now.
1422 */ 1422 */
1423 if (pid) 1423 if (portid)
1424 pid = TC_H_MAKE(qid, pid); 1424 portid = TC_H_MAKE(qid, portid);
1425 } else { 1425 } else {
1426 if (qid == 0) 1426 if (qid == 0)
1427 qid = dev->qdisc->handle; 1427 qid = dev->qdisc->handle;
@@ -1439,7 +1439,7 @@ static int tc_ctl_tclass(struct sk_buff *skb, struct nlmsghdr *n, void *arg)
1439 1439
1440 /* Now try to get class */ 1440 /* Now try to get class */
1441 if (clid == 0) { 1441 if (clid == 0) {
1442 if (pid == TC_H_ROOT) 1442 if (portid == TC_H_ROOT)
1443 clid = qid; 1443 clid = qid;
1444 } else 1444 } else
1445 clid = TC_H_MAKE(qid, clid); 1445 clid = TC_H_MAKE(qid, clid);
@@ -1478,7 +1478,7 @@ static int tc_ctl_tclass(struct sk_buff *skb, struct nlmsghdr *n, void *arg)
1478 new_cl = cl; 1478 new_cl = cl;
1479 err = -EOPNOTSUPP; 1479 err = -EOPNOTSUPP;
1480 if (cops->change) 1480 if (cops->change)
1481 err = cops->change(q, clid, pid, tca, &new_cl); 1481 err = cops->change(q, clid, portid, tca, &new_cl);
1482 if (err == 0) 1482 if (err == 0)
1483 tclass_notify(net, skb, n, q, new_cl, RTM_NEWTCLASS); 1483 tclass_notify(net, skb, n, q, new_cl, RTM_NEWTCLASS);
1484 1484
@@ -1492,7 +1492,7 @@ out:
1492 1492
1493static int tc_fill_tclass(struct sk_buff *skb, struct Qdisc *q, 1493static int tc_fill_tclass(struct sk_buff *skb, struct Qdisc *q,
1494 unsigned long cl, 1494 unsigned long cl,
1495 u32 pid, u32 seq, u16 flags, int event) 1495 u32 portid, u32 seq, u16 flags, int event)
1496{ 1496{
1497 struct tcmsg *tcm; 1497 struct tcmsg *tcm;
1498 struct nlmsghdr *nlh; 1498 struct nlmsghdr *nlh;
@@ -1500,7 +1500,7 @@ static int tc_fill_tclass(struct sk_buff *skb, struct Qdisc *q,
1500 struct gnet_dump d; 1500 struct gnet_dump d;
1501 const struct Qdisc_class_ops *cl_ops = q->ops->cl_ops; 1501 const struct Qdisc_class_ops *cl_ops = q->ops->cl_ops;
1502 1502
1503 nlh = nlmsg_put(skb, pid, seq, event, sizeof(*tcm), flags); 1503 nlh = nlmsg_put(skb, portid, seq, event, sizeof(*tcm), flags);
1504 if (!nlh) 1504 if (!nlh)
1505 goto out_nlmsg_trim; 1505 goto out_nlmsg_trim;
1506 tcm = nlmsg_data(nlh); 1506 tcm = nlmsg_data(nlh);
@@ -1540,18 +1540,18 @@ static int tclass_notify(struct net *net, struct sk_buff *oskb,
1540 unsigned long cl, int event) 1540 unsigned long cl, int event)
1541{ 1541{
1542 struct sk_buff *skb; 1542 struct sk_buff *skb;
1543 u32 pid = oskb ? NETLINK_CB(oskb).pid : 0; 1543 u32 portid = oskb ? NETLINK_CB(oskb).portid : 0;
1544 1544
1545 skb = alloc_skb(NLMSG_GOODSIZE, GFP_KERNEL); 1545 skb = alloc_skb(NLMSG_GOODSIZE, GFP_KERNEL);
1546 if (!skb) 1546 if (!skb)
1547 return -ENOBUFS; 1547 return -ENOBUFS;
1548 1548
1549 if (tc_fill_tclass(skb, q, cl, pid, n->nlmsg_seq, 0, event) < 0) { 1549 if (tc_fill_tclass(skb, q, cl, portid, n->nlmsg_seq, 0, event) < 0) {
1550 kfree_skb(skb); 1550 kfree_skb(skb);
1551 return -EINVAL; 1551 return -EINVAL;
1552 } 1552 }
1553 1553
1554 return rtnetlink_send(skb, net, pid, RTNLGRP_TC, 1554 return rtnetlink_send(skb, net, portid, RTNLGRP_TC,
1555 n->nlmsg_flags & NLM_F_ECHO); 1555 n->nlmsg_flags & NLM_F_ECHO);
1556} 1556}
1557 1557
@@ -1565,7 +1565,7 @@ static int qdisc_class_dump(struct Qdisc *q, unsigned long cl, struct qdisc_walk
1565{ 1565{
1566 struct qdisc_dump_args *a = (struct qdisc_dump_args *)arg; 1566 struct qdisc_dump_args *a = (struct qdisc_dump_args *)arg;
1567 1567
1568 return tc_fill_tclass(a->skb, q, cl, NETLINK_CB(a->cb->skb).pid, 1568 return tc_fill_tclass(a->skb, q, cl, NETLINK_CB(a->cb->skb).portid,
1569 a->cb->nlh->nlmsg_seq, NLM_F_MULTI, RTM_NEWTCLASS); 1569 a->cb->nlh->nlmsg_seq, NLM_F_MULTI, RTM_NEWTCLASS);
1570} 1570}
1571 1571