diff options
author | Anand Jain <anand.jain@oracle.com> | 2013-02-01 15:56:28 +0800 |
---|---|---|
committer | David Sterba <dsterba@suse.cz> | 2013-02-01 16:55:06 +0100 |
commit | 437eea9664ce5f1782aee43f0f8cc49a3e40e9f0 (patch) | |
tree | a9450e43aa306f52132dd634509e89c8e4f60a50 /btrfs-list.c | |
parent | 16ef0a0c3c7e7811dabee76775f170f1a7c61855 (diff) |
Btrfs-progs: add show subcommand to subvol cli
This adds show sub-command to the btrfs subvol cli
to display detailed inforamtion of the given subvol
or snapshot.
Signed-off-by: Anand Jain <anand.jain@oracle.com>
Diffstat (limited to 'btrfs-list.c')
-rw-r--r-- | btrfs-list.c | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/btrfs-list.c b/btrfs-list.c index 1ca7bc4e..2378a4f8 100644 --- a/btrfs-list.c +++ b/btrfs-list.c @@ -1349,6 +1349,22 @@ static void print_subvolume_column(struct root_info *subv, } } +static void print_single_volume_info_raw(struct root_info *subv, char *raw_prefix) +{ + int i; + + for (i = 0; i < BTRFS_LIST_ALL; i++) { + if (!btrfs_list_columns[i].need_print) + continue; + + if (raw_prefix) + printf("%s",raw_prefix); + + print_subvolume_column(subv, i); + } + printf("\n"); +} + static void print_single_volume_info_table(struct root_info *subv) { int i; @@ -1415,7 +1431,7 @@ static void print_all_volume_info_tab_head() } static void print_all_volume_info(struct root_lookup *sorted_tree, - int layout) + int layout, char *raw_prefix) { struct rb_node *n; struct root_info *entry; @@ -1433,6 +1449,9 @@ static void print_all_volume_info(struct root_lookup *sorted_tree, case BTRFS_LIST_LAYOUT_TABLE: print_single_volume_info_table(entry); break; + case BTRFS_LIST_LAYOUT_RAW: + print_single_volume_info_raw(entry, raw_prefix); + break; } n = rb_next(n); } @@ -1459,7 +1478,7 @@ int btrfs_list_subvols(int fd, struct root_lookup *root_lookup) int btrfs_list_subvols_print(int fd, struct btrfs_list_filter_set *filter_set, struct btrfs_list_comparer_set *comp_set, - int layout, int full_path) + int layout, int full_path, char *raw_prefix) { struct root_lookup root_lookup; struct root_lookup root_sort; @@ -1472,7 +1491,7 @@ int btrfs_list_subvols_print(int fd, struct btrfs_list_filter_set *filter_set, __filter_and_sort_subvol(&root_lookup, &root_sort, filter_set, comp_set, top_id); - print_all_volume_info(&root_sort, layout); + print_all_volume_info(&root_sort, layout, raw_prefix); __free_all_subvolumn(&root_lookup); return 0; |