forked from Mirrors/btrfs-progs
Btrfs-progs: switch to arg_strtou64() part2
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>master
parent
aab2f48c18
commit
86da12ff86
|
@ -36,7 +36,7 @@
|
|||
#define FIELD_BUF_LEN 80
|
||||
|
||||
struct extent_buffer *debug_corrupt_block(struct btrfs_root *root, u64 bytenr,
|
||||
u32 blocksize, int copy)
|
||||
u32 blocksize, u64 copy)
|
||||
{
|
||||
int ret;
|
||||
struct extent_buffer *eb;
|
||||
|
@ -165,7 +165,7 @@ static int corrupt_keys_in_block(struct btrfs_root *root, u64 bytenr)
|
|||
}
|
||||
|
||||
static int corrupt_extent(struct btrfs_trans_handle *trans,
|
||||
struct btrfs_root *root, u64 bytenr, int copy)
|
||||
struct btrfs_root *root, u64 bytenr, u64 copy)
|
||||
{
|
||||
struct btrfs_key key;
|
||||
struct extent_buffer *leaf;
|
||||
|
@ -792,7 +792,7 @@ int main(int ac, char **av)
|
|||
u64 logical = (u64)-1;
|
||||
int ret = 0;
|
||||
int option_index = 0;
|
||||
int copy = 0;
|
||||
u64 copy = 0;
|
||||
u64 bytes = 4096;
|
||||
int extent_rec = 0;
|
||||
int extent_tree = 0;
|
||||
|
@ -816,23 +816,13 @@ int main(int ac, char **av)
|
|||
break;
|
||||
switch(c) {
|
||||
case 'l':
|
||||
logical = atoll(optarg);
|
||||
logical = arg_strtou64(optarg);
|
||||
break;
|
||||
case 'c':
|
||||
copy = atoi(optarg);
|
||||
if (copy <= 0) {
|
||||
fprintf(stderr,
|
||||
"invalid copy number\n");
|
||||
print_usage();
|
||||
}
|
||||
copy = arg_strtou64(optarg);
|
||||
break;
|
||||
case 'b':
|
||||
bytes = atoll(optarg);
|
||||
if (bytes == 0) {
|
||||
fprintf(stderr,
|
||||
"invalid byte count\n");
|
||||
print_usage();
|
||||
}
|
||||
bytes = arg_strtou64(optarg);
|
||||
break;
|
||||
case 'e':
|
||||
extent_rec = 1;
|
||||
|
@ -849,33 +839,16 @@ int main(int ac, char **av)
|
|||
case 'U':
|
||||
chunk_tree = 1;
|
||||
case 'i':
|
||||
inode = atoll(optarg);
|
||||
if (inode == 0) {
|
||||
fprintf(stderr,
|
||||
"invalid inode number\n");
|
||||
print_usage();
|
||||
}
|
||||
inode = arg_strtou64(optarg);
|
||||
break;
|
||||
case 'f':
|
||||
strncpy(field, optarg, FIELD_BUF_LEN);
|
||||
break;
|
||||
case 'x':
|
||||
errno = 0;
|
||||
file_extent = atoll(optarg);
|
||||
if (errno) {
|
||||
fprintf(stderr, "error converting "
|
||||
"%d\n", errno);
|
||||
print_usage();
|
||||
}
|
||||
file_extent = arg_strtou64(optarg);
|
||||
break;
|
||||
case 'm':
|
||||
errno = 0;
|
||||
metadata_block = atoll(optarg);
|
||||
if (errno) {
|
||||
fprintf(stderr, "error converting "
|
||||
"%d\n", errno);
|
||||
print_usage();
|
||||
}
|
||||
metadata_block = arg_strtou64(optarg);
|
||||
break;
|
||||
case 'K':
|
||||
ret = sscanf(optarg, "%llu,%u,%llu",
|
||||
|
|
|
@ -162,7 +162,7 @@ int main(int ac, char **av)
|
|||
root_backups = 1;
|
||||
break;
|
||||
case 'b':
|
||||
block_only = atoll(optarg);
|
||||
block_only = arg_strtou64(optarg);
|
||||
break;
|
||||
default:
|
||||
print_usage();
|
||||
|
|
|
@ -2463,8 +2463,8 @@ int main(int argc, char *argv[])
|
|||
{
|
||||
char *source;
|
||||
char *target;
|
||||
int num_threads = 0;
|
||||
int compress_level = 0;
|
||||
u64 num_threads = 0;
|
||||
u64 compress_level = 0;
|
||||
int create = 1;
|
||||
int old_restore = 0;
|
||||
int walk_trees = 0;
|
||||
|
@ -2483,13 +2483,13 @@ int main(int argc, char *argv[])
|
|||
create = 0;
|
||||
break;
|
||||
case 't':
|
||||
num_threads = atoi(optarg);
|
||||
if (num_threads <= 0 || num_threads > 32)
|
||||
num_threads = arg_strtou64(optarg);
|
||||
if (num_threads > 32)
|
||||
print_usage();
|
||||
break;
|
||||
case 'c':
|
||||
compress_level = atoi(optarg);
|
||||
if (compress_level < 0 || compress_level > 9)
|
||||
compress_level = arg_strtou64(optarg);
|
||||
if (compress_level > 9)
|
||||
print_usage();
|
||||
break;
|
||||
case 'o':
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include "transaction.h"
|
||||
#include "list.h"
|
||||
#include "version.h"
|
||||
#include "utils.h"
|
||||
|
||||
/* we write the mirror info to stdout unless they are dumping the data
|
||||
* to stdout
|
||||
|
@ -38,7 +39,7 @@
|
|||
static FILE *info_file;
|
||||
|
||||
static struct extent_buffer * debug_read_block(struct btrfs_root *root,
|
||||
u64 bytenr, u32 blocksize, int copy)
|
||||
u64 bytenr, u32 blocksize, u64 copy)
|
||||
{
|
||||
int ret;
|
||||
struct extent_buffer *eb;
|
||||
|
@ -120,7 +121,7 @@ int main(int ac, char **av)
|
|||
u64 logical = 0;
|
||||
int ret = 0;
|
||||
int option_index = 0;
|
||||
int copy = 0;
|
||||
u64 copy = 0;
|
||||
u64 bytes = 0;
|
||||
int out_fd = 0;
|
||||
|
||||
|
@ -132,28 +133,13 @@ int main(int ac, char **av)
|
|||
break;
|
||||
switch(c) {
|
||||
case 'l':
|
||||
logical = atoll(optarg);
|
||||
if (logical == 0) {
|
||||
fprintf(stderr,
|
||||
"invalid extent number\n");
|
||||
print_usage();
|
||||
}
|
||||
logical = arg_strtou64(optarg);
|
||||
break;
|
||||
case 'c':
|
||||
copy = atoi(optarg);
|
||||
if (copy == 0) {
|
||||
fprintf(stderr,
|
||||
"invalid copy number\n");
|
||||
print_usage();
|
||||
}
|
||||
copy = arg_strtou64(optarg);
|
||||
break;
|
||||
case 'b':
|
||||
bytes = atoll(optarg);
|
||||
if (bytes == 0) {
|
||||
fprintf(stderr,
|
||||
"invalid byte count\n");
|
||||
print_usage();
|
||||
}
|
||||
bytes = arg_strtou64(optarg);
|
||||
break;
|
||||
case 'o':
|
||||
output_file = strdup(optarg);
|
||||
|
|
|
@ -120,7 +120,7 @@ static int cmd_inode_resolve(int argc, char **argv)
|
|||
return 1;
|
||||
}
|
||||
|
||||
ret = __ino_to_path_fd(atoll(argv[optind]), fd, verbose,
|
||||
ret = __ino_to_path_fd(arg_strtou64(argv[optind]), fd, verbose,
|
||||
argv[optind+1]);
|
||||
close_file_or_dir(fd, dirstream);
|
||||
return !!ret;
|
||||
|
@ -167,7 +167,7 @@ static int cmd_logical_resolve(int argc, char **argv)
|
|||
verbose = 1;
|
||||
break;
|
||||
case 's':
|
||||
size = atoll(optarg);
|
||||
size = arg_strtou64(optarg);
|
||||
break;
|
||||
default:
|
||||
usage(cmd_logical_resolve_usage);
|
||||
|
@ -183,7 +183,7 @@ static int cmd_logical_resolve(int argc, char **argv)
|
|||
return 1;
|
||||
|
||||
memset(inodes, 0, sizeof(*inodes));
|
||||
loi.logical = atoll(argv[optind]);
|
||||
loi.logical = arg_strtou64(argv[optind]);
|
||||
loi.size = size;
|
||||
loi.inodes = (uintptr_t)inodes;
|
||||
|
||||
|
@ -283,7 +283,7 @@ static int cmd_subvolid_resolve(int argc, char **argv)
|
|||
goto out;
|
||||
}
|
||||
|
||||
subvol_id = atoll(argv[1]);
|
||||
subvol_id = arg_strtou64(argv[1]);
|
||||
ret = btrfs_subvolid_resolve(fd, path, sizeof(path), subvol_id);
|
||||
|
||||
if (ret) {
|
||||
|
|
Loading…
Reference in New Issue