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@xxxxxxxx>
---
btrfs-corrupt-block.c | 10 ++++++++++
1 file changed, 10 insertions(+)
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)
{
--
2.7.4
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html