omfs.h 2.1 KB

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