All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gu Zheng <guz.fnst@cn.fujitsu.com>
To: Joe Perches <joe@perches.com>
Cc: "David S. Miller" <davem@davemloft.net>, <netdev@vger.kernel.org>,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] net: introduce helper macro for_each_cmsghdr
Date: Wed, 10 Dec 2014 10:02:34 +0800	[thread overview]
Message-ID: <5487A9BA.10208@cn.fujitsu.com> (raw)
In-Reply-To: <1418176864.1047.6.camel@perches.com>

Hi Joe,
On 12/10/2014 10:01 AM, Joe Perches wrote:

> On Wed, 2014-12-10 at 09:39 +0800, Gu Zheng wrote:
>> Introduce helper macro for_each_cmsghdr as a wrapper of the enumerating
>> cmsghdr from msghdr, just cleanup. 
> 
> Does this even compile?
> 
> So which is it?
> 
> 	for_each_cmsghdr
> or
> 	for_each_cmsg_hdr?
> 
> The .h #defines for_each_cmsg_hdr
> but all the uses are for_each_cmsghdr

Thanks for your quick feedback.
There seems some problems with my send-patch script, it sent out the patch
before the test completed.

Thanks,
Gu

> 
>> diff --git a/Documentation/networking/timestamping/timestamping.c b/Documentation/networking/timestamping/timestamping.c
> []
>> @@ -169,9 +169,7 @@ static void printpacket(struct msghdr *msg, int res,
>>  	       res,
>>  	       inet_ntoa(from_addr->sin_addr),
>>  	       msg->msg_controllen);
>> -	for (cmsg = CMSG_FIRSTHDR(msg);
>> -	     cmsg;
>> -	     cmsg = CMSG_NXTHDR(msg, cmsg)) {
>> +	for_each_cmsghdr(cmsg, msg) {
>>  		printf("   cmsg len %zu: ", cmsg->cmsg_len);
>>  		switch (cmsg->cmsg_level) {
>>  		case SOL_SOCKET:
>> diff --git a/crypto/af_alg.c b/crypto/af_alg.c
> []
>> @@ -399,7 +399,7 @@ int af_alg_cmsg_send(struct msghdr *msg, struct af_alg_control *con)
>>  {
>>  	struct cmsghdr *cmsg;
>>  
>> -	for (cmsg = CMSG_FIRSTHDR(msg); cmsg; cmsg = CMSG_NXTHDR(msg, cmsg)) {
>> +	for_each_cmsghdr(cmsg, msg) {
>>  		if (!CMSG_OK(msg, cmsg))
>>  			return -EINVAL;
>>  		if (cmsg->cmsg_level != SOL_ALG)
>> diff --git a/include/linux/socket.h b/include/linux/socket.h
> []
>> @@ -94,6 +94,10 @@ struct cmsghdr {
>>  			     (cmsg)->cmsg_len <= (unsigned long) \
>>  			     ((mhdr)->msg_controllen - \
>>  			      ((char *)(cmsg) - (char *)(mhdr)->msg_control)))
>> +#define for_each_cmsg_hdr(cmsg, msg)  \
>> +	for (cmsg = CMSG_FIRSTHDR(msg); \
>> +	     cmsg; \
>> +	     cmsg = CMSG_NXTHDR(msg, cmsg))
> 
> 
> 
> .
> 



  reply	other threads:[~2014-12-10  2:18 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-10  1:39 [PATCH v2] net: introduce helper macro for_each_cmsghdr Gu Zheng
2014-12-10  1:56 ` Gu Zheng
2014-12-10  2:01 ` Joe Perches
2014-12-10  2:02   ` Gu Zheng [this message]
  -- strict thread matches above, loose matches on Subject: below --
2014-12-10  5:36 Gu Zheng
2014-12-10  6:56 ` Joe Perches
2014-12-10  8:15   ` Gu Zheng
2014-12-10 14:51     ` Joe Perches
2014-12-11  1:11       ` Gu Zheng
2014-12-10 18:48 ` David Miller
2014-12-10 19:44   ` David Miller
2014-12-10 19:44     ` David Miller
2014-12-11  1:05     ` Gu Zheng
2014-12-11  1:47       ` David Miller
2014-12-11  1:50         ` Gu Zheng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5487A9BA.10208@cn.fujitsu.com \
    --to=guz.fnst@cn.fujitsu.com \
    --cc=davem@davemloft.net \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.