From: David Sterba <dsterba@suse.cz>
To: Gui Hecheng <guihc.fnst@cn.fujitsu.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 2/4] btrfs-progs: deal with invalid option combinations for btrfs-image
Date: Mon, 23 Jun 2014 16:12:14 +0200 [thread overview]
Message-ID: <20140623141214.GF1553@twin.jikos.cz> (raw)
In-Reply-To: <1403142363-29482-2-git-send-email-guihc.fnst@cn.fujitsu.com>
On Thu, Jun 19, 2014 at 09:46:01AM +0800, Gui Hecheng wrote:
> For btrfs-image,
> dump may not come with option '-o'
> -r may not come with option '-c', '-s', '-w', dev_cnt != 1
> -m may not come with dev_cnt < 2
> All of the above should be regarded as invalid combinations,
> and the usage will show up.
The generic usage works, but is not very descriptive what really
happened. Would be good to print a message as soon as an error is
detectd. See below:
> @@ -2500,15 +2501,20 @@ int main(int argc, char *argv[])
> }
> }
>
> - if ((old_restore) && create)
> - print_usage();
In this case the old code makes more sense followed by the message that
create and restore cannot be used at the same time.
> - if (multi_devices && dev_cnt < 2)
> - print_usage();
Applies to both modes, eg. "not enoug devices specified for -m option".
> - if (!multi_devices && dev_cnt != 1)
> + if (create) {
> + usage_error = old_restore;
> + } else {
> + usage_error = walk_trees || sanitize || compress_level;
Error message here if usage_error is set.
> + if (multi_devices)
> + usage_error = usage_error || (dev_cnt < 2);
> + else
> + usage_error = usage_error || (dev_cnt != 1);
Could be merged with the multi_devices check above, accepts only one
without -m option.
next prev parent reply other threads:[~2014-06-23 14:12 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-19 1:46 [PATCH 1/4] btrfs-progs: cleanup duplicate assignment of variable leaf for btrfs-image Gui Hecheng
2014-06-19 1:46 ` [PATCH 2/4] btrfs-progs: deal with invalid option combinations " Gui Hecheng
2014-06-23 14:12 ` David Sterba [this message]
2014-06-24 1:43 ` Gui Hecheng
2014-06-24 2:36 ` [PATCH v2 " Gui Hecheng
2014-06-24 2:51 ` Gui Hecheng
2014-06-24 3:16 ` [PATCH v3 " Gui Hecheng
2014-06-19 1:46 ` [PATCH 3/4] btrfs-progs: delete invalid output file when btrfs-image failed Gui Hecheng
2014-06-23 14:15 ` David Sterba
2014-06-24 1:41 ` Gui Hecheng
2014-06-24 2:38 ` [PATCH v2 " Gui Hecheng
2014-06-24 3:05 ` Gui Hecheng
2014-06-24 3:16 ` [PATCH v3 " Gui Hecheng
2014-06-24 8:47 ` David Sterba
2014-06-19 1:46 ` [PATCH 4/4] btrfs-progs: update manpage for btrfs-image with -m option added 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=20140623141214.GF1553@twin.jikos.cz \
--to=dsterba@suse.cz \
--cc=guihc.fnst@cn.fujitsu.com \
--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).