mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/kdave/btrfs-progs.git
synced 2025-01-24 12:43:21 +08:00
btrfs-progs: qgroup show: report unrecognized format of sort string
Let the parsing function distinguish between parsing and other errors and use that in qgroup show. Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
88ab0824a2
commit
9a1550bb2d
@ -346,6 +346,10 @@ static int cmd_qgroup_show(int argc, char **argv)
|
||||
error("cannot parse sort string: %m");
|
||||
return 1;
|
||||
}
|
||||
if (ret > 0) {
|
||||
error("unrecognized format of sort string");
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
case GETOPT_VAL_SYNC:
|
||||
sync = 1;
|
||||
|
11
qgroup.c
11
qgroup.c
@ -1195,6 +1195,13 @@ int btrfs_show_qgroups(int fd,
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* Parse sort string and allocate new comparator.
|
||||
*
|
||||
* Return: 0 no errors while parsing
|
||||
* 1 parse error
|
||||
* <0 other errors
|
||||
*/
|
||||
int btrfs_qgroup_parse_sort_string(const char *opt_arg,
|
||||
struct btrfs_qgroup_comparer_set **comps)
|
||||
{
|
||||
@ -1232,7 +1239,7 @@ int btrfs_qgroup_parse_sort_string(const char *opt_arg,
|
||||
}
|
||||
|
||||
if (flag == 0) {
|
||||
ret = -1;
|
||||
ret = 1;
|
||||
goto out;
|
||||
} else {
|
||||
if (*p == '+') {
|
||||
@ -1246,7 +1253,7 @@ int btrfs_qgroup_parse_sort_string(const char *opt_arg,
|
||||
|
||||
what_to_sort = btrfs_qgroup_get_sort_item(p);
|
||||
if (what_to_sort < 0) {
|
||||
ret = -1;
|
||||
ret = 1;
|
||||
goto out;
|
||||
}
|
||||
btrfs_qgroup_setup_comparer(comps, what_to_sort, order);
|
||||
|
Loading…
Reference in New Issue
Block a user