Lines Matching refs:ino
45 static int check_directory(e2fsck_t ctx, ext2_ino_t ino,
47 static void fix_dotdot(e2fsck_t ctx, ext2_ino_t ino, ext2_ino_t parent);
105 if (ext2fs_test_inode_bitmap(ctx->inode_dir_map, dir->ino))
106 if (check_directory(ctx, dir->ino, &pctx))
263 ext2_ino_t ino = dir, parent;
277 if (ext2fs_mark_inode_bitmap(inode_done_map, ino))
280 if (e2fsck_dir_info_get_parent(ctx, ino, &parent)) {
294 pctx->ino = ino;
296 if (e2fsck_reconnect_file(ctx, pctx->ino))
299 fix_dotdot(ctx, pctx->ino,
306 ino = parent;
308 ext2fs_mark_inode_bitmap(inode_loop_detect, ino);
329 ino = dir;
337 pctx->ino = dir;
357 ext2_ino_t ino;
371 sizeof(name)-1, 0, &ino);
375 if (ext2fs_test_inode_bitmap(ctx->inode_dir_map, ino)) {
376 ctx->lost_and_found = ino;
377 return ino;
383 pctx.ino = ino;
388 pctx.errcode = ext2fs_unlink(fs, EXT2_ROOT_INO, name, ino, 0);
394 (void) e2fsck_dir_info_set_parent(ctx, ino, 0);
395 e2fsck_adjust_inode_count(ctx, ino, -1);
425 ctx->inode_used_map, &ino);
431 ext2fs_mark_inode_bitmap(ctx->inode_used_map, ino);
432 ext2fs_mark_inode_bitmap(ctx->inode_dir_map, ino);
433 ext2fs_inode_alloc_stats2(fs, ino, +1, 1);
438 retval = ext2fs_new_dir_block(fs, ino, EXT2_ROOT_INO, &block);
467 pctx.errcode = ext2fs_write_new_inode(fs, ino, &inode);
476 pctx.errcode = ext2fs_link(fs, EXT2_ROOT_INO, name, ino, EXT2_FT_DIR);
486 e2fsck_add_dir_info(ctx, ino, EXT2_ROOT_INO);
488 ext2fs_icount_store(ctx->inode_count, ino, 2);
489 ext2fs_icount_store(ctx->inode_link_info, ino, 2);
490 ctx->lost_and_found = ino;
492 printf("/lost+found created; inode #%lu\n", ino);
494 return ino;
500 int e2fsck_reconnect_file(e2fsck_t ctx, ext2_ino_t ino)
510 pctx.ino = ino;
521 sprintf(name, "#%u", ino);
522 if (ext2fs_read_inode(fs, ino, &inode) == 0)
524 retval = ext2fs_link(fs, ctx->lost_and_found, name, ino, file_type);
536 ino, file_type);
543 e2fsck_adjust_inode_count(ctx, ino, 1);
551 errcode_t e2fsck_adjust_inode_count(e2fsck_t ctx, ext2_ino_t ino, int adj)
557 if (!ino)
560 retval = ext2fs_read_inode(fs, ino, &inode);
565 printf("Adjusting link count for inode %lu by %d (from %d)\n", ino, adj,
570 ext2fs_icount_increment(ctx->inode_count, ino, 0);
573 ext2fs_icount_increment(ctx->inode_link_info, ino, 0);
576 ext2fs_icount_decrement(ctx->inode_count, ino, 0);
579 ext2fs_icount_decrement(ctx->inode_link_info, ino, 0);
583 retval = ext2fs_write_inode(fs, ino, &inode);
639 static void fix_dotdot(e2fsck_t ctx, ext2_ino_t ino, ext2_ino_t parent)
652 printf("Fixing '..' of inode %lu to be %lu...\n", ino, parent);
656 pctx.ino = ino;
657 retval = ext2fs_dir_iterate(fs, ino, DIRENT_FLAG_INCLUDE_EMPTY,
665 (void) e2fsck_dir_info_set_dotdot(ctx, ino, parent);
666 if (e2fsck_dir_info_set_parent(ctx, ino, ctx->lost_and_found))