1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */ 21b002d7bSBob Copeland #ifndef _OMFS_FS_H 31b002d7bSBob Copeland #define _OMFS_FS_H 41b002d7bSBob Copeland 51b002d7bSBob Copeland /* OMFS On-disk structures */ 61b002d7bSBob Copeland 71b002d7bSBob Copeland #define OMFS_MAGIC 0xC2993D87 81b002d7bSBob Copeland #define OMFS_IMAGIC 0xD2 91b002d7bSBob Copeland 101b002d7bSBob Copeland #define OMFS_DIR 'D' 111b002d7bSBob Copeland #define OMFS_FILE 'F' 121b002d7bSBob Copeland #define OMFS_INODE_NORMAL 'e' 131b002d7bSBob Copeland #define OMFS_INODE_CONTINUATION 'c' 141b002d7bSBob Copeland #define OMFS_INODE_SYSTEM 's' 151b002d7bSBob Copeland #define OMFS_NAMELEN 256 161b002d7bSBob Copeland #define OMFS_DIR_START 0x1b8 171b002d7bSBob Copeland #define OMFS_EXTENT_START 0x1d0 181b002d7bSBob Copeland #define OMFS_EXTENT_CONT 0x40 191b002d7bSBob Copeland #define OMFS_XOR_COUNT 19 201b002d7bSBob Copeland #define OMFS_MAX_BLOCK_SIZE 8192 218800a044SBob Copeland #define OMFS_MAX_CLUSTER_SIZE 8 2276e51210SFabian Frederick #define OMFS_MAX_BLOCKS (1ul << 31) 231b002d7bSBob Copeland 241b002d7bSBob Copeland struct omfs_super_block { 251b002d7bSBob Copeland char s_fill1[256]; 261b002d7bSBob Copeland __be64 s_root_block; /* block number of omfs_root_block */ 271b002d7bSBob Copeland __be64 s_num_blocks; /* total number of FS blocks */ 281b002d7bSBob Copeland __be32 s_magic; /* OMFS_MAGIC */ 291b002d7bSBob Copeland __be32 s_blocksize; /* size of a block */ 301b002d7bSBob Copeland __be32 s_mirrors; /* # of mirrors of system blocks */ 311b002d7bSBob Copeland __be32 s_sys_blocksize; /* size of non-data blocks */ 321b002d7bSBob Copeland }; 331b002d7bSBob Copeland 341b002d7bSBob Copeland struct omfs_header { 351b002d7bSBob Copeland __be64 h_self; /* FS block where this is located */ 361b002d7bSBob Copeland __be32 h_body_size; /* size of useful data after header */ 371b002d7bSBob Copeland __be16 h_crc; /* crc-ccitt of body_size bytes */ 381b002d7bSBob Copeland char h_fill1[2]; 391b002d7bSBob Copeland u8 h_version; /* version, always 1 */ 401b002d7bSBob Copeland char h_type; /* OMFS_INODE_X */ 411b002d7bSBob Copeland u8 h_magic; /* OMFS_IMAGIC */ 421b002d7bSBob Copeland u8 h_check_xor; /* XOR of header bytes before this */ 431b002d7bSBob Copeland __be32 h_fill2; 441b002d7bSBob Copeland }; 451b002d7bSBob Copeland 461b002d7bSBob Copeland struct omfs_root_block { 471b002d7bSBob Copeland struct omfs_header r_head; /* header */ 481b002d7bSBob Copeland __be64 r_fill1; 491b002d7bSBob Copeland __be64 r_num_blocks; /* total number of FS blocks */ 501b002d7bSBob Copeland __be64 r_root_dir; /* block # of root directory */ 511b002d7bSBob Copeland __be64 r_bitmap; /* block # of free space bitmap */ 521b002d7bSBob Copeland __be32 r_blocksize; /* size of a block */ 531b002d7bSBob Copeland __be32 r_clustersize; /* size allocated for data blocks */ 541b002d7bSBob Copeland __be64 r_mirrors; /* # of mirrors of system blocks */ 551b002d7bSBob Copeland char r_name[OMFS_NAMELEN]; /* partition label */ 561b002d7bSBob Copeland }; 571b002d7bSBob Copeland 581b002d7bSBob Copeland struct omfs_inode { 591b002d7bSBob Copeland struct omfs_header i_head; /* header */ 601b002d7bSBob Copeland __be64 i_parent; /* parent containing this inode */ 611b002d7bSBob Copeland __be64 i_sibling; /* next inode in hash bucket */ 621b002d7bSBob Copeland __be64 i_ctime; /* ctime, in milliseconds */ 631b002d7bSBob Copeland char i_fill1[35]; 641b002d7bSBob Copeland char i_type; /* OMFS_[DIR,FILE] */ 651b002d7bSBob Copeland __be32 i_fill2; 661b002d7bSBob Copeland char i_fill3[64]; 671b002d7bSBob Copeland char i_name[OMFS_NAMELEN]; /* filename */ 681b002d7bSBob Copeland __be64 i_size; /* size of file, in bytes */ 691b002d7bSBob Copeland }; 701b002d7bSBob Copeland 711b002d7bSBob Copeland struct omfs_extent_entry { 721b002d7bSBob Copeland __be64 e_cluster; /* start location of a set of blocks */ 731b002d7bSBob Copeland __be64 e_blocks; /* number of blocks after e_cluster */ 741b002d7bSBob Copeland }; 751b002d7bSBob Copeland 761b002d7bSBob Copeland struct omfs_extent { 771b002d7bSBob Copeland __be64 e_next; /* next extent table location */ 781b002d7bSBob Copeland __be32 e_extent_count; /* total # extents in this table */ 791b002d7bSBob Copeland __be32 e_fill; 80*4d8cbf6dSGustavo A. R. Silva struct omfs_extent_entry e_entry[]; /* start of extent entries */ 811b002d7bSBob Copeland }; 821b002d7bSBob Copeland 831b002d7bSBob Copeland #endif 84