diff mbox

[4/4] btrfs-progs: "device ready" accepts just one device

Message ID 56E6056A.4020307@jp.fujitsu.com (mailing list archive)
State Accepted
Headers show

Commit Message

Satoru Takeuchi March 14, 2016, 12:27 a.m. UTC
* actual result

  =======================================
  # ./btrfs device ready /dev/sdb foo
  #
  =======================================

* expecting result

  =======================================
  # ./btrfs device ready /dev/sdb foo
  btrfs device ready: too many arguments
  usage: btrfs device ready <device>

      Check device to see if it has all of its devices in cache for mounting

  #
  =======================================

Signed-off-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
---
 cmds-device.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

David Sterba March 14, 2016, 12:05 p.m. UTC | #1
On Mon, Mar 14, 2016 at 09:27:22AM +0900, Satoru Takeuchi wrote:
> * actual result
> 
>   =======================================
>   # ./btrfs device ready /dev/sdb foo
>   #
>   =======================================
> 
> * expecting result
> 
>   =======================================
>   # ./btrfs device ready /dev/sdb foo
>   btrfs device ready: too many arguments
>   usage: btrfs device ready <device>
> 
>       Check device to see if it has all of its devices in cache for mounting
> 
>   #
>   =======================================
> 
> Signed-off-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
> ---
>  cmds-device.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/cmds-device.c b/cmds-device.c
> index 33da2ce..23656c3 100644
> --- a/cmds-device.c
> +++ b/cmds-device.c
> @@ -326,7 +326,7 @@ static int cmd_device_ready(int argc, char **argv)
> 
>  	clean_args_no_options(argc, argv, cmd_device_ready_usage);
> 
> -	if (check_argc_min(argc - optind, 1))
> +	if (check_argc_exact(argc - optind, 1))

This silently changes the semantics, so far it accepts multiple values
though it contradicts the documentation. I'm not yet sure how to resolve
that.

>  		usage(cmd_device_ready_usage);
> 
>  	fd = open("/dev/btrfs-control", O_RDWR);
> -- 
> 2.7.0
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Sterba April 25, 2016, 11:59 a.m. UTC | #2
On Mon, Mar 14, 2016 at 01:05:15PM +0100, David Sterba wrote:
> On Mon, Mar 14, 2016 at 09:27:22AM +0900, Satoru Takeuchi wrote:
> > * actual result
> > 
> >   =======================================
> >   # ./btrfs device ready /dev/sdb foo
> >   #
> >   =======================================
> > 
> > * expecting result
> > 
> >   =======================================
> >   # ./btrfs device ready /dev/sdb foo
> >   btrfs device ready: too many arguments
> >   usage: btrfs device ready <device>
> > 
> >       Check device to see if it has all of its devices in cache for mounting
> > 
> >   #
> >   =======================================
> > 
> > Signed-off-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
> > ---
> >  cmds-device.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/cmds-device.c b/cmds-device.c
> > index 33da2ce..23656c3 100644
> > --- a/cmds-device.c
> > +++ b/cmds-device.c
> > @@ -326,7 +326,7 @@ static int cmd_device_ready(int argc, char **argv)
> > 
> >  	clean_args_no_options(argc, argv, cmd_device_ready_usage);
> > 
> > -	if (check_argc_min(argc - optind, 1))
> > +	if (check_argc_exact(argc - optind, 1))
> 
> This silently changes the semantics, so far it accepts multiple values
> though it contradicts the documentation. I'm not yet sure how to resolve
> that.

More than one argument did not work before, so I think it's ok to expect
just one device. Applied.
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/cmds-device.c b/cmds-device.c
index 33da2ce..23656c3 100644
--- a/cmds-device.c
+++ b/cmds-device.c
@@ -326,7 +326,7 @@  static int cmd_device_ready(int argc, char **argv)

 	clean_args_no_options(argc, argv, cmd_device_ready_usage);

-	if (check_argc_min(argc - optind, 1))
+	if (check_argc_exact(argc - optind, 1))
 		usage(cmd_device_ready_usage);

 	fd = open("/dev/btrfs-control", O_RDWR);