* [PATCH] btrfs-progs: deal with conflict options for btrfs fi show
@ 2014-09-11 5:19 Gui Hecheng
2014-09-12 1:15 ` [PATCH v2] " Gui Hecheng
0 siblings, 1 reply; 4+ messages in thread
From: Gui Hecheng @ 2014-09-11 5:19 UTC (permalink / raw)
To: linux-btrfs; +Cc: Gui Hecheng
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>
---
cmds-filesystem.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/cmds-filesystem.c b/cmds-filesystem.c
index 69c1ca5..78aeacc 100644
--- a/cmds-filesystem.c
+++ b/cmds-filesystem.c
@@ -526,16 +526,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);
--
1.8.1.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v2] btrfs-progs: deal with conflict options for btrfs fi show
2014-09-11 5:19 [PATCH] btrfs-progs: deal with conflict options for btrfs fi show Gui Hecheng
@ 2014-09-12 1:15 ` Gui Hecheng
2014-09-12 5:56 ` Satoru Takeuchi
0 siblings, 1 reply; 4+ messages in thread
From: Gui Hecheng @ 2014-09-12 1:15 UTC (permalink / raw)
To: linux-btrfs; +Cc: Gui Hecheng
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>]::
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);
--
1.8.1.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2] btrfs-progs: deal with conflict options for btrfs fi show
2014-09-12 1:15 ` [PATCH v2] " Gui Hecheng
@ 2014-09-12 5:56 ` Satoru Takeuchi
2014-09-12 8:33 ` Gui Hecheng
0 siblings, 1 reply; 4+ messages in thread
From: Satoru Takeuchi @ 2014-09-12 5:56 UTC (permalink / raw)
To: Gui Hecheng, linux-btrfs
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);
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] btrfs-progs: deal with conflict options for btrfs fi show
2014-09-12 5:56 ` Satoru Takeuchi
@ 2014-09-12 8:33 ` Gui Hecheng
0 siblings, 0 replies; 4+ messages in thread
From: Gui Hecheng @ 2014-09-12 8:33 UTC (permalink / raw)
To: Satoru Takeuchi; +Cc: linux-btrfs, dsterba
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);
> >
> >
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-09-12 8:34 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 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.