qnx6.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. /*
  2. * QNX6 file system, Linux implementation.
  3. *
  4. * Version : 1.0.0
  5. *
  6. * History :
  7. *
  8. * 01-02-2012 by Kai Bankett (chaosman@ontika.net) : first release.
  9. * 16-02-2012 page map extension by Al Viro
  10. *
  11. */
  12. #ifdef pr_fmt
  13. #undef pr_fmt
  14. #endif
  15. #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
  16. #include <linux/fs.h>
  17. #include <linux/pagemap.h>
  18. typedef __u16 __bitwise __fs16;
  19. typedef __u32 __bitwise __fs32;
  20. typedef __u64 __bitwise __fs64;
  21. #include <linux/qnx6_fs.h>
  22. struct qnx6_sb_info {
  23. struct buffer_head *sb_buf; /* superblock buffer */
  24. struct qnx6_super_block *sb; /* our superblock */
  25. int s_blks_off; /* blkoffset fs-startpoint */
  26. int s_ptrbits; /* indirect pointer bitfield */
  27. unsigned long s_mount_opt; /* all mount options */
  28. int s_bytesex; /* holds endianess info */
  29. struct inode * inodes;
  30. struct inode * longfile;
  31. };
  32. struct qnx6_inode_info {
  33. __fs32 di_block_ptr[QNX6_NO_DIRECT_POINTERS];
  34. __u8 di_filelevels;
  35. __u32 i_dir_start_lookup;
  36. struct inode vfs_inode;
  37. };
  38. extern struct inode *qnx6_iget(struct super_block *sb, unsigned ino);
  39. extern struct dentry *qnx6_lookup(struct inode *dir, struct dentry *dentry,
  40. unsigned int flags);
  41. #ifdef CONFIG_QNX6FS_DEBUG
  42. extern void qnx6_superblock_debug(struct qnx6_super_block *,
  43. struct super_block *);
  44. #endif
  45. extern const struct inode_operations qnx6_dir_inode_operations;
  46. extern const struct file_operations qnx6_dir_operations;
  47. static inline struct qnx6_sb_info *QNX6_SB(struct super_block *sb)
  48. {
  49. return sb->s_fs_info;
  50. }
  51. static inline struct qnx6_inode_info *QNX6_I(struct inode *inode)
  52. {
  53. return container_of(inode, struct qnx6_inode_info, vfs_inode);
  54. }
  55. #define clear_opt(o, opt) (o &= ~(QNX6_MOUNT_##opt))
  56. #define set_opt(o, opt) (o |= (QNX6_MOUNT_##opt))
  57. #define test_opt(sb, opt) (QNX6_SB(sb)->s_mount_opt & \
  58. QNX6_MOUNT_##opt)
  59. enum {
  60. BYTESEX_LE,
  61. BYTESEX_BE,
  62. };
  63. static inline __u64 fs64_to_cpu(struct qnx6_sb_info *sbi, __fs64 n)
  64. {
  65. if (sbi->s_bytesex == BYTESEX_LE)
  66. return le64_to_cpu((__force __le64)n);
  67. else
  68. return be64_to_cpu((__force __be64)n);
  69. }
  70. static inline __fs64 cpu_to_fs64(struct qnx6_sb_info *sbi, __u64 n)
  71. {
  72. if (sbi->s_bytesex == BYTESEX_LE)
  73. return (__force __fs64)cpu_to_le64(n);
  74. else
  75. return (__force __fs64)cpu_to_be64(n);
  76. }
  77. static inline __u32 fs32_to_cpu(struct qnx6_sb_info *sbi, __fs32 n)
  78. {
  79. if (sbi->s_bytesex == BYTESEX_LE)
  80. return le32_to_cpu((__force __le32)n);
  81. else
  82. return be32_to_cpu((__force __be32)n);
  83. }
  84. static inline __fs32 cpu_to_fs32(struct qnx6_sb_info *sbi, __u32 n)
  85. {
  86. if (sbi->s_bytesex == BYTESEX_LE)
  87. return (__force __fs32)cpu_to_le32(n);
  88. else
  89. return (__force __fs32)cpu_to_be32(n);
  90. }
  91. static inline __u16 fs16_to_cpu(struct qnx6_sb_info *sbi, __fs16 n)
  92. {
  93. if (sbi->s_bytesex == BYTESEX_LE)
  94. return le16_to_cpu((__force __le16)n);
  95. else
  96. return be16_to_cpu((__force __be16)n);
  97. }
  98. static inline __fs16 cpu_to_fs16(struct qnx6_sb_info *sbi, __u16 n)
  99. {
  100. if (sbi->s_bytesex == BYTESEX_LE)
  101. return (__force __fs16)cpu_to_le16(n);
  102. else
  103. return (__force __fs16)cpu_to_be16(n);
  104. }
  105. extern struct qnx6_super_block *qnx6_mmi_fill_super(struct super_block *s,
  106. int silent);
  107. static inline void qnx6_put_page(struct page *page)
  108. {
  109. kunmap(page);
  110. page_cache_release(page);
  111. }
  112. extern unsigned qnx6_find_entry(int len, struct inode *dir, const char *name,
  113. struct page **res_page);