diff options
author | Theodore Ts'o <tytso@mit.edu> | 1997-11-03 19:42:40 +0000 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 1997-11-03 19:42:40 +0000 |
commit | 08b213017f8371ce4b56ad4d368eb0f92211d04e (patch) | |
tree | 4ea99c73df01b238ac33cad38b6b955f330450ee /e2fsck/pass5.c | |
parent | 79a90bdad033e101c38bb3c3207c8f4be47a2de7 (diff) | |
download | e2fsprogs-08b213017f8371ce4b56ad4d368eb0f92211d04e.tar.gz |
Many files:
Change ext2fs_read_inode, ext2fs_write_inode to take the e2fsck
context as their first argument.
Change dir_info.c routines to take an e2fsck_context, renamed them to
start with e2fsck_ to avoid namespace issues, and changed them to
store the directory information inside the e2fsck context.
Added e2fsck_run() which calls all of the e2fsck passes in the correct
order, and which handles the return of abort codes.
Added abort processing, both via setjmp/longjmp and via flags in the
e2fsck context.
Use a flag in the e2fsck context instead of the restart_e2fsck global
variable.
Change uses of free and malloc to ext2fs_free_mem and ext2fs_get_mem.
Diffstat (limited to 'e2fsck/pass5.c')
-rw-r--r-- | e2fsck/pass5.c | 48 |
1 files changed, 32 insertions, 16 deletions
diff --git a/e2fsck/pass5.c b/e2fsck/pass5.c index be2edd9a..9dcb7fd9 100644 --- a/e2fsck/pass5.c +++ b/e2fsck/pass5.c @@ -18,7 +18,7 @@ static void check_inode_bitmaps(e2fsck_t ctx); static void check_inode_end(e2fsck_t ctx); static void check_block_end(e2fsck_t ctx); -void pass5(e2fsck_t ctx) +void e2fsck_pass5(e2fsck_t ctx) { #ifdef RESOURCE_TRACK struct resource_track rtrack; @@ -41,9 +41,17 @@ void pass5(e2fsck_t ctx) read_bitmaps(ctx); check_block_bitmaps(ctx); + if (ctx->flags & E2F_FLAG_ABORT) + return; check_inode_bitmaps(ctx); + if (ctx->flags & E2F_FLAG_ABORT) + return; check_inode_end(ctx); + if (ctx->flags & E2F_FLAG_ABORT) + return; check_block_end(ctx); + if (ctx->flags & E2F_FLAG_ABORT) + return; ext2fs_free_inode_bitmap(ctx->inode_used_map); ctx->inode_used_map = 0; @@ -86,8 +94,9 @@ static void check_block_bitmaps(e2fsck_t ctx) pctx.ino = ext2fs_get_block_bitmap_start(ctx->block_found_map); pctx.ino2 = ext2fs_get_block_bitmap_end(ctx->block_found_map); fix_problem(ctx, PR_5_BMAP_ENDPOINTS, &pctx); - /* fatal */ - fatal_error(0); + + ctx->flags |= E2F_FLAG_ABORT; /* fatal */ + return; } if ((fs->super->s_first_data_block < @@ -100,8 +109,9 @@ static void check_block_bitmaps(e2fsck_t ctx) pctx.ino = ext2fs_get_block_bitmap_start(fs->block_map); pctx.ino2 = ext2fs_get_block_bitmap_end(fs->block_map); fix_problem(ctx, PR_5_BMAP_ENDPOINTS, &pctx); - /* fatal */ - fatal_error(0); + + ctx->flags |= E2F_FLAG_ABORT; /* fatal */ + return; } redo_counts: @@ -184,7 +194,7 @@ redo_counts: } else ext2fs_unmark_valid(fs); } - free(free_array); + ext2fs_free_mem((void **) &free_array); } static void check_inode_bitmaps(e2fsck_t ctx) @@ -219,8 +229,9 @@ static void check_inode_bitmaps(e2fsck_t ctx) pctx.ino = ext2fs_get_inode_bitmap_start(ctx->inode_used_map); pctx.ino2 = ext2fs_get_inode_bitmap_end(ctx->inode_used_map); fix_problem(ctx, PR_5_BMAP_ENDPOINTS, &pctx); - /* fatal */ - fatal_error(0); + + ctx->flags |= E2F_FLAG_ABORT; /* fatal */ + return; } if ((1 < ext2fs_get_inode_bitmap_start(fs->inode_map)) || (fs->super->s_inodes_count > @@ -231,8 +242,9 @@ static void check_inode_bitmaps(e2fsck_t ctx) pctx.ino = ext2fs_get_inode_bitmap_start(fs->inode_map); pctx.ino2 = ext2fs_get_inode_bitmap_end(fs->inode_map); fix_problem(ctx, PR_5_BMAP_ENDPOINTS, &pctx); - /* fatal */ - fatal_error(0); + + ctx->flags |= E2F_FLAG_ABORT; /* fatal */ + return; } redo_counts: @@ -332,8 +344,8 @@ do_counts: } else ext2fs_unmark_valid(fs); } - free(free_array); - free(dir_array); + ext2fs_free_mem((void **) &free_array); + ext2fs_free_mem((void **) &dir_array); } static void check_inode_end(e2fsck_t ctx) @@ -350,7 +362,8 @@ static void check_inode_end(e2fsck_t ctx) if (pctx.errcode) { pctx.num = 1; fix_problem(ctx, PR_5_FUDGE_BITMAP_ERROR, &pctx); - fatal_error(0); + ctx->flags |= E2F_FLAG_ABORT; /* fatal */ + return; } if (save_inodes_count == end) return; @@ -373,7 +386,8 @@ static void check_inode_end(e2fsck_t ctx) if (pctx.errcode) { pctx.num = 2; fix_problem(ctx, PR_5_FUDGE_BITMAP_ERROR, &pctx); - fatal_error(0); + ctx->flags |= E2F_FLAG_ABORT; /* fatal */ + return; } } @@ -392,7 +406,8 @@ static void check_block_end(e2fsck_t ctx) if (pctx.errcode) { pctx.num = 3; fix_problem(ctx, PR_5_FUDGE_BITMAP_ERROR, &pctx); - fatal_error(0); + ctx->flags |= E2F_FLAG_ABORT; /* fatal */ + return; } if (save_blocks_count == end) return; @@ -415,7 +430,8 @@ static void check_block_end(e2fsck_t ctx) if (pctx.errcode) { pctx.num = 4; fix_problem(ctx, PR_5_FUDGE_BITMAP_ERROR, &pctx); - fatal_error(0); + ctx->flags |= E2F_FLAG_ABORT; /* fatal */ + return; } } |