From 8e8e019e910f20947fea7eff5da40753639d8870 Mon Sep 17 00:00:00 2001 From: Wang Shilong Date: Fri, 28 Sep 2012 01:25:00 +0800 Subject: 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 "" The relative path is under current path that you input. Signed-off-by: Wang Shilong --- btrfs-list.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'btrfs-list.c') 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[] = ""; + 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; } -- cgit v1.2.3