Thread (4 messages) flat view 4 messages, 3 authors, 2014-12-09

Re: [RESEND PATCH] net: introduce helper macra CMSG_FOREACH_HDR

From: Joe Perches <joe@perches.com>
Date: 2014-12-05 08:02:38
Also in: lkml

On Fri, 2014-12-05 at 15:14 +0800, Gu Zheng wrote:
Introduce helper macra
macro
CMSG_FOREACH_HDR as a wrapper of the enumerating
cmsghdr from msghdr, just cleanup. 
maybe better to use lower case "for_each_cmsg_hdr"
or some such.

checkpatch would recognize that too as long as it
uses "for_each".
quoted hunk ↗ jump to hunk
diff --git a/include/linux/socket.h b/include/linux/socket.h
[]
quoted hunk ↗ jump to hunk
@@ -94,6 +94,10 @@ struct cmsghdr {
 			     (cmsg)->cmsg_len <= (unsigned long) \
 			     ((mhdr)->msg_controllen - \
 			      ((char *)(cmsg) - (char *)(mhdr)->msg_control)))
+#define CMSG_FOREACH_HDR(cmsg, msg)  \
+	for (cmsg = CMSG_FIRSTHDR(msg); \
+	     cmsg; \
+	     cmsg = CMSG_NXTHDR(msg, cmsg))
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help