diff options
author | Wang Shilong <wangsl.fnst@cn.fujitsu.com> | 2014-02-20 09:30:50 +0800 |
---|---|---|
committer | Chris Mason <clm@fb.com> | 2014-03-21 06:23:19 -0700 |
commit | aab2f48c189bb89b71851edbb57e9074405a6262 (patch) | |
tree | c192a7100e3de7d70f638551bbf5db30d900c164 /cmds-restore.c | |
parent | 42a3d9b7746e5a3bab0ca4532069078c43083b2c (diff) | |
download | btrfs-progs-aab2f48c189bb89b71851edbb57e9074405a6262.tar.gz |
Btrfs-progs: switch to arg_strtou64() part1
switch to arg_strtou64 plus some cleanups to remove unnecessary
codes.
Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <clm@fb.com>
Diffstat (limited to 'cmds-restore.c')
-rw-r--r-- | cmds-restore.c | 27 |
1 files changed, 5 insertions, 22 deletions
diff --git a/cmds-restore.c b/cmds-restore.c index fd533ce..6659c75 100644 --- a/cmds-restore.c +++ b/cmds-restore.c @@ -1160,26 +1160,14 @@ int cmd_restore(int argc, char **argv) overwrite = 1; break; case 't': - errno = 0; - tree_location = (u64)strtoll(optarg, NULL, 10); - if (errno != 0) { - fprintf(stderr, "Tree location not valid\n"); - exit(1); - } + tree_location = arg_strtou64(optarg); break; case 'f': - errno = 0; - fs_location = (u64)strtoll(optarg, NULL, 10); - if (errno != 0) { - fprintf(stderr, "Fs location not valid\n"); - exit(1); - } + fs_location = arg_strtou64(optarg); break; case 'u': - errno = 0; - super_mirror = (int)strtol(optarg, NULL, 10); - if (errno != 0 || - super_mirror >= BTRFS_SUPER_MIRROR_MAX) { + super_mirror = arg_strtou64(optarg); + if (super_mirror >= BTRFS_SUPER_MIRROR_MAX) { fprintf(stderr, "Super mirror not " "valid\n"); exit(1); @@ -1189,12 +1177,7 @@ int cmd_restore(int argc, char **argv) find_dir = 1; break; case 'r': - errno = 0; - root_objectid = (u64)strtoll(optarg, NULL, 10); - if (errno != 0) { - fprintf(stderr, "Root objectid not valid\n"); - exit(1); - } + root_objectid = arg_strtou64(optarg); break; case 'l': list_roots = 1; |