📄 e2fsck.h
字号:
/* vi: set sw=4 ts=4: */#include <sys/types.h>#include <stdio.h>#include <string.h>#include <unistd.h>#include <stdlib.h>#include <time.h>#include <fcntl.h>#include <ctype.h>#include <setjmp.h>#include <errno.h>#include <getopt.h>#include <limits.h>#include <stddef.h>#include <assert.h>#include <signal.h>#include <sys/stat.h>#include <sys/resource.h>#include <sys/param.h>#include <sys/mount.h>#include <sys/ioctl.h>#include <termios.h>#include <mntent.h>#include <dirent.h>#include "ext2fs/kernel-list.h"#include <sys/types.h>#include <linux/types.h>/* * Now pull in the real linux/jfs.h definitions. */#include "ext2fs/kernel-jbd.h"#include "fsck.h"#include "ext2fs/ext2_fs.h"#include "blkid/blkid.h"#include "ext2fs/ext2_ext_attr.h"#include "uuid/uuid.h"#include "libbb.h"#ifdef HAVE_CONIO_H#undef HAVE_TERMIOS_H#include <conio.h>#define read_a_char() getch()#else#ifdef HAVE_TERMIOS_H#include <termios.h>#endif#endif/* * The last ext2fs revision level that this version of e2fsck is able to * support */#define E2FSCK_CURRENT_REV 1/* Used by the region allocation code */typedef __u32 region_addr_t;typedef struct region_struct *region_t;struct dx_dirblock_info { int type; blk_t phys; int flags; blk_t parent; ext2_dirhash_t min_hash; ext2_dirhash_t max_hash; ext2_dirhash_t node_min_hash; ext2_dirhash_t node_max_hash;};/*These defines are used in the type field of dx_dirblock_info*/#define DX_DIRBLOCK_ROOT 1#define DX_DIRBLOCK_LEAF 2#define DX_DIRBLOCK_NODE 3/*The following defines are used in the 'flags' field of a dx_dirblock_info*/#define DX_FLAG_REFERENCED 1#define DX_FLAG_DUP_REF 2#define DX_FLAG_FIRST 4#define DX_FLAG_LAST 8/* * E2fsck options */#define E2F_OPT_READONLY 0x0001#define E2F_OPT_PREEN 0x0002#define E2F_OPT_YES 0x0004#define E2F_OPT_NO 0x0008#define E2F_OPT_TIME 0x0010#define E2F_OPT_CHECKBLOCKS 0x0040#define E2F_OPT_DEBUG 0x0080#define E2F_OPT_FORCE 0x0100#define E2F_OPT_WRITECHECK 0x0200#define E2F_OPT_COMPRESS_DIRS 0x0400/* * E2fsck flags */#define E2F_FLAG_ABORT 0x0001 /* Abort signaled */#define E2F_FLAG_CANCEL 0x0002 /* Cancel signaled */#define E2F_FLAG_SIGNAL_MASK 0x0003#define E2F_FLAG_RESTART 0x0004 /* Restart signaled */#define E2F_FLAG_SETJMP_OK 0x0010 /* Setjmp valid for abort */#define E2F_FLAG_PROG_BAR 0x0020 /* Progress bar on screen */#define E2F_FLAG_PROG_SUPPRESS 0x0040 /* Progress suspended */#define E2F_FLAG_JOURNAL_INODE 0x0080 /* Create a new ext3 journal inode */#define E2F_FLAG_SB_SPECIFIED 0x0100 /* The superblock was explicitly * specified by the user */#define E2F_FLAG_RESTARTED 0x0200 /* E2fsck has been restarted */#define E2F_FLAG_RESIZE_INODE 0x0400 /* Request to recreate resize inode *//*Don't know where these come from*/#define READ 0#define WRITE 1#define cpu_to_be32(n) htonl(n)#define be32_to_cpu(n) ntohl(n)/* * We define a set of "latch groups"; these are problems which are * handled as a set. The user answers once for a particular latch * group. */#define PR_LATCH_MASK 0x0ff0 /* Latch mask */#define PR_LATCH_BLOCK 0x0010 /* Latch for illegal blocks (pass 1) */#define PR_LATCH_BBLOCK 0x0020 /* Latch for bad block inode blocks (pass 1) */#define PR_LATCH_IBITMAP 0x0030 /* Latch for pass 5 inode bitmap proc. */#define PR_LATCH_BBITMAP 0x0040 /* Latch for pass 5 inode bitmap proc. */#define PR_LATCH_RELOC 0x0050 /* Latch for superblock relocate hint */#define PR_LATCH_DBLOCK 0x0060 /* Latch for pass 1b dup block headers */#define PR_LATCH_LOW_DTIME 0x0070 /* Latch for pass1 orphaned list refugees */#define PR_LATCH_TOOBIG 0x0080 /* Latch for file to big errors */#define PR_LATCH_OPTIMIZE_DIR 0x0090 /* Latch for optimize directories */#define PR_LATCH(x) ((((x) & PR_LATCH_MASK) >> 4) - 1)/* * Latch group descriptor flags */#define PRL_YES 0x0001 /* Answer yes */#define PRL_NO 0x0002 /* Answer no */#define PRL_LATCHED 0x0004 /* The latch group is latched */#define PRL_SUPPRESS 0x0008 /* Suppress all latch group questions */#define PRL_VARIABLE 0x000f /* All the flags that need to be reset *//* * Pre-Pass 1 errors */#define PR_0_BB_NOT_GROUP 0x000001 /* Block bitmap not in group */#define PR_0_IB_NOT_GROUP 0x000002 /* Inode bitmap not in group */#define PR_0_ITABLE_NOT_GROUP 0x000003 /* Inode table not in group */#define PR_0_SB_CORRUPT 0x000004 /* Superblock corrupt */#define PR_0_FS_SIZE_WRONG 0x000005 /* Filesystem size is wrong */#define PR_0_NO_FRAGMENTS 0x000006 /* Fragments not supported */#define PR_0_BLOCKS_PER_GROUP 0x000007 /* Bad blocks_per_group */#define PR_0_FIRST_DATA_BLOCK 0x000008 /* Bad first_data_block */#define PR_0_ADD_UUID 0x000009 /* Adding UUID to filesystem */#define PR_0_RELOCATE_HINT 0x00000A /* Relocate hint */#define PR_0_MISC_CORRUPT_SUPER 0x00000B /* Miscellaneous superblock corruption */#define PR_0_GETSIZE_ERROR 0x00000C /* Error determing physical device size of filesystem */#define PR_0_INODE_COUNT_WRONG 0x00000D /* Inode count in the superblock incorrect */#define PR_0_HURD_CLEAR_FILETYPE 0x00000E /* The Hurd does not support the filetype feature */#define PR_0_JOURNAL_BAD_INODE 0x00000F /* The Hurd does not support the filetype feature */#define PR_0_JOURNAL_UNSUPP_MULTIFS 0x000010 /* The external journal has multiple filesystems (which we can't handle yet) */#define PR_0_CANT_FIND_JOURNAL 0x000011 /* Can't find external journal */#define PR_0_EXT_JOURNAL_BAD_SUPER 0x000012/* External journal has bad superblock */#define PR_0_JOURNAL_BAD_UUID 0x000013 /* Superblock has a bad journal UUID */#define PR_0_JOURNAL_UNSUPP_SUPER 0x000014 /* Journal has an unknown superblock type */#define PR_0_JOURNAL_BAD_SUPER 0x000015 /* Journal superblock is corrupt */#define PR_0_JOURNAL_HAS_JOURNAL 0x000016 /* Journal superblock is corrupt */#define PR_0_JOURNAL_RECOVER_SET 0x000017 /* Superblock has recovery flag set but no journal */#define PR_0_JOURNAL_RECOVERY_CLEAR 0x000018 /* Journal has data, but recovery flag is clear */#define PR_0_JOURNAL_RESET_JOURNAL 0x000019 /* Ask if we should clear the journal */#define PR_0_FS_REV_LEVEL 0x00001A /* Filesystem revision is 0, but feature flags are set */#define PR_0_ORPHAN_CLEAR_INODE 0x000020 /* Clearing orphan inode */#define PR_0_ORPHAN_ILLEGAL_BLOCK_NUM 0x000021 /* Illegal block found in orphaned inode */#define PR_0_ORPHAN_ALREADY_CLEARED_BLOCK 0x000022 /* Already cleared block found in orphaned inode */#define PR_0_ORPHAN_ILLEGAL_HEAD_INODE 0x000023 /* Illegal orphan inode in superblock */#define PR_0_ORPHAN_ILLEGAL_INODE 0x000024 /* Illegal inode in orphaned inode list */#define PR_0_JOURNAL_UNSUPP_ROCOMPAT 0x000025 /* Journal has unsupported read-only feature - abort */#define PR_0_JOURNAL_UNSUPP_INCOMPAT 0x000026 /* Journal has unsupported incompatible feature - abort */#define PR_0_JOURNAL_UNSUPP_VERSION 0x000027 /* Journal has unsupported version number */#define PR_0_MOVE_JOURNAL 0x000028 /* Moving journal to hidden file */#define PR_0_ERR_MOVE_JOURNAL 0x000029 /* Error moving journal */#define PR_0_CLEAR_V2_JOURNAL 0x00002A /* Clearing V2 journal superblock */#define PR_0_JOURNAL_RUN 0x00002B /* Run journal anyway */#define PR_0_JOURNAL_RUN_DEFAULT 0x00002C /* Run journal anyway by default */#define PR_0_BACKUP_JNL 0x00002D /* Backup journal inode blocks */#define PR_0_NONZERO_RESERVED_GDT_BLOCKS 0x00002E /* Reserved blocks w/o resize_inode */#define PR_0_CLEAR_RESIZE_INODE 0x00002F /* Resize_inode not enabled, but resize inode is non-zero */#define PR_0_RESIZE_INODE_INVALID 0x000030 /* Resize inode invalid *//* * Pass 1 errors */#define PR_1_PASS_HEADER 0x010000 /* Pass 1: Checking inodes, blocks, and sizes */#define PR_1_ROOT_NO_DIR 0x010001 /* Root directory is not an inode */#define PR_1_ROOT_DTIME 0x010002 /* Root directory has dtime set */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -