ufs.h 5.1 KB

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