All of lore.kernel.org
 help / color / mirror / Atom feed
From: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
To: Gui Hecheng <guihc.fnst@cn.fujitsu.com>, <linux-btrfs@vger.kernel.org>
Subject: Re: [PATCH v2] btrfs-progs: deal with conflict options for btrfs fi show
Date: Fri, 12 Sep 2014 14:56:05 +0900	[thread overview]
Message-ID: <54128AF5.8080202@jp.fujitsu.com> (raw)
In-Reply-To: <1410484541-16422-1-git-send-email-guihc.fnst@cn.fujitsu.com>

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

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  5:56 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 [this message]
2014-09-12  8:33     ` 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=54128AF5.8080202@jp.fujitsu.com \
    --to=takeuchi_satoru@jp.fujitsu.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.