diff options
author | Patrick McHardy <kaber@trash.net> | 2008-01-23 23:34:48 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 18:11:20 -0500 |
commit | 24beeab539c6f42c4a93e2ff7c3b5f272e60da45 (patch) | |
tree | eb1be7e7d8b3f0f3375bf0d12fd26851e518d9ca /net | |
parent | 57e1c487a4f5754cb77abeb00adb21faa88c484f (diff) |
[NET_SCHED]: Use typeful attribute construction helpers
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/sched/act_api.c | 2 | ||||
-rw-r--r-- | net/sched/act_ipt.c | 4 | ||||
-rw-r--r-- | net/sched/act_police.c | 5 | ||||
-rw-r--r-- | net/sched/cls_basic.c | 2 | ||||
-rw-r--r-- | net/sched/cls_fw.c | 4 | ||||
-rw-r--r-- | net/sched/cls_route.c | 8 | ||||
-rw-r--r-- | net/sched/cls_rsvp.h | 2 | ||||
-rw-r--r-- | net/sched/cls_tcindex.c | 11 | ||||
-rw-r--r-- | net/sched/cls_u32.c | 8 | ||||
-rw-r--r-- | net/sched/em_meta.c | 3 | ||||
-rw-r--r-- | net/sched/sch_atm.c | 8 |
11 files changed, 26 insertions, 31 deletions
diff --git a/net/sched/act_api.c b/net/sched/act_api.c index e33e43abe969..41fbd496abac 100644 --- a/net/sched/act_api.c +++ b/net/sched/act_api.c | |||
@@ -133,7 +133,7 @@ static int tcf_del_walker(struct sk_buff *skb, struct tc_action *a, | |||
133 | p = s_p; | 133 | p = s_p; |
134 | } | 134 | } |
135 | } | 135 | } |
136 | NLA_PUT(skb, TCA_FCNT, 4, &n_i); | 136 | NLA_PUT_U32(skb, TCA_FCNT, n_i); |
137 | nla_nest_end(skb, nest); | 137 | nla_nest_end(skb, nest); |
138 | 138 | ||
139 | return n_i; | 139 | return n_i; |
diff --git a/net/sched/act_ipt.c b/net/sched/act_ipt.c index ecda51da9c14..5dd701a7bc56 100644 --- a/net/sched/act_ipt.c +++ b/net/sched/act_ipt.c | |||
@@ -254,8 +254,8 @@ static int tcf_ipt_dump(struct sk_buff *skb, struct tc_action *a, int bind, int | |||
254 | strcpy(t->u.user.name, ipt->tcfi_t->u.kernel.target->name); | 254 | strcpy(t->u.user.name, ipt->tcfi_t->u.kernel.target->name); |
255 | 255 | ||
256 | NLA_PUT(skb, TCA_IPT_TARG, ipt->tcfi_t->u.user.target_size, t); | 256 | NLA_PUT(skb, TCA_IPT_TARG, ipt->tcfi_t->u.user.target_size, t); |
257 | NLA_PUT(skb, TCA_IPT_INDEX, 4, &ipt->tcf_index); | 257 | NLA_PUT_U32(skb, TCA_IPT_INDEX, ipt->tcf_index); |
258 | NLA_PUT(skb, TCA_IPT_HOOK, 4, &ipt->tcfi_hook); | 258 | NLA_PUT_U32(skb, TCA_IPT_HOOK, ipt->tcfi_hook); |
259 | NLA_PUT(skb, TCA_IPT_CNT, sizeof(struct tc_cnt), &c); | 259 | NLA_PUT(skb, TCA_IPT_CNT, sizeof(struct tc_cnt), &c); |
260 | NLA_PUT_STRING(skb, TCA_IPT_TABLE, ipt->tcfi_tname); | 260 | NLA_PUT_STRING(skb, TCA_IPT_TABLE, ipt->tcfi_tname); |
261 | tm.install = jiffies_to_clock_t(jiffies - ipt->tcf_tm.install); | 261 | tm.install = jiffies_to_clock_t(jiffies - ipt->tcf_tm.install); |
diff --git a/net/sched/act_police.c b/net/sched/act_police.c index ee2f1b64dd70..79db6bb8a5fd 100644 --- a/net/sched/act_police.c +++ b/net/sched/act_police.c | |||
@@ -339,10 +339,9 @@ tcf_act_police_dump(struct sk_buff *skb, struct tc_action *a, int bind, int ref) | |||
339 | memset(&opt.peakrate, 0, sizeof(opt.peakrate)); | 339 | memset(&opt.peakrate, 0, sizeof(opt.peakrate)); |
340 | NLA_PUT(skb, TCA_POLICE_TBF, sizeof(opt), &opt); | 340 | NLA_PUT(skb, TCA_POLICE_TBF, sizeof(opt), &opt); |
341 | if (police->tcfp_result) | 341 | if (police->tcfp_result) |
342 | NLA_PUT(skb, TCA_POLICE_RESULT, sizeof(int), | 342 | NLA_PUT_U32(skb, TCA_POLICE_RESULT, police->tcfp_result); |
343 | &police->tcfp_result); | ||
344 | if (police->tcfp_ewma_rate) | 343 | if (police->tcfp_ewma_rate) |
345 | NLA_PUT(skb, TCA_POLICE_AVRATE, 4, &police->tcfp_ewma_rate); | 344 | NLA_PUT_U32(skb, TCA_POLICE_AVRATE, police->tcfp_ewma_rate); |
346 | return skb->len; | 345 | return skb->len; |
347 | 346 | ||
348 | nla_put_failure: | 347 | nla_put_failure: |
diff --git a/net/sched/cls_basic.c b/net/sched/cls_basic.c index 6d08b429635e..58444fedf06e 100644 --- a/net/sched/cls_basic.c +++ b/net/sched/cls_basic.c | |||
@@ -258,7 +258,7 @@ static int basic_dump(struct tcf_proto *tp, unsigned long fh, | |||
258 | goto nla_put_failure; | 258 | goto nla_put_failure; |
259 | 259 | ||
260 | if (f->res.classid) | 260 | if (f->res.classid) |
261 | NLA_PUT(skb, TCA_BASIC_CLASSID, sizeof(u32), &f->res.classid); | 261 | NLA_PUT_U32(skb, TCA_BASIC_CLASSID, f->res.classid); |
262 | 262 | ||
263 | if (tcf_exts_dump(skb, &f->exts, &basic_ext_map) < 0 || | 263 | if (tcf_exts_dump(skb, &f->exts, &basic_ext_map) < 0 || |
264 | tcf_em_tree_dump(skb, &f->ematches, TCA_BASIC_EMATCHES) < 0) | 264 | tcf_em_tree_dump(skb, &f->ematches, TCA_BASIC_EMATCHES) < 0) |
diff --git a/net/sched/cls_fw.c b/net/sched/cls_fw.c index 31074735d1bd..61ebe25e5f77 100644 --- a/net/sched/cls_fw.c +++ b/net/sched/cls_fw.c | |||
@@ -349,13 +349,13 @@ static int fw_dump(struct tcf_proto *tp, unsigned long fh, | |||
349 | goto nla_put_failure; | 349 | goto nla_put_failure; |
350 | 350 | ||
351 | if (f->res.classid) | 351 | if (f->res.classid) |
352 | NLA_PUT(skb, TCA_FW_CLASSID, 4, &f->res.classid); | 352 | NLA_PUT_U32(skb, TCA_FW_CLASSID, f->res.classid); |
353 | #ifdef CONFIG_NET_CLS_IND | 353 | #ifdef CONFIG_NET_CLS_IND |
354 | if (strlen(f->indev)) | 354 | if (strlen(f->indev)) |
355 | NLA_PUT_STRING(skb, TCA_FW_INDEV, f->indev); | 355 | NLA_PUT_STRING(skb, TCA_FW_INDEV, f->indev); |
356 | #endif /* CONFIG_NET_CLS_IND */ | 356 | #endif /* CONFIG_NET_CLS_IND */ |
357 | if (head->mask != 0xFFFFFFFF) | 357 | if (head->mask != 0xFFFFFFFF) |
358 | NLA_PUT(skb, TCA_FW_MASK, 4, &head->mask); | 358 | NLA_PUT_U32(skb, TCA_FW_MASK, head->mask); |
359 | 359 | ||
360 | if (tcf_exts_dump(skb, &f->exts, &fw_ext_map) < 0) | 360 | if (tcf_exts_dump(skb, &f->exts, &fw_ext_map) < 0) |
361 | goto nla_put_failure; | 361 | goto nla_put_failure; |
diff --git a/net/sched/cls_route.c b/net/sched/cls_route.c index 1ce1f3623d65..7752586e918d 100644 --- a/net/sched/cls_route.c +++ b/net/sched/cls_route.c | |||
@@ -565,17 +565,17 @@ static int route4_dump(struct tcf_proto *tp, unsigned long fh, | |||
565 | 565 | ||
566 | if (!(f->handle&0x8000)) { | 566 | if (!(f->handle&0x8000)) { |
567 | id = f->id&0xFF; | 567 | id = f->id&0xFF; |
568 | NLA_PUT(skb, TCA_ROUTE4_TO, sizeof(id), &id); | 568 | NLA_PUT_U32(skb, TCA_ROUTE4_TO, id); |
569 | } | 569 | } |
570 | if (f->handle&0x80000000) { | 570 | if (f->handle&0x80000000) { |
571 | if ((f->handle>>16) != 0xFFFF) | 571 | if ((f->handle>>16) != 0xFFFF) |
572 | NLA_PUT(skb, TCA_ROUTE4_IIF, sizeof(f->iif), &f->iif); | 572 | NLA_PUT_U32(skb, TCA_ROUTE4_IIF, f->iif); |
573 | } else { | 573 | } else { |
574 | id = f->id>>16; | 574 | id = f->id>>16; |
575 | NLA_PUT(skb, TCA_ROUTE4_FROM, sizeof(id), &id); | 575 | NLA_PUT_U32(skb, TCA_ROUTE4_FROM, id); |
576 | } | 576 | } |
577 | if (f->res.classid) | 577 | if (f->res.classid) |
578 | NLA_PUT(skb, TCA_ROUTE4_CLASSID, 4, &f->res.classid); | 578 | NLA_PUT_U32(skb, TCA_ROUTE4_CLASSID, f->res.classid); |
579 | 579 | ||
580 | if (tcf_exts_dump(skb, &f->exts, &route_ext_map) < 0) | 580 | if (tcf_exts_dump(skb, &f->exts, &route_ext_map) < 0) |
581 | goto nla_put_failure; | 581 | goto nla_put_failure; |
diff --git a/net/sched/cls_rsvp.h b/net/sched/cls_rsvp.h index 77097e023f77..838a3ff5a2cc 100644 --- a/net/sched/cls_rsvp.h +++ b/net/sched/cls_rsvp.h | |||
@@ -617,7 +617,7 @@ static int rsvp_dump(struct tcf_proto *tp, unsigned long fh, | |||
617 | pinfo.pad = 0; | 617 | pinfo.pad = 0; |
618 | NLA_PUT(skb, TCA_RSVP_PINFO, sizeof(pinfo), &pinfo); | 618 | NLA_PUT(skb, TCA_RSVP_PINFO, sizeof(pinfo), &pinfo); |
619 | if (f->res.classid) | 619 | if (f->res.classid) |
620 | NLA_PUT(skb, TCA_RSVP_CLASSID, 4, &f->res.classid); | 620 | NLA_PUT_U32(skb, TCA_RSVP_CLASSID, f->res.classid); |
621 | if (((f->handle>>8)&0xFF) != 16) | 621 | if (((f->handle>>8)&0xFF) != 16) |
622 | NLA_PUT(skb, TCA_RSVP_SRC, sizeof(f->src), f->src); | 622 | NLA_PUT(skb, TCA_RSVP_SRC, sizeof(f->src), f->src); |
623 | 623 | ||
diff --git a/net/sched/cls_tcindex.c b/net/sched/cls_tcindex.c index cd350d38bdaf..7d46df7eac09 100644 --- a/net/sched/cls_tcindex.c +++ b/net/sched/cls_tcindex.c | |||
@@ -449,11 +449,10 @@ static int tcindex_dump(struct tcf_proto *tp, unsigned long fh, | |||
449 | 449 | ||
450 | if (!fh) { | 450 | if (!fh) { |
451 | t->tcm_handle = ~0; /* whatever ... */ | 451 | t->tcm_handle = ~0; /* whatever ... */ |
452 | NLA_PUT(skb, TCA_TCINDEX_HASH, sizeof(p->hash), &p->hash); | 452 | NLA_PUT_U32(skb, TCA_TCINDEX_HASH, p->hash); |
453 | NLA_PUT(skb, TCA_TCINDEX_MASK, sizeof(p->mask), &p->mask); | 453 | NLA_PUT_U16(skb, TCA_TCINDEX_MASK, p->mask); |
454 | NLA_PUT(skb, TCA_TCINDEX_SHIFT, sizeof(p->shift), &p->shift); | 454 | NLA_PUT_U32(skb, TCA_TCINDEX_SHIFT, p->shift); |
455 | NLA_PUT(skb, TCA_TCINDEX_FALL_THROUGH, sizeof(p->fall_through), | 455 | NLA_PUT_U32(skb, TCA_TCINDEX_FALL_THROUGH, p->fall_through); |
456 | &p->fall_through); | ||
457 | nla_nest_end(skb, nest); | 456 | nla_nest_end(skb, nest); |
458 | } else { | 457 | } else { |
459 | if (p->perfect) { | 458 | if (p->perfect) { |
@@ -473,7 +472,7 @@ static int tcindex_dump(struct tcf_proto *tp, unsigned long fh, | |||
473 | } | 472 | } |
474 | pr_debug("handle = %d\n", t->tcm_handle); | 473 | pr_debug("handle = %d\n", t->tcm_handle); |
475 | if (r->res.class) | 474 | if (r->res.class) |
476 | NLA_PUT(skb, TCA_TCINDEX_CLASSID, 4, &r->res.classid); | 475 | NLA_PUT_U32(skb, TCA_TCINDEX_CLASSID, r->res.classid); |
477 | 476 | ||
478 | if (tcf_exts_dump(skb, &r->exts, &tcindex_ext_map) < 0) | 477 | if (tcf_exts_dump(skb, &r->exts, &tcindex_ext_map) < 0) |
479 | goto nla_put_failure; | 478 | goto nla_put_failure; |
diff --git a/net/sched/cls_u32.c b/net/sched/cls_u32.c index 7a1502553b30..326711eb593c 100644 --- a/net/sched/cls_u32.c +++ b/net/sched/cls_u32.c | |||
@@ -708,19 +708,19 @@ static int u32_dump(struct tcf_proto *tp, unsigned long fh, | |||
708 | if (TC_U32_KEY(n->handle) == 0) { | 708 | if (TC_U32_KEY(n->handle) == 0) { |
709 | struct tc_u_hnode *ht = (struct tc_u_hnode*)fh; | 709 | struct tc_u_hnode *ht = (struct tc_u_hnode*)fh; |
710 | u32 divisor = ht->divisor+1; | 710 | u32 divisor = ht->divisor+1; |
711 | NLA_PUT(skb, TCA_U32_DIVISOR, 4, &divisor); | 711 | NLA_PUT_U32(skb, TCA_U32_DIVISOR, divisor); |
712 | } else { | 712 | } else { |
713 | NLA_PUT(skb, TCA_U32_SEL, | 713 | NLA_PUT(skb, TCA_U32_SEL, |
714 | sizeof(n->sel) + n->sel.nkeys*sizeof(struct tc_u32_key), | 714 | sizeof(n->sel) + n->sel.nkeys*sizeof(struct tc_u32_key), |
715 | &n->sel); | 715 | &n->sel); |
716 | if (n->ht_up) { | 716 | if (n->ht_up) { |
717 | u32 htid = n->handle & 0xFFFFF000; | 717 | u32 htid = n->handle & 0xFFFFF000; |
718 | NLA_PUT(skb, TCA_U32_HASH, 4, &htid); | 718 | NLA_PUT_U32(skb, TCA_U32_HASH, htid); |
719 | } | 719 | } |
720 | if (n->res.classid) | 720 | if (n->res.classid) |
721 | NLA_PUT(skb, TCA_U32_CLASSID, 4, &n->res.classid); | 721 | NLA_PUT_U32(skb, TCA_U32_CLASSID, n->res.classid); |
722 | if (n->ht_down) | 722 | if (n->ht_down) |
723 | NLA_PUT(skb, TCA_U32_LINK, 4, &n->ht_down->handle); | 723 | NLA_PUT_U32(skb, TCA_U32_LINK, n->ht_down->handle); |
724 | 724 | ||
725 | #ifdef CONFIG_CLS_U32_MARK | 725 | #ifdef CONFIG_CLS_U32_MARK |
726 | if (n->mark.val || n->mark.mask) | 726 | if (n->mark.val || n->mark.mask) |
diff --git a/net/sched/em_meta.c b/net/sched/em_meta.c index dd5723670d31..63ae6a230c4f 100644 --- a/net/sched/em_meta.c +++ b/net/sched/em_meta.c | |||
@@ -623,8 +623,7 @@ static int meta_int_dump(struct sk_buff *skb, struct meta_value *v, int tlv) | |||
623 | if (v->len == sizeof(unsigned long)) | 623 | if (v->len == sizeof(unsigned long)) |
624 | NLA_PUT(skb, tlv, sizeof(unsigned long), &v->val); | 624 | NLA_PUT(skb, tlv, sizeof(unsigned long), &v->val); |
625 | else if (v->len == sizeof(u32)) { | 625 | else if (v->len == sizeof(u32)) { |
626 | u32 d = v->val; | 626 | NLA_PUT_U32(skb, tlv, v->val); |
627 | NLA_PUT(skb, tlv, sizeof(d), &d); | ||
628 | } | 627 | } |
629 | 628 | ||
630 | return 0; | 629 | return 0; |
diff --git a/net/sched/sch_atm.c b/net/sched/sch_atm.c index 19c00074ba1f..4d876598d7df 100644 --- a/net/sched/sch_atm.c +++ b/net/sched/sch_atm.c | |||
@@ -629,14 +629,12 @@ static int atm_tc_dump_class(struct Qdisc *sch, unsigned long cl, | |||
629 | pvc.sap_addr.vci = flow->vcc->vci; | 629 | pvc.sap_addr.vci = flow->vcc->vci; |
630 | NLA_PUT(skb, TCA_ATM_ADDR, sizeof(pvc), &pvc); | 630 | NLA_PUT(skb, TCA_ATM_ADDR, sizeof(pvc), &pvc); |
631 | state = ATM_VF2VS(flow->vcc->flags); | 631 | state = ATM_VF2VS(flow->vcc->flags); |
632 | NLA_PUT(skb, TCA_ATM_STATE, sizeof(state), &state); | 632 | NLA_PUT_U32(skb, TCA_ATM_STATE, state); |
633 | } | 633 | } |
634 | if (flow->excess) | 634 | if (flow->excess) |
635 | NLA_PUT(skb, TCA_ATM_EXCESS, sizeof(u32), &flow->classid); | 635 | NLA_PUT_U32(skb, TCA_ATM_EXCESS, flow->classid); |
636 | else { | 636 | else { |
637 | static u32 zero; | 637 | NLA_PUT_U32(skb, TCA_ATM_EXCESS, 0); |
638 | |||
639 | NLA_PUT(skb, TCA_ATM_EXCESS, sizeof(zero), &zero); | ||
640 | } | 638 | } |
641 | 639 | ||
642 | nla_nest_end(skb, nest); | 640 | nla_nest_end(skb, nest); |