linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Gui Hecheng <guihc.fnst@cn.fujitsu.com>
To: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
Cc: <linux-btrfs@vger.kernel.org>, <dsterba@suse.cz>
Subject: Re: [PATCH v2] btrfs-progs: deal with conflict options for btrfs fi show
Date: Fri, 12 Sep 2014 16:33:51 +0800	[thread overview]
Message-ID: <1410510831.21185.13.camel@localhost.localdomain> (raw)
In-Reply-To: <54128AF5.8080202@jp.fujitsu.com>

On Fri, 2014-09-12 at 14:56 +0900, Satoru Takeuchi wrote:
> Hi Gui,
> 
> (2014/09/12 10:15), Gui Hecheng wrote:
> > For btrfs fi show, -d|--all-devices & -m|--mounted will
> > overwrite each other, so if specified both, let the user
> > know that he should not use them at the same time.
> > 
> > Signed-off-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com>
> > ---
> > changelog:
> > 	v1->v2: add option conflict descriptions to manpage and usage.
> > ---
> >   Documentation/btrfs-filesystem.txt |  9 ++++++---
> >   cmds-filesystem.c                  | 12 ++++++++++--
> >   2 files changed, 16 insertions(+), 5 deletions(-)
> > 
> > diff --git a/Documentation/btrfs-filesystem.txt b/Documentation/btrfs-filesystem.txt
> > index c9c0b00..d3d2dcc 100644
> > --- a/Documentation/btrfs-filesystem.txt
> > +++ b/Documentation/btrfs-filesystem.txt
> > @@ -20,15 +20,18 @@ SUBCOMMAND
> >   *df* <path> [<path>...]::
> >   Show space usage information for a mount point.
> >   
> > -*show* [--mounted|--all-devices|<path>|<uuid>|<device>|<label>]::
> > +*show* [-m|--mounted|-d|--all-devices|<path>|<uuid>|<device>|<label>]::
> 
> This line seems to be too long. Please see also the
> following thread.
> 
> https://www.mail-archive.com/linux-btrfs@vger.kernel.org/msg36270.html
> 

Hi Satoru,

Ah, there is a patch that is changing the same document before but not
merged yet. So I think I will rebase my "additional words" about the
"option conflict" after the former patch merged.
----------------------------------------------------------------------
Hi David,
Sorry to bother, would you please give a glance at the v1 patch and
ignore this v2 first. And I will add the "option conflict" stuff in
another patch after the former path below merged. Is that OK?

https://patchwork.kernel.org/patch/4711831/

-Gui

> Thanks,
> Satoru
> 
> 
> >   Show the btrfs filesystem with some additional info.
> >   +
> >   If no option nor <path>|<uuid>|<device>|<label> is passed, btrfs shows
> >   information of all the btrfs filesystem both mounted and unmounted.
> > -If '--mounted' is passed, it would probe btrfs kernel to list mounted btrfs
> > +If '-m|--mounted' is passed, it would probe btrfs kernel to list mounted btrfs
> >   filesystem(s);
> > -If '--all-devices' is passed, all the devices under /dev are scanned;
> > +If '-d|--all-devices' is passed, all the devices under /dev are scanned;
> >   otherwise the devices list is extracted from the /proc/partitions file.
> > +Don't combine -m|--mounted and -d|--all-devices, because these two options
> > +will overwrite each other, and only one scan way will be adopted,
> > +probe the kernel to scan or scan devices under /dev.
> >   
> >   *sync* <path>::
> >   Force a sync for the filesystem identified by <path>.
> > diff --git a/cmds-filesystem.c b/cmds-filesystem.c
> > index 69c1ca5..51c4c55 100644
> > --- a/cmds-filesystem.c
> > +++ b/cmds-filesystem.c
> > @@ -495,6 +495,7 @@ static const char * const cmd_show_usage[] = {
> >   	"-d|--all-devices   show only disks under /dev containing btrfs filesystem",
> >   	"-m|--mounted       show only mounted btrfs",
> >   	"If no argument is given, structure of all present filesystems is shown.",
> > +	"Don't combine -d|--all-devices and -m|--mounted, refer to manpage for details.",
> >   	NULL
> >   };
> >   
> > @@ -526,16 +527,23 @@ static int cmd_show(int argc, char **argv)
> >   			break;
> >   		switch (c) {
> >   		case 'd':
> > -			where = BTRFS_SCAN_PROC;
> > +			where &= ~BTRFS_SCAN_LBLKID;
> > +			where |= BTRFS_SCAN_PROC;
> >   			break;
> >   		case 'm':
> > -			where = BTRFS_SCAN_MOUNTED;
> > +			where &= ~BTRFS_SCAN_LBLKID;
> > +			where |= BTRFS_SCAN_MOUNTED;
> >   			break;
> >   		default:
> >   			usage(cmd_show_usage);
> >   		}
> >   	}
> >   
> > +	if ((where & BTRFS_SCAN_PROC) && (where & BTRFS_SCAN_MOUNTED)) {
> > +		fprintf(stderr, "Don't use -d|--all-devices and -m|--mounted options at the same time.\n");
> > +		usage(cmd_show_usage);
> > +	}
> > +
> >   	if (check_argc_max(argc, optind + 1))
> >   		usage(cmd_show_usage);
> >   
> > 
> 



      reply	other threads:[~2014-09-12  8:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-11  5:19 [PATCH] btrfs-progs: deal with conflict options for btrfs fi show Gui Hecheng
2014-09-12  1:15 ` [PATCH v2] " Gui Hecheng
2014-09-12  5:56   ` Satoru Takeuchi
2014-09-12  8:33     ` Gui Hecheng [this message]

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=1410510831.21185.13.camel@localhost.localdomain \
    --to=guihc.fnst@cn.fujitsu.com \
    --cc=dsterba@suse.cz \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=takeuchi_satoru@jp.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).