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 208800a044SBob Copeland #define OMFS_MAX_CLUSTER_SIZE 8 21*76e51210SFabian Frederick #define OMFS_MAX_BLOCKS (1ul << 31) 221b002d7bSBob Copeland 231b002d7bSBob Copeland struct omfs_super_block { 241b002d7bSBob Copeland char s_fill1[256]; 251b002d7bSBob Copeland __be64 s_root_block; /* block number of omfs_root_block */ 261b002d7bSBob Copeland __be64 s_num_blocks; /* total number of FS blocks */ 271b002d7bSBob Copeland __be32 s_magic; /* OMFS_MAGIC */ 281b002d7bSBob Copeland __be32 s_blocksize; /* size of a block */ 291b002d7bSBob Copeland __be32 s_mirrors; /* # of mirrors of system blocks */ 301b002d7bSBob Copeland __be32 s_sys_blocksize; /* size of non-data blocks */ 311b002d7bSBob Copeland }; 321b002d7bSBob Copeland 331b002d7bSBob Copeland struct omfs_header { 341b002d7bSBob Copeland __be64 h_self; /* FS block where this is located */ 351b002d7bSBob Copeland __be32 h_body_size; /* size of useful data after header */ 361b002d7bSBob Copeland __be16 h_crc; /* crc-ccitt of body_size bytes */ 371b002d7bSBob Copeland char h_fill1[2]; 381b002d7bSBob Copeland u8 h_version; /* version, always 1 */ 391b002d7bSBob Copeland char h_type; /* OMFS_INODE_X */ 401b002d7bSBob Copeland u8 h_magic; /* OMFS_IMAGIC */ 411b002d7bSBob Copeland u8 h_check_xor; /* XOR of header bytes before this */ 421b002d7bSBob Copeland __be32 h_fill2; 431b002d7bSBob Copeland }; 441b002d7bSBob Copeland 451b002d7bSBob Copeland struct omfs_root_block { 461b002d7bSBob Copeland struct omfs_header r_head; /* header */ 471b002d7bSBob Copeland __be64 r_fill1; 481b002d7bSBob Copeland __be64 r_num_blocks; /* total number of FS blocks */ 491b002d7bSBob Copeland __be64 r_root_dir; /* block # of root directory */ 501b002d7bSBob Copeland __be64 r_bitmap; /* block # of free space bitmap */ 511b002d7bSBob Copeland __be32 r_blocksize; /* size of a block */ 521b002d7bSBob Copeland __be32 r_clustersize; /* size allocated for data blocks */ 531b002d7bSBob Copeland __be64 r_mirrors; /* # of mirrors of system blocks */ 541b002d7bSBob Copeland char r_name[OMFS_NAMELEN]; /* partition label */ 551b002d7bSBob Copeland }; 561b002d7bSBob Copeland 571b002d7bSBob Copeland struct omfs_inode { 581b002d7bSBob Copeland struct omfs_header i_head; /* header */ 591b002d7bSBob Copeland __be64 i_parent; /* parent containing this inode */ 601b002d7bSBob Copeland __be64 i_sibling; /* next inode in hash bucket */ 611b002d7bSBob Copeland __be64 i_ctime; /* ctime, in milliseconds */ 621b002d7bSBob Copeland char i_fill1[35]; 631b002d7bSBob Copeland char i_type; /* OMFS_[DIR,FILE] */ 641b002d7bSBob Copeland __be32 i_fill2; 651b002d7bSBob Copeland char i_fill3[64]; 661b002d7bSBob Copeland char i_name[OMFS_NAMELEN]; /* filename */ 671b002d7bSBob Copeland __be64 i_size; /* size of file, in bytes */ 681b002d7bSBob Copeland }; 691b002d7bSBob Copeland 701b002d7bSBob Copeland struct omfs_extent_entry { 711b002d7bSBob Copeland __be64 e_cluster; /* start location of a set of blocks */ 721b002d7bSBob Copeland __be64 e_blocks; /* number of blocks after e_cluster */ 731b002d7bSBob Copeland }; 741b002d7bSBob Copeland 751b002d7bSBob Copeland struct omfs_extent { 761b002d7bSBob Copeland __be64 e_next; /* next extent table location */ 771b002d7bSBob Copeland __be32 e_extent_count; /* total # extents in this table */ 781b002d7bSBob Copeland __be32 e_fill; 791b002d7bSBob Copeland struct omfs_extent_entry e_entry; /* start of extent entries */ 801b002d7bSBob Copeland }; 811b002d7bSBob Copeland 821b002d7bSBob Copeland #endif 83