Rename filter options in ''subvol list'' subcommand, that way we
can
distinguish them from the options that just show some option in the
output and can have a matching uppercase filter.
Signed-off-by: David Sterba <dsterba@suse.cz>
---
cmds-subvolume.c | 17 +++++++++++------
1 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/cmds-subvolume.c b/cmds-subvolume.c
index ac39f7b..61be38a 100644
--- a/cmds-subvolume.c
+++ b/cmds-subvolume.c
@@ -271,8 +271,13 @@ out:
return ret;
}
+/*
+ * Naming of options:
+ * - uppercase for filters and sort options
+ * - lowercase for enabling specific items in the output
+ */
static const char * const cmd_subvol_list_usage[] = {
- "btrfs subvolume list [-apurts] [-g [+|-]value] [-c [+|-]value] "
+ "btrfs subvolume list [-apurts] [-G [+|-]value] [-C [+|-]value] "
"[--sort=gen,ogen,rootid,path] <path>",
"List subvolumes (and snapshots)",
"",
@@ -282,10 +287,10 @@ static const char * const cmd_subvol_list_usage[] = {
"-t print the result as a table",
"-s list snapshots only in the filesystem",
"-r list readonly subvolumes (including snapshots)",
- "-g [+|-]value",
+ "-G [+|-]value",
" filter the subvolumes by generation",
" (+value: >= value; -value: <= value; value: =
value)",
- "-c [+|-]value",
+ "-C [+|-]value",
" filter the subvolumes by ogeneration",
" (+value: >= value; -value: <= value; value: =
value)",
"--sort=gen,ogen,rootid,path",
@@ -318,7 +323,7 @@ static int cmd_subvol_list(int argc, char **argv)
optind = 1;
while(1) {
c = getopt_long(argc, argv,
- "apsurg:c:t", long_options, NULL);
+ "apsurG:C:t", long_options, NULL);
if (c < 0)
break;
@@ -345,7 +350,7 @@ static int cmd_subvol_list(int argc, char **argv)
case ''r'':
flags |= BTRFS_ROOT_SUBVOL_RDONLY;
break;
- case ''g'':
+ case ''G'':
btrfs_list_setup_print_column(BTRFS_LIST_GENERATION);
ret = btrfs_list_parse_filter_string(optarg,
&filter_set,
@@ -354,7 +359,7 @@ static int cmd_subvol_list(int argc, char **argv)
usage(cmd_subvol_list_usage);
break;
- case ''c'':
+ case ''C'':
btrfs_list_setup_print_column(BTRFS_LIST_OGENERATION);
ret = btrfs_list_parse_filter_string(optarg,
&filter_set,
--
1.7.6.233.gd79bc
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs"
in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
David Sterba
2012-Oct-09 16:27 UTC
[PATCH 2/4] btrfs-progs: add option g to show generation, do not show it by default
The generation was not printed so far, and adding ''g'' will
pair the ''G''
filter.
Signed-off-by: David Sterba <dsterba@suse.cz>
---
btrfs-list.c | 2 +-
cmds-subvolume.c | 8 ++++++--
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/btrfs-list.c b/btrfs-list.c
index e5f0f96..3821064 100644
--- a/btrfs-list.c
+++ b/btrfs-list.c
@@ -105,7 +105,7 @@ struct {
{
.name = "gen",
.column_name = "Gen",
- .need_print = 1,
+ .need_print = 0,
},
{
.name = "cgen",
diff --git a/cmds-subvolume.c b/cmds-subvolume.c
index 61be38a..a2dece6 100644
--- a/cmds-subvolume.c
+++ b/cmds-subvolume.c
@@ -277,7 +277,7 @@ out:
* - lowercase for enabling specific items in the output
*/
static const char * const cmd_subvol_list_usage[] = {
- "btrfs subvolume list [-apurts] [-G [+|-]value] [-C [+|-]value] "
+ "btrfs subvolume list [-agpurts] [-G [+|-]value] [-C [+|-]value] "
"[--sort=gen,ogen,rootid,path] <path>",
"List subvolumes (and snapshots)",
"",
@@ -285,6 +285,7 @@ static const char * const cmd_subvol_list_usage[] = {
"-a print all the subvolumes in the filesystem.",
"-u print the uuid of subvolumes (and snapshots)",
"-t print the result as a table",
+ "-g print the generation of the subvolume",
"-s list snapshots only in the filesystem",
"-r list readonly subvolumes (including snapshots)",
"-G [+|-]value",
@@ -323,7 +324,7 @@ static int cmd_subvol_list(int argc, char **argv)
optind = 1;
while(1) {
c = getopt_long(argc, argv,
- "apsurG:C:t", long_options, NULL);
+ "agpsurG:C:t", long_options, NULL);
if (c < 0)
break;
@@ -334,6 +335,9 @@ static int cmd_subvol_list(int argc, char **argv)
case ''a'':
is_list_all = 1;
break;
+ case ''g'':
+ btrfs_list_setup_print_column(BTRFS_LIST_GENERATION);
+ break;
case ''t'':
is_tab_result = 1;
break;
--
1.7.6.233.gd79bc
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs"
in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
David Sterba
2012-Oct-09 16:27 UTC
[PATCH 3/4] btrfs-progs: add option c to show ogeneration
This will also pair the ''C'' filter.
Signed-off-by: David Sterba <dsterba@suse.cz>
---
cmds-subvolume.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/cmds-subvolume.c b/cmds-subvolume.c
index a2dece6..7a0b49f 100644
--- a/cmds-subvolume.c
+++ b/cmds-subvolume.c
@@ -277,12 +277,13 @@ out:
* - lowercase for enabling specific items in the output
*/
static const char * const cmd_subvol_list_usage[] = {
- "btrfs subvolume list [-agpurts] [-G [+|-]value] [-C [+|-]value] "
+ "btrfs subvolume list [-acgpurts] [-G [+|-]value] [-C [+|-]value] "
"[--sort=gen,ogen,rootid,path] <path>",
"List subvolumes (and snapshots)",
"",
"-p print parent ID",
"-a print all the subvolumes in the filesystem.",
+ "-c print the ogeneration of the subvolume",
"-u print the uuid of subvolumes (and snapshots)",
"-t print the result as a table",
"-g print the generation of the subvolume",
@@ -324,7 +325,7 @@ static int cmd_subvol_list(int argc, char **argv)
optind = 1;
while(1) {
c = getopt_long(argc, argv,
- "agpsurG:C:t", long_options, NULL);
+ "acgpsurG:C:t", long_options, NULL);
if (c < 0)
break;
@@ -335,6 +336,9 @@ static int cmd_subvol_list(int argc, char **argv)
case ''a'':
is_list_all = 1;
break;
+ case ''c'':
+ btrfs_list_setup_print_column(BTRFS_LIST_OGENERATION);
+ break;
case ''g'':
btrfs_list_setup_print_column(BTRFS_LIST_GENERATION);
break;
--
1.7.6.233.gd79bc
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs"
in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
David Sterba
2012-Oct-09 16:27 UTC
[PATCH 4/4] btrfs-progs: update man pages of subvol list
- rename to match code where applicable - add missing - unify the help strings in short and detailed sections - fix a few typos Signed-off-by: David Sterba <dsterba@suse.cz> --- man/btrfs.8.in | 24 +++++++++++++++--------- 1 files changed, 15 insertions(+), 9 deletions(-) diff --git a/man/btrfs.8.in b/man/btrfs.8.in index 9222580..4044b08 100644 --- a/man/btrfs.8.in +++ b/man/btrfs.8.in @@ -11,7 +11,7 @@ btrfs \- control a btrfs filesystem .PP \fBbtrfs\fP \fBsubvolume create\fP\fI [<dest>/]<name>\fP .PP -\fBbtrfs\fP \fBsubvolume list\fP\fI [-aprts] [-g [+|-]value] [-c [+|-]value] [--rootid=rootid,gen,ogen,path] <path>\fP +\fBbtrfs\fP \fBsubvolume list\fP\fI [-acgprts] [-G [+|-]value] [-C [+|-]value] [--sort=rootid,gen,ogen,path] <path>\fP .PP \fBbtrfs\fP \fBsubvolume set-default\fP\fI <id> <path>\fP .PP @@ -108,7 +108,7 @@ Create a subvolume in \fI<dest>\fR (or in the current directory if \fI<dest>\fR is omitted). .TP -\fBsubvolume list\fR\fI [-aprts][-g [+|-]value] [-c [+|-]value] [--sort=gen,ogen,rootid,path] <path>\fR +\fBsubvolume list\fR\fI [-acgprts] [-G [+|-]value] [-C [+|-]value] [--sort=rootid,gen,ogen,path] <path>\fR .RS List the subvolumes present in the filesystem \fI<path>\fR. For every subvolume the following information is shown by default. @@ -117,7 +117,7 @@ where path is the relative path of the subvolume to the \fItop level\fR subvolume. The subvolume''s ID may be used by the \fBsubvolume set-default\fR command, or -at mount time via the \fIsubvol=\fR option. +at mount time via the \fIsubvolid=\fR option. If \fI-p\fR is given, then \fIparent <ID>\fR is added to the output between ID and top level. The parent''s ID may be used at mount time via the \fIsubvolrootid=\fR option. @@ -126,22 +126,28 @@ and top level. The parent''s ID may be used at mount time via the \fB-a\fP print all the subvolumes in the filesystem. -\fB-r\fP only readonly subvolumes in the filesystem wille be listed. +\fB-c\fP print the ogeneration of the subvolume -\fB-s\fP only snapshot subvolumes in the filesystem will be listed. +\fB-g\fP print the ogeneration of the subvolume -\fB-g [+|-]value\fP +\fB-u\fP print the UUID of the subvolume + +\fB-r\fP only readonly subvolumes in the filesystem will be listed. + +\fB-s\fP only snapshot subvolumes in the filesystem will be listed. + +\fB-G [+|-]value\fP list subvolumes in the filesystem that its generation is >=, <= or = value. ''+'' means >= value, ''-'' means <= value, If there is neither ''+'' nor ''-'', it means = value. -\fB-c [+|-]value\fP +\fB-C [+|-]value\fP list subvolumes in the filesystem that its ogeneration is >=, <= or = value. The usage is the same to ''-g'' option. -\fB--sort=gen,ogen,path,rootid\fP +\fB--sort=rootid,gen,ogen,path\fP list subvolumes in order by specified items. -you can add ''+'' or ''-'' in front of each items, ''+'' means ascending,''-'' +you can add ''+'' or ''-'' in front of each items, ''+'' means ascending, ''-'' means descending. The default is ascending. for \fB--sort\fP you can combine some items together by '','', just like -- 1.7.6.233.gd79bc -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html