From e633b58ac75f2f544b7d6572e37d4b63da31e59c Mon Sep 17 00:00:00 2001 From: Eric Sandeen Date: Sun, 25 Oct 2009 21:41:32 -0400 Subject: 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 Signed-off-by: "Theodore Ts'o" --- resize/resize2fs.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'resize') diff --git a/resize/resize2fs.c b/resize/resize2fs.c index 5a1eb2a8..869ae626 100644 --- a/resize/resize2fs.c +++ b/resize/resize2fs.c @@ -112,7 +112,7 @@ errcode_t resize_fs(ext2_filsys fs, blk_t *new_size, int flags, fix_uninit_block_bitmaps(rfs->new_fs); /* Clear the block bitmap uninit flag for the last block group */ - ext2fs_bg_flag_clear(rfs->new_fs, rfs->new_fs->group_desc_count - 1, + ext2fs_bg_flags_clear(rfs->new_fs, rfs->new_fs->group_desc_count - 1, EXT2_BG_BLOCK_UNINIT); *new_size = ext2fs_blocks_count(rfs->new_fs->super); @@ -499,10 +499,9 @@ retry: sizeof(struct ext2_group_desc)); adjblocks = 0; - ext2fs_bg_flags_clear(fs, i, 0); + ext2fs_bg_flags_zap(fs, i); if (csum_flag) - ext2fs_bg_flag_set(fs, i, EXT2_BG_INODE_UNINIT | EXT2_BG_INODE_ZEROED) - ; + ext2fs_bg_flags_set(fs, i, EXT2_BG_INODE_UNINIT | EXT2_BG_INODE_ZEROED); if (i == fs->group_desc_count-1) { numblocks = (ext2fs_blocks_count(fs->super) - fs->super->s_first_data_block) % @@ -512,8 +511,8 @@ retry: } else { numblocks = fs->super->s_blocks_per_group; if (csum_flag) - ext2fs_bg_flag_set(fs, i, EXT2_BG_BLOCK_UNINIT) - ; + ext2fs_bg_flags_set(fs, i, + EXT2_BG_BLOCK_UNINIT); } has_super = ext2fs_bg_has_super(fs, i); -- cgit v1.2.3