Skip to contentSkip to conversation

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

PATCH New Lakshmipathi.G 1 participant 1 message Apr 24, 2017

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

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

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

---
 Makefile                 |   3 +-
 cmds-inspect-dump-csum.c | 256 +++++++++++++++++++++++++++++++++++++++++++++++
 cmds-inspect-dump-csum.h |  24 +++++
 cmds-inspect.c           |   3 +
 4 files changed, 285 insertions(+), 1 deletion(-)
 create mode 100644 cmds-inspect-dump-csum.c
 create mode 100644 cmds-inspect-dump-csum.h
Makefile +2 -1
index 81598df..6e63e18 100644
@@ -102,7 +102,7 @@ cmds_objects = cmds-subvolume.o cmds-filesystem.o cmds-device.o cmds-scrub.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 \
-	       mkfs/common.o
+	       cmds-inspect-dump-csum.o mkfs/common.o
 libbtrfs_objects = send-stream.o send-utils.o kernel-lib/rbtree.o btrfs-list.o \
 		   kernel-lib/crc32c.o messages.o \
 		   uuid-tree.o utils-lib.o rbtree-utils.o
@@ -191,6 +191,7 @@ btrfs_convert_cflags = -DBTRFSCONVERT_EXT2=$(BTRFSCONVERT_EXT2)
 btrfs_fragments_libs = -lgd -lpng -ljpeg -lfreetype
 btrfs_debug_tree_objects = cmds-inspect-dump-tree.o
 btrfs_show_super_objects = cmds-inspect-dump-super.o
+btrfs_dump_csum_objects = cmds-inspect-dump-csum.o
 btrfs_calc_size_objects = cmds-inspect-tree-stats.o
 
 # collect values of the variables above
cmds-inspect-dump-csum.c new file +256 -0

256 lines not on this page · raw message

cmds-inspect-dump-csum.h new file +24 -0
new file mode 100644
index 0000000..05d1a8f
@@ -0,0 +1,24 @@
+/*
+ * 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]>
+ */
+
+#ifndef __CMDS_INSPECT_DUMP_CSUM_H__
+#define __CMDS_INSPECT_DUMP_CSUM_H__
+
+int cmd_inspect_dump_csum(int argc, char **argv);
+
+extern const char * const cmd_inspect_dump_csum_usage[];

+
+#endif

cmds-inspect.c +3 -0
index 58b5956..3d248d0 100644
@@ -34,6 +34,7 @@
 #include "cmds-inspect-dump-tree.h"
 #include "cmds-inspect-dump-super.h"
 #include "cmds-inspect-tree-stats.h"
+#include "cmds-inspect-dump-csum.h"
 #include "help.h"
 
 static const char * const inspect_cmd_group_usage[] = {
@@ -650,6 +651,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
2.7.4