1 /* SPDX-License-Identifier: GPL-2.0 */ 1 /* SPDX-License-Identifier: GPL-2.0 */ 2 #ifndef _OMFS_FS_H 2 #ifndef _OMFS_FS_H 3 #define _OMFS_FS_H 3 #define _OMFS_FS_H 4 4 5 /* OMFS On-disk structures */ 5 /* OMFS On-disk structures */ 6 6 7 #define OMFS_MAGIC 0xC2993D87 7 #define OMFS_MAGIC 0xC2993D87 8 #define OMFS_IMAGIC 0xD2 8 #define OMFS_IMAGIC 0xD2 9 9 10 #define OMFS_DIR 'D' 10 #define OMFS_DIR 'D' 11 #define OMFS_FILE 'F' 11 #define OMFS_FILE 'F' 12 #define OMFS_INODE_NORMAL 'e' 12 #define OMFS_INODE_NORMAL 'e' 13 #define OMFS_INODE_CONTINUATION 'c' 13 #define OMFS_INODE_CONTINUATION 'c' 14 #define OMFS_INODE_SYSTEM 's' 14 #define OMFS_INODE_SYSTEM 's' 15 #define OMFS_NAMELEN 256 15 #define OMFS_NAMELEN 256 16 #define OMFS_DIR_START 0x1b8 16 #define OMFS_DIR_START 0x1b8 17 #define OMFS_EXTENT_START 0x1d0 17 #define OMFS_EXTENT_START 0x1d0 18 #define OMFS_EXTENT_CONT 0x40 18 #define OMFS_EXTENT_CONT 0x40 19 #define OMFS_XOR_COUNT 19 19 #define OMFS_XOR_COUNT 19 20 #define OMFS_MAX_BLOCK_SIZE 8192 20 #define OMFS_MAX_BLOCK_SIZE 8192 21 #define OMFS_MAX_CLUSTER_SIZE 8 21 #define OMFS_MAX_CLUSTER_SIZE 8 22 #define OMFS_MAX_BLOCKS (1ul << 31) 22 #define OMFS_MAX_BLOCKS (1ul << 31) 23 23 24 struct omfs_super_block { 24 struct omfs_super_block { 25 char s_fill1[256]; 25 char s_fill1[256]; 26 __be64 s_root_block; /* blo 26 __be64 s_root_block; /* block number of omfs_root_block */ 27 __be64 s_num_blocks; /* tot 27 __be64 s_num_blocks; /* total number of FS blocks */ 28 __be32 s_magic; /* OMF 28 __be32 s_magic; /* OMFS_MAGIC */ 29 __be32 s_blocksize; /* siz 29 __be32 s_blocksize; /* size of a block */ 30 __be32 s_mirrors; /* # o 30 __be32 s_mirrors; /* # of mirrors of system blocks */ 31 __be32 s_sys_blocksize; /* siz 31 __be32 s_sys_blocksize; /* size of non-data blocks */ 32 }; 32 }; 33 33 34 struct omfs_header { 34 struct omfs_header { 35 __be64 h_self; /* FS 35 __be64 h_self; /* FS block where this is located */ 36 __be32 h_body_size; /* siz 36 __be32 h_body_size; /* size of useful data after header */ 37 __be16 h_crc; /* crc 37 __be16 h_crc; /* crc-ccitt of body_size bytes */ 38 char h_fill1[2]; 38 char h_fill1[2]; 39 u8 h_version; /* ver 39 u8 h_version; /* version, always 1 */ 40 char h_type; /* OMF 40 char h_type; /* OMFS_INODE_X */ 41 u8 h_magic; /* OMF 41 u8 h_magic; /* OMFS_IMAGIC */ 42 u8 h_check_xor; /* XOR 42 u8 h_check_xor; /* XOR of header bytes before this */ 43 __be32 h_fill2; 43 __be32 h_fill2; 44 }; 44 }; 45 45 46 struct omfs_root_block { 46 struct omfs_root_block { 47 struct omfs_header r_head; /* hea 47 struct omfs_header r_head; /* header */ 48 __be64 r_fill1; 48 __be64 r_fill1; 49 __be64 r_num_blocks; /* tot 49 __be64 r_num_blocks; /* total number of FS blocks */ 50 __be64 r_root_dir; /* blo 50 __be64 r_root_dir; /* block # of root directory */ 51 __be64 r_bitmap; /* blo 51 __be64 r_bitmap; /* block # of free space bitmap */ 52 __be32 r_blocksize; /* siz 52 __be32 r_blocksize; /* size of a block */ 53 __be32 r_clustersize; /* siz 53 __be32 r_clustersize; /* size allocated for data blocks */ 54 __be64 r_mirrors; /* # o 54 __be64 r_mirrors; /* # of mirrors of system blocks */ 55 char r_name[OMFS_NAMELEN]; /* par 55 char r_name[OMFS_NAMELEN]; /* partition label */ 56 }; 56 }; 57 57 58 struct omfs_inode { 58 struct omfs_inode { 59 struct omfs_header i_head; /* hea 59 struct omfs_header i_head; /* header */ 60 __be64 i_parent; /* par 60 __be64 i_parent; /* parent containing this inode */ 61 __be64 i_sibling; /* nex 61 __be64 i_sibling; /* next inode in hash bucket */ 62 __be64 i_ctime; /* cti 62 __be64 i_ctime; /* ctime, in milliseconds */ 63 char i_fill1[35]; 63 char i_fill1[35]; 64 char i_type; /* OMF 64 char i_type; /* OMFS_[DIR,FILE] */ 65 __be32 i_fill2; 65 __be32 i_fill2; 66 char i_fill3[64]; 66 char i_fill3[64]; 67 char i_name[OMFS_NAMELEN]; /* fil 67 char i_name[OMFS_NAMELEN]; /* filename */ 68 __be64 i_size; /* siz 68 __be64 i_size; /* size of file, in bytes */ 69 }; 69 }; 70 70 71 struct omfs_extent_entry { 71 struct omfs_extent_entry { 72 __be64 e_cluster; /* sta 72 __be64 e_cluster; /* start location of a set of blocks */ 73 __be64 e_blocks; /* num 73 __be64 e_blocks; /* number of blocks after e_cluster */ 74 }; 74 }; 75 75 76 struct omfs_extent { 76 struct omfs_extent { 77 __be64 e_next; /* nex 77 __be64 e_next; /* next extent table location */ 78 __be32 e_extent_count; /* tot 78 __be32 e_extent_count; /* total # extents in this table */ 79 __be32 e_fill; 79 __be32 e_fill; 80 struct omfs_extent_entry e_entry[]; !! 80 struct omfs_extent_entry e_entry; /* start of extent entries */ 81 }; 81 }; 82 82 83 #endif 83 #endif 84 84
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.