blob: 4008be73de545ee4b07a379b7f795b4f63b44bad [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Bob Copeland1b002d72008-07-25 19:45:15 -07002#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 */
11struct 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;
Eric W. Biederman80fcbe72012-02-07 16:29:49 -080023 kuid_t s_uid;
24 kgid_t s_gid;
Bob Copeland1b002d72008-07-25 19:45:15 -070025 int s_dmask;
26 int s_fmask;
27};
28
29/* convert a cluster number to a scaled block number */
30static inline sector_t clus_to_blk(struct omfs_sb_info *sbi, sector_t block)
31{
32 return block << sbi->s_block_shift;
33}
34
35static inline struct omfs_sb_info *OMFS_SB(struct super_block *sb)
36{
37 return sb->s_fs_info;
38}
39
40/* bitmap.c */
41extern unsigned long omfs_count_free(struct super_block *sb);
42extern int omfs_allocate_block(struct super_block *sb, u64 block);
43extern int omfs_allocate_range(struct super_block *sb, int min_request,
44 int max_request, u64 *return_block, int *return_size);
45extern int omfs_clear_range(struct super_block *sb, u64 block, int count);
46
47/* dir.c */
Alexey Dobriyan828c0952009-10-01 15:43:56 -070048extern const struct file_operations omfs_dir_operations;
Alexey Dobriyan6e1d5dc2009-09-21 17:01:11 -070049extern const struct inode_operations omfs_dir_inops;
Bob Copeland1b002d72008-07-25 19:45:15 -070050extern int omfs_make_empty(struct inode *inode, struct super_block *sb);
51extern int omfs_is_bad(struct omfs_sb_info *sbi, struct omfs_header *header,
52 u64 fsblock);
53
54/* file.c */
Alexey Dobriyan828c0952009-10-01 15:43:56 -070055extern const struct file_operations omfs_file_operations;
Alexey Dobriyan6e1d5dc2009-09-21 17:01:11 -070056extern const struct inode_operations omfs_file_inops;
Alexey Dobriyan7f094102009-09-21 17:01:10 -070057extern const struct address_space_operations omfs_aops;
Bob Copeland1b002d72008-07-25 19:45:15 -070058extern void omfs_make_empty_table(struct buffer_head *bh, int offset);
59extern int omfs_shrink_inode(struct inode *inode);
60
61/* inode.c */
Bob Copelandf0682722008-09-06 17:51:53 -040062extern struct buffer_head *omfs_bread(struct super_block *sb, sector_t block);
Bob Copeland1b002d72008-07-25 19:45:15 -070063extern struct inode *omfs_iget(struct super_block *sb, ino_t inode);
Al Viro587228b2011-07-24 22:58:10 -040064extern struct inode *omfs_new_inode(struct inode *dir, umode_t mode);
Bob Copeland1b002d72008-07-25 19:45:15 -070065extern int omfs_reserve_block(struct super_block *sb, sector_t block);
66extern int omfs_find_empty_block(struct super_block *sb, int mode, ino_t *ino);
67extern int omfs_sync_inode(struct inode *inode);
68
69#endif