Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

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