@@ -49,10 +49,10 @@ index c19e664a..8d491c8f 100644
49
49
DECLARE_COMMAND(send);
50
50
diff --git a/cmds/inspect-dump-csum.c b/cmds/inspect-dump-csum.c
51
51
new file mode 100644
52
- index 00000000..8e607e51
52
+ index 00000000..4597ebf6
53
53
--- /dev/null
54
54
+++ b/cmds/inspect-dump-csum.c
55
- @@ -0,0 +1,243 @@
55
+ @@ -0,0 +1,244 @@
56
56
+ /*
57
57
+ * Copyright (C) 2019 SUSE. All rights reserved.
58
58
+ *
@@ -223,7 +223,7 @@ index 00000000..8e607e51
223
223
+ }
224
224
+
225
225
+ static const char * const cmd_inspect_dump_csum_usage[] = {
226
- + "btrfs inspect-internal dump-csum <path > <device>",
226
+ + "btrfs inspect-internal dump-csum <file > <device>",
227
227
+ "Dump checksums for a given file",
228
228
+ "",
229
229
+ OPTLINE("-d|--debug", "Be more verbose"),
@@ -269,13 +269,13 @@ index 00000000..8e607e51
269
269
+
270
270
+ fd = open(filename, O_RDONLY);
271
271
+ if (fd < 0) {
272
- + error("cannot open file %s: %m", filename);
272
+ + error("couldn't open file %s: %m", filename);
273
273
+ return -errno;
274
274
+ }
275
275
+
276
276
+ devfd = open(device, O_RDONLY);
277
277
+ if (devfd < 0) {
278
- + error("cannot open device %s: %m", device);
278
+ + error("couldn't open device %s: %m", device);
279
279
+ ret = -errno;
280
280
+ goto out_close;
281
281
+ }
@@ -284,13 +284,14 @@ index 00000000..8e607e51
284
284
+
285
285
+ if (btrfs_super_magic(&sb) != BTRFS_MAGIC) {
286
286
+ ret = -EINVAL;
287
- + error("bad magic on superblock on %s", device);
287
+ + error("bad superblock magic on %s", device);
288
288
+ goto out_close;
289
289
+ }
290
290
+
291
291
+ ret = btrfs_get_extent_csum(fd, &sb);
292
292
+ if (ret)
293
- + error("checsum lookup for file %s failed", filename);
293
+ + error("checksum lookup for file %s failed", filename);
294
+ +
294
295
+ out_close:
295
296
+ close(fd);
296
297
+ return ret;
0 commit comments