diff options
author | Patrick McHardy <kaber@trash.net> | 2008-01-23 23:34:11 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 18:11:18 -0500 |
commit | 4b3550ef530cfc153fa91f0b37cbda448bad11c6 (patch) | |
tree | 02aba7497298f220629af8e47f48e56df86d428f /net/sched/sch_cbq.c | |
parent | cee63723b358e594225e812d6e14a2a0abfd5c88 (diff) |
[NET_SCHED]: Use nla_nest_start/nla_nest_end
Use nla_nest_start/nla_nest_end for dumping nested attributes.
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched/sch_cbq.c')
-rw-r--r-- | net/sched/sch_cbq.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/net/sched/sch_cbq.c b/net/sched/sch_cbq.c index 585f8a6ec7ec..da0f6c0152de 100644 --- a/net/sched/sch_cbq.c +++ b/net/sched/sch_cbq.c | |||
@@ -1565,18 +1565,18 @@ static int cbq_dump_attr(struct sk_buff *skb, struct cbq_class *cl) | |||
1565 | static int cbq_dump(struct Qdisc *sch, struct sk_buff *skb) | 1565 | static int cbq_dump(struct Qdisc *sch, struct sk_buff *skb) |
1566 | { | 1566 | { |
1567 | struct cbq_sched_data *q = qdisc_priv(sch); | 1567 | struct cbq_sched_data *q = qdisc_priv(sch); |
1568 | unsigned char *b = skb_tail_pointer(skb); | 1568 | struct nlattr *nest; |
1569 | struct nlattr *nla; | ||
1570 | 1569 | ||
1571 | nla = (struct nlattr*)b; | 1570 | nest = nla_nest_start(skb, TCA_OPTIONS); |
1572 | NLA_PUT(skb, TCA_OPTIONS, 0, NULL); | 1571 | if (nest == NULL) |
1572 | goto nla_put_failure; | ||
1573 | if (cbq_dump_attr(skb, &q->link) < 0) | 1573 | if (cbq_dump_attr(skb, &q->link) < 0) |
1574 | goto nla_put_failure; | 1574 | goto nla_put_failure; |
1575 | nla->nla_len = skb_tail_pointer(skb) - b; | 1575 | nla_nest_end(skb, nest); |
1576 | return skb->len; | 1576 | return skb->len; |
1577 | 1577 | ||
1578 | nla_put_failure: | 1578 | nla_put_failure: |
1579 | nlmsg_trim(skb, b); | 1579 | nla_nest_cancel(skb, nest); |
1580 | return -1; | 1580 | return -1; |
1581 | } | 1581 | } |
1582 | 1582 | ||
@@ -1594,8 +1594,7 @@ cbq_dump_class(struct Qdisc *sch, unsigned long arg, | |||
1594 | struct sk_buff *skb, struct tcmsg *tcm) | 1594 | struct sk_buff *skb, struct tcmsg *tcm) |
1595 | { | 1595 | { |
1596 | struct cbq_class *cl = (struct cbq_class*)arg; | 1596 | struct cbq_class *cl = (struct cbq_class*)arg; |
1597 | unsigned char *b = skb_tail_pointer(skb); | 1597 | struct nlattr *nest; |
1598 | struct nlattr *nla; | ||
1599 | 1598 | ||
1600 | if (cl->tparent) | 1599 | if (cl->tparent) |
1601 | tcm->tcm_parent = cl->tparent->classid; | 1600 | tcm->tcm_parent = cl->tparent->classid; |
@@ -1604,15 +1603,16 @@ cbq_dump_class(struct Qdisc *sch, unsigned long arg, | |||
1604 | tcm->tcm_handle = cl->classid; | 1603 | tcm->tcm_handle = cl->classid; |
1605 | tcm->tcm_info = cl->q->handle; | 1604 | tcm->tcm_info = cl->q->handle; |
1606 | 1605 | ||
1607 | nla = (struct nlattr*)b; | 1606 | nest = nla_nest_start(skb, TCA_OPTIONS); |
1608 | NLA_PUT(skb, TCA_OPTIONS, 0, NULL); | 1607 | if (nest == NULL) |
1608 | goto nla_put_failure; | ||
1609 | if (cbq_dump_attr(skb, cl) < 0) | 1609 | if (cbq_dump_attr(skb, cl) < 0) |
1610 | goto nla_put_failure; | 1610 | goto nla_put_failure; |
1611 | nla->nla_len = skb_tail_pointer(skb) - b; | 1611 | nla_nest_end(skb, nest); |
1612 | return skb->len; | 1612 | return skb->len; |
1613 | 1613 | ||
1614 | nla_put_failure: | 1614 | nla_put_failure: |
1615 | nlmsg_trim(skb, b); | 1615 | nla_nest_cancel(skb, nest); |
1616 | return -1; | 1616 | return -1; |
1617 | } | 1617 | } |
1618 | 1618 | ||