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