Fix incorrect swap in mkomfs
[omfsprogs.git] / libomfs / omfs_fs.h
blob4561a098b68049fd8ec2172f1a504ad73b91d0e6
1 #ifndef _OMFS_FS_H
2 #define _OMFS_FS_H
4 /* OMFS On-disk structures */
6 #define OMFS_MAGIC 0xC2993D87
7 #define OMFS_IMAGIC 0xD2
9 #define OMFS_DIR 'D'
10 #define OMFS_FILE 'F'
11 #define OMFS_INODE_NORMAL 'e'
12 #define OMFS_INODE_CONTINUATION 'c'
13 #define OMFS_INODE_SYSTEM 's'
14 #define OMFS_SUPER_NAMELEN 64
15 #define OMFS_NAMELEN 256
16 #define OMFS_DIR_START 0x1b8
17 #define OMFS_EXTENT_START 0x1d0
18 #define OMFS_EXTENT_CONT 0x40
19 #define OMFS_XOR_COUNT 19
20 #define OMFS_MAX_BLOCK_SIZE 8192
22 struct omfs_super_block {
23 char s_fill1[192];
24 char s_name[OMFS_SUPER_NAMELEN];
25 __be64 s_root_block; /* block number of omfs_root_block */
26 __be64 s_num_blocks; /* total number of FS blocks */
27 __be32 s_magic; /* OMFS_MAGIC */
28 __be32 s_blocksize; /* size of a block */
29 __be32 s_mirrors; /* # of mirrors of system blocks */
30 __be32 s_sys_blocksize; /* size of non-data blocks */
33 struct omfs_header {
34 __be64 h_self; /* FS block where this is located */
35 __be32 h_body_size; /* size of useful data after header */
36 __be16 h_crc; /* crc-ccitt of body_size bytes */
37 char h_fill1[2];
38 u8 h_version; /* version, always 1 */
39 char h_type; /* OMFS_INODE_X */
40 u8 h_magic; /* OMFS_IMAGIC */
41 u8 h_check_xor; /* XOR of header bytes before this */
42 __be32 h_fill2;
45 struct omfs_root_block {
46 struct omfs_header r_head; /* header */
47 __be64 r_fill1;
48 __be64 r_num_blocks; /* total number of FS blocks */
49 __be64 r_root_dir; /* block # of root directory */
50 __be64 r_bitmap; /* block # of free space bitmap */
51 __be32 r_blocksize; /* size of a block */
52 __be32 r_clustersize; /* size allocated for data blocks */
53 __be64 r_mirrors; /* # of mirrors of system blocks */
54 char r_name[OMFS_NAMELEN]; /* partition label */
55 __be64 r_fill2;
58 struct omfs_inode {
59 struct omfs_header i_head; /* header */
60 __be64 i_parent; /* parent containing this inode */
61 __be64 i_sibling; /* next inode in hash bucket */
62 __be64 i_ctime; /* ctime, in milliseconds */
63 char i_fill1[35];
64 char i_type; /* OMFS_[DIR,FILE] */
65 __be32 i_fill2;
66 char i_fill3[64];
67 char i_name[OMFS_NAMELEN]; /* filename */
68 __be64 i_size; /* size of file, in bytes */
71 struct omfs_extent_entry {
72 __be64 e_cluster; /* start location of a set of blocks */
73 __be64 e_blocks; /* number of blocks after e_cluster */
76 struct omfs_extent {
77 __be64 e_next; /* next extent table location */
78 __be32 e_extent_count; /* total # extents in this table */
79 __be32 e_fill;
80 struct omfs_extent_entry e_entry; /* start of extent entries */
83 #endif