diff options
author | Wang Shilong <wangsl-fnst@cn.fujistu.com> | 2012-09-28 01:25:00 +0800 |
---|---|---|
committer | root <root@localhost.localdomain> | 2012-10-04 16:26:33 -0400 |
commit | 8e8e019e910f20947fea7eff5da40753639d8870 (patch) | |
tree | 622bb812570502c863ad7f8fc2183d174c9f6f8d /btrfs-list.c | |
parent | a1e89891eb6af5381539d9875b85c196150171b6 (diff) |
Btrfs-progs: introduces '-a' option into subvolume list command
We list the subvolumes under current directory according to the input
subvolume.
However, if we still want to list all the subvolumes in the tree, we
can use '-a' option to help us.
There may be two kinds of path: absolute path , relative path .
The absolute path is beginning with "<FS_TREE>"
The relative path is under current path that you input.
Signed-off-by: Wang Shilong <wangsl-fnst@cn.fujitsu.com>
Diffstat (limited to 'btrfs-list.c')
-rw-r--r-- | btrfs-list.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/btrfs-list.c b/btrfs-list.c index f079d998..e5f0f969 100644 --- a/btrfs-list.c +++ b/btrfs-list.c @@ -627,8 +627,16 @@ static int resolve_root(struct root_lookup *rl, struct root_info *ri, break; } - /* if the ref_tree refers to ourselves, we're at the top */ - if (next == found->root_id) { + if (next == BTRFS_FS_TREE_OBJECTID) { + char p[] = "<FS_TREE>"; + add_len = strlen(p); + len = strlen(full_path); + tmp = malloc(len + add_len + 2); + memcpy(tmp + add_len + 1, full_path, len); + tmp[add_len] = '/'; + memcpy(tmp, p, add_len); + free(full_path); + full_path = tmp; ri->top_id = next; break; } |