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