From bd00b928e678b3ede5dbc5abc933539fe5cc31e6 Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Sun, 4 Apr 2010 16:19:03 +0200 Subject: remove mnl_align() as it's been replaced by MNL_ALIGN() We remove mnl_align() since it has been replaced by the macro MNL_ALIGN(). The macro allows its use in static arrays and such. Signed-off-by: Pablo Neira Ayuso --- src/msg.c | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-) (limited to 'src/msg.c') diff --git a/src/msg.c b/src/msg.c index fc6a7c8..2a2f830 100644 --- a/src/msg.c +++ b/src/msg.c @@ -13,18 +13,6 @@ #include #include -/** - * mnl_align - align a value to four bytes - * @value: the value that we want to get aligned - * - * This function returns the value passed aligned to four bytes. Netlink - * message headers and its attributes are always aligned to four bytes. - */ -int mnl_align(int value) -{ - return (value + MNL_ALIGNTO - 1) & ~(MNL_ALIGNTO - 1); -} - /** * mnl_nlmsg_size - get size of the netlink messages (without alignment) * @len: length of the netlink message @@ -34,7 +22,7 @@ int mnl_align(int value) */ size_t mnl_nlmsg_size(int len) { - return len + mnl_align(MNL_NLMSG_HDRLEN); + return len + MNL_ALIGN(MNL_NLMSG_HDRLEN); } /** @@ -46,7 +34,7 @@ size_t mnl_nlmsg_size(int len) */ size_t mnl_nlmsg_aligned_size(int len) { - return mnl_align(mnl_nlmsg_size(len)); + return MNL_ALIGN(mnl_nlmsg_size(len)); } /** @@ -71,7 +59,7 @@ size_t mnl_nlmsg_payload_size(const struct nlmsghdr *nlh) */ struct nlmsghdr *mnl_nlmsg_put_header(void *buf) { - int len = mnl_align(sizeof(struct nlmsghdr)); + int len = MNL_ALIGN(sizeof(struct nlmsghdr)); struct nlmsghdr *nlh = buf; memset(buf, 0, len); @@ -92,7 +80,7 @@ struct nlmsghdr *mnl_nlmsg_put_header(void *buf) void *mnl_nlmsg_put_extra_header(struct nlmsghdr *nlh, int size) { char *ptr = (char *)nlh + nlh->nlmsg_len; - nlh->nlmsg_len += mnl_align(size); + nlh->nlmsg_len += MNL_ALIGN(size); memset(ptr, 0, size); return ptr; } @@ -130,7 +118,7 @@ void *mnl_nlmsg_get_data(const struct nlmsghdr *nlh) */ void *mnl_nlmsg_get_data_offset(const struct nlmsghdr *nlh, int offset) { - return (void *)nlh + MNL_NLMSG_HDRLEN + mnl_align(offset); + return (void *)nlh + MNL_NLMSG_HDRLEN + MNL_ALIGN(offset); } /** @@ -162,8 +150,8 @@ int mnl_nlmsg_ok(const struct nlmsghdr *nlh, int len) */ struct nlmsghdr *mnl_nlmsg_next(const struct nlmsghdr *nlh, int *len) { - *len -= mnl_align(nlh->nlmsg_len); - return (struct nlmsghdr *)((void *)nlh + mnl_align(nlh->nlmsg_len)); + *len -= MNL_ALIGN(nlh->nlmsg_len); + return (struct nlmsghdr *)((void *)nlh + MNL_ALIGN(nlh->nlmsg_len)); } /** @@ -175,7 +163,7 @@ struct nlmsghdr *mnl_nlmsg_next(const struct nlmsghdr *nlh, int *len) */ void *mnl_nlmsg_get_tail(const struct nlmsghdr *nlh) { - return (struct nlmsghdr *)((void *)nlh + mnl_align(nlh->nlmsg_len)); + return (struct nlmsghdr *)((void *)nlh + MNL_ALIGN(nlh->nlmsg_len)); } /** -- cgit v1.2.3