📄 ocfs2_fs.h
字号:
__le64 h_blkno; /* Offset on disk, in blocks *//*20*/ __le64 h_reserved3; __le64 h_next_leaf_blk; /* Offset on disk, in blocks, of next leaf header pointing to data *//*30*/ struct ocfs2_extent_list h_list; /* Extent record list *//* Actual on-disk size is one block */};/* * On disk superblock for OCFS2 * Note that it is contained inside an ocfs2_dinode, so all offsets * are relative to the start of ocfs2_dinode.id2. */struct ocfs2_super_block {/*00*/ __le16 s_major_rev_level; __le16 s_minor_rev_level; __le16 s_mnt_count; __le16 s_max_mnt_count; __le16 s_state; /* File system state */ __le16 s_errors; /* Behaviour when detecting errors */ __le32 s_checkinterval; /* Max time between checks *//*10*/ __le64 s_lastcheck; /* Time of last check */ __le32 s_creator_os; /* OS */ __le32 s_feature_compat; /* Compatible feature set *//*20*/ __le32 s_feature_incompat; /* Incompatible feature set */ __le32 s_feature_ro_compat; /* Readonly-compatible feature set */ __le64 s_root_blkno; /* Offset, in blocks, of root directory dinode *//*30*/ __le64 s_system_dir_blkno; /* Offset, in blocks, of system directory dinode */ __le32 s_blocksize_bits; /* Blocksize for this fs */ __le32 s_clustersize_bits; /* Clustersize for this fs *//*40*/ __le16 s_max_slots; /* Max number of simultaneous mounts before tunefs required */ __le16 s_reserved1; __le32 s_reserved2; __le64 s_first_cluster_group; /* Block offset of 1st cluster * group header *//*50*/ __u8 s_label[OCFS2_MAX_VOL_LABEL_LEN]; /* Label for mounting, etc. *//*90*/ __u8 s_uuid[OCFS2_VOL_UUID_LEN]; /* 128-bit uuid *//*A0*/};/* * Local allocation bitmap for OCFS2 slots * Note that it exists inside an ocfs2_dinode, so all offsets are * relative to the start of ocfs2_dinode.id2. */struct ocfs2_local_alloc{/*00*/ __le32 la_bm_off; /* Starting bit offset in main bitmap */ __le16 la_size; /* Size of included bitmap, in bytes */ __le16 la_reserved1; __le64 la_reserved2;/*10*/ __u8 la_bitmap[0];};/* * On disk inode for OCFS2 */struct ocfs2_dinode {/*00*/ __u8 i_signature[8]; /* Signature for validation */ __le32 i_generation; /* Generation number */ __le16 i_suballoc_slot; /* Slot suballocator this inode belongs to */ __le16 i_suballoc_bit; /* Bit offset in suballocator block group *//*10*/ __le32 i_reserved0; __le32 i_clusters; /* Cluster count */ __le32 i_uid; /* Owner UID */ __le32 i_gid; /* Owning GID *//*20*/ __le64 i_size; /* Size in bytes */ __le16 i_mode; /* File mode */ __le16 i_links_count; /* Links count */ __le32 i_flags; /* File flags *//*30*/ __le64 i_atime; /* Access time */ __le64 i_ctime; /* Creation time *//*40*/ __le64 i_mtime; /* Modification time */ __le64 i_dtime; /* Deletion time *//*50*/ __le64 i_blkno; /* Offset on disk, in blocks */ __le64 i_last_eb_blk; /* Pointer to last extent block *//*60*/ __le32 i_fs_generation; /* Generation per fs-instance */ __le32 i_atime_nsec; __le32 i_ctime_nsec; __le32 i_mtime_nsec;/*70*/ __le64 i_reserved1[9];/*B8*/ union { __le64 i_pad1; /* Generic way to refer to this 64bit union */ struct { __le64 i_rdev; /* Device number */ } dev1; struct { /* Info for bitmap system inodes */ __le32 i_used; /* Bits (ie, clusters) used */ __le32 i_total; /* Total bits (clusters) available */ } bitmap1; struct { /* Info for journal system inodes */ __le32 ij_flags; /* Mounted, version, etc. */ __le32 ij_pad; } journal1; } id1; /* Inode type dependant 1 *//*C0*/ union { struct ocfs2_super_block i_super; struct ocfs2_local_alloc i_lab; struct ocfs2_chain_list i_chain; struct ocfs2_extent_list i_list; struct ocfs2_truncate_log i_dealloc; __u8 i_symlink[0]; } id2;/* Actual on-disk size is one block */};/* * On-disk directory entry structure for OCFS2 * * Packed as this structure could be accessed unaligned on 64-bit platforms */struct ocfs2_dir_entry {/*00*/ __le64 inode; /* Inode number */ __le16 rec_len; /* Directory entry length */ __u8 name_len; /* Name length */ __u8 file_type;/*0C*/ char name[OCFS2_MAX_FILENAME_LEN]; /* File name *//* Actual on-disk length specified by rec_len */} __attribute__ ((packed));/* * On disk allocator group structure for OCFS2 */struct ocfs2_group_desc{/*00*/ __u8 bg_signature[8]; /* Signature for validation */ __le16 bg_size; /* Size of included bitmap in bytes. */ __le16 bg_bits; /* Bits represented by this group. */ __le16 bg_free_bits_count; /* Free bits count */ __le16 bg_chain; /* What chain I am in. *//*10*/ __le32 bg_generation; __le32 bg_reserved1; __le64 bg_next_group; /* Next group in my list, in blocks *//*20*/ __le64 bg_parent_dinode; /* dinode which owns me, in blocks */ __le64 bg_blkno; /* Offset on disk, in blocks *//*30*/ __le64 bg_reserved2[2];/*40*/ __u8 bg_bitmap[0];};#ifdef __KERNEL__static inline int ocfs2_fast_symlink_chars(struct super_block *sb){ return sb->s_blocksize - offsetof(struct ocfs2_dinode, id2.i_symlink);}static inline int ocfs2_extent_recs_per_inode(struct super_block *sb){ int size; size = sb->s_blocksize - offsetof(struct ocfs2_dinode, id2.i_list.l_recs); return size / sizeof(struct ocfs2_extent_rec);}static inline int ocfs2_chain_recs_per_inode(struct super_block *sb){ int size; size = sb->s_blocksize - offsetof(struct ocfs2_dinode, id2.i_chain.cl_recs); return size / sizeof(struct ocfs2_chain_rec);}static inline u16 ocfs2_extent_recs_per_eb(struct super_block *sb){ int size; size = sb->s_blocksize - offsetof(struct ocfs2_extent_block, h_list.l_recs); return size / sizeof(struct ocfs2_extent_rec);}static inline u16 ocfs2_local_alloc_size(struct super_block *sb){ u16 size; size = sb->s_blocksize - offsetof(struct ocfs2_dinode, id2.i_lab.la_bitmap); return size;}static inline int ocfs2_group_bitmap_size(struct super_block *sb){ int size; size = sb->s_blocksize - offsetof(struct ocfs2_group_desc, bg_bitmap); return size;}static inline int ocfs2_truncate_recs_per_inode(struct super_block *sb){ int size; size = sb->s_blocksize - offsetof(struct ocfs2_dinode, id2.i_dealloc.tl_recs); return size / sizeof(struct ocfs2_truncate_rec);}#elsestatic inline int ocfs2_fast_symlink_chars(int blocksize){ return blocksize - offsetof(struct ocfs2_dinode, id2.i_symlink);}static inline int ocfs2_extent_recs_per_inode(int blocksize){ int size; size = blocksize - offsetof(struct ocfs2_dinode, id2.i_list.l_recs); return size / sizeof(struct ocfs2_extent_rec);}static inline int ocfs2_chain_recs_per_inode(int blocksize){ int size; size = blocksize - offsetof(struct ocfs2_dinode, id2.i_chain.cl_recs); return size / sizeof(struct ocfs2_chain_rec);}static inline int ocfs2_extent_recs_per_eb(int blocksize){ int size; size = blocksize - offsetof(struct ocfs2_extent_block, h_list.l_recs); return size / sizeof(struct ocfs2_extent_rec);}static inline int ocfs2_local_alloc_size(int blocksize){ int size; size = blocksize - offsetof(struct ocfs2_dinode, id2.i_lab.la_bitmap); return size;}static inline int ocfs2_group_bitmap_size(int blocksize){ int size; size = blocksize - offsetof(struct ocfs2_group_desc, bg_bitmap); return size;}static inline int ocfs2_truncate_recs_per_inode(int blocksize){ int size; size = blocksize - offsetof(struct ocfs2_dinode, id2.i_dealloc.tl_recs); return size / sizeof(struct ocfs2_truncate_rec);}#endif /* __KERNEL__ */static inline int ocfs2_system_inode_is_global(int type){ return ((type >= 0) && (type <= OCFS2_LAST_GLOBAL_SYSTEM_INODE));}static inline int ocfs2_sprintf_system_inode_name(char *buf, int len, int type, int slot){ int chars; /* * Global system inodes can only have one copy. Everything * after OCFS2_LAST_GLOBAL_SYSTEM_INODE in the system inode * list has a copy per slot. */ if (type <= OCFS2_LAST_GLOBAL_SYSTEM_INODE) chars = snprintf(buf, len, ocfs2_system_inodes[type].si_name); else chars = snprintf(buf, len, ocfs2_system_inodes[type].si_name, slot); return chars;}static inline void ocfs2_set_de_type(struct ocfs2_dir_entry *de, umode_t mode){ de->file_type = ocfs2_type_by_mode[(mode & S_IFMT)>>S_SHIFT];}#endif /* _OCFS2_FS_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -