All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Btrfs-progs: end user may like full path for the subvol list display
@ 2012-09-28 12:56 Anand jain
  2012-09-28 12:57 ` [PATCH] Btrfs-progs: put find_mount_root() in commands.h Anand jain
  2012-09-30 23:42 ` [PATCH] Btrfs-progs: end user may like full path for the subvol list display David Sterba
  0 siblings, 2 replies; 3+ messages in thread
From: Anand jain @ 2012-09-28 12:56 UTC (permalink / raw)
  To: linux-btrfs

From: Anand Jain <anand.jain@oracle.com>

Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
 btrfs-list.c     |   10 +++++-----
 cmds-subvolume.c |   12 +++++++++---
 2 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/btrfs-list.c b/btrfs-list.c
index c53d016..9191b7c 100644
--- a/btrfs-list.c
+++ b/btrfs-list.c
@@ -719,7 +719,7 @@ static int __list_subvol_fill_paths(int fd, struct root_lookup *root_lookup)
 	return 0;
 }
 
-int list_subvols(int fd, int print_parent, int get_default)
+int list_subvols(int fd, int print_parent, int get_default, char *mntp)
 {
 	struct root_lookup root_lookup;
 	struct rb_node *n;
@@ -779,14 +779,14 @@ int list_subvols(int fd, int print_parent, int get_default)
 
 		resolve_root(&root_lookup, entry, &parent_id, &level, &path);
 		if (print_parent) {
-			printf("ID %llu parent %llu top level %llu path %s\n",
+			printf("ID %llu parent %llu top level %llu path %s/%s\n",
 				(unsigned long long)entry->root_id,
 				(unsigned long long)parent_id,
-				(unsigned long long)level, path);
+				(unsigned long long)level, mntp, path);
 		} else {
-			printf("ID %llu top level %llu path %s\n",
+			printf("ID %llu top level %llu path %s/%s\n",
 				(unsigned long long)entry->root_id,
-				(unsigned long long)level, path);
+				(unsigned long long)level, mntp, path);
 		}
 
 		free(path);
diff --git a/cmds-subvolume.c b/cmds-subvolume.c
index f4aa80f..0725d2d 100644
--- a/cmds-subvolume.c
+++ b/cmds-subvolume.c
@@ -31,7 +31,7 @@
 #include "commands.h"
 
 /* btrfs-list.c */
-int list_subvols(int fd, int print_parent, int get_default);
+int list_subvols(int fd, int print_parent, int get_default, char *mntp);
 int find_updated_files(int fd, u64 root_id, u64 oldest_gen);
 
 static const char * const subvolume_cmd_group_usage[] = {
@@ -274,6 +274,7 @@ static int cmd_subvol_list(int argc, char **argv)
 	int ret;
 	int print_parent = 0;
 	char *subvol;
+	char *mntp = NULL;
 
 	optind = 1;
 	while(1) {
@@ -310,7 +311,9 @@ static int cmd_subvol_list(int argc, char **argv)
 		fprintf(stderr, "ERROR: can't access '%s'\n", subvol);
 		return 12;
 	}
-	ret = list_subvols(fd, print_parent, 0);
+	find_mount_root(subvol, &mntp);
+	ret = list_subvols(fd, print_parent, 0, mntp);
+	free(mntp);
 	if (ret)
 		return 19;
 	return 0;
@@ -470,6 +473,7 @@ static int cmd_subvol_get_default(int argc, char **argv)
 	int fd;
 	int ret;
 	char *subvol;
+	char *mntp = NULL;
 
 	if (check_argc_exact(argc, 2))
 		usage(cmd_subvol_get_default_usage);
@@ -491,7 +495,9 @@ static int cmd_subvol_get_default(int argc, char **argv)
 		fprintf(stderr, "ERROR: can't access '%s'\n", subvol);
 		return 12;
 	}
-	ret = list_subvols(fd, 0, 1);
+	find_mount_root(subvol, &mntp);
+	ret = list_subvols(fd, 0, 1, mntp);
+	free(mntp);
 	if (ret)
 		return 19;
 	return 0;
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH] Btrfs-progs: put find_mount_root() in commands.h
  2012-09-28 12:56 [PATCH] Btrfs-progs: end user may like full path for the subvol list display Anand jain
@ 2012-09-28 12:57 ` Anand jain
  2012-09-30 23:42 ` [PATCH] Btrfs-progs: end user may like full path for the subvol list display David Sterba
  1 sibling, 0 replies; 3+ messages in thread
From: Anand jain @ 2012-09-28 12:57 UTC (permalink / raw)
  To: linux-btrfs

From: Anand Jain <anand.jain@oracle.com>

Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
 commands.h |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/commands.h b/commands.h
index bb6d2dd..eb9147a 100644
--- a/commands.h
+++ b/commands.h
@@ -106,3 +106,6 @@ int cmd_qgroup(int argc, char **argv);
 
 /* subvolume exported functions */
 int test_issubvolume(char *path);
+
+/* send.c */
+int find_mount_root(const char *path, char **mount_root);
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] Btrfs-progs: end user may like full path for the subvol list display
  2012-09-28 12:56 [PATCH] Btrfs-progs: end user may like full path for the subvol list display Anand jain
  2012-09-28 12:57 ` [PATCH] Btrfs-progs: put find_mount_root() in commands.h Anand jain
@ 2012-09-30 23:42 ` David Sterba
  1 sibling, 0 replies; 3+ messages in thread
From: David Sterba @ 2012-09-30 23:42 UTC (permalink / raw)
  To: Anand jain; +Cc: linux-btrfs

On Fri, Sep 28, 2012 at 08:56:33PM +0800, Anand jain wrote:
> From: Anand Jain <anand.jain@oracle.com>

> [PATCH] Btrfs-progs: end user may like full path for the subvol list
> display

Sure, why not, but please make it optional, eg. with --full-subvol-path
or similar ugly command line option :)

There are several patches touching the output format of the subvolume
listing, it would be great to put them all into one branch and then
unify the options.

It may end up in a more invasive format change where the one-line would
stay as is now and another --verbose format where the rest of the
information (generation, timestamp, uuid, rw/ro, parent) will be listed
separately under the subvol name in a parseable format.


david

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-09-30 23:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-28 12:56 [PATCH] Btrfs-progs: end user may like full path for the subvol list display Anand jain
2012-09-28 12:57 ` [PATCH] Btrfs-progs: put find_mount_root() in commands.h Anand jain
2012-09-30 23:42 ` [PATCH] Btrfs-progs: end user may like full path for the subvol list display David Sterba

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.