2
0
mirror of https://github.com/openvswitch/ovs synced 2025-10-25 15:07:05 +00:00

netlink: New function nl_msg_put_unspec_zero().

This function already had a few potential users, which this commit
converts.  An upcoming commit adds more users.

Signed-off-by: Ben Pfaff <blp@nicira.com>
This commit is contained in:
Ben Pfaff
2013-10-07 14:11:40 -07:00
parent d1ba66e9ff
commit 9ddf12cc12
3 changed files with 18 additions and 7 deletions

View File

@@ -220,6 +220,18 @@ nl_msg_put_unspec_uninit(struct ofpbuf *msg, uint16_t type, size_t size)
return nla + 1;
}
/* Appends a Netlink attribute of the given 'type' and room for 'size' bytes of
* data as its payload, plus Netlink padding if needed, to the tail end of
* 'msg', reallocating and copying its data if necessary. Returns a pointer to
* the first byte of data in the attribute, which is zeroed. */
void *
nl_msg_put_unspec_zero(struct ofpbuf *msg, uint16_t type, size_t size)
{
void *data = nl_msg_put_unspec_uninit(msg, type, size);
memset(data, 0, size);
return data;
}
/* Appends a Netlink attribute of the given 'type' and the 'size' bytes of
* 'data' as its payload, to the tail end of 'msg', reallocating and copying
* its data if necessary. Returns a pointer to the first byte of data in the