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