Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: Nikolay Borisov <nborisov@suse.com>
Cc: Bart Van Assche <bart.vanassche@wdc.com>,
	Chris Mason <clm@fb.com>, Josef Bacik <jbacik@fb.com>,
	David Sterba <dsterba@suse.com>,
	linux-btrfs@vger.kernel.org, Jeff Mahoney <jeffm@suse.com>
Subject: Re: [PATCH] btrfs: Fix a C compliance issue
Date: Mon, 18 Jun 2018 11:26:33 +0200	[thread overview]
Message-ID: <20180618092633.GH24375@twin.jikos.cz> (raw)
In-Reply-To: <838e73e8-e9b8-6075-1d69-79bc65c15b0c@suse.com>

On Sat, Jun 16, 2018 at 01:28:13PM +0300, Nikolay Borisov wrote:
> 
> 
> On 16.06.2018 01:36, Bart Van Assche wrote:
> > The C programming language does not allow to use preprocessor statements
> > inside macro arguments (pr_info() is defined as a macro). Hence rework
> > the pr_info() statement in btrfs_print_mod_info() such that it becomes
> > compliant. This patch allows tools like sparse to analyze the BTRFS
> > source code.
> > 
> > Fixes: 62e855771dac ("btrfs: convert printk(KERN_* to use pr_* calls")
> > Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
> > Cc: Jeff Mahoney <jeffm@suse.com>
> > Cc: David Sterba <dsterba@suse.com>
> > ---
> >  fs/btrfs/super.c | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> > 
> > diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
> > index 81107ad49f3a..dd4980df5b8e 100644
> > --- a/fs/btrfs/super.c
> > +++ b/fs/btrfs/super.c
> > @@ -2369,7 +2369,7 @@ static __cold void btrfs_interface_exit(void)
> >  
> >  static void __init btrfs_print_mod_info(void)
> >  {
> > -	pr_info("Btrfs loaded, crc32c=%s"
> > +	static const char fmt[] = KERN_INFO "Btrfs loaded, crc32c=%s"
> >  #ifdef CONFIG_BTRFS_DEBUG
> >  			", debug=on"
> >  #endif
> > @@ -2382,8 +2382,8 @@ static void __init btrfs_print_mod_info(void)
> >  #ifdef CONFIG_BTRFS_FS_REF_VERIFY
> >  			", ref-verify=on"
> >  #endif
> > -			"\n",
> > -			crc32c_impl());
> > +			"\n";
> > +	printk(fmt, crc32c_impl());
> 
> I'd rather not see more printk being added. Nothing prevents from having
> the fmt string being passed to pr_info.

So you mean to do

+	static const char fmt[] = "Btrfs loaded, crc32c=%s"
+	pr_info(fmt);

?

  reply	other threads:[~2018-06-18  9:29 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-15 22:36 [PATCH] btrfs: Fix a C compliance issue Bart Van Assche
2018-06-16 10:28 ` Nikolay Borisov
2018-06-18  9:26   ` David Sterba [this message]
2018-06-18  9:31     ` Nikolay Borisov
2018-06-20 16:44       ` Bart Van Assche
2018-06-20 16:55         ` David Sterba
2018-06-20 17:19           ` Jeff Mahoney
2018-06-20 17:58             ` Bart Van Assche

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=20180618092633.GH24375@twin.jikos.cz \
    --to=dsterba@suse.cz \
    --cc=bart.vanassche@wdc.com \
    --cc=clm@fb.com \
    --cc=dsterba@suse.com \
    --cc=jbacik@fb.com \
    --cc=jeffm@suse.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=nborisov@suse.com \
    /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