From: Gui Hecheng <guihc.fnst@cn.fujitsu.com>
To: <dsterba@suse.cz>
Cc: <linux-btrfs@vger.kernel.org>
Subject: Re: [PATCH 1/2] btrfs-progs: move the check_argc_* functions into utils.c
Date: Wed, 2 Jul 2014 09:13:04 +0800 [thread overview]
Message-ID: <1404263584.31646.0.camel@localhost.localdomain> (raw)
In-Reply-To: <20140701231101.GT1553@twin.jikos.cz>
On Wed, 2014-07-02 at 01:11 +0200, David Sterba wrote:
> On Mon, Jun 30, 2014 at 11:54:11AM +0800, Gui Hecheng wrote:
> > To let the independent tools(e.g. btrfs-image, btrfs-convert, etc.)
> > share the convenience of check_argc_* functions, just move it into
> > utils.c.
> > Also add a new function "set_argv0" to set the correct tool name:
> > *btrfs-image*: too few arguments
> >
> > The original btrfs* tools work as before.
>
> Good cleanup, but I don't like to see the utils.c pull the commands.h,
> the argv0 or argument helpers are selfcontained, so the relevant
> definitions shloud be moved to utils.h .
>
> Moved ARGV0_BUF_SIZE -> utils.h
> Removed check_argc_* protoypes from command.h
>
> Trivial changes, I made them myself, no need to resend the patch.
Thanks very much David.
> The diff:
> --- a/commands.h
> +++ b/commands.h
> @@ -14,8 +14,6 @@
> * Boston, MA 021110-1307, USA.
> */
>
> -#define ARGV0_BUF_SIZE 64
> -
> struct cmd_struct {
> const char *token;
> int (*fn)(int, char **);
> @@ -62,10 +60,6 @@ struct cmd_group {
> /* btrfs.c */
> int prefixcmp(const char *str, const char *prefix);
>
> -int check_argc_exact(int nargs, int expected);
> -int check_argc_min(int nargs, int expected);
> -int check_argc_max(int nargs, int expected);
> -
> int handle_command_group(const struct cmd_group *grp, int argc,
> char **argv);
>
> diff --git a/utils.h b/utils.h
> index 20e5a2200052..e29ab936cd81 100644
> --- a/utils.h
> +++ b/utils.h
> @@ -39,6 +39,8 @@
>
> #define BTRFS_UUID_UNPARSED_SIZE 37
>
> +#define ARGV0_BUF_SIZE 64
> +
> int check_argc_exact(int nargs, int expected);
> int check_argc_min(int nargs, int expected);
> int check_argc_max(int nargs, int expected);
> ---
next prev parent reply other threads:[~2014-07-02 1:18 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-26 2:53 [PATCH 1/6] btrfs-progs: fix btrfs-image old_restore fsck failure Gui Hecheng
2014-06-26 2:53 ` [PATCH 2/6] btrfs-progs: deal with malloc failure in btrfs-image Gui Hecheng
2014-06-26 2:53 ` [PATCH 3/6] btrfs-progs: cleanup unnecessary free if malloc fails " Gui Hecheng
2014-06-26 2:53 ` [PATCH 4/6] btrfs-progs: cleanup possible silent failure " Gui Hecheng
2014-06-26 2:53 ` [PATCH 5/6] btrfs-progs: limit minimal num of args for btrfs-image Gui Hecheng
2014-06-27 12:35 ` David Sterba
2014-06-30 1:47 ` Gui Hecheng
2014-06-30 3:54 ` [PATCH 1/2] btrfs-progs: move the check_argc_* functions into utils.c Gui Hecheng
2014-06-30 3:54 ` [PATCH v2 2/2] btrfs-progs: limit minimal num of args for btrfs-image Gui Hecheng
2014-07-01 23:11 ` [PATCH 1/2] btrfs-progs: move the check_argc_* functions into utils.c David Sterba
2014-07-02 0:20 ` WorMzy Tykashi
2014-07-02 9:34 ` David Sterba
2014-07-02 10:50 ` WorMzy Tykashi
2014-07-02 1:13 ` Gui Hecheng [this message]
2014-07-10 1:06 ` [PATCH] btrfs-progs: use check_argc_* to check arg number for all tools Gui Hecheng
2014-07-16 3:44 ` [PATCH v2] " Gui Hecheng
2014-07-16 3:58 ` Gui Hecheng
2014-07-16 3:59 ` Gui Hecheng
2014-06-26 2:53 ` [PATCH 6/6] btrfs-progs: use BTRFS_SUPER_INFO_SIZE to replace raw 4096 in btrfs-image Gui Hecheng
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=1404263584.31646.0.camel@localhost.localdomain \
--to=guihc.fnst@cn.fujitsu.com \
--cc=dsterba@suse.cz \
--cc=linux-btrfs@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 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).