ufs.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. #ifndef _UFS_UFS_H
  2. #define _UFS_UFS_H 1
  3. #ifdef pr_fmt
  4. #undef pr_fmt
  5. #endif
  6. #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
  7. #define UFS_MAX_GROUP_LOADED 8
  8. #define UFS_CGNO_EMPTY ((unsigned)-1)
  9. struct ufs_sb_private_info;
  10. struct ufs_cg_private_info;
  11. struct ufs_csum;
  12. struct ufs_sb_info {
  13. struct ufs_sb_private_info * s_uspi;
  14. struct ufs_csum * s_csp;
  15. unsigned s_bytesex;
  16. unsigned s_flags;
  17. struct buffer_head ** s_ucg;
  18. struct ufs_cg_private_info * s_ucpi[UFS_MAX_GROUP_LOADED];
  19. unsigned s_cgno[UFS_MAX_GROUP_LOADED];
  20. unsigned short s_cg_loaded;
  21. unsigned s_mount_opt;
  22. struct super_block *sb;
  23. int work_queued; /* non-zero if the delayed work is queued */
  24. struct delayed_work sync_work; /* FS sync delayed work */
  25. spinlock_t work_lock; /* protects sync_work and work_queued */
  26. struct mutex s_lock;
  27. };
  28. struct ufs_inode_info {
  29. union {
  30. __fs32 i_data[15];
  31. __u8 i_symlink[2 * 4 * 15];
  32. __fs64 u2_i_data[15];
  33. } i_u1;
  34. __u32 i_flags;
  35. __u32 i_shadow;
  36. __u32 i_unused1;
  37. __u32 i_unused2;
  38. __u32 i_oeftflag;
  39. __u16 i_osync;
  40. __u64 i_lastfrag;
  41. seqlock_t meta_lock;
  42. struct mutex truncate_mutex;
  43. __u32 i_dir_start_lookup;
  44. struct inode vfs_inode;
  45. };
  46. /* mount options */
  47. #define UFS_MOUNT_ONERROR 0x0000000F
  48. #define UFS_MOUNT_ONERROR_PANIC 0x00000001
  49. #define UFS_MOUNT_ONERROR_LOCK 0x00000002
  50. #define UFS_MOUNT_ONERROR_UMOUNT 0x00000004
  51. #define UFS_MOUNT_ONERROR_REPAIR 0x00000008
  52. #define UFS_MOUNT_UFSTYPE 0x0000FFF0
  53. #define UFS_MOUNT_UFSTYPE_OLD 0x00000010
  54. #define UFS_MOUNT_UFSTYPE_44BSD 0x00000020
  55. #define UFS_MOUNT_UFSTYPE_SUN 0x00000040
  56. #define UFS_MOUNT_UFSTYPE_NEXTSTEP 0x00000080
  57. #define UFS_MOUNT_UFSTYPE_NEXTSTEP_CD 0x00000100
  58. #define UFS_MOUNT_UFSTYPE_OPENSTEP 0x00000200
  59. #define UFS_MOUNT_UFSTYPE_SUNx86 0x00000400
  60. #define UFS_MOUNT_UFSTYPE_HP 0x00000800
  61. #define UFS_MOUNT_UFSTYPE_UFS2 0x00001000
  62. #define UFS_MOUNT_UFSTYPE_SUNOS 0x00002000
  63. #define ufs_clear_opt(o,opt) o &= ~UFS_MOUNT_##opt
  64. #define ufs_set_opt(o,opt) o |= UFS_MOUNT_##opt
  65. #define ufs_test_opt(o,opt) ((o) & UFS_MOUNT_##opt)
  66. /*
  67. * Debug code
  68. */
  69. #ifdef CONFIG_UFS_DEBUG
  70. # define UFSD(f, a...) { \
  71. pr_debug("UFSD (%s, %d): %s:", \
  72. __FILE__, __LINE__, __func__); \
  73. pr_debug(f, ## a); \
  74. }
  75. #else
  76. # define UFSD(f, a...) /**/
  77. #endif
  78. /* balloc.c */
  79. extern void ufs_free_fragments (struct inode *, u64, unsigned);
  80. extern void ufs_free_blocks (struct inode *, u64, unsigned);
  81. extern u64 ufs_new_fragments(struct inode *, void *, u64, u64,
  82. unsigned, int *, struct page *);
  83. /* cylinder.c */
  84. extern struct ufs_cg_private_info * ufs_load_cylinder (struct super_block *, unsigned);
  85. extern void ufs_put_cylinder (struct super_block *, unsigned);
  86. /* dir.c */
  87. extern const struct inode_operations ufs_dir_inode_operations;
  88. extern int ufs_add_link (struct dentry *, struct inode *);
  89. extern ino_t ufs_inode_by_name(struct inode *, const struct qstr *);
  90. extern int ufs_make_empty(struct inode *, struct inode *);
  91. extern struct ufs_dir_entry *ufs_find_entry(struct inode *, const struct qstr *, struct page **);
  92. extern int ufs_delete_entry(struct inode *, struct ufs_dir_entry *, struct page *);
  93. extern int ufs_empty_dir (struct inode *);
  94. extern struct ufs_dir_entry *ufs_dotdot(struct inode *, struct page **);
  95. extern void ufs_set_link(struct inode *dir, struct ufs_dir_entry *de,
  96. struct page *page, struct inode *inode, bool update_times);
  97. /* file.c */
  98. extern const struct inode_operations ufs_file_inode_operations;
  99. extern const struct file_operations ufs_file_operations;
  100. extern const struct address_space_operations ufs_aops;
  101. /* ialloc.c */
  102. extern void ufs_free_inode (struct inode *inode);
  103. extern struct inode * ufs_new_inode (struct inode *, umode_t);
  104. /* inode.c */
  105. extern struct inode *ufs_iget(struct super_block *, unsigned long);
  106. extern int ufs_write_inode (struct inode *, struct writeback_control *);
  107. extern int ufs_sync_inode (struct inode *);
  108. extern void ufs_evict_inode (struct inode *);
  109. extern int ufs_setattr(struct dentry *dentry, struct iattr *attr);
  110. /* namei.c */
  111. extern const struct file_operations ufs_dir_operations;
  112. /* super.c */
  113. extern __printf(3, 4)
  114. void ufs_warning(struct super_block *, const char *, const char *, ...);
  115. extern __printf(3, 4)
  116. void ufs_error(struct super_block *, const char *, const char *, ...);
  117. extern __printf(3, 4)
  118. void ufs_panic(struct super_block *, const char *, const char *, ...);
  119. void ufs_mark_sb_dirty(struct super_block *sb);
  120. /* symlink.c */
  121. extern const struct inode_operations ufs_fast_symlink_inode_operations;
  122. extern const struct inode_operations ufs_symlink_inode_operations;
  123. static inline struct ufs_sb_info *UFS_SB(struct super_block *sb)
  124. {
  125. return sb->s_fs_info;
  126. }
  127. static inline struct ufs_inode_info *UFS_I(struct inode *inode)
  128. {
  129. return container_of(inode, struct ufs_inode_info, vfs_inode);
  130. }
  131. /*
  132. * Give cylinder group number for a file system block.
  133. * Give cylinder group block number for a file system block.
  134. */
  135. /* #define ufs_dtog(d) ((d) / uspi->s_fpg) */
  136. static inline u64 ufs_dtog(struct ufs_sb_private_info * uspi, u64 b)
  137. {
  138. do_div(b, uspi->s_fpg);
  139. return b;
  140. }
  141. /* #define ufs_dtogd(d) ((d) % uspi->s_fpg) */
  142. static inline u32 ufs_dtogd(struct ufs_sb_private_info * uspi, u64 b)
  143. {
  144. return do_div(b, uspi->s_fpg);
  145. }
  146. #endif /* _UFS_UFS_H */