qnx4_fs.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. /*
  2. * Name : qnx4_fs.h
  3. * Author : Richard Frowijn
  4. * Function : qnx4 global filesystem definitions
  5. * Version : 1.0.2
  6. * Last modified : 2000-01-31
  7. *
  8. * History : 23-03-1998 created
  9. */
  10. #ifndef _LINUX_QNX4_FS_H
  11. #define _LINUX_QNX4_FS_H
  12. #include <linux/qnxtypes.h>
  13. #include <linux/magic.h>
  14. #define QNX4_ROOT_INO 1
  15. #define QNX4_MAX_XTNTS_PER_XBLK 60
  16. /* for di_status */
  17. #define QNX4_FILE_USED 0x01
  18. #define QNX4_FILE_MODIFIED 0x02
  19. #define QNX4_FILE_BUSY 0x04
  20. #define QNX4_FILE_LINK 0x08
  21. #define QNX4_FILE_INODE 0x10
  22. #define QNX4_FILE_FSYSCLEAN 0x20
  23. #define QNX4_I_MAP_SLOTS 8
  24. #define QNX4_Z_MAP_SLOTS 64
  25. #define QNX4_VALID_FS 0x0001 /* Clean fs. */
  26. #define QNX4_ERROR_FS 0x0002 /* fs has errors. */
  27. #define QNX4_BLOCK_SIZE 0x200 /* blocksize of 512 bytes */
  28. #define QNX4_BLOCK_SIZE_BITS 9 /* blocksize shift */
  29. #define QNX4_DIR_ENTRY_SIZE 0x040 /* dir entry size of 64 bytes */
  30. #define QNX4_DIR_ENTRY_SIZE_BITS 6 /* dir entry size shift */
  31. #define QNX4_XBLK_ENTRY_SIZE 0x200 /* xblk entry size */
  32. #define QNX4_INODES_PER_BLOCK 0x08 /* 512 / 64 */
  33. /* for filenames */
  34. #define QNX4_SHORT_NAME_MAX 16
  35. #define QNX4_NAME_MAX 48
  36. /*
  37. * This is the original qnx4 inode layout on disk.
  38. */
  39. struct qnx4_inode_entry {
  40. char di_fname[QNX4_SHORT_NAME_MAX];
  41. qnx4_off_t di_size;
  42. qnx4_xtnt_t di_first_xtnt;
  43. __le32 di_xblk;
  44. __le32 di_ftime;
  45. __le32 di_mtime;
  46. __le32 di_atime;
  47. __le32 di_ctime;
  48. qnx4_nxtnt_t di_num_xtnts;
  49. qnx4_mode_t di_mode;
  50. qnx4_muid_t di_uid;
  51. qnx4_mgid_t di_gid;
  52. qnx4_nlink_t di_nlink;
  53. __u8 di_zero[4];
  54. qnx4_ftype_t di_type;
  55. __u8 di_status;
  56. };
  57. struct qnx4_link_info {
  58. char dl_fname[QNX4_NAME_MAX];
  59. __le32 dl_inode_blk;
  60. __u8 dl_inode_ndx;
  61. __u8 dl_spare[10];
  62. __u8 dl_status;
  63. };
  64. struct qnx4_xblk {
  65. __le32 xblk_next_xblk;
  66. __le32 xblk_prev_xblk;
  67. __u8 xblk_num_xtnts;
  68. __u8 xblk_spare[3];
  69. __le32 xblk_num_blocks;
  70. qnx4_xtnt_t xblk_xtnts[QNX4_MAX_XTNTS_PER_XBLK];
  71. char xblk_signature[8];
  72. qnx4_xtnt_t xblk_first_xtnt;
  73. };
  74. struct qnx4_super_block {
  75. struct qnx4_inode_entry RootDir;
  76. struct qnx4_inode_entry Inode;
  77. struct qnx4_inode_entry Boot;
  78. struct qnx4_inode_entry AltBoot;
  79. };
  80. #ifdef __KERNEL__
  81. #define QNX4_DEBUG 0
  82. #if QNX4_DEBUG
  83. #define QNX4DEBUG(X) printk X
  84. #else
  85. #define QNX4DEBUG(X) (void) 0
  86. #endif
  87. struct qnx4_sb_info {
  88. struct buffer_head *sb_buf; /* superblock buffer */
  89. struct qnx4_super_block *sb; /* our superblock */
  90. unsigned int Version; /* may be useful */
  91. struct qnx4_inode_entry *BitMap; /* useful */
  92. };
  93. struct qnx4_inode_info {
  94. struct qnx4_inode_entry raw;
  95. loff_t mmu_private;
  96. struct inode vfs_inode;
  97. };
  98. extern struct dentry *qnx4_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd);
  99. extern unsigned long qnx4_count_free_blocks(struct super_block *sb);
  100. extern unsigned long qnx4_block_map(struct inode *inode, long iblock);
  101. extern struct buffer_head *qnx4_bread(struct inode *, int, int);
  102. extern const struct inode_operations qnx4_file_inode_operations;
  103. extern const struct inode_operations qnx4_dir_inode_operations;
  104. extern const struct file_operations qnx4_file_operations;
  105. extern const struct file_operations qnx4_dir_operations;
  106. extern int qnx4_is_free(struct super_block *sb, long block);
  107. extern int qnx4_set_bitmap(struct super_block *sb, long block, int busy);
  108. extern int qnx4_create(struct inode *inode, struct dentry *dentry, int mode, struct nameidata *nd);
  109. extern void qnx4_truncate(struct inode *inode);
  110. extern void qnx4_free_inode(struct inode *inode);
  111. extern int qnx4_unlink(struct inode *dir, struct dentry *dentry);
  112. extern int qnx4_rmdir(struct inode *dir, struct dentry *dentry);
  113. extern int qnx4_sync_file(struct file *file, struct dentry *dentry, int);
  114. extern int qnx4_sync_inode(struct inode *inode);
  115. static inline struct qnx4_sb_info *qnx4_sb(struct super_block *sb)
  116. {
  117. return sb->s_fs_info;
  118. }
  119. static inline struct qnx4_inode_info *qnx4_i(struct inode *inode)
  120. {
  121. return container_of(inode, struct qnx4_inode_info, vfs_inode);
  122. }
  123. static inline struct qnx4_inode_entry *qnx4_raw_inode(struct inode *inode)
  124. {
  125. return &qnx4_i(inode)->raw;
  126. }
  127. #endif /* __KERNEL__ */
  128. #endif