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