From: Valerie Clement Date: Thu, 30 Aug 2007 15:31:36 +0000 (+0200) Subject: libext2fs: use ext2fs_group_first_block() instead of open-coded equivalent X-Git-Tag: v1.41-WIP-0427~129 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3bfca9a499af9f72a2b22ff0d92bcc8686904e8e;p=thirdparty%2Fe2fsprogs.git libext2fs: use ext2fs_group_first_block() instead of open-coded equivalent Use ext2fs_group_first_block() instead of the open-coded equivalent in ext2fs_super_and_bgd_loc() and ext2fs_descriptor_block_loc(). Signed-off-by: Valerie Clement Signed-off-by: "Theodore Ts'o" --- diff --git a/lib/ext2fs/closefs.c b/lib/ext2fs/closefs.c index c570256b9..64f010e7f 100644 --- a/lib/ext2fs/closefs.c +++ b/lib/ext2fs/closefs.c @@ -57,8 +57,7 @@ int ext2fs_super_and_bgd_loc(ext2_filsys fs, int numblocks, has_super; int old_desc_blocks; - group_block = fs->super->s_first_data_block + - (group * fs->super->s_blocks_per_group); + group_block = ext2fs_group_first_block(fs, group); if (fs->super->s_feature_incompat & EXT2_FEATURE_INCOMPAT_META_BG) old_desc_blocks = fs->super->s_first_meta_bg; diff --git a/lib/ext2fs/openfs.c b/lib/ext2fs/openfs.c index 35bd44bc0..2cc033636 100644 --- a/lib/ext2fs/openfs.c +++ b/lib/ext2fs/openfs.c @@ -42,8 +42,7 @@ blk_t ext2fs_descriptor_block_loc(ext2_filsys fs, blk_t group_block, dgrp_t i) bg = (fs->blocksize / sizeof (struct ext2_group_desc)) * i; if (ext2fs_bg_has_super(fs, bg)) has_super = 1; - ret_blk = (fs->super->s_first_data_block + has_super + - (bg * fs->super->s_blocks_per_group)); + ret_blk = ext2fs_group_first_block(fs, bg) + has_super; /* * If group_block is not the normal value, we're trying to use * the backup group descriptors and superblock --- so use the