Message ID | 1526296414-27638-4-git-send-email-nborisov@suse.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
diff --git a/btrfs-corrupt-block.c b/btrfs-corrupt-block.c index 0018b6c9662d..39a611d89d55 100644 --- a/btrfs-corrupt-block.c +++ b/btrfs-corrupt-block.c @@ -1081,6 +1081,16 @@ static int find_chunk_offset(struct btrfs_root *root, } +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 %d\n", errno); + print_usage(1); + } +} + static struct btrfs_root *open_root(struct btrfs_fs_info *fs_info, u64 root_objectid) {
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> --- btrfs-corrupt-block.c | 10 ++++++++++ 1 file changed, 10 insertions(+)