📄 xfs.h
字号:
#define XFS_DIR2_LEAFN_MAGIC 0xd2ff /* magic number: v2 dirlf multi blks */typedef struct xfs_da_blkinfo { xfs_dablk_t forw; /* previous block in list */ xfs_dablk_t back; /* following block in list */ __uint16_t magic; /* validity check on block */ __uint16_t pad; /* unused */} xfs_da_blkinfo_t;/* * This is the structure of the root and intermediate nodes in the Btree. * The leaf nodes are defined above. * * Entries are not packed. * * Since we have duplicate keys, use a binary search but always follow * all match in the block, not just the first match found. */typedef struct xfs_da_intnode { struct xfs_da_node_hdr { /* constant-structure header block */ xfs_da_blkinfo_t info; /* block type, links, etc. */ __uint16_t count; /* count of active entries */ __uint16_t level; /* level above leaves (leaf == 0) */ } hdr; struct xfs_da_node_entry { xfs_dahash_t hashval; /* hash value for this descendant */ xfs_dablk_t before; /* Btree block before this key */ } btree[1]; /* variable sized array of keys */} xfs_da_intnode_t;/* those are from xfs_dir2_data.h *//* * Directory format 2, data block structures. *//* * Constants. */#define XFS_DIR2_DATA_FREE_TAG 0xffff#define XFS_DIR2_DATA_FD_COUNT 3/* * Structures. *//* * Describe a free area in the data block. * The freespace will be formatted as a xfs_dir2_data_unused_t. */typedef struct xfs_dir2_data_free { xfs_dir2_data_off_t offset; /* start of freespace */ xfs_dir2_data_off_t length; /* length of freespace */} xfs_dir2_data_free_t;/* * Header for the data blocks. * Always at the beginning of a directory-sized block. * The code knows that XFS_DIR2_DATA_FD_COUNT is 3. */typedef struct xfs_dir2_data_hdr { __uint32_t magic; /* XFS_DIR2_DATA_MAGIC */ /* or XFS_DIR2_BLOCK_MAGIC */ xfs_dir2_data_free_t bestfree[XFS_DIR2_DATA_FD_COUNT];} xfs_dir2_data_hdr_t;/* * Active entry in a data block. Aligned to 8 bytes. * Tag appears as the last 2 bytes. */typedef struct xfs_dir2_data_entry { xfs_ino_t inumber; /* inode number */ __uint8_t namelen; /* name length */ __uint8_t name[1]; /* name bytes, no null */ /* variable offset */ xfs_dir2_data_off_t tag; /* starting offset of us */} xfs_dir2_data_entry_t;/* * Unused entry in a data block. Aligned to 8 bytes. * Tag appears as the last 2 bytes. */typedef struct xfs_dir2_data_unused { __uint16_t freetag; /* XFS_DIR2_DATA_FREE_TAG */ xfs_dir2_data_off_t length; /* total free length */ /* variable offset */ xfs_dir2_data_off_t tag; /* starting offset of us */} xfs_dir2_data_unused_t;typedef union { xfs_dir2_data_entry_t entry; xfs_dir2_data_unused_t unused;} xfs_dir2_data_union_t;/* those are from xfs_dir2_leaf.h *//* * Directory version 2, leaf block structures. *//* * Leaf block header. */typedef struct xfs_dir2_leaf_hdr { xfs_da_blkinfo_t info; /* header for da routines */ __uint16_t count; /* count of entries */ __uint16_t stale; /* count of stale entries */} xfs_dir2_leaf_hdr_t;/* those are from xfs_dir2_block.h *//* * xfs_dir2_block.h * Directory version 2, single block format structures *//* * The single block format is as follows: * xfs_dir2_data_hdr_t structure * xfs_dir2_data_entry_t and xfs_dir2_data_unused_t structures * xfs_dir2_leaf_entry_t structures * xfs_dir2_block_tail_t structure */#define XFS_DIR2_BLOCK_MAGIC 0x58443242 /* XD2B: for one block dirs */typedef struct xfs_dir2_block_tail { __uint32_t count; /* count of leaf entries */ __uint32_t stale; /* count of stale lf entries */} xfs_dir2_block_tail_t;/* those are from xfs_dir2_sf.h *//* * Directory layout when stored internal to an inode. * * Small directories are packed as tightly as possible so as to * fit into the literal area of the inode. *//* * Inode number stored as 8 8-bit values. */typedef struct { __uint8_t i[8]; } xfs_dir2_ino8_t;/* * Inode number stored as 4 8-bit values. * Works a lot of the time, when all the inode numbers in a directory * fit in 32 bits. */typedef struct { __uint8_t i[4]; } xfs_dir2_ino4_t;typedef union { xfs_dir2_ino8_t i8; xfs_dir2_ino4_t i4;} xfs_dir2_inou_t;/* * Normalized offset (in a data block) of the entry, really xfs_dir2_data_off_t. * Only need 16 bits, this is the byte offset into the single block form. */typedef struct { __uint8_t i[2]; } xfs_dir2_sf_off_t;/* * The parent directory has a dedicated field, and the self-pointer must * be calculated on the fly. * * Entries are packed toward the top as tightly as possible. The header * and the elements must be bcopy()'d out into a work area to get correct * alignment for the inode number fields. */typedef struct xfs_dir2_sf_hdr { __uint8_t count; /* count of entries */ __uint8_t i8count; /* count of 8-byte inode #s */ xfs_dir2_inou_t parent; /* parent dir inode number */} xfs_dir2_sf_hdr_t;typedef struct xfs_dir2_sf_entry { __uint8_t namelen; /* actual name length */ xfs_dir2_sf_off_t offset; /* saved offset */ __uint8_t name[1]; /* name, variable size */ xfs_dir2_inou_t inumber; /* inode number, var. offset */} xfs_dir2_sf_entry_t;typedef struct xfs_dir2_sf { xfs_dir2_sf_hdr_t hdr; /* shortform header */ xfs_dir2_sf_entry_t list[1]; /* shortform entries */} xfs_dir2_sf_t;/* those are from xfs_dinode.h */#define XFS_DINODE_VERSION_1 1#define XFS_DINODE_VERSION_2 2#define XFS_DINODE_MAGIC 0x494e /* 'IN' *//* * Disk inode structure. * This is just the header; the inode is expanded to fill a variable size * with the last field expanding. It is split into the core and "other" * because we only need the core part in the in-core inode. */typedef struct xfs_timestamp { __int32_t t_sec; /* timestamp seconds */ __int32_t t_nsec; /* timestamp nanoseconds */} xfs_timestamp_t;/* * Note: Coordinate changes to this structure with the XFS_DI_* #defines * below and the offsets table in xfs_ialloc_log_di(). */typedef struct xfs_dinode_core{ __uint16_t di_magic; /* inode magic # = XFS_DINODE_MAGIC */ __uint16_t di_mode; /* mode and type of file */ __int8_t di_version; /* inode version */ __int8_t di_format; /* format of di_c data */ __uint16_t di_onlink; /* old number of links to file */ __uint32_t di_uid; /* owner's user id */ __uint32_t di_gid; /* owner's group id */ __uint32_t di_nlink; /* number of links to file */ __uint16_t di_projid; /* owner's project id */ __uint8_t di_pad[10]; /* unused, zeroed space */ xfs_timestamp_t di_atime; /* time last accessed */ xfs_timestamp_t di_mtime; /* time last modified */ xfs_timestamp_t di_ctime; /* time created/inode modified */ xfs_fsize_t di_size; /* number of bytes in file */ xfs_drfsbno_t di_nblocks; /* # of direct & btree blocks used */ xfs_extlen_t di_extsize; /* basic/minimum extent size for file */ xfs_extnum_t di_nextents; /* number of extents in data fork */ xfs_aextnum_t di_anextents; /* number of extents in attribute fork*/ __uint8_t di_forkoff; /* attr fork offs, <<3 for 64b align */ __int8_t di_aformat; /* format of attr fork's data */ __uint32_t di_dmevmask; /* DMIG event mask */ __uint16_t di_dmstate; /* DMIG state info */ __uint16_t di_flags; /* random flags, XFS_DIFLAG_... */ __uint32_t di_gen; /* generation number */} xfs_dinode_core_t;typedef struct xfs_dinode{ xfs_dinode_core_t di_core; xfs_agino_t di_next_unlinked;/* agi unlinked list ptr */ union { xfs_bmdr_block_t di_bmbt; /* btree root block */ xfs_bmbt_rec_32_t di_bmx[1]; /* extent list */ xfs_dir2_sf_t di_dir2sf; /* shortform directory v2 */ char di_c[1]; /* local contents */ } di_u;} xfs_dinode_t;/* * Values for di_format */typedef enum xfs_dinode_fmt{ XFS_DINODE_FMT_DEV, /* CHR, BLK: di_dev */ XFS_DINODE_FMT_LOCAL, /* DIR, REG: di_c */ /* LNK: di_symlink */ XFS_DINODE_FMT_EXTENTS, /* DIR, REG, LNK: di_bmx */ XFS_DINODE_FMT_BTREE, /* DIR, REG, LNK: di_bmbt */ XFS_DINODE_FMT_UUID /* MNT: di_uuid */} xfs_dinode_fmt_t;/* * File types (mode field) */#define IFMT 0170000 /* type of file */#define IFDIR 0040000 /* directory */#define IFREG 0100000 /* regular */#define IFLNK 0120000 /* symbolic link */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -