diff options
author | Eric Sandeen <sandeen@redhat.com> | 2009-10-25 21:41:32 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2009-10-25 21:41:32 -0400 |
commit | e633b58ac75f2f544b7d6572e37d4b63da31e59c (patch) | |
tree | b9dc7c7905f1134bac197d86aadb934a9bf17eec /e2fsck | |
parent | 03b9dca63a75731711071e0a7ddef0475d6daf3a (diff) | |
download | e2fsprogs-e633b58ac75f2f544b7d6572e37d4b63da31e59c.tar.gz |
libext2fs: clean up ext2fs_bg_flags_ interfaces
The ext2fs_bg_flag* functions were confusing.
Currently we have this:
void ext2fs_bg_flags_set(ext2_filsys fs, dgrp_t group, __u16 bg_flags);
void ext2fs_bg_flags_clear(ext2_filsys fs, dgrp_t group,__u16 bg_flags);
(_set (unused) sets exactly bg_flags; _clear clears all and ignores bg_flags)
and these, which can twiddle individual bits in bg_flags:
void ext2fs_bg_flag_set(ext2_filsys fs, dgrp_t group, __u16 bg_flag);
void ext2fs_bg_flag_clear(ext2_filsys fs, dgrp_t group, __u16 bg_flag);
A better interface, after the patch below, is just:
ext2fs_bg_flags_zap(fs, group) /* zeros bg_flags */
ext2fs_bg_flags_set(fs, group, flags) /* adds flags to bg_flags */
ext2fs_bg_flags_clear(fs, group, flags) /* clears flags in bg_flags */
and remove the original ext2fs_bg_flags_set / ext2fs_bg_flags_clear.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'e2fsck')
-rw-r--r-- | e2fsck/pass2.c | 2 | ||||
-rw-r--r-- | e2fsck/pass5.c | 9 | ||||
-rw-r--r-- | e2fsck/super.c | 12 |
3 files changed, 10 insertions, 13 deletions
diff --git a/e2fsck/pass2.c b/e2fsck/pass2.c index 067a9c71..d45ff744 100644 --- a/e2fsck/pass2.c +++ b/e2fsck/pass2.c @@ -991,7 +991,7 @@ out_htree: pctx.num = dirent->inode; if (fix_problem(ctx, PR_2_INOREF_BG_INO_UNINIT, &cd->pctx)){ - ext2fs_bg_flag_clear(fs, group, + ext2fs_bg_flags_clear(fs, group, EXT2_BG_INODE_UNINIT); ext2fs_mark_super_dirty(fs); ctx->flags |= E2F_FLAG_RESTART_LATER; diff --git a/e2fsck/pass5.c b/e2fsck/pass5.c index be5a2412..aee4e5fa 100644 --- a/e2fsck/pass5.c +++ b/e2fsck/pass5.c @@ -260,8 +260,7 @@ redo_counts: pctx2.blk = i; pctx2.group = group; if (fix_problem(ctx, PR_5_BLOCK_UNINIT,&pctx2)){ - ext2fs_bg_flag_clear(fs, group, EXT2_BG_BLOCK_UNINIT) - ; + ext2fs_bg_flags_clear(fs, group, EXT2_BG_BLOCK_UNINIT); skip_group = 0; } } @@ -343,8 +342,7 @@ redo_counts: if (fix_problem(ctx, PR_5_FREE_BLOCK_COUNT_GROUP, &pctx)) { - fs->group_desc[i].bg_free_blocks_count = - free_array[i]; + ext2fs_bg_free_blocks_count_set(fs, i, free_array[i]); ext2fs_mark_super_dirty(fs); } else ext2fs_unmark_valid(fs); @@ -482,8 +480,7 @@ redo_counts: pctx2.blk = i; pctx2.group = group; if (fix_problem(ctx, PR_5_INODE_UNINIT,&pctx2)){ - ext2fs_bg_flag_clear(fs, group, EXT2_BG_INODE_UNINIT) - ; + ext2fs_bg_flags_clear(fs, group, EXT2_BG_INODE_UNINIT); skip_group = 0; } } diff --git a/e2fsck/super.c b/e2fsck/super.c index 40f65e50..b10539a9 100644 --- a/e2fsck/super.c +++ b/e2fsck/super.c @@ -638,8 +638,8 @@ void check_super_block(e2fsck_t ctx) should_be = 0; if (!ext2fs_group_desc_csum_verify(fs, i)) { if (fix_problem(ctx, PR_0_GDT_CSUM, &pctx)) { - ext2fs_bg_flag_clear (fs, i, EXT2_BG_BLOCK_UNINIT); - ext2fs_bg_flag_clear (fs, i, EXT2_BG_INODE_UNINIT); + ext2fs_bg_flags_clear(fs, i, EXT2_BG_BLOCK_UNINIT); + ext2fs_bg_flags_clear(fs, i, EXT2_BG_INODE_UNINIT); gd->bg_itable_unused = 0; should_be = 1; } @@ -651,8 +651,8 @@ void check_super_block(e2fsck_t ctx) ext2fs_bg_flag_test(fs, i, EXT2_BG_INODE_UNINIT) || gd->bg_itable_unused != 0)){ if (fix_problem(ctx, PR_0_GDT_UNINIT, &pctx)) { - ext2fs_bg_flag_clear (fs, i, EXT2_BG_BLOCK_UNINIT); - ext2fs_bg_flag_clear (fs, i, EXT2_BG_INODE_UNINIT); + ext2fs_bg_flags_clear(fs, i, EXT2_BG_BLOCK_UNINIT); + ext2fs_bg_flags_clear(fs, i, EXT2_BG_INODE_UNINIT); gd->bg_itable_unused = 0; should_be = 1; } @@ -662,7 +662,7 @@ void check_super_block(e2fsck_t ctx) if (i == fs->group_desc_count - 1 && ext2fs_bg_flag_test(fs, i, EXT2_BG_BLOCK_UNINIT)) { if (fix_problem(ctx, PR_0_BB_UNINIT_LAST, &pctx)) { - ext2fs_bg_flag_clear (fs, i, EXT2_BG_BLOCK_UNINIT); + ext2fs_bg_flags_clear(fs, i, EXT2_BG_BLOCK_UNINIT); should_be = 1; } ext2fs_unmark_valid(fs); @@ -671,7 +671,7 @@ void check_super_block(e2fsck_t ctx) if (ext2fs_bg_flag_test(fs, i, EXT2_BG_BLOCK_UNINIT) && !ext2fs_bg_flag_test(fs, i, EXT2_BG_INODE_UNINIT)) { if (fix_problem(ctx, PR_0_BB_UNINIT_IB_INIT, &pctx)) { - ext2fs_bg_flag_clear (fs, i, EXT2_BG_BLOCK_UNINIT); + ext2fs_bg_flags_clear(fs, i, EXT2_BG_BLOCK_UNINIT); should_be = 1; } ext2fs_unmark_valid(fs); |