fstests.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eryu Guan <guaneryu@gmail.com>
To: Marcos Paulo de Souza <marcos@mpdesouza.com>
Cc: dsterba@suse.com, nborisov@suse.com, linux-btrfs@vger.kernel.org,
	fstests@vger.kernel.org,
	Marcos Paulo de Souza <mpdesouza@suse.com>
Subject: Re: [ fstests PATCHv3 1/2] common: btrfs: Improve _require_btrfs_command
Date: Sun, 1 Mar 2020 21:36:02 +0800	[thread overview]
Message-ID: <20200301133600.GJ3840@desktop> (raw)
In-Reply-To: <20200224031341.27740-2-marcos@mpdesouza.com>

On Mon, Feb 24, 2020 at 12:13:40AM -0300, Marcos Paulo de Souza wrote:
> From: Marcos Paulo de Souza <mpdesouza@suse.com>
> 
> Now _require_btrfs_command can also check for subfuntion options, like
> "subvolume delete --subvolid".
> 
> Signed-off-by: Marcos Paulo de Souza <mpdesouza@suse.com>

Ah, this patch has already been applied in previous updates. Please see

2f9b4039253d common/btrfs: Improve _require_btrfs_command

Thanks,
Eryu

> ---
> Changes from v2:
> * Added Reviewed-by from Nikolay to patch 0001
> 
> Changes from v1:
> * New patch expanding the funtionality of _require_btrfs_command, which now
>   check for argument of subcommands
> 
>  common/btrfs | 13 +++++++++++--
>  1 file changed, 11 insertions(+), 2 deletions(-)
> 
> diff --git a/common/btrfs b/common/btrfs
> index 19ac7cc4..ae3142b6 100644
> --- a/common/btrfs
> +++ b/common/btrfs
> @@ -12,12 +12,14 @@ _btrfs_get_subvolid()
>  
>  # _require_btrfs_command <command> [<subcommand>|<option>]
>  # We check for btrfs and (optionally) features of the btrfs command
> -# It can both subfunction like "inspect-internal dump-tree" and
> -# options like "check --qgroup-report"
> +# This function support both subfunction like "inspect-internal dump-tree" and
> +# options like "check --qgroup-report", and also subfunction options like
> +# "subvolume delete --subvolid"
>  _require_btrfs_command()
>  {
>  	local cmd=$1
>  	local param=$2
> +	local param_arg=$3
>  	local safe_param
>  
>  	_require_command "$BTRFS_UTIL_PROG" btrfs
> @@ -39,6 +41,13 @@ _require_btrfs_command()
>  
>  	$BTRFS_UTIL_PROG $cmd $param --help &> /dev/null
>  	[ $? -eq 0 ] || _notrun "$BTRFS_UTIL_PROG too old (must support $cmd $param)"
> +
> +	test -z "$param_arg" && return
> +
> +	# replace leading "-"s for grep
> +	safe_param=$(echo $param_arg | sed 's/^-*//')
> +	$BTRFS_UTIL_PROG $cmd $param --help | grep -wq $safe_param || \
> +		_notrun "$BTRFS_UTIL_PROG too old (must support $cmd $param $param_arg)"
>  }
>  
>  # Require extra check on btrfs qgroup numbers
> -- 
> 2.25.0
> 

  parent reply	other threads:[~2020-03-01 13:37 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-24  3:13 [ fstests PATCHv3 0/2] btrfs: Test subvolume delete by id feature Marcos Paulo de Souza
2020-02-24  3:13 ` [ fstests PATCHv3 1/2] common: btrfs: Improve _require_btrfs_command Marcos Paulo de Souza
2020-02-24 19:54   ` Johannes Thumshirn
2020-03-01 13:36   ` Eryu Guan [this message]
2020-02-24  3:13 ` [ fstests PATCHv3 2/2] btrfs: Test subvolume delete --subvolid feature Marcos Paulo de Souza
2020-03-01 13:54   ` Eryu Guan
2020-03-01 17:06     ` Marcos Paulo de Souza
2020-03-08 15:12       ` Eryu Guan
2020-03-08 15:15         ` Eryu Guan

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=20200301133600.GJ3840@desktop \
    --to=guaneryu@gmail.com \
    --cc=dsterba@suse.com \
    --cc=fstests@vger.kernel.org \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=marcos@mpdesouza.com \
    --cc=mpdesouza@suse.com \
    --cc=nborisov@suse.com \
    /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).