netlink: whitespace fix in netlink_message_writer.h.

Reported by:	garga
MFC after:	2 weeks
This commit is contained in:
Alexander V. Chernikov 2023-05-01 14:45:45 +00:00
parent a58648a68b
commit 88406e631e

View File

@ -186,7 +186,7 @@ nlmsg_reply(struct nl_writer *nw, const struct nlmsghdr *hdr, int payload_len)
hdr->nlmsg_flags, payload_len));
}
#define nlmsg_data(_hdr) ((void *)((_hdr) + 1))
#define nlmsg_data(_hdr) ((void *)((_hdr) + 1))
/*
* KPI similar to mtodo():
@ -196,7 +196,7 @@ nlmsg_reply(struct nl_writer *nw, const struct nlmsghdr *hdr, int payload_len)
static inline int
nlattr_save_offset(const struct nl_writer *nw)
{
return (nw->offset - ((char *)nw->hdr - nw->data));
return (nw->offset - ((char *)nw->hdr - nw->data));
}
static inline void *
@ -218,16 +218,16 @@ nlmsg_reserve_data_raw(struct nl_writer *nw, size_t sz)
{
sz = NETLINK_ALIGN(sz);
if (__predict_false(nw->offset + sz > nw->alloc_len)) {
if (__predict_false(nw->offset + sz > nw->alloc_len)) {
if (!nlmsg_refill_buffer(nw, sz))
return (NULL);
}
}
void *data_ptr = &nw->data[nw->offset];
nw->offset += sz;
void *data_ptr = &nw->data[nw->offset];
nw->offset += sz;
bzero(data_ptr, sz);
return (data_ptr);
return (data_ptr);
}
#define nlmsg_reserve_object(_ns, _t) ((_t *)nlmsg_reserve_data_raw(_ns, sizeof(_t)))
#define nlmsg_reserve_data(_ns, _sz, _t) ((_t *)nlmsg_reserve_data_raw(_ns, _sz))
@ -263,24 +263,24 @@ nlattr_add(struct nl_writer *nw, int attr_type, int attr_len, const void *data)
{
int required_len = NLA_ALIGN(attr_len + sizeof(struct nlattr));
if (__predict_false(nw->offset + required_len > nw->alloc_len)) {
if (__predict_false(nw->offset + required_len > nw->alloc_len)) {
if (!nlmsg_refill_buffer(nw, required_len))
return (false);
}
struct nlattr *nla = (struct nlattr *)(&nw->data[nw->offset]);
struct nlattr *nla = (struct nlattr *)(&nw->data[nw->offset]);
nla->nla_len = attr_len + sizeof(struct nlattr);
nla->nla_type = attr_type;
if (attr_len > 0) {
nla->nla_len = attr_len + sizeof(struct nlattr);
nla->nla_type = attr_type;
if (attr_len > 0) {
if ((attr_len % 4) != 0) {
/* clear padding bytes */
bzero((char *)nla + required_len - 4, 4);
}
memcpy((nla + 1), data, attr_len);
memcpy((nla + 1), data, attr_len);
}
nw->offset += required_len;
return (true);
nw->offset += required_len;
return (true);
}
static inline bool