xref: /openbmc/linux/fs/omfs/omfs.h (revision add48ba4)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _OMFS_H
3 #define _OMFS_H
4 
5 #include <linux/module.h>
6 #include <linux/fs.h>
7 
8 #include "omfs_fs.h"
9 
10 /* In-memory structures */
11 struct omfs_sb_info {
12 	u64 s_num_blocks;
13 	u64 s_bitmap_ino;
14 	u64 s_root_ino;
15 	u32 s_blocksize;
16 	u32 s_mirrors;
17 	u32 s_sys_blocksize;
18 	u32 s_clustersize;
19 	int s_block_shift;
20 	unsigned long **s_imap;
21 	int s_imap_size;
22 	struct mutex s_bitmap_lock;
23 	kuid_t s_uid;
24 	kgid_t s_gid;
25 	int s_dmask;
26 	int s_fmask;
27 };
28 
29 /* convert a cluster number to a scaled block number */
30 static inline sector_t clus_to_blk(struct omfs_sb_info *sbi, sector_t block)
31 {
32 	return block << sbi->s_block_shift;
33 }
34 
35 static inline struct omfs_sb_info *OMFS_SB(struct super_block *sb)
36 {
37 	return sb->s_fs_info;
38 }
39 
40 /* bitmap.c */
41 extern unsigned long omfs_count_free(struct super_block *sb);
42 extern int omfs_allocate_block(struct super_block *sb, u64 block);
43 extern int omfs_allocate_range(struct super_block *sb, int min_request,
44 			int max_request, u64 *return_block, int *return_size);
45 extern int omfs_clear_range(struct super_block *sb, u64 block, int count);
46 
47 /* dir.c */
48 extern const struct file_operations omfs_dir_operations;
49 extern const struct inode_operations omfs_dir_inops;
50 extern int omfs_make_empty(struct inode *inode, struct super_block *sb);
51 extern int omfs_is_bad(struct omfs_sb_info *sbi, struct omfs_header *header,
52 			u64 fsblock);
53 
54 /* file.c */
55 extern const struct file_operations omfs_file_operations;
56 extern const struct inode_operations omfs_file_inops;
57 extern const struct address_space_operations omfs_aops;
58 extern void omfs_make_empty_table(struct buffer_head *bh, int offset);
59 extern int omfs_shrink_inode(struct inode *inode);
60 
61 /* inode.c */
62 extern struct buffer_head *omfs_bread(struct super_block *sb, sector_t block);
63 extern struct inode *omfs_iget(struct super_block *sb, ino_t inode);
64 extern struct inode *omfs_new_inode(struct inode *dir, umode_t mode);
65 extern int omfs_reserve_block(struct super_block *sb, sector_t block);
66 extern int omfs_find_empty_block(struct super_block *sb, int mode, ino_t *ino);
67 extern int omfs_sync_inode(struct inode *inode);
68 
69 #endif
70