omfs.h 2.0 KB

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