From: Zhao Lei <zhaolei@cn.fujitsu.com>
To: <dsterba@suse.cz>
Cc: <linux-btrfs@vger.kernel.org>, "'Qu Wenruo'" <quwenruo@cn.fujitsu.com>
Subject: RE: [PATCH v2 1/2] btrfs-progs: Introduce warning and error for common use
Date: Mon, 28 Sep 2015 22:07:35 +0800 [thread overview]
Message-ID: <01c901d0f9f7$06769f20$1363dd60$@cn.fujitsu.com> (raw)
In-Reply-To: <20150925105002.GE11442@twin.jikos.cz>
Hi, David Sterba
Thanks for review.
> -----Original Message-----
> From: David Sterba [mailto:dsterba@suse.cz]
> Sent: Friday, September 25, 2015 6:50 PM
> To: Zhao Lei <zhaolei@cn.fujitsu.com>
> Cc: linux-btrfs@vger.kernel.org; Qu Wenruo <quwenruo@cn.fujitsu.com>
> Subject: Re: [PATCH v2 1/2] btrfs-progs: Introduce warning and error for
> common use
>
> On Wed, Sep 16, 2015 at 05:40:46PM +0800, Zhao Lei wrote:
> > +static inline void __veprintf(const char *prefix, const char *format,
> > + va_list ap)
> > +{
> > + if (prefix)
> > + fprintf(stderr, "%s", prefix);
> > + vfprintf(stderr, format, ap);
>
> I'm not sure we need this helper. All it does it prints a fixed string, we can
> simply add fputs("prefix", stderr) into warning/error functions.
>
This wrapper is to support locale in future:
Make all message output by one function, then we can put locale code into it
simply.
But now it is hard to introduce locale, because user-land tools
changes output frequently, we need to wait the output about fixed.
So I removed __veprintf() in v3, we can modify it when we need.
> > +static inline int warning_on(int condition, const char *fmt, ...) {
> > + if (!condition)
> > + return 0;
> > +
> > + va_list args;
>
> Please do not put declaration(s) after statements.
>
Fixed in v3.
> > +static inline int error_on(int condition, const char *fmt, ...) {
> > + if (!condition)
> > + return 0;
> > +
> > + va_list args;
>
> dtto
>
Fixed in v3.
Thanks
Zhaolei
> > +
> > + va_start(args, fmt);
> > + __veprintf("ERROR: ", fmt, args);
> > + va_end(args);
> > +
> > + return 1;
> > +}
next prev parent reply other threads:[~2015-09-28 14:07 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-16 9:40 [PATCH v2 0/2] btrfs-progs: Introduce warning and error for common use Zhao Lei
2015-09-16 9:40 ` [PATCH v2 1/2] " Zhao Lei
2015-09-25 10:50 ` David Sterba
2015-09-28 14:07 ` Zhao Lei [this message]
2015-09-16 9:40 ` [PATCH v2 2/2] btrfs-progs: use common warning/error for cmds-scrub.c Zhao Lei
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='01c901d0f9f7$06769f20$1363dd60$@cn.fujitsu.com' \
--to=zhaolei@cn.fujitsu.com \
--cc=dsterba@suse.cz \
--cc=linux-btrfs@vger.kernel.org \
--cc=quwenruo@cn.fujitsu.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;
as well as URLs for NNTP newsgroup(s).