Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef _OMFS_H
0003 #define _OMFS_H
0004 
0005 #include <linux/module.h>
0006 #include <linux/fs.h>
0007 
0008 #include "omfs_fs.h"
0009 
0010 /* In-memory structures */
0011 struct omfs_sb_info {
0012     u64 s_num_blocks;
0013     u64 s_bitmap_ino;
0014     u64 s_root_ino;
0015     u32 s_blocksize;
0016     u32 s_mirrors;
0017     u32 s_sys_blocksize;
0018     u32 s_clustersize;
0019     int s_block_shift;
0020     unsigned long **s_imap;
0021     int s_imap_size;
0022     struct mutex s_bitmap_lock;
0023     kuid_t s_uid;
0024     kgid_t s_gid;
0025     int s_dmask;
0026     int s_fmask;
0027 };
0028 
0029 /* convert a cluster number to a scaled block number */
0030 static inline sector_t clus_to_blk(struct omfs_sb_info *sbi, sector_t block)
0031 {
0032     return block << sbi->s_block_shift;
0033 }
0034 
0035 static inline struct omfs_sb_info *OMFS_SB(struct super_block *sb)
0036 {
0037     return sb->s_fs_info;
0038 }
0039 
0040 /* bitmap.c */
0041 extern unsigned long omfs_count_free(struct super_block *sb);
0042 extern int omfs_allocate_block(struct super_block *sb, u64 block);
0043 extern int omfs_allocate_range(struct super_block *sb, int min_request,
0044             int max_request, u64 *return_block, int *return_size);
0045 extern int omfs_clear_range(struct super_block *sb, u64 block, int count);
0046 
0047 /* dir.c */
0048 extern const struct file_operations omfs_dir_operations;
0049 extern const struct inode_operations omfs_dir_inops;
0050 extern int omfs_make_empty(struct inode *inode, struct super_block *sb);
0051 extern int omfs_is_bad(struct omfs_sb_info *sbi, struct omfs_header *header,
0052             u64 fsblock);
0053 
0054 /* file.c */
0055 extern const struct file_operations omfs_file_operations;
0056 extern const struct inode_operations omfs_file_inops;
0057 extern const struct address_space_operations omfs_aops;
0058 extern void omfs_make_empty_table(struct buffer_head *bh, int offset);
0059 extern int omfs_shrink_inode(struct inode *inode);
0060 
0061 /* inode.c */
0062 extern struct buffer_head *omfs_bread(struct super_block *sb, sector_t block);
0063 extern struct inode *omfs_iget(struct super_block *sb, ino_t inode);
0064 extern struct inode *omfs_new_inode(struct inode *dir, umode_t mode);
0065 extern int omfs_reserve_block(struct super_block *sb, sector_t block);
0066 extern int omfs_find_empty_block(struct super_block *sb, int mode, ino_t *ino);
0067 extern int omfs_sync_inode(struct inode *inode);
0068 
0069 #endif