7 #define OMFS_MAGIC 0xC2993D87
8 #define OMFS_IMAGIC 0xD2
12 #define OMFS_INODE_NORMAL 'e'
13 #define OMFS_INODE_CONTINUATION 'c'
14 #define OMFS_INODE_SYSTEM 's'
15 #define OMFS_SUPER_NAMELEN 64
16 #define OMFS_NAMELEN 256
17 #define OMFS_DIR_START 0x1b8
18 #define OMFS_EXTENT_START 0x1d0
19 #define OMFS_EXTENT_CONT 0x40
20 #define OMFS_XOR_COUNT 19
25 struct omfs_super_block
*super
;
26 struct omfs_root_block
*root
;
27 struct omfs_bitmap
*bitmap
;
29 pthread_mutex_t dev_mutex
;
32 struct omfs_super_block
{
34 char name
[OMFS_SUPER_NAMELEN
];
55 struct omfs_root_block
{
56 struct omfs_header head
;
64 char name
[OMFS_NAMELEN
];
69 struct omfs_header head
;
77 char name
[OMFS_NAMELEN
];
81 struct omfs_extent_entry
{
90 struct omfs_extent_entry entry
;
98 typedef struct omfs_info omfs_info_t
;
99 typedef struct omfs_header omfs_header_t
;
100 typedef struct omfs_super_block omfs_super_t
;
101 typedef struct omfs_root_block omfs_root_t
;
102 typedef struct omfs_inode omfs_inode_t
;
104 int omfs_read_super(omfs_info_t
*info
);
105 int omfs_write_super(omfs_info_t
*info
);
106 int omfs_read_root_block(omfs_info_t
*info
);
107 int omfs_write_root_block(omfs_info_t
*info
);
108 u8
*omfs_get_block(omfs_info_t
*info
, u64 block
);
109 int omfs_write_block(omfs_info_t
*info
, u64 block
, u8
* buf
);
110 void omfs_release_block(u8
*buf
);
111 int omfs_check_crc(u8
*blk
);
112 omfs_inode_t
*omfs_get_inode(omfs_info_t
*info
, u64 block
);
113 int omfs_write_inode(omfs_info_t
*info
, omfs_inode_t
*inode
);
114 void omfs_release_inode(omfs_inode_t
*inode
);
115 void omfs_sync(omfs_info_t
*info
);
116 int omfs_load_bitmap(omfs_info_t
*info
);
117 int omfs_flush_bitmap(omfs_info_t
*info
);
118 int omfs_compute_hash(omfs_info_t
*info
, char *filename
);
119 omfs_inode_t
*omfs_new_inode(omfs_info_t
*info
, u64 block
, char *name
,
121 void omfs_clear_data(omfs_info_t
*info
, u64 block
, int count
);
124 int omfs_allocate_one_block(omfs_info_t
*info
, u64 block
);
125 int omfs_allocate_block(omfs_info_t
*info
, int size
, u64
*return_block
);
126 int omfs_clear_range(omfs_info_t
*info
, u64 start
, int count
);
127 unsigned long omfs_count_free(omfs_info_t
*info
);