linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Miao Xie <miaox@cn.fujitsu.com>
To: Anand jain <Anand.Jain@oracle.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 2/4] Btrfs-progs: fix irrelevant string in the subvol path
Date: Fri, 19 Oct 2012 16:59:45 +0800	[thread overview]
Message-ID: <50811681.2000702@cn.fujitsu.com> (raw)
In-Reply-To: <1350627837-27639-3-git-send-email-Anand.Jain@oracle.com>

On 	fri, 19 Oct 2012 14:23:55 +0800, Anand jain wrote:
> From: Anand Jain <anand.jain@oracle.com>
> 
> btrfs su list -a /btrfs/sv1
> ID 256 gen 6 top level 5 path <FS_TREE>/sv1
> ID 258 gen 6 top level 5 path <FS_TREE>/ss1

I don't agree with this patch, because after applying this patch, the output of 'btrfs su list'
is the same as 'btrfs su list'. I hope 'btrfs su list' just list the subvolumes in the specified
path. In this way, the user can find the path of the subvolume easily (the specified path + the
path in the result of 'btrfs su list').

Could you make it output the path which is relative to the path that the user specified? 

Thanks
Miao

> 
> Signed-off-by: Anand Jain <anand.jain@oracle.com>
> ---
>  cmds-subvolume.c |   15 +++++++++++++--
>  1 files changed, 13 insertions(+), 2 deletions(-)
> 
> diff --git a/cmds-subvolume.c b/cmds-subvolume.c
> index a33c352..f8beecc 100644
> --- a/cmds-subvolume.c
> +++ b/cmds-subvolume.c
> @@ -306,7 +306,7 @@ static int cmd_subvol_list(int argc, char **argv)
>  	u64 top_id;
>  	int ret;
>  	int c;
> -	char *subvol;
> +	char *subvol, *mnt = NULL;
>  	int is_tab_result = 0;
>  	int is_list_all = 0;
>  	struct option long_options[] = {
> @@ -398,9 +398,18 @@ static int cmd_subvol_list(int argc, char **argv)
>  		return 13;
>  	}
>  
> -	fd = open_file_or_dir(subvol);
> +	ret = find_mount_root(subvol, &mnt);
> +	if (ret < 0) {
> +		fprintf(stderr, "ERROR: find_mount_root failed on %s: "
> +				"%s\n", subvol,
> +			strerror(-ret));
> +		return 12;
> +	}
> +
> +	fd = open_file_or_dir(mnt);
>  	if (fd < 0) {
>  		fprintf(stderr, "ERROR: can't access '%s'\n", subvol);
> +		free(mnt);
>  		return 12;
>  	}
>  
> @@ -412,6 +421,8 @@ static int cmd_subvol_list(int argc, char **argv)
>  
>  	ret = btrfs_list_subvols(fd, filter_set, comparer_set,
>  				is_tab_result);
> +
> +	free(mnt);
>  	if (ret)
>  		return 19;
>  	return 0;
> 



  reply	other threads:[~2012-10-19  8:59 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-19  6:23 [PATCH 0/4] filter snapshot(s) by its parent uuid Anand jain
2012-10-19  6:23 ` [PATCH 1/4] Btrfs-progs: provide method to check if filter is set Anand jain
2012-10-19  6:23 ` [PATCH 2/4] Btrfs-progs: fix irrelevant string in the subvol path Anand jain
2012-10-19  8:59   ` Miao Xie [this message]
2012-10-19  6:23 ` [PATCH 3/4] Btrfs-progs: add method to filter snapshots by parent uuid Anand jain
2012-10-19  6:23 ` [PATCH 4/4] Btrfs-progs: list only snapshots of the given subvol Anand jain
2012-10-19  7:38 ` [PATCH 0/4] filter snapshot(s) by its parent uuid Miao Xie
2012-10-19  8:37   ` Rory Campbell-Lange
2012-10-22 12:34     ` Lenz Grimmer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=50811681.2000702@cn.fujitsu.com \
    --to=miaox@cn.fujitsu.com \
    --cc=Anand.Jain@oracle.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).