summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2009-09-07 21:15:12 -0400
committerTheodore Ts'o <tytso@mit.edu>2009-09-07 21:15:12 -0400
commit732c8cd58ff30ffae0d3276c411a08920717a46c (patch)
treede130d62127f09d3c8a975d3b5b7fd2875209afa
parent24a117abd0340d247befbf7687ffb70547fdf218 (diff)
downloade2fsprogs-732c8cd58ff30ffae0d3276c411a08920717a46c.tar.gz
Use accessor functions fields for bg_flags in the block group descriptors
Signed-off-by: Valerie Aurora Henson <vaurora@redhat.com> Signed-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
-rw-r--r--debugfs/debugfs.c8
-rw-r--r--e2fsck/pass2.c6
-rw-r--r--e2fsck/pass5.c20
-rw-r--r--e2fsck/super.c21
-rw-r--r--lib/ext2fs/alloc.c8
-rw-r--r--lib/ext2fs/alloc_sb.c2
-rw-r--r--lib/ext2fs/alloc_stats.c4
-rw-r--r--lib/ext2fs/alloc_tables.c7
-rw-r--r--lib/ext2fs/initialize.c6
-rw-r--r--lib/ext2fs/inode.c4
-rw-r--r--lib/ext2fs/openfs.c11
-rw-r--r--lib/ext2fs/rw_bitmaps.c16
-rw-r--r--misc/dumpe2fs.c2
-rw-r--r--misc/mke2fs.c2
-rw-r--r--resize/resize2fs.c32
15 files changed, 76 insertions, 73 deletions
diff --git a/debugfs/debugfs.c b/debugfs/debugfs.c
index 93227e38..24aa664b 100644
--- a/debugfs/debugfs.c
+++ b/debugfs/debugfs.c
@@ -290,10 +290,10 @@ static void print_features(struct ext2_super_block * s, FILE *f)
fputs("\n", f);
}
-static void print_bg_opts(struct ext2_group_desc *gdp, int mask,
+static void print_bg_opts(ext2_filsys fs, dgrp_t group, int mask,
const char *str, int *first, FILE *f)
{
- if (gdp->bg_flags & mask) {
+ if (ext2fs_bg_flag_test(fs, group, mask)) {
if (*first) {
fputs(" [", f);
*first = 0;
@@ -362,9 +362,9 @@ void do_show_super_stats(int argc, char *argv[])
gdp->bg_itable_unused,
gdp->bg_itable_unused != 1 ? "inodes":"inode");
first = 1;
- print_bg_opts(gdp, EXT2_BG_INODE_UNINIT, "Inode not init",
+ print_bg_opts(current_fs, i, EXT2_BG_INODE_UNINIT, "Inode not init",
&first, out);
- print_bg_opts(gdp, EXT2_BG_BLOCK_UNINIT, "Block not init",
+ print_bg_opts(current_fs, i, EXT2_BG_BLOCK_UNINIT, "Block not init",
&first, out);
if (gdt_csum) {
fprintf(out, "%sChecksum 0x%04x",
diff --git a/e2fsck/pass2.c b/e2fsck/pass2.c
index 70738446..b7ce3528 100644
--- a/e2fsck/pass2.c
+++ b/e2fsck/pass2.c
@@ -987,12 +987,12 @@ out_htree:
* we could call a function in pass1.c that checks the
* newly visible inodes.
*/
- if (fs->group_desc[group].bg_flags & EXT2_BG_INODE_UNINIT) {
+ if (ext2fs_bg_flag_test(fs, group, EXT2_BG_INODE_UNINIT)) {
pctx.num = dirent->inode;
if (fix_problem(ctx, PR_2_INOREF_BG_INO_UNINIT,
&cd->pctx)){
- fs->group_desc[group].bg_flags &=
- ~EXT2_BG_INODE_UNINIT;
+ ext2fs_bg_flag_clear(fs, group,
+ EXT2_BG_INODE_UNINIT);
ext2fs_mark_super_dirty(fs);
ctx->flags |= E2F_FLAG_RESTART_LATER;
} else {
diff --git a/e2fsck/pass5.c b/e2fsck/pass5.c
index 232bee07..a2a00b17 100644
--- a/e2fsck/pass5.c
+++ b/e2fsck/pass5.c
@@ -162,7 +162,7 @@ redo_counts:
save_problem = 0;
pctx.blk = pctx.blk2 = NO_BLK;
if (csum_flag &&
- (fs->group_desc[group].bg_flags & EXT2_BG_BLOCK_UNINIT))
+ (ext2fs_bg_flag_test(fs, group, EXT2_BG_BLOCK_UNINIT)))
skip_group++;
for (i = fs->super->s_first_data_block;
i < fs->super->s_blocks_count;
@@ -260,8 +260,8 @@ redo_counts:
pctx2.blk = i;
pctx2.group = group;
if (fix_problem(ctx, PR_5_BLOCK_UNINIT,&pctx2)){
- fs->group_desc[group].bg_flags &=
- ~EXT2_BG_BLOCK_UNINIT;
+ ext2fs_bg_flag_clear(fs, group, EXT2_BG_BLOCK_UNINIT)
+ ;
skip_group = 0;
}
}
@@ -301,8 +301,8 @@ redo_counts:
goto errout;
if (csum_flag &&
(i != fs->super->s_blocks_count-1) &&
- (fs->group_desc[group].bg_flags &
- EXT2_BG_BLOCK_UNINIT))
+ ext2fs_bg_flag_test(fs, group,
+ EXT2_BG_BLOCK_UNINIT))
skip_group++;
}
}
@@ -425,7 +425,7 @@ redo_counts:
save_problem = 0;
pctx.ino = pctx.ino2 = 0;
if (csum_flag &&
- (fs->group_desc[group].bg_flags & EXT2_BG_INODE_UNINIT))
+ (ext2fs_bg_flag_test(fs, group, EXT2_BG_INODE_UNINIT)))
skip_group++;
/* Protect loop from wrap-around if inodes_count is maxed */
@@ -482,8 +482,8 @@ redo_counts:
pctx2.blk = i;
pctx2.group = group;
if (fix_problem(ctx, PR_5_INODE_UNINIT,&pctx2)){
- fs->group_desc[group].bg_flags &=
- ~EXT2_BG_INODE_UNINIT;
+ ext2fs_bg_flag_clear(fs, group, EXT2_BG_INODE_UNINIT)
+ ;
skip_group = 0;
}
}
@@ -529,8 +529,8 @@ do_counts:
goto errout;
if (csum_flag &&
(i != fs->super->s_inodes_count) &&
- (fs->group_desc[group].bg_flags &
- EXT2_BG_INODE_UNINIT))
+ (ext2fs_bg_flag_test(fs, group, EXT2_BG_INODE_UNINIT)
+ ))
skip_group++;
}
}
diff --git a/e2fsck/super.c b/e2fsck/super.c
index 72d32681..2d5d6615 100644
--- a/e2fsck/super.c
+++ b/e2fsck/super.c
@@ -636,8 +636,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)) {
- gd->bg_flags &= ~(EXT2_BG_BLOCK_UNINIT |
- EXT2_BG_INODE_UNINIT);
+ ext2fs_bg_flag_clear (fs, i, EXT2_BG_BLOCK_UNINIT);
+ ext2fs_bg_flag_clear (fs, i, EXT2_BG_INODE_UNINIT);
gd->bg_itable_unused = 0;
should_be = 1;
}
@@ -645,11 +645,12 @@ void check_super_block(e2fsck_t ctx)
}
if (!csum_flag &&
- (gd->bg_flags &(EXT2_BG_BLOCK_UNINIT|EXT2_BG_INODE_UNINIT)||
+ (ext2fs_bg_flag_test(fs, i, EXT2_BG_BLOCK_UNINIT) ||
+ ext2fs_bg_flag_test(fs, i, EXT2_BG_INODE_UNINIT) ||
gd->bg_itable_unused != 0)){
if (fix_problem(ctx, PR_0_GDT_UNINIT, &pctx)) {
- gd->bg_flags &= ~(EXT2_BG_BLOCK_UNINIT |
- EXT2_BG_INODE_UNINIT);
+ ext2fs_bg_flag_clear (fs, i, EXT2_BG_BLOCK_UNINIT);
+ ext2fs_bg_flag_clear (fs, i, EXT2_BG_INODE_UNINIT);
gd->bg_itable_unused = 0;
should_be = 1;
}
@@ -657,18 +658,18 @@ void check_super_block(e2fsck_t ctx)
}
if (i == fs->group_desc_count - 1 &&
- gd->bg_flags & EXT2_BG_BLOCK_UNINIT) {
+ ext2fs_bg_flag_test(fs, i, EXT2_BG_BLOCK_UNINIT)) {
if (fix_problem(ctx, PR_0_BB_UNINIT_LAST, &pctx)) {
- gd->bg_flags &= ~EXT2_BG_BLOCK_UNINIT;
+ ext2fs_bg_flag_clear (fs, i, EXT2_BG_BLOCK_UNINIT);
should_be = 1;
}
ext2fs_unmark_valid(fs);
}
- if (gd->bg_flags & EXT2_BG_BLOCK_UNINIT &&
- !(gd->bg_flags & EXT2_BG_INODE_UNINIT)) {
+ 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)) {
- gd->bg_flags &= ~EXT2_BG_BLOCK_UNINIT;
+ ext2fs_bg_flag_clear (fs, i, EXT2_BG_BLOCK_UNINIT);
should_be = 1;
}
ext2fs_unmark_valid(fs);
diff --git a/lib/ext2fs/alloc.c b/lib/ext2fs/alloc.c
index 2dbae87c..2c38bc9e 100644
--- a/lib/ext2fs/alloc.c
+++ b/lib/ext2fs/alloc.c
@@ -38,7 +38,7 @@ static void check_block_uninit(ext2_filsys fs, ext2fs_block_bitmap map,
if (!(EXT2_HAS_RO_COMPAT_FEATURE(fs->super,
EXT4_FEATURE_RO_COMPAT_GDT_CSUM)) ||
- !(fs->group_desc[group].bg_flags & EXT2_BG_BLOCK_UNINIT))
+ !(ext2fs_bg_flag_test(fs, group, EXT2_BG_BLOCK_UNINIT)))
return;
blk = (group * fs->super->s_blocks_per_group) +
@@ -68,7 +68,7 @@ static void check_block_uninit(ext2_filsys fs, ext2fs_block_bitmap map,
else
ext2fs_fast_unmark_block_bitmap2(map, blk);
}
- fs->group_desc[group].bg_flags &= ~EXT2_BG_BLOCK_UNINIT;
+ ext2fs_bg_flag_clear(fs, group, EXT2_BG_BLOCK_UNINIT);
ext2fs_group_desc_csum_set(fs, group);
}
@@ -82,14 +82,14 @@ static void check_inode_uninit(ext2_filsys fs, ext2fs_inode_bitmap map,
if (!(EXT2_HAS_RO_COMPAT_FEATURE(fs->super,
EXT4_FEATURE_RO_COMPAT_GDT_CSUM)) ||
- !(fs->group_desc[group].bg_flags & EXT2_BG_INODE_UNINIT))
+ !(ext2fs_bg_flag_test(fs, group, EXT2_BG_INODE_UNINIT)))
return;
ino = (group * fs->super->s_inodes_per_group) + 1;
for (i=0; i < fs->super->s_inodes_per_group; i++, ino++)
ext2fs_fast_unmark_inode_bitmap2(map, ino);
- fs->group_desc[group].bg_flags &= ~EXT2_BG_INODE_UNINIT;
+ ext2fs_bg_flag_clear(fs, group, EXT2_BG_INODE_UNINIT);
check_block_uninit(fs, fs->block_map, group);
}
diff --git a/lib/ext2fs/alloc_sb.c b/lib/ext2fs/alloc_sb.c
index d9080b66..8bb88275 100644
--- a/lib/ext2fs/alloc_sb.c
+++ b/lib/ext2fs/alloc_sb.c
@@ -62,7 +62,7 @@ int ext2fs_reserve_super_and_bgd(ext2_filsys fs,
if (old_desc_blk) {
if (fs->super->s_reserved_gdt_blocks && fs->block_map == bmap)
- fs->group_desc[group].bg_flags &= ~EXT2_BG_BLOCK_UNINIT;
+ ext2fs_bg_flag_clear(fs, group, EXT2_BG_BLOCK_UNINIT);
for (j=0; j < old_desc_blocks; j++)
if (old_desc_blk + j < fs->super->s_blocks_count)
ext2fs_mark_block_bitmap2(bmap,
diff --git a/lib/ext2fs/alloc_stats.c b/lib/ext2fs/alloc_stats.c
index 50487870..9180b5c5 100644
--- a/lib/ext2fs/alloc_stats.c
+++ b/lib/ext2fs/alloc_stats.c
@@ -37,7 +37,7 @@ void ext2fs_inode_alloc_stats2(ext2_filsys fs, ext2_ino_t ino,
/* We don't strictly need to be clearing the uninit flag if inuse < 0
* (i.e. freeing inodes) but it also means something is bad. */
- fs->group_desc[group].bg_flags &= ~EXT2_BG_INODE_UNINIT;
+ ext2fs_bg_flag_clear(fs, group, EXT2_BG_INODE_UNINIT);
if (EXT2_HAS_RO_COMPAT_FEATURE(fs->super,
EXT4_FEATURE_RO_COMPAT_GDT_CSUM)) {
ext2_ino_t first_unused_inode = fs->super->s_inodes_per_group -
@@ -77,7 +77,7 @@ void ext2fs_block_alloc_stats2(ext2_filsys fs, blk64_t blk, int inuse)
else
ext2fs_unmark_block_bitmap2(fs->block_map, blk);
fs->group_desc[group].bg_free_blocks_count -= inuse;
- fs->group_desc[group].bg_flags &= ~EXT2_BG_BLOCK_UNINIT;
+ ext2fs_bg_flag_clear(fs, group, EXT2_BG_BLOCK_UNINIT);
ext2fs_group_desc_csum_set(fs, group);
ext2fs_free_blocks_count_add(fs->super, -inuse);
diff --git a/lib/ext2fs/alloc_tables.c b/lib/ext2fs/alloc_tables.c
index c7d50d05..a72cac62 100644
--- a/lib/ext2fs/alloc_tables.c
+++ b/lib/ext2fs/alloc_tables.c
@@ -142,7 +142,7 @@ errcode_t ext2fs_allocate_group_table(ext2_filsys fs, dgrp_t group,
dgrp_t gr = ext2fs_group_of_blk(fs, new_blk);
fs->group_desc[gr].bg_free_blocks_count--;
fs->super->s_free_blocks_count--;
- fs->group_desc[gr].bg_flags &= ~EXT2_BG_BLOCK_UNINIT;
+ ext2fs_bg_flag_clear(fs, gr, EXT2_BG_BLOCK_UNINIT);
ext2fs_group_desc_csum_set(fs, gr);
}
}
@@ -170,7 +170,7 @@ errcode_t ext2fs_allocate_group_table(ext2_filsys fs, dgrp_t group,
dgrp_t gr = ext2fs_group_of_blk(fs, new_blk);
fs->group_desc[gr].bg_free_blocks_count--;
fs->super->s_free_blocks_count--;
- fs->group_desc[gr].bg_flags &= ~EXT2_BG_BLOCK_UNINIT;
+ ext2fs_bg_flag_clear(fs, gr, EXT2_BG_BLOCK_UNINIT);
ext2fs_group_desc_csum_set(fs, gr);
}
}
@@ -204,7 +204,8 @@ errcode_t ext2fs_allocate_group_table(ext2_filsys fs, dgrp_t group,
dgrp_t gr = ext2fs_group_of_blk(fs, blk);
fs->group_desc[gr].bg_free_blocks_count--;
fs->super->s_free_blocks_count--;
- fs->group_desc[gr].bg_flags &= ~EXT2_BG_BLOCK_UNINIT;
+ ext2fs_bg_flag_clear(fs, gr,
+ EXT2_BG_BLOCK_UNINIT);
ext2fs_group_desc_csum_set(fs, gr);
}
}
diff --git a/lib/ext2fs/initialize.c b/lib/ext2fs/initialize.c
index 21fc2935..73c4fec4 100644
--- a/lib/ext2fs/initialize.c
+++ b/lib/ext2fs/initialize.c
@@ -401,9 +401,9 @@ ipg_retry:
*/
if (csum_flag) {
if (i != fs->group_desc_count - 1)
- fs->group_desc[i].bg_flags |=
- EXT2_BG_BLOCK_UNINIT;
- fs->group_desc[i].bg_flags |= EXT2_BG_INODE_UNINIT;
+ ext2fs_bg_flag_set(fs, i, EXT2_BG_BLOCK_UNINIT)
+ ;
+ ext2fs_bg_flag_set(fs, i, EXT2_BG_INODE_UNINIT);
numblocks = super->s_inodes_per_group;
if (i == 0)
numblocks -= super->s_first_ino;
diff --git a/lib/ext2fs/inode.c b/lib/ext2fs/inode.c
index 365d8c8e..e439b1c5 100644
--- a/lib/ext2fs/inode.c
+++ b/lib/ext2fs/inode.c
@@ -435,8 +435,8 @@ errcode_t ext2fs_get_next_inode_full(ext2_inode_scan scan, ext2_ino_t *ino,
* they can be done for block group #0.
*/
if ((scan->scan_flags & EXT2_SF_DO_LAZY) &&
- (scan->fs->group_desc[scan->current_group].bg_flags &
- EXT2_BG_INODE_UNINIT))
+ (ext2fs_bg_flag_test(scan->fs, scan->current_group, EXT2_BG_INODE_UNINIT)
+ ))
goto force_new_group;
if (scan->inodes_left == 0)
goto force_new_group;
diff --git a/lib/ext2fs/openfs.c b/lib/ext2fs/openfs.c
index 3c0563aa..2d78290a 100644
--- a/lib/ext2fs/openfs.c
+++ b/lib/ext2fs/openfs.c
@@ -348,11 +348,12 @@ errcode_t ext2fs_open2(const char *name, const char *io_options,
if (superblock > 1 && EXT2_HAS_RO_COMPAT_FEATURE(fs->super,
EXT4_FEATURE_RO_COMPAT_GDT_CSUM)) {
struct ext2_group_desc *gd;
- for (i = 0, gd = fs->group_desc; i < fs->group_desc_count;
- i++, gd++) {
- gd->bg_flags &= ~EXT2_BG_BLOCK_UNINIT;
- gd->bg_flags &= ~EXT2_BG_INODE_UNINIT;
- gd->bg_itable_unused = 0;
+ dgrp_t group;
+
+ for (group = 0; group < fs->group_desc_count; group++) {
+ ext2fs_bg_flag_clear(fs, group, EXT2_BG_BLOCK_UNINIT);
+ ext2fs_bg_flag_clear(fs, group, EXT2_BG_INODE_UNINIT);
+ fs->group_desc[group].bg_itable_unused = 0;
}
ext2fs_mark_super_dirty(fs);
}
diff --git a/lib/ext2fs/rw_bitmaps.c b/lib/ext2fs/rw_bitmaps.c
index 0792c5b3..08d3a5e9 100644
--- a/lib/ext2fs/rw_bitmaps.c
+++ b/lib/ext2fs/rw_bitmaps.c
@@ -70,8 +70,8 @@ static errcode_t write_bitmaps(ext2_filsys fs, int do_inode, int do_block)
if (!do_block)
goto skip_block_bitmap;
- if (csum_flag && fs->group_desc[i].bg_flags &
- EXT2_BG_BLOCK_UNINIT)
+ if (csum_flag && ext2fs_bg_flag_test(fs, i, EXT2_BG_BLOCK_UNINIT)
+ )
goto skip_this_block_bitmap;
retval = ext2fs_get_block_bitmap_range2(fs->block_map,
@@ -102,8 +102,8 @@ static errcode_t write_bitmaps(ext2_filsys fs, int do_inode, int do_block)
if (!do_inode)
continue;
- if (csum_flag && fs->group_desc[i].bg_flags &
- EXT2_BG_INODE_UNINIT)
+ if (csum_flag && ext2fs_bg_flag_test(fs, i, EXT2_BG_INODE_UNINIT)
+ )
goto skip_this_inode_bitmap;
retval = ext2fs_get_inode_bitmap_range2(fs->inode_map,
@@ -236,8 +236,8 @@ static errcode_t read_bitmaps(ext2_filsys fs, int do_inode, int do_block)
for (i = 0; i < fs->group_desc_count; i++) {
if (block_bitmap) {
blk = fs->group_desc[i].bg_block_bitmap;
- if (csum_flag && fs->group_desc[i].bg_flags &
- EXT2_BG_BLOCK_UNINIT &&
+ if (csum_flag &&
+ ext2fs_bg_flag_test(fs, i, EXT2_BG_BLOCK_UNINIT) &&
ext2fs_group_desc_csum_verify(fs, i))
blk = 0;
if (blk) {
@@ -258,8 +258,8 @@ static errcode_t read_bitmaps(ext2_filsys fs, int do_inode, int do_block)
}
if (inode_bitmap) {
blk = fs->group_desc[i].bg_inode_bitmap;
- if (csum_flag && fs->group_desc[i].bg_flags &
- EXT2_BG_INODE_UNINIT &&
+ if (csum_flag &&
+ ext2fs_bg_flag_test(fs, i, EXT2_BG_INODE_UNINIT) &&
ext2fs_group_desc_csum_verify(fs, i))
blk = 0;
if (blk) {
diff --git a/misc/dumpe2fs.c b/misc/dumpe2fs.c
index 37b75a13..62eb1c72 100644
--- a/misc/dumpe2fs.c
+++ b/misc/dumpe2fs.c
@@ -113,7 +113,7 @@ static void print_bg_opts(ext2_filsys fs, dgrp_t i)
int first = 1, bg_flags = 0;
if (fs->super->s_feature_ro_compat & EXT4_FEATURE_RO_COMPAT_GDT_CSUM)
- bg_flags = fs->group_desc[i].bg_flags;
+ bg_flags = ext2fs_bg_flags(fs, i);
print_bg_opt(bg_flags, EXT2_BG_INODE_UNINIT, "INODE_UNINIT",
&first);
diff --git a/misc/mke2fs.c b/misc/mke2fs.c
index 0ce6017d..ff02d398 100644
--- a/misc/mke2fs.c
+++ b/misc/mke2fs.c
@@ -376,7 +376,7 @@ static void write_inode_tables(ext2_filsys fs, int lazy_flag)
EXT2_BLOCK_SIZE(fs->super));
} else {
/* The kernel doesn't need to zero the itable blocks */
- fs->group_desc[i].bg_flags |= EXT2_BG_INODE_ZEROED;
+ ext2fs_bg_flag_set(fs, i, EXT2_BG_INODE_ZEROED);
ext2fs_group_desc_csum_set(fs, i);
}
retval = ext2fs_zero_blocks(fs, blk, num, &blk, &num);
diff --git a/resize/resize2fs.c b/resize/resize2fs.c
index 2e971771..dc350013 100644
--- a/resize/resize2fs.c
+++ b/resize/resize2fs.c
@@ -112,8 +112,8 @@ 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 */
- rfs->new_fs->group_desc[rfs->new_fs->group_desc_count-1].bg_flags &=
- ~EXT2_BG_BLOCK_UNINIT;
+ ext2fs_bg_flag_clear(rfs->new_fs, rfs->new_fs->group_desc_count - 1,
+ EXT2_BG_BLOCK_UNINIT);
*new_size = rfs->new_fs->super->s_blocks_count;
@@ -199,7 +199,7 @@ static void fix_uninit_block_bitmaps(ext2_filsys fs)
return;
for (g=0; g < fs->group_desc_count; g++) {
- if (!(fs->group_desc[g].bg_flags & EXT2_BG_BLOCK_UNINIT))
+ if (!(ext2fs_bg_flag_test(fs, g, EXT2_BG_BLOCK_UNINIT)))
continue;
blk = (g * fs->super->s_blocks_per_group) +
@@ -495,10 +495,10 @@ retry:
sizeof(struct ext2_group_desc));
adjblocks = 0;
- fs->group_desc[i].bg_flags = 0;
+ ext2fs_bg_flags_clear(fs, i, 0);
if (csum_flag)
- fs->group_desc[i].bg_flags |= EXT2_BG_INODE_UNINIT |
- EXT2_BG_INODE_ZEROED;
+ ext2fs_bg_flag_set(fs, i, EXT2_BG_INODE_UNINIT | EXT2_BG_INODE_ZEROED)
+ ;
if (i == fs->group_desc_count-1) {
numblocks = (fs->super->s_blocks_count -
fs->super->s_first_data_block) %
@@ -508,8 +508,8 @@ retry:
} else {
numblocks = fs->super->s_blocks_per_group;
if (csum_flag)
- fs->group_desc[i].bg_flags |=
- EXT2_BG_BLOCK_UNINIT;
+ ext2fs_bg_flag_set(fs, i, EXT2_BG_BLOCK_UNINIT)
+ ;
}
has_super = ext2fs_bg_has_super(fs, i);
@@ -751,7 +751,7 @@ static void mark_fs_metablock(ext2_resize_t rfs,
rfs->needed_blocks++;
} else if (EXT2_HAS_RO_COMPAT_FEATURE(fs->super,
EXT4_FEATURE_RO_COMPAT_GDT_CSUM) &&
- (fs->group_desc[group].bg_flags & EXT2_BG_BLOCK_UNINIT)) {
+ (ext2fs_bg_flag_test(fs, group, EXT2_BG_BLOCK_UNINIT))) {
/*
* If the block bitmap is uninitialized, which means
* nothing other than standard metadata in use.
@@ -812,7 +812,7 @@ static errcode_t blocks_to_move(ext2_resize_t rfs)
g = ext2fs_group_of_blk(fs, blk);
if (EXT2_HAS_RO_COMPAT_FEATURE(fs->super,
EXT4_FEATURE_RO_COMPAT_GDT_CSUM) &&
- (old_fs->group_desc[g].bg_flags & EXT2_BG_BLOCK_UNINIT)) {
+ ext2fs_bg_flag_test(old_fs, g, EXT2_BG_BLOCK_UNINIT)) {
/*
* The block bitmap is uninitialized, so skip
* to the next block group.
@@ -1787,7 +1787,7 @@ static errcode_t ext2fs_calculate_summary_stats(ext2_filsys fs)
/*
* First calculate the block statistics
*/
- uninit = fs->group_desc[group].bg_flags & EXT2_BG_BLOCK_UNINIT;
+ uninit = ext2fs_bg_flag_test(fs, group, EXT2_BG_BLOCK_UNINIT);
ext2fs_super_and_bgd_loc(fs, group, &super_blk, &old_desc_blk,
&new_desc_blk, 0);
if (fs->super->s_feature_incompat & EXT2_FEATURE_INCOMPAT_META_BG)
@@ -1821,8 +1821,8 @@ static errcode_t ext2fs_calculate_summary_stats(ext2_filsys fs)
group++;
count = 0;
group_free = 0;
- uninit = (fs->group_desc[group].bg_flags &
- EXT2_BG_BLOCK_UNINIT);
+ uninit = (ext2fs_bg_flag_test(fs, group, EXT2_BG_BLOCK_UNINIT)
+ );
ext2fs_super_and_bgd_loc(fs, group, &super_blk,
&old_desc_blk,
&new_desc_blk, 0);
@@ -1845,7 +1845,7 @@ static errcode_t ext2fs_calculate_summary_stats(ext2_filsys fs)
group = 0;
/* Protect loop from wrap-around if s_inodes_count maxed */
- uninit = fs->group_desc[group].bg_flags & EXT2_BG_INODE_UNINIT;
+ uninit = ext2fs_bg_flag_test(fs, group, EXT2_BG_INODE_UNINIT);
for (ino = 1; ino <= fs->super->s_inodes_count && ino > 0; ino++) {
if (uninit ||
!ext2fs_fast_test_inode_bitmap2(fs->inode_map, ino)) {
@@ -1861,8 +1861,8 @@ static errcode_t ext2fs_calculate_summary_stats(ext2_filsys fs)
group++;
count = 0;
group_free = 0;
- uninit = (fs->group_desc[group].bg_flags &
- EXT2_BG_INODE_UNINIT);
+ uninit = (ext2fs_bg_flag_test(fs, group, EXT2_BG_INODE_UNINIT)
+ );
}
}
fs->super->s_free_inodes_count = total_free;