* [PATCH net-next] netlink: remove duplicated NLMSG_ALIGN
@ 2013-03-26 5:04 Hong Zhiguo
2013-03-26 11:13 ` Thomas Graf
0 siblings, 1 reply; 3+ messages in thread
From: Hong Zhiguo @ 2013-03-26 5:04 UTC (permalink / raw)
To: netdev; +Cc: davem, stephen, zhiguo.hong
NLMSG_HDRLEN is already aligned value. It's for directly reference
without extra alignment.
The redundant alignment here may confuse the API users.
Signed-off-by: Hong Zhiguo <honkiko@gmail.com>
---
include/uapi/linux/netlink.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/uapi/linux/netlink.h b/include/uapi/linux/netlink.h
index 78d5b8a..32a354f 100644
--- a/include/uapi/linux/netlink.h
+++ b/include/uapi/linux/netlink.h
@@ -78,7 +78,7 @@ struct nlmsghdr {
#define NLMSG_ALIGNTO 4U
#define NLMSG_ALIGN(len) ( ((len)+NLMSG_ALIGNTO-1) & ~(NLMSG_ALIGNTO-1) )
#define NLMSG_HDRLEN ((int) NLMSG_ALIGN(sizeof(struct nlmsghdr)))
-#define NLMSG_LENGTH(len) ((len)+NLMSG_ALIGN(NLMSG_HDRLEN))
+#define NLMSG_LENGTH(len) ((len) + NLMSG_HDRLEN)
#define NLMSG_SPACE(len) NLMSG_ALIGN(NLMSG_LENGTH(len))
#define NLMSG_DATA(nlh) ((void*)(((char*)nlh) + NLMSG_LENGTH(0)))
#define NLMSG_NEXT(nlh,len) ((len) -= NLMSG_ALIGN((nlh)->nlmsg_len), \
--
1.7.10.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] netlink: remove duplicated NLMSG_ALIGN
2013-03-26 5:04 [PATCH net-next] netlink: remove duplicated NLMSG_ALIGN Hong Zhiguo
@ 2013-03-26 11:13 ` Thomas Graf
2013-03-26 16:40 ` David Miller
0 siblings, 1 reply; 3+ messages in thread
From: Thomas Graf @ 2013-03-26 11:13 UTC (permalink / raw)
To: Hong Zhiguo; +Cc: netdev, davem, stephen, zhiguo.hong
On 03/26/13 at 01:04pm, Hong Zhiguo wrote:
> NLMSG_HDRLEN is already aligned value. It's for directly reference
> without extra alignment.
>
> The redundant alignment here may confuse the API users.
>
> Signed-off-by: Hong Zhiguo <honkiko@gmail.com>
Acked-by: Thomas Graf <tgraf@suug.ch>
This is actually an obsoleted API that we only want to keep around
for backwards compatibility with user space. It would be great to
replace all in kernel usages of NLMSG_LENGTH() with the type safe
variants nlmsg_*() in <net/netlink.h>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] netlink: remove duplicated NLMSG_ALIGN
2013-03-26 11:13 ` Thomas Graf
@ 2013-03-26 16:40 ` David Miller
0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2013-03-26 16:40 UTC (permalink / raw)
To: tgraf; +Cc: honkiko, netdev, stephen, zhiguo.hong
From: Thomas Graf <tgraf@suug.ch>
Date: Tue, 26 Mar 2013 11:13:47 +0000
> On 03/26/13 at 01:04pm, Hong Zhiguo wrote:
>> NLMSG_HDRLEN is already aligned value. It's for directly reference
>> without extra alignment.
>>
>> The redundant alignment here may confuse the API users.
>>
>> Signed-off-by: Hong Zhiguo <honkiko@gmail.com>
>
> Acked-by: Thomas Graf <tgraf@suug.ch>
Applied, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-03-26 16:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-26 5:04 [PATCH net-next] netlink: remove duplicated NLMSG_ALIGN Hong Zhiguo
2013-03-26 11:13 ` Thomas Graf
2013-03-26 16:40 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).