mirror of
https://github.com/kdave/btrfs-progs
synced 2025-01-30 09:21:45 +00:00
btrfs-progs: corrupt-block: Factor out key parsing function
Currently passing a key with -K handling is open coded. I intend on changing the interface a bit to make the program more usable. To aid in this factor out common code which parses a triplet of the "u64,u8,u64" format, corresponding to a btrfs key. No functional changes. Signed-off-by: Nikolay Borisov <nborisov@suse.com> [ print optarg too ] Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
04be0e4b19
commit
572637b6f9
@ -1081,6 +1081,16 @@ out:
|
||||
|
||||
}
|
||||
|
||||
static void parse_key(u64 *objectid, u8 *type, u64 *offset)
|
||||
{
|
||||
|
||||
int ret = sscanf(optarg, "%llu,%hhu,%llu", objectid, type, offset);
|
||||
if (ret != 3) {
|
||||
fprintf(stderr, "error parsing key '%s': %d\n", optarg, errno);
|
||||
print_usage(1);
|
||||
}
|
||||
}
|
||||
|
||||
static struct btrfs_root *open_root(struct btrfs_fs_info *fs_info,
|
||||
u64 root_objectid)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user