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