libext2fs: Fix counting routines in blknum.c to take/return __u32 counts

Several routines in lib/ext2fs/blknum.c:

        ext2fs_bg_free_blocks_count()
        ext2fs_bg_free_inodes_count()
        ext2fs_bg_used_dirs_count()
        ext2fs_bg_itable_unused()

and their _set() counterparts, operate as if they are dealing with
blk64_t quantities, but they should be dealing with __u32 counts
instead.

Signed-off-by: Nick Dokos <nicholas.dokos@hp.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
This commit is contained in:
Nick Dokos 2009-09-07 21:13:59 -04:00 committed by Theodore Ts'o
parent dc615a21c3
commit d62d218f11
2 changed files with 32 additions and 32 deletions

View File

@ -274,7 +274,7 @@ void ext2fs_inode_table_loc_set(ext2_filsys fs, dgrp_t group, blk64_t blk)
/*
* Return the free blocks count of a group
*/
blk64_t ext2fs_bg_free_blocks_count(ext2_filsys fs, dgrp_t group)
__u32 ext2fs_bg_free_blocks_count(ext2_filsys fs, dgrp_t group)
{
if (fs->super->s_desc_size >= EXT2_MIN_DESC_SIZE_64BIT) {
struct ext4_group_desc *gdp;
@ -283,7 +283,7 @@ blk64_t ext2fs_bg_free_blocks_count(ext2_filsys fs, dgrp_t group)
return gdp->bg_free_blocks_count |
(fs->super->s_feature_incompat
& EXT4_FEATURE_INCOMPAT_64BIT ?
(__u64) gdp->bg_free_blocks_count_hi << 32 : 0);
(__u32) gdp->bg_free_blocks_count_hi << 16 : 0);
}
return fs->group_desc[group].bg_free_blocks_count;
@ -292,22 +292,22 @@ blk64_t ext2fs_bg_free_blocks_count(ext2_filsys fs, dgrp_t group)
/*
* Set the free blocks count of a group
*/
void ext2fs_bg_free_blocks_count_set(ext2_filsys fs, dgrp_t group, blk64_t blk)
void ext2fs_bg_free_blocks_count_set(ext2_filsys fs, dgrp_t group, __u32 n)
{
if (fs->super->s_desc_size >= EXT2_MIN_DESC_SIZE_64BIT) {
struct ext4_group_desc *gdp;
gdp = (struct ext4_group_desc *) (fs->group_desc) + group;
gdp->bg_free_blocks_count = blk;
gdp->bg_free_blocks_count = n;
if (fs->super->s_feature_incompat & EXT4_FEATURE_INCOMPAT_64BIT)
gdp->bg_free_blocks_count_hi = (__u64) blk >> 32;
gdp->bg_free_blocks_count_hi = (__u32) n >> 16;
} else
fs->group_desc[group].bg_free_blocks_count = blk;
fs->group_desc[group].bg_free_blocks_count = n;
}
/*
* Return the free inodes count of a group
*/
blk64_t ext2fs_bg_free_inodes_count(ext2_filsys fs, dgrp_t group)
__u32 ext2fs_bg_free_inodes_count(ext2_filsys fs, dgrp_t group)
{
if (fs->super->s_desc_size >= EXT2_MIN_DESC_SIZE_64BIT) {
struct ext4_group_desc *gdp;
@ -316,7 +316,7 @@ blk64_t ext2fs_bg_free_inodes_count(ext2_filsys fs, dgrp_t group)
return gdp->bg_free_inodes_count |
(fs->super->s_feature_incompat
& EXT4_FEATURE_INCOMPAT_64BIT ?
(__u64) gdp->bg_free_inodes_count_hi << 32 : 0);
(__u32) gdp->bg_free_inodes_count_hi << 16 : 0);
}
return fs->group_desc[group].bg_free_inodes_count;
@ -325,22 +325,22 @@ blk64_t ext2fs_bg_free_inodes_count(ext2_filsys fs, dgrp_t group)
/*
* Set the free inodes count of a group
*/
void ext2fs_bg_free_inodes_count_set(ext2_filsys fs, dgrp_t group, blk64_t blk)
void ext2fs_bg_free_inodes_count_set(ext2_filsys fs, dgrp_t group, __u32 n)
{
if (fs->super->s_desc_size >= EXT2_MIN_DESC_SIZE_64BIT) {
struct ext4_group_desc *gdp;
gdp = (struct ext4_group_desc *) (fs->group_desc) + group;
gdp->bg_free_inodes_count = blk;
gdp->bg_free_inodes_count = n;
if (fs->super->s_feature_incompat & EXT4_FEATURE_INCOMPAT_64BIT)
gdp->bg_free_inodes_count_hi = (__u64) blk >> 32;
gdp->bg_free_inodes_count_hi = (__u32) n >> 16;
} else
fs->group_desc[group].bg_free_inodes_count = blk;
fs->group_desc[group].bg_free_inodes_count = n;
}
/*
* Return the used dirs count of a group
*/
blk64_t ext2fs_bg_used_dirs_count(ext2_filsys fs, dgrp_t group)
__u32 ext2fs_bg_used_dirs_count(ext2_filsys fs, dgrp_t group)
{
if (fs->super->s_desc_size >= EXT2_MIN_DESC_SIZE_64BIT) {
struct ext4_group_desc *gdp;
@ -349,7 +349,7 @@ blk64_t ext2fs_bg_used_dirs_count(ext2_filsys fs, dgrp_t group)
return gdp->bg_used_dirs_count |
(fs->super->s_feature_incompat
& EXT4_FEATURE_INCOMPAT_64BIT ?
(__u64) gdp->bg_used_dirs_count_hi << 32 : 0);
(__u32) gdp->bg_used_dirs_count_hi << 16 : 0);
}
return fs->group_desc[group].bg_used_dirs_count;
@ -358,22 +358,22 @@ blk64_t ext2fs_bg_used_dirs_count(ext2_filsys fs, dgrp_t group)
/*
* Set the used dirs count of a group
*/
void ext2fs_bg_used_dirs_count_set(ext2_filsys fs, dgrp_t group, blk64_t blk)
void ext2fs_bg_used_dirs_count_set(ext2_filsys fs, dgrp_t group, __u32 n)
{
if (fs->super->s_desc_size >= EXT2_MIN_DESC_SIZE_64BIT) {
struct ext4_group_desc *gdp;
gdp = (struct ext4_group_desc *) (fs->group_desc) + group;
gdp->bg_used_dirs_count = blk;
gdp->bg_used_dirs_count = n;
if (fs->super->s_feature_incompat & EXT4_FEATURE_INCOMPAT_64BIT)
gdp->bg_used_dirs_count_hi = (__u64) blk >> 32;
gdp->bg_used_dirs_count_hi = (__u32) n >> 16;
} else
fs->group_desc[group].bg_used_dirs_count = blk;
fs->group_desc[group].bg_used_dirs_count = n;
}
/*
* Return the unused inodes count of a group
*/
blk64_t ext2fs_bg_itable_unused(ext2_filsys fs, dgrp_t group)
__u32 ext2fs_bg_itable_unused(ext2_filsys fs, dgrp_t group)
{
if (fs->super->s_desc_size >= EXT2_MIN_DESC_SIZE_64BIT) {
struct ext4_group_desc *gdp;
@ -382,7 +382,7 @@ blk64_t ext2fs_bg_itable_unused(ext2_filsys fs, dgrp_t group)
return gdp->bg_itable_unused |
(fs->super->s_feature_incompat
& EXT4_FEATURE_INCOMPAT_64BIT ?
(__u64) gdp->bg_itable_unused_hi << 32 : 0);
(__u32) gdp->bg_itable_unused_hi << 16 : 0);
}
return fs->group_desc[group].bg_itable_unused;
@ -391,16 +391,16 @@ blk64_t ext2fs_bg_itable_unused(ext2_filsys fs, dgrp_t group)
/*
* Set the unused inodes count of a group
*/
void ext2fs_bg_itable_unused_set(ext2_filsys fs, dgrp_t group, blk64_t blk)
void ext2fs_bg_itable_unused_set(ext2_filsys fs, dgrp_t group, __u32 n)
{
if (fs->super->s_desc_size >= EXT2_MIN_DESC_SIZE_64BIT) {
struct ext4_group_desc *gdp;
gdp = (struct ext4_group_desc *) (fs->group_desc) + group;
gdp->bg_itable_unused = blk;
gdp->bg_itable_unused = n;
if (fs->super->s_feature_incompat & EXT4_FEATURE_INCOMPAT_64BIT)
gdp->bg_itable_unused_hi = (__u64) blk >> 32;
gdp->bg_itable_unused_hi = (__u32) n >> 16;
} else
fs->group_desc[group].bg_itable_unused = blk;
fs->group_desc[group].bg_itable_unused = n;
}
/*

View File

@ -748,18 +748,18 @@ extern void ext2fs_inode_bitmap_loc_set(ext2_filsys fs, dgrp_t group,
extern blk64_t ext2fs_inode_table_loc(ext2_filsys fs, dgrp_t group);
extern void ext2fs_inode_table_loc_set(ext2_filsys fs, dgrp_t group,
blk64_t blk);
extern blk64_t ext2fs_bg_free_blocks_count(ext2_filsys fs, dgrp_t group);
extern __u32 ext2fs_bg_free_blocks_count(ext2_filsys fs, dgrp_t group);
extern void ext2fs_bg_free_blocks_count_set(ext2_filsys fs, dgrp_t group,
blk64_t blk);
extern blk64_t ext2fs_bg_free_inodes_count(ext2_filsys fs, dgrp_t group);
__u32 n);
extern __u32 ext2fs_bg_free_inodes_count(ext2_filsys fs, dgrp_t group);
extern void ext2fs_bg_free_inodes_count_set(ext2_filsys fs, dgrp_t group,
blk64_t blk);
extern blk64_t ext2fs_bg_used_dirs_count(ext2_filsys fs, dgrp_t group);
__u32 n);
extern __u32 ext2fs_bg_used_dirs_count(ext2_filsys fs, dgrp_t group);
extern void ext2fs_bg_used_dirs_count_set(ext2_filsys fs, dgrp_t group,
blk64_t blk);
extern blk64_t ext2fs_bg_itable_unused(ext2_filsys fs, dgrp_t group);
__u32 n);
extern __u32 ext2fs_bg_itable_unused(ext2_filsys fs, dgrp_t group);
extern void ext2fs_bg_itable_unused_set(ext2_filsys fs, dgrp_t group,
blk64_t blk);
__u32 n);
extern __u16 ext2fs_bg_flags(ext2_filsys fs, dgrp_t group);
extern void ext2fs_bg_flags_set(ext2_filsys fs, dgrp_t group, __u16 bg_flags);
extern void ext2fs_bg_flags_clear(ext2_filsys fs, dgrp_t group,