[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1207006592-13980-3-git-send-email-tytso@mit.edu>
Date: Mon, 31 Mar 2008 19:36:24 -0400
From: "Theodore Ts'o" <tytso@....EDU>
To: linux-ext4@...r.kernel.org
Cc: Andreas Dilger <adilger@...ger.ca>, "Theodore Ts'o" <tytso@....edu>
Subject: [PATCH, E2FSPROGS] debugfs: Add support for "set_block_group <bg_num> checksum calc"
From: Andreas Dilger <adilger@...ger.ca>
Signed-off-by: Andreas Dilger <adilger@...ger.ca>
Signed-off-by: "Theodore Ts'o" <tytso@....edu>
---
debugfs/set_fields.c | 18 ++++++++++++++++--
1 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/debugfs/set_fields.c b/debugfs/set_fields.c
index a58c94e..ee51c45 100644
--- a/debugfs/set_fields.c
+++ b/debugfs/set_fields.c
@@ -42,6 +42,7 @@
static struct ext2_super_block set_sb;
static struct ext2_inode set_inode;
static struct ext2_group_desc set_gd;
+static dgrp_t set_bg;
static ext2_ino_t set_ino;
static int array_idx;
@@ -63,6 +64,7 @@ static errcode_t parse_uuid(struct field_set_info *info, char *arg);
static errcode_t parse_hashalg(struct field_set_info *info, char *arg);
static errcode_t parse_time(struct field_set_info *info, char *arg);
static errcode_t parse_bmap(struct field_set_info *info, char *arg);
+static errcode_t parse_gd_csum(struct field_set_info *info, char *arg);
static struct field_set_info super_fields[] = {
{ "inodes_count", &set_sb.s_inodes_count, 4, parse_uint },
@@ -178,7 +180,7 @@ static struct field_set_info ext2_bg_fields[] = {
{ "flags", &set_gd.bg_flags, 2, parse_uint },
{ "reserved", &set_gd.bg_reserved, 2, parse_uint, FLAG_ARRAY, 2 },
{ "itable_unused", &set_gd.bg_itable_unused, 2, parse_uint },
- { "checksum", &set_gd.bg_checksum, 2, parse_uint },
+ { "checksum", &set_gd.bg_checksum, 2, parse_gd_csum },
{ 0, 0, 0, 0 }
};
@@ -402,6 +404,19 @@ static errcode_t parse_bmap(struct field_set_info *info, char *arg)
return retval;
}
+static errcode_t parse_gd_csum(struct field_set_info *info, char *arg)
+{
+
+ if (strcmp(arg, "calc") == 0) {
+ ext2fs_group_desc_csum_set(current_fs, set_bg);
+ set_gd = current_fs->group_desc[set_bg];
+ printf("Checksum set to 0x%04x\n",
+ current_fs->group_desc[set_bg].bg_checksum);
+ return 0;
+ }
+
+ return parse_uint(info, arg);
+}
static void print_possible_fields(struct field_set_info *fields)
{
@@ -521,7 +536,6 @@ void do_set_block_group_descriptor(int argc, char *argv[])
"\t\"set_block_group_descriptor -l\" will list the names of "
"the fields in a block group descriptor\n\twhich can be set.";
struct field_set_info *ss;
- dgrp_t set_bg;
char *end;
if ((argc == 2) && !strcmp(argv[1], "-l")) {
--
1.5.4.1.144.gdfee-dirty
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists