bfs.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * fs/bfs/bfs.h
  4. * Copyright (C) 1999-2018 Tigran Aivazian <[email protected]>
  5. */
  6. #ifndef _FS_BFS_BFS_H
  7. #define _FS_BFS_BFS_H
  8. #include <linux/bfs_fs.h>
  9. /* In theory BFS supports up to 512 inodes, numbered from 2 (for /) up to 513 inclusive.
  10. In actual fact, attempting to create the 512th inode (i.e. inode No. 513 or file No. 511)
  11. will fail with ENOSPC in bfs_add_entry(): the root directory cannot contain so many entries, counting '..'.
  12. So, mkfs.bfs(8) should really limit its -N option to 511 and not 512. For now, we just print a warning
  13. if a filesystem is mounted with such "impossible to fill up" number of inodes */
  14. #define BFS_MAX_LASTI 513
  15. /*
  16. * BFS file system in-core superblock info
  17. */
  18. struct bfs_sb_info {
  19. unsigned long si_blocks;
  20. unsigned long si_freeb;
  21. unsigned long si_freei;
  22. unsigned long si_lf_eblk;
  23. unsigned long si_lasti;
  24. DECLARE_BITMAP(si_imap, BFS_MAX_LASTI+1);
  25. struct mutex bfs_lock;
  26. };
  27. /*
  28. * BFS file system in-core inode info
  29. */
  30. struct bfs_inode_info {
  31. unsigned long i_dsk_ino; /* inode number from the disk, can be 0 */
  32. unsigned long i_sblock;
  33. unsigned long i_eblock;
  34. struct inode vfs_inode;
  35. };
  36. static inline struct bfs_sb_info *BFS_SB(struct super_block *sb)
  37. {
  38. return sb->s_fs_info;
  39. }
  40. static inline struct bfs_inode_info *BFS_I(struct inode *inode)
  41. {
  42. return container_of(inode, struct bfs_inode_info, vfs_inode);
  43. }
  44. #define printf(format, args...) \
  45. printk(KERN_ERR "BFS-fs: %s(): " format, __func__, ## args)
  46. /* inode.c */
  47. extern struct inode *bfs_iget(struct super_block *sb, unsigned long ino);
  48. extern void bfs_dump_imap(const char *, struct super_block *);
  49. /* file.c */
  50. extern const struct inode_operations bfs_file_inops;
  51. extern const struct file_operations bfs_file_operations;
  52. extern const struct address_space_operations bfs_aops;
  53. /* dir.c */
  54. extern const struct inode_operations bfs_dir_inops;
  55. extern const struct file_operations bfs_dir_operations;
  56. #endif /* _FS_BFS_BFS_H */