packages: net: wprobe: get rid of NLA_PUT_* macros

Similar to r33906, use the functions directly to allow compilation for
linux 3.6.

Signed-off-by: Jonas Gorski <jogo@openwrt.org>

git-svn-id: svn://svn.openwrt.org/openwrt/packages@34319 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
jogo 2012-11-24 11:03:01 +00:00
parent fced2ecedb
commit 3de4f48885

View File

@ -444,33 +444,44 @@ wprobe_send_item_value(struct sk_buff *msg, struct netlink_callback *cb,
hdr = genlmsg_put(msg, NETLINK_CB(cb->skb).pid, cb->nlh->nlmsg_seq,
&wprobe_fam, NLM_F_MULTI, WPROBE_CMD_GET_INFO);
NLA_PUT_U32(msg, WPROBE_ATTR_ID, i);
NLA_PUT_U32(msg, WPROBE_ATTR_FLAGS, flags);
NLA_PUT_U8(msg, WPROBE_ATTR_TYPE, item[i].type);
NLA_PUT_U64(msg, WPROBE_ATTR_DURATION, time);
if (nla_put_u32(msg, WPROBE_ATTR_ID, i))
goto nla_put_failure;
if (nla_put_u32(msg, WPROBE_ATTR_FLAGS, flags))
goto nla_put_failure;
if (nla_put_u8(msg, WPROBE_ATTR_TYPE, item[i].type))
goto nla_put_failure;
if (nla_put_u64(msg, WPROBE_ATTR_DURATION, time))
goto nla_put_failure;
switch(item[i].type) {
case WPROBE_VAL_S8:
case WPROBE_VAL_U8:
NLA_PUT_U8(msg, item[i].type, val[i].U8);
if (nla_put_u8(msg, item[i].type, val[i].U8))
goto nla_put_failure;
break;
case WPROBE_VAL_S16:
case WPROBE_VAL_U16:
NLA_PUT_U16(msg, item[i].type, val[i].U16);
if (nla_put_u16(msg, item[i].type, val[i].U16))
goto nla_put_failure;
break;
case WPROBE_VAL_S32:
case WPROBE_VAL_U32:
NLA_PUT_U32(msg, item[i].type, val[i].U32);
if (nla_put_u32(msg, item[i].type, val[i].U32))
goto nla_put_failure;
break;
case WPROBE_VAL_S64:
case WPROBE_VAL_U64:
NLA_PUT_U64(msg, item[i].type, val[i].U64);
if (nla_put_u64(msg, item[i].type, val[i].U64))
goto nla_put_failure;
break;
case WPROBE_VAL_STRING:
if (val[i].STRING)
NLA_PUT_STRING(msg, item[i].type, val[i].STRING);
else
NLA_PUT_STRING(msg, item[i].type, "");
if (val[i].STRING) {
if (nla_put_string(msg, item[i].type, val[i].STRING))
goto nla_put_failure;
} else {
if (nla_put_string(msg, item[i].type, ""))
goto nla_put_failure;
}
/* bypass avg/stdev */
goto done;
default:
@ -478,10 +489,14 @@ wprobe_send_item_value(struct sk_buff *msg, struct netlink_callback *cb,
goto done;
}
if (item[i].flags & WPROBE_F_KEEPSTAT) {
NLA_PUT_U64(msg, WPROBE_VAL_SUM, val[i].s);
NLA_PUT_U64(msg, WPROBE_VAL_SUM_SQ, val[i].ss);
NLA_PUT_U32(msg, WPROBE_VAL_SAMPLES, (u32) val[i].n);
NLA_PUT_MSECS(msg, WPROBE_VAL_SCALE_TIME, val[i].scale_timestamp);
if (nla_put_u64(msg, WPROBE_VAL_SUM, val[i].s))
goto nla_put_failure;
if (nla_put_u64(msg, WPROBE_VAL_SUM_SQ, val[i].ss))
goto nla_put_failure;
if (nla_put_u32(msg, WPROBE_VAL_SAMPLES, (u32) val[i].n))
goto nla_put_failure;
if (nla_put_msecs(msg, WPROBE_VAL_SCALE_TIME, val[i].scale_timestamp))
goto nla_put_failure;
}
done:
genlmsg_end(msg, hdr);
@ -502,12 +517,18 @@ wprobe_send_item_info(struct sk_buff *msg, struct netlink_callback *cb,
hdr = genlmsg_put(msg, NETLINK_CB(cb->skb).pid, cb->nlh->nlmsg_seq,
&wprobe_fam, NLM_F_MULTI, WPROBE_CMD_GET_LIST);
if ((i == 0) && (dev->addr != NULL))
NLA_PUT(msg, WPROBE_ATTR_MAC, 6, dev->addr);
NLA_PUT_U32(msg, WPROBE_ATTR_ID, (u32) i);
NLA_PUT_STRING(msg, WPROBE_ATTR_NAME, item[i].name);
NLA_PUT_U8(msg, WPROBE_ATTR_TYPE, item[i].type);
NLA_PUT_U32(msg, WPROBE_ATTR_FLAGS, item[i].flags);
if ((i == 0) && (dev->addr != NULL)) {
if (nla_put(msg, WPROBE_ATTR_MAC, 6, dev->addr))
goto nla_put_failure;
}
if (nla_put_u32(msg, WPROBE_ATTR_ID, (u32) i))
goto nla_put_failure;
if (nla_put_string(msg, WPROBE_ATTR_NAME, item[i].name))
goto nla_put_failure;
if (nla_put_u8(msg, WPROBE_ATTR_TYPE, item[i].type))
goto nla_put_failure;
if (nla_put_u32(msg, WPROBE_ATTR_FLAGS, item[i].flags))
goto nla_put_failure;
genlmsg_end(msg, hdr);
return true;
@ -541,16 +562,20 @@ wprobe_dump_filter_group(struct sk_buff *msg, struct wprobe_filter_group *fg, st
if (!hdr)
return false;
NLA_PUT_STRING(msg, WPROBE_ATTR_NAME, fg->name);
if (nla_put_string(msg, WPROBE_ATTR_NAME, fg->name))
goto nla_put_failure;
group = nla_nest_start(msg, WPROBE_ATTR_FILTER_GROUP);
for (i = 0; i < fg->n_items; i++) {
struct wprobe_filter_item *fi = fg->items[i];
struct wprobe_filter_counter *fc = &fg->counters[i];
item = nla_nest_start(msg, WPROBE_ATTR_FILTER_GROUP);
NLA_PUT_STRING(msg, WPROBE_ATTR_NAME, fi->hdr.name);
NLA_PUT_U64(msg, WPROBE_ATTR_RXCOUNT, fc->rx);
NLA_PUT_U64(msg, WPROBE_ATTR_TXCOUNT, fc->tx);
if (nla_put_string(msg, WPROBE_ATTR_NAME, fi->hdr.name))
goto nla_put_failure;
if (nla_put_u64(msg, WPROBE_ATTR_RXCOUNT, fc->rx))
goto nla_put_failure;
if (nla_put_u64(msg, WPROBE_ATTR_TXCOUNT, fc->tx))
goto nla_put_failure;
nla_nest_end(msg, item);
}
@ -619,7 +644,8 @@ wprobe_dump_link(struct sk_buff *msg, struct wprobe_link *l, struct netlink_call
if (!hdr)
return false;
NLA_PUT(msg, WPROBE_ATTR_MAC, 6, l->addr);
if (nla_put(msg, WPROBE_ATTR_MAC, 6, l->addr))
goto nla_put_failure;
genlmsg_end(msg, hdr);
return true;