summaryrefslogtreecommitdiff
path: root/debugfs/set_fields.c
diff options
context:
space:
mode:
Diffstat (limited to 'debugfs/set_fields.c')
-rw-r--r--debugfs/set_fields.c30
1 files changed, 18 insertions, 12 deletions
diff --git a/debugfs/set_fields.c b/debugfs/set_fields.c
index 08bfd8da..ffbda746 100644
--- a/debugfs/set_fields.c
+++ b/debugfs/set_fields.c
@@ -150,6 +150,8 @@ static struct field_set_info super_fields[] = {
{ "usr_quota_inum", &set_sb.s_usr_quota_inum, NULL, 4, parse_uint },
{ "grp_quota_inum", &set_sb.s_grp_quota_inum, NULL, 4, parse_uint },
{ "overhead_blocks", &set_sb.s_overhead_blocks, NULL, 4, parse_uint },
+ { "backup_bgs", &set_sb.s_backup_bgs[0], NULL, 4, parse_uint,
+ FLAG_ARRAY, 2 },
{ "checksum", &set_sb.s_checksum, NULL, 4, parse_uint },
{ 0, 0, 0, 0 }
};
@@ -389,7 +391,10 @@ static errcode_t parse_uint(struct field_set_info *info, char *field,
n = num & mask;
switch (size) {
case 8:
- *u.ptr64 = n;
+ /* Should never get here */
+ fprintf(stderr, "64-bit field %s has a second 64-bit field\n"
+ "defined; BUG?!?\n", info->name);
+ *u.ptr64 = 0;
break;
case 4:
*u.ptr32 = n;
@@ -526,22 +531,20 @@ static errcode_t parse_hashalg(struct field_set_info *info,
static errcode_t parse_bmap(struct field_set_info *info,
char *field EXT2FS_ATTR((unused)), char *arg)
{
- unsigned long num;
- blk_t blk;
+ blk64_t blk;
errcode_t retval;
char *tmp;
- num = strtoul(arg, &tmp, 0);
+ blk = strtoull(arg, &tmp, 0);
if (*tmp) {
fprintf(stderr, "Couldn't parse '%s' for field %s.\n",
arg, info->name);
return EINVAL;
}
- blk = num;
- retval = ext2fs_bmap(current_fs, set_ino,
+ retval = ext2fs_bmap2(current_fs, set_ino,
(struct ext2_inode *) &set_inode,
- 0, BMAP_SET, array_idx, &blk);
+ NULL, BMAP_SET, array_idx, NULL, &blk);
if (retval) {
com_err("set_inode", retval, "while setting block map");
}
@@ -701,11 +704,14 @@ void do_set_block_group_descriptor(int argc, char *argv[])
int size;
/*
- *Determine whether we are editing an ext2 or ext4 block
- * group descriptor
+ * Determine whether we are editing an ext2 or ext4 block group
+ * descriptor. Descriptors larger than ext4_group_desc cannot
+ * have their fields edited yet, because they do not have any
+ * names assigned. When that happens, this function needs to
+ * be updated for the new descriptor struct and fields.
*/
- if (current_fs && current_fs->super->s_feature_incompat &
- EXT4_FEATURE_INCOMPAT_64BIT) {
+ if (current_fs &&
+ EXT2_DESC_SIZE(current_fs->super) >= EXT2_MIN_DESC_SIZE_64BIT) {
table = ext4_bg_fields;
edit = &set_gd4;
size = sizeof(set_gd4);
@@ -801,7 +807,7 @@ void do_set_mmp_value(int argc, char *argv[])
if (retval) {
com_err(argv[0], retval, "reading MMP block %llu.\n",
(long long)current_fs->super->s_mmp_block);
- ext2fs_free_mem(mmp_s);
+ ext2fs_free_mem(&mmp_s);
return;
}
current_fs->mmp_buf = mmp_s;