Lines Matching full:ctx
25 static void check_super_value(e2fsck_t ctx, const char *descr,
36 fix_problem(ctx, PR_0_MISC_CORRUPT_SUPER, &pctx);
37 ctx->flags |= E2F_FLAG_ABORT; /* never get here! */
45 e2fsck_t ctx;
64 e2fsck_t ctx;
70 ctx = pb->ctx;
81 fix_problem(ctx, PR_0_ORPHAN_ILLEGAL_BLOCK_NUM, pctx);
88 fix_problem(ctx, PR_0_ORPHAN_ALREADY_CLEARED_BLOCK, pctx);
153 static int release_inode_blocks(e2fsck_t ctx, ext2_ino_t ino,
158 ext2_filsys fs = ctx->fs;
165 pb.buf = block_buf + 3 * ctx->fs->blocksize;
166 pb.ctx = ctx;
195 e2fsck_read_inode(ctx, ino, inode, "release_inode_blocks");
224 static int release_orphan_inodes(e2fsck_t ctx)
226 ext2_filsys fs = ctx->fs;
254 fix_problem(ctx, PR_0_ORPHAN_ILLEGAL_HEAD_INODE, &pctx);
258 block_buf = (char *) e2fsck_allocate_memory(ctx, fs->blocksize * 4,
260 e2fsck_read_bitmaps(ctx);
263 e2fsck_read_inode(ctx, ino, &inode, "release_orphan_inodes");
270 fix_problem(ctx, PR_0_ORPHAN_CLEAR_INODE, &pctx);
277 fix_problem(ctx, PR_0_ORPHAN_ILLEGAL_INODE, &pctx);
281 if (release_inode_blocks(ctx, ino, &inode, block_buf, &pctx))
287 inode.i_dtime = ctx->now;
291 e2fsck_write_inode(ctx, ino, &inode, "delete_file");
307 void check_resize_inode(e2fsck_t ctx)
309 ext2_filsys fs = ctx->fs;
328 if (fix_problem(ctx, PR_0_NONZERO_RESERVED_GDT_BLOCKS,
342 ctx->flags |= E2F_FLAG_RESIZE_INODE;
357 fix_problem(ctx, PR_0_CLEAR_RESIZE_INODE, &pctx)) {
359 e2fsck_write_inode(ctx, EXT2_RESIZE_INO, &inode,
379 if (fix_problem(ctx, PR_0_RESIZE_INODE_INVALID, &pctx)) {
381 e2fsck_write_inode(ctx, EXT2_RESIZE_INO, &inode,
383 ctx->flags |= E2F_FLAG_RESIZE_INODE;
385 if (!(ctx->options & E2F_OPT_READONLY)) {
391 dind_buf = (__u32 *) e2fsck_allocate_memory(ctx, fs->blocksize * 2,
429 static void e2fsck_fix_dirhash_hint(e2fsck_t ctx)
431 struct ext2_super_block *sb = ctx->fs->super;
435 if ((ctx->options & E2F_OPT_READONLY) ||
443 if (fix_problem(ctx, PR_0_DIRHASH_HINT, &pctx)) {
449 ext2fs_mark_super_dirty(ctx->fs);
454 void check_super_block(e2fsck_t ctx)
456 ext2_filsys fs = ctx->fs;
483 ctx->invalid_inode_bitmap_flag = (int *) e2fsck_allocate_memory(ctx,
485 ctx->invalid_block_bitmap_flag = (int *) e2fsck_allocate_memory(ctx,
487 ctx->invalid_inode_table_flag = (int *) e2fsck_allocate_memory(ctx,
495 check_super_value(ctx, "inodes_count", sb->s_inodes_count,
497 check_super_value(ctx, "blocks_count", sb->s_blocks_count,
499 check_super_value(ctx, "first_data_block", sb->s_first_data_block,
501 check_super_value(ctx, "log_block_size", sb->s_log_block_size,
504 check_super_value(ctx, "log_frag_size", sb->s_log_frag_size,
506 check_super_value(ctx, "frags_per_group", sb->s_frags_per_group,
509 check_super_value(ctx, "blocks_per_group", sb->s_blocks_per_group,
511 check_super_value(ctx, "inodes_per_group", sb->s_inodes_per_group,
513 check_super_value(ctx, "r_blocks_count", sb->s_r_blocks_count,
515 check_super_value(ctx, "reserved_gdt_blocks",
519 check_super_value(ctx, "first_ino", sb->s_first_ino,
523 check_super_value(ctx, "inode_size",
529 fix_problem(ctx, PR_0_MISC_CORRUPT_SUPER, &pctx);
530 ctx->flags |= E2F_FLAG_ABORT; /* never get here! */
534 if ((ctx->flags & E2F_FLAG_GOT_DEVSIZE) &&
535 (ctx->num_blocks < sb->s_blocks_count)) {
537 pctx.blk2 = ctx->num_blocks;
538 if (fix_problem(ctx, PR_0_FS_SIZE_WRONG, &pctx)) {
539 ctx->flags |= E2F_FLAG_ABORT;
547 fix_problem(ctx, PR_0_NO_FRAGMENTS, &pctx);
548 ctx->flags |= E2F_FLAG_ABORT;
557 fix_problem(ctx, PR_0_BLOCKS_PER_GROUP, &pctx);
558 ctx->flags |= E2F_FLAG_ABORT;
566 fix_problem(ctx, PR_0_FIRST_DATA_BLOCK, &pctx);
567 ctx->flags |= E2F_FLAG_ABORT;
575 if (fix_problem(ctx, PR_0_INODE_COUNT_WRONG, &pctx)) {
601 if (fix_problem(ctx, PR_0_BB_NOT_GROUP, &pctx))
605 ctx->invalid_block_bitmap_flag[i]++;
606 ctx->invalid_bitmaps++;
611 if (fix_problem(ctx, PR_0_IB_NOT_GROUP, &pctx))
615 ctx->invalid_inode_bitmap_flag[i]++;
616 ctx->invalid_bitmaps++;
622 if (fix_problem(ctx, PR_0_ITABLE_NOT_GROUP, &pctx))
626 ctx->invalid_inode_table_flag[i]++;
627 ctx->invalid_bitmaps++;
639 if (fix_problem(ctx, PR_0_GDT_CSUM, &pctx)) {
651 if (fix_problem(ctx, PR_0_GDT_UNINIT, &pctx)) {
662 if (fix_problem(ctx, PR_0_BB_UNINIT_LAST, &pctx)) {
671 if (fix_problem(ctx, PR_0_BB_UNINIT_IB_INIT, &pctx)) {
682 if (fix_problem(ctx, PR_0_GDT_ITABLE_UNUSED, &pctx)) {
702 if (ctx->options & E2F_OPT_READONLY)
720 if (ctx->invalid_bitmaps && !(ctx->options & E2F_OPT_READONLY)) {
731 if (!(ctx->options & E2F_OPT_READONLY) && uuid_is_null(sb->s_uuid)) {
732 if (fix_problem(ctx, PR_0_ADD_UUID, &pctx)) {
743 profile_get_boolean(ctx->profile, "options",
746 if (!(ctx->options & E2F_OPT_READONLY) &&
750 if (fix_problem(ctx, PR_0_CLEAR_TESTFS_FLAG, &pctx)) {
761 if (!(ctx->options & E2F_OPT_READONLY) &&
765 if (fix_problem(ctx, PR_0_HURD_CLEAR_FILETYPE, &pctx)) {
779 if (!(ctx->options & E2F_OPT_READONLY) &&
784 fix_problem(ctx, PR_0_FS_REV_LEVEL, &pctx)) {
793 if (!(ctx->options & E2F_OPT_READONLY) && release_orphan_inodes(ctx)) {
819 profile_get_boolean(ctx->profile, "options", "accept_time_fudge",
821 profile_get_boolean(ctx->profile, "options", "buggy_init_scripts",
823 ctx->time_fudge = accept_time_fudge ? 86400 : 0;
825 profile_get_boolean(ctx->profile, "options", "broken_system_clock",
833 !(ctx->flags & E2F_FLAG_TIME_INSANE) &&
834 fs->super->s_mtime > (__u32) ctx->now) {
837 if (fs->super->s_mtime <= (__u32) ctx->now + ctx->time_fudge)
839 if (fix_problem(ctx, problem, &pctx)) {
840 fs->super->s_mtime = ctx->now;
845 !(ctx->flags & E2F_FLAG_TIME_INSANE) &&
846 fs->super->s_wtime > (__u32) ctx->now) {
849 if (fs->super->s_wtime <= (__u32) ctx->now + ctx->time_fudge)
851 if (fix_problem(ctx, problem, &pctx)) {
852 fs->super->s_wtime = ctx->now;
860 e2fsck_move_ext3_journal(ctx);
865 e2fsck_fix_ext3_journal_hint(ctx);
870 e2fsck_fix_dirhash_hint(ctx);
899 int check_backup_super_block(e2fsck_t ctx)
901 ext2_filsys fs = ctx->fs;
919 (ctx->flags & (E2F_FLAG_ABORT | E2F_FLAG_CANCEL)) ||
920 (ctx->options & E2F_OPT_READONLY))