diff options
author | Bob Copeland <me@bobcopeland.com> | 2008-07-25 22:45:15 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-26 15:00:05 -0400 |
commit | 1b002d7b173ae7cc15ed90d3c07f6d106babc510 (patch) | |
tree | ec6c72320e8709547734c89cce1348c6f31208c9 | |
parent | a14e4b572b0ee5c6dbe4aceb83d00b2c969324e9 (diff) |
omfs: define filesystem structures
Add header files containing OMFS on-disk and memory structures.
Signed-off-by: Bob Copeland <me@bobcopeland.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | fs/omfs/omfs.h | 67 | ||||
-rw-r--r-- | fs/omfs/omfs_fs.h | 80 |
2 files changed, 147 insertions, 0 deletions
diff --git a/fs/omfs/omfs.h b/fs/omfs/omfs.h new file mode 100644 index 000000000000..2bc0f0670406 --- /dev/null +++ b/fs/omfs/omfs.h | |||
@@ -0,0 +1,67 @@ | |||
1 | #ifndef _OMFS_H | ||
2 | #define _OMFS_H | ||
3 | |||
4 | #include <linux/module.h> | ||
5 | #include <linux/fs.h> | ||
6 | |||
7 | #include "omfs_fs.h" | ||
8 | |||
9 | /* In-memory structures */ | ||
10 | struct omfs_sb_info { | ||
11 | u64 s_num_blocks; | ||
12 | u64 s_bitmap_ino; | ||
13 | u64 s_root_ino; | ||
14 | u32 s_blocksize; | ||
15 | u32 s_mirrors; | ||
16 | u32 s_sys_blocksize; | ||
17 | u32 s_clustersize; | ||
18 | int s_block_shift; | ||
19 | unsigned long **s_imap; | ||
20 | int s_imap_size; | ||
21 | struct mutex s_bitmap_lock; | ||
22 | int s_uid; | ||
23 | int s_gid; | ||
24 | int s_dmask; | ||
25 | int s_fmask; | ||
26 | }; | ||
27 | |||
28 | /* convert a cluster number to a scaled block number */ | ||
29 | static inline sector_t clus_to_blk(struct omfs_sb_info *sbi, sector_t block) | ||
30 | { | ||
31 | return block << sbi->s_block_shift; | ||
32 | } | ||
33 | |||
34 | static inline struct omfs_sb_info *OMFS_SB(struct super_block *sb) | ||
35 | { | ||
36 | return sb->s_fs_info; | ||
37 | } | ||
38 | |||
39 | /* bitmap.c */ | ||
40 | extern unsigned long omfs_count_free(struct super_block *sb); | ||
41 | extern int omfs_allocate_block(struct super_block *sb, u64 block); | ||
42 | extern int omfs_allocate_range(struct super_block *sb, int min_request, | ||
43 | int max_request, u64 *return_block, int *return_size); | ||
44 | extern int omfs_clear_range(struct super_block *sb, u64 block, int count); | ||
45 | |||
46 | /* dir.c */ | ||
47 | extern struct file_operations omfs_dir_operations; | ||
48 | extern struct inode_operations omfs_dir_inops; | ||
49 | extern int omfs_make_empty(struct inode *inode, struct super_block *sb); | ||
50 | extern int omfs_is_bad(struct omfs_sb_info *sbi, struct omfs_header *header, | ||
51 | u64 fsblock); | ||
52 | |||
53 | /* file.c */ | ||
54 | extern struct file_operations omfs_file_operations; | ||
55 | extern struct inode_operations omfs_file_inops; | ||
56 | extern struct address_space_operations omfs_aops; | ||
57 | extern void omfs_make_empty_table(struct buffer_head *bh, int offset); | ||
58 | extern int omfs_shrink_inode(struct inode *inode); | ||
59 | |||
60 | /* inode.c */ | ||
61 | extern struct inode *omfs_iget(struct super_block *sb, ino_t inode); | ||
62 | extern struct inode *omfs_new_inode(struct inode *dir, int mode); | ||
63 | extern int omfs_reserve_block(struct super_block *sb, sector_t block); | ||
64 | extern int omfs_find_empty_block(struct super_block *sb, int mode, ino_t *ino); | ||
65 | extern int omfs_sync_inode(struct inode *inode); | ||
66 | |||
67 | #endif | ||
diff --git a/fs/omfs/omfs_fs.h b/fs/omfs/omfs_fs.h new file mode 100644 index 000000000000..12cca245d6e8 --- /dev/null +++ b/fs/omfs/omfs_fs.h | |||
@@ -0,0 +1,80 @@ | |||
1 | #ifndef _OMFS_FS_H | ||
2 | #define _OMFS_FS_H | ||
3 | |||
4 | /* OMFS On-disk structures */ | ||
5 | |||
6 | #define OMFS_MAGIC 0xC2993D87 | ||
7 | #define OMFS_IMAGIC 0xD2 | ||
8 | |||
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_NAMELEN 256 | ||
15 | #define OMFS_DIR_START 0x1b8 | ||
16 | #define OMFS_EXTENT_START 0x1d0 | ||
17 | #define OMFS_EXTENT_CONT 0x40 | ||
18 | #define OMFS_XOR_COUNT 19 | ||
19 | #define OMFS_MAX_BLOCK_SIZE 8192 | ||
20 | |||
21 | struct omfs_super_block { | ||
22 | char s_fill1[256]; | ||
23 | __be64 s_root_block; /* block number of omfs_root_block */ | ||
24 | __be64 s_num_blocks; /* total number of FS blocks */ | ||
25 | __be32 s_magic; /* OMFS_MAGIC */ | ||
26 | __be32 s_blocksize; /* size of a block */ | ||
27 | __be32 s_mirrors; /* # of mirrors of system blocks */ | ||
28 | __be32 s_sys_blocksize; /* size of non-data blocks */ | ||
29 | }; | ||
30 | |||
31 | struct omfs_header { | ||
32 | __be64 h_self; /* FS block where this is located */ | ||
33 | __be32 h_body_size; /* size of useful data after header */ | ||
34 | __be16 h_crc; /* crc-ccitt of body_size bytes */ | ||
35 | char h_fill1[2]; | ||
36 | u8 h_version; /* version, always 1 */ | ||
37 | char h_type; /* OMFS_INODE_X */ | ||
38 | u8 h_magic; /* OMFS_IMAGIC */ | ||
39 | u8 h_check_xor; /* XOR of header bytes before this */ | ||
40 | __be32 h_fill2; | ||
41 | }; | ||
42 | |||
43 | struct omfs_root_block { | ||
44 | struct omfs_header r_head; /* header */ | ||
45 | __be64 r_fill1; | ||
46 | __be64 r_num_blocks; /* total number of FS blocks */ | ||
47 | __be64 r_root_dir; /* block # of root directory */ | ||
48 | __be64 r_bitmap; /* block # of free space bitmap */ | ||
49 | __be32 r_blocksize; /* size of a block */ | ||
50 | __be32 r_clustersize; /* size allocated for data blocks */ | ||
51 | __be64 r_mirrors; /* # of mirrors of system blocks */ | ||
52 | char r_name[OMFS_NAMELEN]; /* partition label */ | ||
53 | }; | ||
54 | |||
55 | struct omfs_inode { | ||
56 | struct omfs_header i_head; /* header */ | ||
57 | __be64 i_parent; /* parent containing this inode */ | ||
58 | __be64 i_sibling; /* next inode in hash bucket */ | ||
59 | __be64 i_ctime; /* ctime, in milliseconds */ | ||
60 | char i_fill1[35]; | ||
61 | char i_type; /* OMFS_[DIR,FILE] */ | ||
62 | __be32 i_fill2; | ||
63 | char i_fill3[64]; | ||
64 | char i_name[OMFS_NAMELEN]; /* filename */ | ||
65 | __be64 i_size; /* size of file, in bytes */ | ||
66 | }; | ||
67 | |||
68 | struct omfs_extent_entry { | ||
69 | __be64 e_cluster; /* start location of a set of blocks */ | ||
70 | __be64 e_blocks; /* number of blocks after e_cluster */ | ||
71 | }; | ||
72 | |||
73 | struct omfs_extent { | ||
74 | __be64 e_next; /* next extent table location */ | ||
75 | __be32 e_extent_count; /* total # extents in this table */ | ||
76 | __be32 e_fill; | ||
77 | struct omfs_extent_entry e_entry; /* start of extent entries */ | ||
78 | }; | ||
79 | |||
80 | #endif | ||