diff options
author | Patrick McHardy <kaber@trash.net> | 2008-01-23 20:34:48 -0800 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 15:11:20 -0800 |
commit | 24beeab539c6f42c4a93e2ff7c3b5f272e60da45 (patch) | |
tree | eb1be7e7d8b3f0f3375bf0d12fd26851e518d9ca | |
parent | 57e1c487a4f5754cb77abeb00adb21faa88c484f (diff) | |
download | linux-3.10-24beeab539c6f42c4a93e2ff7c3b5f272e60da45.tar.gz linux-3.10-24beeab539c6f42c4a93e2ff7c3b5f272e60da45.tar.bz2 linux-3.10-24beeab539c6f42c4a93e2ff7c3b5f272e60da45.zip |
[NET_SCHED]: Use typeful attribute construction helpers
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.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 e33e43abe96..41fbd496aba 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, p = s_p; } } - NLA_PUT(skb, TCA_FCNT, 4, &n_i); + NLA_PUT_U32(skb, TCA_FCNT, n_i); nla_nest_end(skb, nest); return n_i; diff --git a/net/sched/act_ipt.c b/net/sched/act_ipt.c index ecda51da9c1..5dd701a7bc5 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 strcpy(t->u.user.name, ipt->tcfi_t->u.kernel.target->name); NLA_PUT(skb, TCA_IPT_TARG, ipt->tcfi_t->u.user.target_size, t); - NLA_PUT(skb, TCA_IPT_INDEX, 4, &ipt->tcf_index); - NLA_PUT(skb, TCA_IPT_HOOK, 4, &ipt->tcfi_hook); + NLA_PUT_U32(skb, TCA_IPT_INDEX, ipt->tcf_index); + NLA_PUT_U32(skb, TCA_IPT_HOOK, ipt->tcfi_hook); NLA_PUT(skb, TCA_IPT_CNT, sizeof(struct tc_cnt), &c); NLA_PUT_STRING(skb, TCA_IPT_TABLE, ipt->tcfi_tname); 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 ee2f1b64dd7..79db6bb8a5f 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) memset(&opt.peakrate, 0, sizeof(opt.peakrate)); NLA_PUT(skb, TCA_POLICE_TBF, sizeof(opt), &opt); if (police->tcfp_result) - NLA_PUT(skb, TCA_POLICE_RESULT, sizeof(int), - &police->tcfp_result); + NLA_PUT_U32(skb, TCA_POLICE_RESULT, police->tcfp_result); if (police->tcfp_ewma_rate) - NLA_PUT(skb, TCA_POLICE_AVRATE, 4, &police->tcfp_ewma_rate); + NLA_PUT_U32(skb, TCA_POLICE_AVRATE, police->tcfp_ewma_rate); return skb->len; nla_put_failure: diff --git a/net/sched/cls_basic.c b/net/sched/cls_basic.c index 6d08b429635..58444fedf06 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, goto nla_put_failure; if (f->res.classid) - NLA_PUT(skb, TCA_BASIC_CLASSID, sizeof(u32), &f->res.classid); + NLA_PUT_U32(skb, TCA_BASIC_CLASSID, f->res.classid); if (tcf_exts_dump(skb, &f->exts, &basic_ext_map) < 0 || 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 31074735d1b..61ebe25e5f7 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, goto nla_put_failure; if (f->res.classid) - NLA_PUT(skb, TCA_FW_CLASSID, 4, &f->res.classid); + NLA_PUT_U32(skb, TCA_FW_CLASSID, f->res.classid); #ifdef CONFIG_NET_CLS_IND if (strlen(f->indev)) NLA_PUT_STRING(skb, TCA_FW_INDEV, f->indev); #endif /* CONFIG_NET_CLS_IND */ if (head->mask != 0xFFFFFFFF) - NLA_PUT(skb, TCA_FW_MASK, 4, &head->mask); + NLA_PUT_U32(skb, TCA_FW_MASK, head->mask); if (tcf_exts_dump(skb, &f->exts, &fw_ext_map) < 0) goto nla_put_failure; diff --git a/net/sched/cls_route.c b/net/sched/cls_route.c index 1ce1f3623d6..7752586e918 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, if (!(f->handle&0x8000)) { id = f->id&0xFF; - NLA_PUT(skb, TCA_ROUTE4_TO, sizeof(id), &id); + NLA_PUT_U32(skb, TCA_ROUTE4_TO, id); } if (f->handle&0x80000000) { if ((f->handle>>16) != 0xFFFF) - NLA_PUT(skb, TCA_ROUTE4_IIF, sizeof(f->iif), &f->iif); + NLA_PUT_U32(skb, TCA_ROUTE4_IIF, f->iif); } else { id = f->id>>16; - NLA_PUT(skb, TCA_ROUTE4_FROM, sizeof(id), &id); + NLA_PUT_U32(skb, TCA_ROUTE4_FROM, id); } if (f->res.classid) - NLA_PUT(skb, TCA_ROUTE4_CLASSID, 4, &f->res.classid); + NLA_PUT_U32(skb, TCA_ROUTE4_CLASSID, f->res.classid); if (tcf_exts_dump(skb, &f->exts, &route_ext_map) < 0) goto nla_put_failure; diff --git a/net/sched/cls_rsvp.h b/net/sched/cls_rsvp.h index 77097e023f7..838a3ff5a2c 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, pinfo.pad = 0; NLA_PUT(skb, TCA_RSVP_PINFO, sizeof(pinfo), &pinfo); if (f->res.classid) - NLA_PUT(skb, TCA_RSVP_CLASSID, 4, &f->res.classid); + NLA_PUT_U32(skb, TCA_RSVP_CLASSID, f->res.classid); if (((f->handle>>8)&0xFF) != 16) NLA_PUT(skb, TCA_RSVP_SRC, sizeof(f->src), f->src); diff --git a/net/sched/cls_tcindex.c b/net/sched/cls_tcindex.c index cd350d38bda..7d46df7eac0 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, if (!fh) { t->tcm_handle = ~0; /* whatever ... */ - NLA_PUT(skb, TCA_TCINDEX_HASH, sizeof(p->hash), &p->hash); - NLA_PUT(skb, TCA_TCINDEX_MASK, sizeof(p->mask), &p->mask); - NLA_PUT(skb, TCA_TCINDEX_SHIFT, sizeof(p->shift), &p->shift); - NLA_PUT(skb, TCA_TCINDEX_FALL_THROUGH, sizeof(p->fall_through), - &p->fall_through); + NLA_PUT_U32(skb, TCA_TCINDEX_HASH, p->hash); + NLA_PUT_U16(skb, TCA_TCINDEX_MASK, p->mask); + NLA_PUT_U32(skb, TCA_TCINDEX_SHIFT, p->shift); + NLA_PUT_U32(skb, TCA_TCINDEX_FALL_THROUGH, p->fall_through); nla_nest_end(skb, nest); } else { if (p->perfect) { @@ -473,7 +472,7 @@ static int tcindex_dump(struct tcf_proto *tp, unsigned long fh, } pr_debug("handle = %d\n", t->tcm_handle); if (r->res.class) - NLA_PUT(skb, TCA_TCINDEX_CLASSID, 4, &r->res.classid); + NLA_PUT_U32(skb, TCA_TCINDEX_CLASSID, r->res.classid); if (tcf_exts_dump(skb, &r->exts, &tcindex_ext_map) < 0) goto nla_put_failure; diff --git a/net/sched/cls_u32.c b/net/sched/cls_u32.c index 7a1502553b3..326711eb593 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, if (TC_U32_KEY(n->handle) == 0) { struct tc_u_hnode *ht = (struct tc_u_hnode*)fh; u32 divisor = ht->divisor+1; - NLA_PUT(skb, TCA_U32_DIVISOR, 4, &divisor); + NLA_PUT_U32(skb, TCA_U32_DIVISOR, divisor); } else { NLA_PUT(skb, TCA_U32_SEL, sizeof(n->sel) + n->sel.nkeys*sizeof(struct tc_u32_key), &n->sel); if (n->ht_up) { u32 htid = n->handle & 0xFFFFF000; - NLA_PUT(skb, TCA_U32_HASH, 4, &htid); + NLA_PUT_U32(skb, TCA_U32_HASH, htid); } if (n->res.classid) - NLA_PUT(skb, TCA_U32_CLASSID, 4, &n->res.classid); + NLA_PUT_U32(skb, TCA_U32_CLASSID, n->res.classid); if (n->ht_down) - NLA_PUT(skb, TCA_U32_LINK, 4, &n->ht_down->handle); + NLA_PUT_U32(skb, TCA_U32_LINK, n->ht_down->handle); #ifdef CONFIG_CLS_U32_MARK if (n->mark.val || n->mark.mask) diff --git a/net/sched/em_meta.c b/net/sched/em_meta.c index dd5723670d3..63ae6a230c4 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) if (v->len == sizeof(unsigned long)) NLA_PUT(skb, tlv, sizeof(unsigned long), &v->val); else if (v->len == sizeof(u32)) { - u32 d = v->val; - NLA_PUT(skb, tlv, sizeof(d), &d); + NLA_PUT_U32(skb, tlv, v->val); } return 0; diff --git a/net/sched/sch_atm.c b/net/sched/sch_atm.c index 19c00074ba1..4d876598d7d 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, pvc.sap_addr.vci = flow->vcc->vci; NLA_PUT(skb, TCA_ATM_ADDR, sizeof(pvc), &pvc); state = ATM_VF2VS(flow->vcc->flags); - NLA_PUT(skb, TCA_ATM_STATE, sizeof(state), &state); + NLA_PUT_U32(skb, TCA_ATM_STATE, state); } if (flow->excess) - NLA_PUT(skb, TCA_ATM_EXCESS, sizeof(u32), &flow->classid); + NLA_PUT_U32(skb, TCA_ATM_EXCESS, flow->classid); else { - static u32 zero; - - NLA_PUT(skb, TCA_ATM_EXCESS, sizeof(zero), &zero); + NLA_PUT_U32(skb, TCA_ATM_EXCESS, 0); } nla_nest_end(skb, nest); |