From 4efbac6fed75c29d3d5f1b676b932754653a2ac5 Mon Sep 17 00:00:00 2001 From: Valerie Aurora Henson Date: Mon, 7 Sep 2009 20:46:34 -0400 Subject: Convert uses of super->s_*_blocks_count to ext2fs_*_blocks_count() Signed-off-by: Valerie Aurora Henson Signed-off-by: Nick Dokos Signed-off-by: Eric Sandeen Signed-off-by: "Theodore Ts'o" --- ext2ed/init.c | 11 ++--------- ext2ed/super_com.c | 6 +++--- 2 files changed, 5 insertions(+), 12 deletions(-) (limited to 'ext2ed') diff --git a/ext2ed/init.c b/ext2ed/init.c index 41c2a398..3815ab56 100644 --- a/ext2ed/init.c +++ b/ext2ed/init.c @@ -370,13 +370,6 @@ void add_user_command (struct struct_commands *ptr,char *name,char *description, ptr->callback [num]=callback; } -static unsigned int div_ceil(unsigned int a, unsigned int b) -{ - if (!a) - return 0; - return ((a - 1) / b) + 1; -} - int set_file_system_info (void) { @@ -422,13 +415,13 @@ int set_file_system_info (void) file_system_info.first_group_desc_offset=2*EXT2_MIN_BLOCK_SIZE; else file_system_info.first_group_desc_offset=file_system_info.block_size; - file_system_info.groups_count = div_ceil(sb->s_blocks_count, + file_system_info.groups_count = ext2fs_div64_ceil(ext2fs_blocks_count(sb), sb->s_blocks_per_group); file_system_info.inodes_per_block=file_system_info.block_size/sizeof (struct ext2_inode); file_system_info.blocks_per_group=sb->s_inodes_per_group/file_system_info.inodes_per_block; file_system_info.no_blocks_in_group=sb->s_blocks_per_group; - file_system_info.file_system_size=(sb->s_blocks_count-1)*file_system_info.block_size; + file_system_info.file_system_size=(ext2fs_blocks_count(sb)-1)*file_system_info.block_size; } else { diff --git a/ext2ed/super_com.c b/ext2ed/super_com.c index 3d30070b..57953ab6 100644 --- a/ext2ed/super_com.c +++ b/ext2ed/super_com.c @@ -29,9 +29,9 @@ void type_ext2_super_block___show (char *command_line) show (command_line); - if (super->s_blocks_count != 0) { - wmove (show_pad,2,40);wprintw (show_pad,"%2.2f%%",100*(float) super->s_r_blocks_count/ (float) super->s_blocks_count); - wmove (show_pad,3,40);wprintw (show_pad,"%2.2f%%",100*(float) super->s_free_blocks_count/ (float) super->s_blocks_count); + if (ext2fs_blocks_count(super) != 0) { + wmove (show_pad,2,40);wprintw (show_pad,"%2.2f%%",100*(float) ext2fs_r_blocks_count(super)/ (float) ext2fs_blocks_count(super)); + wmove (show_pad,3,40);wprintw (show_pad,"%2.2f%%",100*(float) ext2fs_free_blocks_count(super)/ (float) ext2fs_blocks_count(super)); } if (super->s_inodes_count != 0) { -- cgit v1.2.1