* [PATCH 1/2] btrfs-progs: Describe optarg of -m option in the manpage of receive @ 2016-03-16 2:01 Satoru Takeuchi 2016-03-16 2:11 ` [PATCH 2/2 v2] fix a regression that "property" with -t option doesn't work Satoru Takeuchi 2016-03-16 9:28 ` [PATCH 1/2] btrfs-progs: Describe optarg of -m option in the manpage of receive David Sterba 0 siblings, 2 replies; 5+ messages in thread From: Satoru Takeuchi @ 2016-03-16 2:01 UTC (permalink / raw) To: linux-btrfs@vger.kernel.org Signed-off-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com> --- This patch can be applied to devel branch (commit: 4685a560811a) --- Documentation/btrfs-receive.asciidoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/btrfs-receive.asciidoc b/Documentation/btrfs-receive.asciidoc index 84b85c1..758eebe 100644 --- a/Documentation/btrfs-receive.asciidoc +++ b/Documentation/btrfs-receive.asciidoc @@ -43,7 +43,7 @@ or on EOF. --max-errors <N>:: Terminate as soon as N errors happened while processing commands from the send stream. Default value is 1. A value of 0 means no limit. --m:: +-m <mountpoint>:: The root mount point of the destination fs. + By default the mountpoint is searched in /proc/self/mounts. -- 2.5.0 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2 v2] fix a regression that "property" with -t option doesn't work 2016-03-16 2:01 [PATCH 1/2] btrfs-progs: Describe optarg of -m option in the manpage of receive Satoru Takeuchi @ 2016-03-16 2:11 ` Satoru Takeuchi 2016-03-16 2:15 ` [PATCH 2/2 v2] btrfs-progs: Fix " Satoru Takeuchi 2016-03-16 9:28 ` [PATCH 1/2] btrfs-progs: Describe optarg of -m option in the manpage of receive David Sterba 1 sibling, 1 reply; 5+ messages in thread From: Satoru Takeuchi @ 2016-03-16 2:11 UTC (permalink / raw) To: linux-btrfs@vger.kernel.org "property" is considered as working without any options from the following commit. commit 176aeca9a148 ("btrfs-progs: add getopt stubs where needed") However, we can pass -t option to this command. * actual result ================================================== $ ./btrfs prop list -t f /btrfs btrfs property list: invalid option -- 't' usage: btrfs property list [-t <type>] <object> Lists available properties with their descriptions for the given object. Please see the help of 'btrfs property get' for a description of objects and object types. ================================================== * expected result ================================================== $ ./btrfs prop list -t f /btrfs label Set/get label of device. ================================================== Signed-off-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com --- v2: Reflect David's comment. - Check the number of non-option arguments --- cmds-property.c | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/cmds-property.c b/cmds-property.c index 5b4da26..eed5f4a 100644 --- a/cmds-property.c +++ b/cmds-property.c @@ -294,10 +294,11 @@ out: static void parse_args(int argc, char **argv, const char * const *usage_str, int *types, char **object, - char **name, char **value) + char **name, char **value, int min_nonopt_args) { int ret; char *type_str = NULL; + int max_nonopt_args = 0; optind = 1; while (1) { @@ -314,6 +315,17 @@ static void parse_args(int argc, char **argv, } } + if (object) + max_nonopt_args++; + if (name) + max_nonopt_args++; + if (value) + max_nonopt_args++; + + if (check_argc_min(argc - optind, min_nonopt_args) || + check_argc_max(argc - optind, max_nonopt_args)) + usage(usage_str); + *types = 0; if (type_str) { if (!strcmp(type_str, "s") || !strcmp(type_str, "subvol")) { @@ -379,13 +391,8 @@ static int cmd_property_get(int argc, char **argv) char *name = NULL; int types = 0; - clean_args_no_options(argc, argv, cmd_property_get_usage); - - if (check_argc_min(argc, 2) || check_argc_max(argc, 5)) - usage(cmd_property_get_usage); - parse_args(argc, argv, cmd_property_get_usage, &types, &object, &name, - NULL); + NULL, 1); if (!object) { error("invalid arguments"); usage(cmd_property_get_usage); @@ -415,13 +422,8 @@ static int cmd_property_set(int argc, char **argv) char *value = NULL; int types = 0; - clean_args_no_options(argc, argv, cmd_property_set_usage); - - if (check_argc_min(argc, 4) || check_argc_max(argc, 6)) - usage(cmd_property_set_usage); - parse_args(argc, argv, cmd_property_set_usage, &types, - &object, &name, &value); + &object, &name, &value, 3); if (!object || !name || !value) { error("invalid arguments"); usage(cmd_property_set_usage); @@ -446,13 +448,8 @@ static int cmd_property_list(int argc, char **argv) char *object = NULL; int types = 0; - clean_args_no_options(argc, argv, cmd_property_list_usage); - - if (check_argc_min(argc, 2) || check_argc_max(argc, 4)) - usage(cmd_property_list_usage); - parse_args(argc, argv, cmd_property_list_usage, - &types, &object, NULL, NULL); + &types, &object, NULL, NULL, 1); if (!object) { error("invalid arguments"); usage(cmd_property_list_usage); -- 2.5.0 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2 v2] btrfs-progs: Fix a regression that "property" with -t option doesn't work 2016-03-16 2:11 ` [PATCH 2/2 v2] fix a regression that "property" with -t option doesn't work Satoru Takeuchi @ 2016-03-16 2:15 ` Satoru Takeuchi 2016-03-16 9:28 ` David Sterba 0 siblings, 1 reply; 5+ messages in thread From: Satoru Takeuchi @ 2016-03-16 2:15 UTC (permalink / raw) To: linux-btrfs@vger.kernel.org Sorry, I forgot to add "btrfs-progs: " in the subject line. --- "property" is considered as working without any options from the following commit. commit 176aeca9a148 ("btrfs-progs: add getopt stubs where needed") However, we can pass -t option to this command. * actual result ================================================== $ ./btrfs prop list -t f /btrfs btrfs property list: invalid option -- 't' usage: btrfs property list [-t <type>] <object> Lists available properties with their descriptions for the given object. Please see the help of 'btrfs property get' for a description of objects and object types. ================================================== * expected result ================================================== $ ./btrfs prop list -t f /btrfs label Set/get label of device. ================================================== Signed-off-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com --- v2: Reflect David's comment. - Check the number of non-option arguments --- cmds-property.c | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/cmds-property.c b/cmds-property.c index 5b4da26..eed5f4a 100644 --- a/cmds-property.c +++ b/cmds-property.c @@ -294,10 +294,11 @@ out: static void parse_args(int argc, char **argv, const char * const *usage_str, int *types, char **object, - char **name, char **value) + char **name, char **value, int min_nonopt_args) { int ret; char *type_str = NULL; + int max_nonopt_args = 0; optind = 1; while (1) { @@ -314,6 +315,17 @@ static void parse_args(int argc, char **argv, } } + if (object) + max_nonopt_args++; + if (name) + max_nonopt_args++; + if (value) + max_nonopt_args++; + + if (check_argc_min(argc - optind, min_nonopt_args) || + check_argc_max(argc - optind, max_nonopt_args)) + usage(usage_str); + *types = 0; if (type_str) { if (!strcmp(type_str, "s") || !strcmp(type_str, "subvol")) { @@ -379,13 +391,8 @@ static int cmd_property_get(int argc, char **argv) char *name = NULL; int types = 0; - clean_args_no_options(argc, argv, cmd_property_get_usage); - - if (check_argc_min(argc, 2) || check_argc_max(argc, 5)) - usage(cmd_property_get_usage); - parse_args(argc, argv, cmd_property_get_usage, &types, &object, &name, - NULL); + NULL, 1); if (!object) { error("invalid arguments"); usage(cmd_property_get_usage); @@ -415,13 +422,8 @@ static int cmd_property_set(int argc, char **argv) char *value = NULL; int types = 0; - clean_args_no_options(argc, argv, cmd_property_set_usage); - - if (check_argc_min(argc, 4) || check_argc_max(argc, 6)) - usage(cmd_property_set_usage); - parse_args(argc, argv, cmd_property_set_usage, &types, - &object, &name, &value); + &object, &name, &value, 3); if (!object || !name || !value) { error("invalid arguments"); usage(cmd_property_set_usage); @@ -446,13 +448,8 @@ static int cmd_property_list(int argc, char **argv) char *object = NULL; int types = 0; - clean_args_no_options(argc, argv, cmd_property_list_usage); - - if (check_argc_min(argc, 2) || check_argc_max(argc, 4)) - usage(cmd_property_list_usage); - parse_args(argc, argv, cmd_property_list_usage, - &types, &object, NULL, NULL); + &types, &object, NULL, NULL, 1); if (!object) { error("invalid arguments"); usage(cmd_property_list_usage); -- 2.5.0 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2 v2] btrfs-progs: Fix a regression that "property" with -t option doesn't work 2016-03-16 2:15 ` [PATCH 2/2 v2] btrfs-progs: Fix " Satoru Takeuchi @ 2016-03-16 9:28 ` David Sterba 0 siblings, 0 replies; 5+ messages in thread From: David Sterba @ 2016-03-16 9:28 UTC (permalink / raw) To: Satoru Takeuchi; +Cc: linux-btrfs@vger.kernel.org On Wed, Mar 16, 2016 at 11:15:42AM +0900, Satoru Takeuchi wrote: > Sorry, I forgot to add "btrfs-progs: " in the subject line. > --- > "property" is considered as working without any options > from the following commit. > > commit 176aeca9a148 ("btrfs-progs: add getopt stubs where needed") > > However, we can pass -t option to this command. > > * actual result > > ================================================== > $ ./btrfs prop list -t f /btrfs > btrfs property list: invalid option -- 't' > usage: btrfs property list [-t <type>] <object> > > Lists available properties with their descriptions for the given object. > > Please see the help of 'btrfs property get' for a description of > objects and object types. > > ================================================== > > * expected result > > ================================================== > $ ./btrfs prop list -t f /btrfs > label Set/get label of device. > ================================================== > > Signed-off-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com Applied, thanks. ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] btrfs-progs: Describe optarg of -m option in the manpage of receive 2016-03-16 2:01 [PATCH 1/2] btrfs-progs: Describe optarg of -m option in the manpage of receive Satoru Takeuchi 2016-03-16 2:11 ` [PATCH 2/2 v2] fix a regression that "property" with -t option doesn't work Satoru Takeuchi @ 2016-03-16 9:28 ` David Sterba 1 sibling, 0 replies; 5+ messages in thread From: David Sterba @ 2016-03-16 9:28 UTC (permalink / raw) To: Satoru Takeuchi; +Cc: linux-btrfs@vger.kernel.org On Wed, Mar 16, 2016 at 11:01:11AM +0900, Satoru Takeuchi wrote: > Signed-off-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com> Applied, thanks. ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-03-16 9:28 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2016-03-16 2:01 [PATCH 1/2] btrfs-progs: Describe optarg of -m option in the manpage of receive Satoru Takeuchi 2016-03-16 2:11 ` [PATCH 2/2 v2] fix a regression that "property" with -t option doesn't work Satoru Takeuchi 2016-03-16 2:15 ` [PATCH 2/2 v2] btrfs-progs: Fix " Satoru Takeuchi 2016-03-16 9:28 ` David Sterba 2016-03-16 9:28 ` [PATCH 1/2] btrfs-progs: Describe optarg of -m option in the manpage of receive 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.