The NLMSG_LENGTH(0) may confuse the API users, NLMSG_HDRLEN is much more clear. Besides, some code style problems are also fixed. Signed-off-by: Chen Li <chenli@uniontech.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Showing the changes to include/uapi (1 of 1 file). Show all
Unified · Split
| @@ -91,9 +91,10 @@ struct nlmsghdr { · 90 unmodified lines | ||
| 91 | 91 | #define NLMSG_HDRLEN ((int) NLMSG_ALIGN(sizeof(struct nlmsghdr))) |
| 92 | 92 | #define NLMSG_LENGTH(len) ((len) + NLMSG_HDRLEN) |
| 93 | 93 | #define NLMSG_SPACE(len) NLMSG_ALIGN(NLMSG_LENGTH(len)) |
| 94 | −#define NLMSG_DATA(nlh) ((void*)(((char*)nlh) + NLMSG_LENGTH(0))) | |
| 94 | +#define NLMSG_DATA(nlh) ((void *)(((char *)nlh) + NLMSG_HDRLEN)) | |
| 95 | 95 | #define NLMSG_NEXT(nlh,len) ((len) -= NLMSG_ALIGN((nlh)->nlmsg_len), \ |
| 96 | − (struct nlmsghdr*)(((char*)(nlh)) + NLMSG_ALIGN((nlh)->nlmsg_len))) | |
| 96 | + (struct nlmsghdr *)(((char *)(nlh)) + \ | |
| 97 | + NLMSG_ALIGN((nlh)->nlmsg_len))) | |
| 97 | 98 | #define NLMSG_OK(nlh,len) ((len) >= (int)sizeof(struct nlmsghdr) && \ |
| 98 | 99 | (nlh)->nlmsg_len >= sizeof(struct nlmsghdr) && \ |
| 99 | 100 | (nlh)->nlmsg_len <= (len)) |