diff options
author | Wang Shilong <wangsl-fnst@cn.fujitsu.com> | 2013-01-20 16:04:15 -0500 |
---|---|---|
committer | David Sterba <dsterba@suse.cz> | 2013-01-21 18:28:01 +0100 |
commit | 9886166880ad36f586edd8f9fd220cc416b0d594 (patch) | |
tree | c592aae4222857429e83de86debaec4d63c8035b /cmds-qgroup.c | |
parent | f933e084eafe3f0b441f0ffb99505fc34a66194e (diff) |
Btrfs-progs: clean up reduplicate parse_qgroupid() and replace atoi with strtoull
1. parse_qgroupid() is implemented twice, clean up the reduplicate code.
2. atoi() can not detect errors, so use strtoull() instead of it.
Signed-off-by: Wang Shilong <wangsl-fnst@cn.fujitsu.com>
Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
Signed-off-by: Gene Czarcinski <gene@czarc.net>
Diffstat (limited to 'cmds-qgroup.c')
-rw-r--r-- | cmds-qgroup.c | 15 |
1 files changed, 1 insertions, 14 deletions
diff --git a/cmds-qgroup.c b/cmds-qgroup.c index 129a4f03..c4122bfd 100644 --- a/cmds-qgroup.c +++ b/cmds-qgroup.c @@ -24,26 +24,13 @@ #include "ioctl.h" #include "commands.h" +#include "qgroup.h" static const char * const qgroup_cmd_group_usage[] = { "btrfs qgroup <command> [options] <path>", NULL }; -static u64 parse_qgroupid(char *p) -{ - char *s = strchr(p, '/'); - u64 level; - u64 id; - - if (!s) - return atoll(p); - level = atoll(p); - id = atoll(s + 1); - - return (level << 48) | id; -} - static int qgroup_assign(int assign, int argc, char **argv) { int ret = 0; |