diff options
author | Gu Zheng <guz.fnst@cn.fujitsu.com> | 2014-12-10 22:22:04 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-12-10 22:41:55 -0500 |
commit | f95b414edb18de59940dcebbefb49cf25c6d505c (patch) | |
tree | 654de508641fd2c82428f43387b72fd1a3dcef42 /net/rds | |
parent | dd0bcc0bc842e0d2c981102376d867c1a8bad320 (diff) |
net: introduce helper macro for_each_cmsghdr
Introduce helper macro for_each_cmsghdr as a wrapper of the enumerating
cmsghdr from msghdr, just cleanup.
Signed-off-by: Gu Zheng <guz.fnst@cn.fujitsu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/rds')
-rw-r--r-- | net/rds/send.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/net/rds/send.c b/net/rds/send.c index 40a5629a0a13..42f65d4305c8 100644 --- a/net/rds/send.c +++ b/net/rds/send.c | |||
@@ -826,7 +826,7 @@ static int rds_rm_size(struct msghdr *msg, int data_len) | |||
826 | int cmsg_groups = 0; | 826 | int cmsg_groups = 0; |
827 | int retval; | 827 | int retval; |
828 | 828 | ||
829 | for (cmsg = CMSG_FIRSTHDR(msg); cmsg; cmsg = CMSG_NXTHDR(msg, cmsg)) { | 829 | for_each_cmsghdr(cmsg, msg) { |
830 | if (!CMSG_OK(msg, cmsg)) | 830 | if (!CMSG_OK(msg, cmsg)) |
831 | return -EINVAL; | 831 | return -EINVAL; |
832 | 832 | ||
@@ -878,7 +878,7 @@ static int rds_cmsg_send(struct rds_sock *rs, struct rds_message *rm, | |||
878 | struct cmsghdr *cmsg; | 878 | struct cmsghdr *cmsg; |
879 | int ret = 0; | 879 | int ret = 0; |
880 | 880 | ||
881 | for (cmsg = CMSG_FIRSTHDR(msg); cmsg; cmsg = CMSG_NXTHDR(msg, cmsg)) { | 881 | for_each_cmsghdr(cmsg, msg) { |
882 | if (!CMSG_OK(msg, cmsg)) | 882 | if (!CMSG_OK(msg, cmsg)) |
883 | return -EINVAL; | 883 | return -EINVAL; |
884 | 884 | ||