mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton@redhat.com>
To: Joe Perches <joe@perches.com>
Cc: Steve French <sfrench@samba.org>,
	linux-cifs@vger.kernel.org, samba-technical@lists.samba.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/3] cifs: Make CIFS_DEBUG possible to undefine
Date: Fri, 30 Nov 2012 06:49:19 -0500	[thread overview]
Message-ID: <20121130064919.373547f4@tlielax.poochiereds.net> (raw)
In-Reply-To: <26f6f4e1a1fb5091784fb1a6919e214994a6dc88.1354217746.git.joe@perches.com>

On Thu, 29 Nov 2012 11:37:19 -0800
Joe Perches <joe@perches.com> wrote:

> Make the compilation work again when CIFS_DEBUG is not #define'd.
> 
> Add format and argument verification for the various macros when
> CIFS_DEBUG is not #define'd.
> 
> Signed-off-by: Joe Perches <joe@perches.com>
> ---
>  fs/cifs/cifs_debug.h |   64 ++++++++++++++++++++++++++++++++------------------
>  1 files changed, 41 insertions(+), 23 deletions(-)
> 
> diff --git a/fs/cifs/cifs_debug.h b/fs/cifs/cifs_debug.h
> index b0fc344..4d12fe4 100644
> --- a/fs/cifs/cifs_debug.h
> +++ b/fs/cifs/cifs_debug.h
> @@ -37,6 +37,9 @@ void dump_smb(void *, int);
>  #define CIFS_RC		0x02
>  #define CIFS_TIMER	0x04
>  
> +extern int cifsFYI;
> +extern int cifsERROR;
> +
>  /*
>   *	debug ON
>   *	--------
> @@ -44,36 +47,33 @@ void dump_smb(void *, int);
>  #ifdef CIFS_DEBUG
>  
>  /* information message: e.g., configuration, major event */
> -extern int cifsFYI;
> -#define cifsfyi(fmt, arg...)						\
> +#define cifsfyi(fmt, ...)						\
>  do {									\
>  	if (cifsFYI & CIFS_INFO)					\
> -		printk(KERN_DEBUG "%s: " fmt "\n", __FILE__, ##arg);	\
> +		printk(KERN_DEBUG "%s: " fmt "\n",			\
> +		       __FILE__, ##__VA_ARGS__);			\
>  } while (0)
>  
> -#define cFYI(set, fmt, arg...)			\
> -do {						\
> -	if (set)				\
> -		cifsfyi(fmt, ##arg);		\
> +#define cFYI(set, fmt, ...)						\
> +do {									\
> +	if (set)							\
> +		cifsfyi(fmt, ##__VA_ARGS__);				\
>  } while (0)
>  
> -#define cifswarn(fmt, arg...)			\
> -	printk(KERN_WARNING fmt "\n", ##arg)
> -
> -/* debug event message: */
> -extern int cifsERROR;
> +#define cifswarn(fmt, ...)						\
> +	printk(KERN_WARNING fmt "\n", ##__VA_ARGS__)
>  
>  /* error event message: e.g., i/o error */
> -#define cifserror(fmt, arg...)					\
> -do {								\
> -	if (cifsERROR)						\
> -		printk(KERN_ERR "CIFS VFS: " fmt "\n", ##arg);	\
> +#define cifserror(fmt, ...)						\
> +do {									\
> +	if (cifsERROR)							\
> +		printk(KERN_ERR "CIFS VFS: " fmt "\n", ##__VA_ARGS__);	\
>  } while (0)
>  
> -#define cERROR(set, fmt, arg...)		\
> -do {						\
> -	if (set)				\
> -		cifserror(fmt, ##arg);		\
> +#define cERROR(set, fmt, ...)						\
> +do {									\
> +	if (set)							\
> +		cifserror(fmt, ##__VA_ARGS__);				\
>  } while (0)
>  
>  /*
> @@ -81,9 +81,27 @@ do {						\
>   *	---------
>   */
>  #else		/* _CIFS_DEBUG */
> -#define cERROR(set, fmt, arg...)
> -#define cFYI(set, fmt, arg...)
> -#define cifserror(fmt, arg...)
> +#define cifsfyi(fmt, ...)						\
> +do {									\
> +	if (0)								\
> +		printk(KERN_DEBUG "%s: " fmt "\n",			\
> +		       __FILE__, ##__VA_ARGS__);			\
> +} while (0)
> +#define cFYI(set, fmt, ...)						\
> +do {									\
> +	if (0 && set)							\
> +		cifsfyi(fmt, ##__VA_ARGS__);				\
> +} while (0)
> +#define cifserror(fmt, ...)						\
> +do {									\
> +	if (0)								\
> +		printk(KERN_ERR "CIFS VFS: " fmt "\n", ##__VA_ARGS__);	\
> +} while (0)
> +#define cERROR(set, fmt, ...)						\
> +do {									\
> +	if (0 && set)							\
> +		cifserror(fmt, ##__VA_ARGS__);				\
> +} while (0)

Would it be better to simply make those the standard

"do { ; } while(0)" noop macros?

I'm not sure I see the point in keeping the printk statements in there...

>  #endif		/* _CIFS_DEBUG */
>  
>  #endif				/* _H_CIFS_DEBUG */

-- 
Jeff Layton <jlayton@redhat.com>

  reply	other threads:[~2012-11-30 11:49 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-29 19:37 [PATCH 0/3] cifs: neatening and embedded module size reduction Joe Perches
2012-11-29 19:37 ` [PATCH 1/3] cifs: Remove unused cEVENT macro Joe Perches
2012-11-30 11:47   ` Jeff Layton
2012-11-30 15:39     ` Steve French
2012-12-03 18:46       ` Joe Perches
2012-12-04 18:18       ` Joe Perches
2012-11-29 19:37 ` [PATCH 2/3] cifs: Make CIFS_DEBUG possible to undefine Joe Perches
2012-11-30 11:49   ` Jeff Layton [this message]
2012-11-30 14:52     ` Joe Perches
2012-11-30 15:03       ` Jeff Layton
2012-11-29 19:37 ` [PATCH 3/3] cifs: Enable Kconfig control of CIFS_DEBUG Joe Perches
2012-11-30 11:56   ` Jeff Layton
2012-11-30 14:57     ` Joe Perches
2012-11-30 15:07       ` Jeff Layton
2012-11-30 15:31         ` [PATCH V2 3/3] cifs: Add CONFIG_CIFS_DEBUG and rename use " Joe Perches
2012-11-30 15:39           ` Jeff Layton
2012-11-30 15:42         ` [PATCH 3/3] cifs: Enable Kconfig control " Steve French

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=20121130064919.373547f4@tlielax.poochiereds.net \
    --to=jlayton@redhat.com \
    --cc=joe@perches.com \
    --cc=linux-cifs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=samba-technical@lists.samba.org \
    --cc=sfrench@samba.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®