Skip to contentSkip to conversation

v2: btrfs-progs: Introduce 'btrfs inspect-internal dump-csum' option

PATCH New Lakshmipathi.G 1 participant 1 message Jul 16, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 v2: btrfs-progs: Introduce 'btrfs inspect-internal dump-csum' option

Dump csum for a given file.

Sample usage:
btrfs inspect-internal dump-csum /btrfs/50gbfile /dev/sda4 csum for /btrfs/50gbfile dumped to /btrfs/50gbfile.csumdump

---
 Makefile                 |   2 +-
 cmds-inspect-dump-csum.c | 256 +++++++++++++++++++++++++++++++++++++++++++++++
 cmds-inspect-dump-csum.h |  22 ++++
 cmds-inspect.c           |   3 +
 4 files changed, 282 insertions(+), 1 deletion(-)
 create mode 100644 cmds-inspect-dump-csum.c
 create mode 100644 cmds-inspect-dump-csum.h
Makefile +1 -1
index 544410e..8ad2801 100644
@@ -122,7 +122,7 @@ cmds_objects = cmds-subvolume.o cmds-filesystem.o cmds-device.o cmds-scrub.o \
 	       cmds-quota.o cmds-qgroup.o cmds-replace.o check/main.o \
 	       cmds-restore.o cmds-rescue.o chunk-recover.o super-recover.o \
 	       cmds-property.o cmds-fi-usage.o cmds-inspect-dump-tree.o \
-	       cmds-inspect-dump-super.o cmds-inspect-tree-stats.o cmds-fi-du.o \
+	       cmds-inspect-dump-super.o cmds-inspect-tree-stats.o cmds-fi-du.o cmds-inspect-dump-csum.o \
 	       mkfs/common.o check/mode-common.o check/mode-lowmem.o
 libbtrfs_objects = send-stream.o send-utils.o kernel-lib/rbtree.o btrfs-list.o \
 		   kernel-lib/crc32c.o messages.o \
cmds-inspect-dump-csum.c new file +256 -0

256 lines not on this page · raw message

cmds-inspect-dump-csum.h new file +22 -0
new file mode 100644
index 0000000..338fa67
@@ -0,0 +1,22 @@
+/*
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License v2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 021110-1307, USA.
+ *
+ * Authors: Lakshmipathi.G <[email protected]>
+ */
+
+
+int cmd_inspect_dump_csum(int argc, char **argv);
+
+extern const char * const cmd_inspect_dump_csum_usage[];
cmds-inspect.c +3 -0
index afd7fe4..c0d59c6 100644
@@ -32,6 +32,7 @@
 #include "commands.h"
 #include "btrfs-list.h"
 #include "help.h"
+#include "cmds-inspect-dump-csum.h"
 
 static const char * const inspect_cmd_group_usage[] = {
 	"btrfs inspect-internal <command> <args>",
@@ -647,6 +648,8 @@ const struct cmd_group inspect_cmd_group = {
 				cmd_inspect_dump_super_usage, NULL, 0 },
 		{ "tree-stats", cmd_inspect_tree_stats,
 				cmd_inspect_tree_stats_usage, NULL, 0 },
+		{ "dump-csum", cmd_inspect_dump_csum,
+				cmd_inspect_dump_csum_usage, NULL, 0 },
 		NULL_CMD_STRUCT
 	}
 };
Signature · 1 line
1.9.3