Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  * QNX6 file system, Linux implementation.
0004  *
0005  * Version : 1.0.0
0006  *
0007  * History :
0008  *
0009  * 01-02-2012 by Kai Bankett (chaosman@ontika.net) : first release.
0010  * 16-02-2012 page map extension by Al Viro
0011  *
0012  */
0013 
0014 #ifdef pr_fmt
0015 #undef pr_fmt
0016 #endif
0017 
0018 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
0019 
0020 #include <linux/fs.h>
0021 #include <linux/pagemap.h>
0022 
0023 typedef __u16 __bitwise __fs16;
0024 typedef __u32 __bitwise __fs32;
0025 typedef __u64 __bitwise __fs64;
0026 
0027 #include <linux/qnx6_fs.h>
0028 
0029 struct qnx6_sb_info {
0030     struct buffer_head  *sb_buf;    /* superblock buffer */
0031     struct qnx6_super_block *sb;        /* our superblock */
0032     int         s_blks_off; /* blkoffset fs-startpoint */
0033     int         s_ptrbits;  /* indirect pointer bitfield */
0034     unsigned long       s_mount_opt;    /* all mount options */
0035     int         s_bytesex;  /* holds endianess info */
0036     struct inode *      inodes;
0037     struct inode *      longfile;
0038 };
0039 
0040 struct qnx6_inode_info {
0041     __fs32          di_block_ptr[QNX6_NO_DIRECT_POINTERS];
0042     __u8            di_filelevels;
0043     __u32           i_dir_start_lookup;
0044     struct inode        vfs_inode;
0045 };
0046 
0047 extern struct inode *qnx6_iget(struct super_block *sb, unsigned ino);
0048 extern struct dentry *qnx6_lookup(struct inode *dir, struct dentry *dentry,
0049                     unsigned int flags);
0050 
0051 #ifdef CONFIG_QNX6FS_DEBUG
0052 extern void qnx6_superblock_debug(struct qnx6_super_block *,
0053                         struct super_block *);
0054 #endif
0055 
0056 extern const struct inode_operations qnx6_dir_inode_operations;
0057 extern const struct file_operations qnx6_dir_operations;
0058 
0059 static inline struct qnx6_sb_info *QNX6_SB(struct super_block *sb)
0060 {
0061     return sb->s_fs_info;
0062 }
0063 
0064 static inline struct qnx6_inode_info *QNX6_I(struct inode *inode)
0065 {
0066     return container_of(inode, struct qnx6_inode_info, vfs_inode);
0067 }
0068 
0069 #define clear_opt(o, opt)       (o &= ~(QNX6_MOUNT_##opt))
0070 #define set_opt(o, opt)         (o |= (QNX6_MOUNT_##opt))
0071 #define test_opt(sb, opt)       (QNX6_SB(sb)->s_mount_opt & \
0072                      QNX6_MOUNT_##opt)
0073 enum {
0074     BYTESEX_LE,
0075     BYTESEX_BE,
0076 };
0077 
0078 static inline __u64 fs64_to_cpu(struct qnx6_sb_info *sbi, __fs64 n)
0079 {
0080     if (sbi->s_bytesex == BYTESEX_LE)
0081         return le64_to_cpu((__force __le64)n);
0082     else
0083         return be64_to_cpu((__force __be64)n);
0084 }
0085 
0086 static inline __fs64 cpu_to_fs64(struct qnx6_sb_info *sbi, __u64 n)
0087 {
0088     if (sbi->s_bytesex == BYTESEX_LE)
0089         return (__force __fs64)cpu_to_le64(n);
0090     else
0091         return (__force __fs64)cpu_to_be64(n);
0092 }
0093 
0094 static inline __u32 fs32_to_cpu(struct qnx6_sb_info *sbi, __fs32 n)
0095 {
0096     if (sbi->s_bytesex == BYTESEX_LE)
0097         return le32_to_cpu((__force __le32)n);
0098     else
0099         return be32_to_cpu((__force __be32)n);
0100 }
0101 
0102 static inline __fs32 cpu_to_fs32(struct qnx6_sb_info *sbi, __u32 n)
0103 {
0104     if (sbi->s_bytesex == BYTESEX_LE)
0105         return (__force __fs32)cpu_to_le32(n);
0106     else
0107         return (__force __fs32)cpu_to_be32(n);
0108 }
0109 
0110 static inline __u16 fs16_to_cpu(struct qnx6_sb_info *sbi, __fs16 n)
0111 {
0112     if (sbi->s_bytesex == BYTESEX_LE)
0113         return le16_to_cpu((__force __le16)n);
0114     else
0115         return be16_to_cpu((__force __be16)n);
0116 }
0117 
0118 static inline __fs16 cpu_to_fs16(struct qnx6_sb_info *sbi, __u16 n)
0119 {
0120     if (sbi->s_bytesex == BYTESEX_LE)
0121         return (__force __fs16)cpu_to_le16(n);
0122     else
0123         return (__force __fs16)cpu_to_be16(n);
0124 }
0125 
0126 extern struct qnx6_super_block *qnx6_mmi_fill_super(struct super_block *s,
0127                             int silent);
0128 
0129 static inline void qnx6_put_page(struct page *page)
0130 {
0131     kunmap(page);
0132     put_page(page);
0133 }
0134 
0135 extern unsigned qnx6_find_entry(int len, struct inode *dir, const char *name,
0136                 struct page **res_page);