X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=debugfs%2Fset_fields.c;h=65949060d980feb060278a58d5fa2b3407a76a69;hb=366d526f15ef06c0a832dee4abe2a0c0349adb92;hp=973afa788a9888ad7141b22224601a0726c4bf15;hpb=f3d9ac36a021aab3d84ef7759790839f9a65a1bf;p=tools%2Fe2fsprogs.git diff --git a/debugfs/set_fields.c b/debugfs/set_fields.c index 973afa7..6594906 100644 --- a/debugfs/set_fields.c +++ b/debugfs/set_fields.c @@ -175,6 +175,7 @@ static struct field_set_info super_fields[] = { FLAG_ARRAY, 4 }, { "encrypt_pw_salt", &set_sb.s_encrypt_pw_salt, NULL, 16, parse_uuid }, { "lpf_ino", &set_sb.s_lpf_ino, NULL, 4, parse_uint }, + { "checksum_seed", &set_sb.s_checksum_seed, NULL, 4, parse_uint }, { 0, 0, 0, 0 } }; @@ -211,7 +212,6 @@ static struct field_set_info inode_fields[] = { /* Special case: i_file_acl_high is 2 bytes */ { "file_acl", &set_inode.i_file_acl, &set_inode.osd2.linux2.l_i_file_acl_high, 6, parse_uint }, - { "dir_acl", &set_inode.i_dir_acl, NULL, 4, parse_uint, FLAG_ALIAS }, { "faddr", &set_inode.i_faddr, NULL, 4, parse_uint }, { "frag", &set_inode.osd2.hurd2.h_i_frag, NULL, 1, parse_uint, FLAG_ALIAS }, { "fsize", &set_inode.osd2.hurd2.h_i_fsize, NULL, 1, parse_uint }, @@ -429,7 +429,7 @@ static struct field_set_info *find_field(struct field_set_info *fields, /* * Note: info->size == 6 is special; this means a base size 4 bytes, - * and secondiory (high) size of 2 bytes. This is needed for the + * and secondary (high) size of 2 bytes. This is needed for the * special case of i_blocks_high and i_file_acl_high. */ static errcode_t parse_uint(struct field_set_info *info, char *field, @@ -495,7 +495,7 @@ static errcode_t parse_uint(struct field_set_info *info, char *field, } if (!field2) return 0; - n = num >> (size*8); + n = (size == 8) ? 0 : (num >> (size*8)); u.ptr8 = (__u8 *) field2; if (info->size == 6) size = 2; @@ -568,7 +568,6 @@ static errcode_t parse_time(struct field_set_info *info, __s64 t; __u32 t_low, t_high; __u32 *ptr_low, *ptr_high; - int suffix = check_suffix(field); if (check_suffix(field)) return parse_uint(info, field, arg); @@ -652,18 +651,13 @@ static errcode_t parse_bmap(struct field_set_info *info, static errcode_t parse_gd_csum(struct field_set_info *info, char *field, char *arg) { + __u16 *checksum = info->ptr; if (strcmp(arg, "calc") == 0) { - ext2fs_group_desc_csum_set(current_fs, set_bg); - memcpy(&set_gd, ext2fs_group_desc(current_fs, - current_fs->group_desc, - set_bg), - sizeof(set_gd)); - printf("Checksum set to 0x%04x\n", - ext2fs_bg_checksum(current_fs, set_bg)); + *checksum = ext2fs_group_desc_csum(current_fs, set_bg); + printf("Checksum set to 0x%04x\n", *checksum); return 0; } - return parse_uint(info, field, arg); } @@ -793,7 +787,7 @@ void do_set_inode(int argc, char *argv[]) void do_set_block_group_descriptor(int argc, char *argv[]) { const char *usage = " \n" - "\t\"set_block_group_descriptor -l\" will list the names of " + "\t\"set_block_group -l\" will list the names of " "the fields in a block group descriptor\n\twhich can be set."; struct field_set_info *table; struct field_set_info *ss; @@ -824,7 +818,7 @@ void do_set_block_group_descriptor(int argc, char *argv[]) return; } - if (common_args_process(argc, argv, 4, 4, "set_block_group_descriptor", + if (common_args_process(argc, argv, 4, 4, "set_block_group", usage, CHECK_FS_RW)) return;