2 * QNX6 file system, Linux implementation.
8 * 01-02-2012 by Kai Bankett (chaosman@ontika.net) : first release.
9 * 16-02-2012 page map extension by Al Viro
17 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
20 #include <linux/pagemap.h>
22 typedef __u16 __bitwise __fs16
;
23 typedef __u32 __bitwise __fs32
;
24 typedef __u64 __bitwise __fs64
;
26 #include <linux/qnx6_fs.h>
29 struct buffer_head
*sb_buf
; /* superblock buffer */
30 struct qnx6_super_block
*sb
; /* our superblock */
31 int s_blks_off
; /* blkoffset fs-startpoint */
32 int s_ptrbits
; /* indirect pointer bitfield */
33 unsigned long s_mount_opt
; /* all mount options */
34 int s_bytesex
; /* holds endianess info */
35 struct inode
* inodes
;
36 struct inode
* longfile
;
39 struct qnx6_inode_info
{
40 __fs32 di_block_ptr
[QNX6_NO_DIRECT_POINTERS
];
42 __u32 i_dir_start_lookup
;
43 struct inode vfs_inode
;
46 extern struct inode
*qnx6_iget(struct super_block
*sb
, unsigned ino
);
47 extern struct dentry
*qnx6_lookup(struct inode
*dir
, struct dentry
*dentry
,
50 #ifdef CONFIG_QNX6FS_DEBUG
51 extern void qnx6_superblock_debug(struct qnx6_super_block
*,
52 struct super_block
*);
55 extern const struct inode_operations qnx6_dir_inode_operations
;
56 extern const struct file_operations qnx6_dir_operations
;
58 static inline struct qnx6_sb_info
*QNX6_SB(struct super_block
*sb
)
63 static inline struct qnx6_inode_info
*QNX6_I(struct inode
*inode
)
65 return container_of(inode
, struct qnx6_inode_info
, vfs_inode
);
68 #define clear_opt(o, opt) (o &= ~(QNX6_MOUNT_##opt))
69 #define set_opt(o, opt) (o |= (QNX6_MOUNT_##opt))
70 #define test_opt(sb, opt) (QNX6_SB(sb)->s_mount_opt & \
77 static inline __u64
fs64_to_cpu(struct qnx6_sb_info
*sbi
, __fs64 n
)
79 if (sbi
->s_bytesex
== BYTESEX_LE
)
80 return le64_to_cpu((__force __le64
)n
);
82 return be64_to_cpu((__force __be64
)n
);
85 static inline __fs64
cpu_to_fs64(struct qnx6_sb_info
*sbi
, __u64 n
)
87 if (sbi
->s_bytesex
== BYTESEX_LE
)
88 return (__force __fs64
)cpu_to_le64(n
);
90 return (__force __fs64
)cpu_to_be64(n
);
93 static inline __u32
fs32_to_cpu(struct qnx6_sb_info
*sbi
, __fs32 n
)
95 if (sbi
->s_bytesex
== BYTESEX_LE
)
96 return le32_to_cpu((__force __le32
)n
);
98 return be32_to_cpu((__force __be32
)n
);
101 static inline __fs32
cpu_to_fs32(struct qnx6_sb_info
*sbi
, __u32 n
)
103 if (sbi
->s_bytesex
== BYTESEX_LE
)
104 return (__force __fs32
)cpu_to_le32(n
);
106 return (__force __fs32
)cpu_to_be32(n
);
109 static inline __u16
fs16_to_cpu(struct qnx6_sb_info
*sbi
, __fs16 n
)
111 if (sbi
->s_bytesex
== BYTESEX_LE
)
112 return le16_to_cpu((__force __le16
)n
);
114 return be16_to_cpu((__force __be16
)n
);
117 static inline __fs16
cpu_to_fs16(struct qnx6_sb_info
*sbi
, __u16 n
)
119 if (sbi
->s_bytesex
== BYTESEX_LE
)
120 return (__force __fs16
)cpu_to_le16(n
);
122 return (__force __fs16
)cpu_to_be16(n
);
125 extern struct qnx6_super_block
*qnx6_mmi_fill_super(struct super_block
*s
,
128 static inline void qnx6_put_page(struct page
*page
)
134 extern unsigned qnx6_find_entry(int len
, struct inode
*dir
, const char *name
,
135 struct page
**res_page
);