diff options
Diffstat (limited to 'cmds-subvolume.c')
-rw-r--r-- | cmds-subvolume.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/cmds-subvolume.c b/cmds-subvolume.c index 59f4dfdd..f385816f 100644 --- a/cmds-subvolume.c +++ b/cmds-subvolume.c @@ -259,13 +259,14 @@ static int cmd_subvol_delete(int argc, char **argv) } static const char * const cmd_subvol_list_usage[] = { - "btrfs subvolume list [-pu] [-s 0|1] <path>", + "btrfs subvolume list [-pur] [-s 0|1] <path>", "List subvolumes (and snapshots)", "", "-p print parent ID", "-u print the uuid of subvolumes (and snapshots)", "-s value list snapshots with generation in ascending/descending order", " (1: ascending, 0: descending)", + "-r list readonly subvolumes (including snapshots)", NULL }; @@ -273,6 +274,7 @@ static int cmd_subvol_list(int argc, char **argv) { struct btrfs_list_filter_set *filter_set; struct btrfs_list_comparer_set *comparer_set; + u64 flags = 0; int fd; int ret; int order; @@ -283,7 +285,7 @@ static int cmd_subvol_list(int argc, char **argv) optind = 1; while(1) { - int c = getopt(argc, argv, "ps:u"); + int c = getopt(argc, argv, "ps:ur"); if (c < 0) break; @@ -305,11 +307,18 @@ static int cmd_subvol_list(int argc, char **argv) case 'u': btrfs_list_setup_print_column(BTRFS_LIST_UUID); break; + case 'r': + flags |= BTRFS_ROOT_SUBVOL_RDONLY; + break; default: usage(cmd_subvol_list_usage); } } + if (flags) + btrfs_list_setup_filter(&filter_set, BTRFS_LIST_FILTER_FLAGS, + flags); + if (check_argc_exact(argc - optind, 1)) usage(cmd_subvol_list_usage); |