2 * QNX4 file system, Linux implementation.
6 * Using parts of the xiafs filesystem.
10 * 28-05-1998 by Richard Frowijn : first release.
11 * 20-06-1998 by Frank Denis : Linux 2.1.99+ & dcache support.
14 #include <linux/config.h>
15 #include <linux/string.h>
16 #include <linux/errno.h>
18 #include <linux/qnx4_fs.h>
19 #include <linux/stat.h>
21 #include <asm/segment.h>
23 static int qnx4_readdir(struct file
*filp
, void *dirent
, filldir_t filldir
);
25 static int qnx4_readdir(struct file
*filp
, void *dirent
, filldir_t filldir
)
27 struct inode
*inode
= filp
->f_dentry
->d_inode
;
29 struct buffer_head
*bh
;
30 struct qnx4_inode_entry
*de
;
35 blknum
= inode
->u
.qnx4_i
.i_first_xtnt
.xtnt_blk
- 1 +
36 ((filp
->f_pos
>> 6) >> 3);
38 QNX4DEBUG(("qnx4_readdir:i_size = %ld\n", (long) inode
->i_size
));
39 QNX4DEBUG(("filp->f_pos = %ld\n", (long) filp
->f_pos
));
40 QNX4DEBUG(("BlkNum = %ld\n", (long) blknum
));
42 while (filp
->f_pos
< inode
->i_size
) {
43 bh
= bread(inode
->i_dev
, blknum
, QNX4_BLOCK_SIZE
);
46 printk(KERN_ERR
"qnx4_readdir: bread failed (%ld)\n", blknum
);
49 i
= (filp
->f_pos
- (((filp
->f_pos
>> 6) >> 3) << 9)) & 0x3f;
50 while (i
< QNX4_INODES_PER_BLOCK
) {
51 offset
= i
* QNX4_DIR_ENTRY_SIZE
;
52 de
= (struct qnx4_inode_entry
*) (bh
->b_data
+ offset
);
53 size
= strlen(de
->di_fname
);
56 QNX4DEBUG(("qnx4_readdir:%s\n", de
->di_fname
));
58 if ((de
->di_mode
) || (de
->di_status
== QNX4_FILE_LINK
)) {
60 if (filldir(dirent
, de
->di_fname
, size
, filp
->f_pos
, de
->di_first_xtnt
.xtnt_blk
) < 0) {
68 filp
->f_pos
+= QNX4_DIR_ENTRY_SIZE
;
78 static struct file_operations qnx4_dir_operations
=
80 NULL
, /* lseek - default */
82 NULL
, /* write - bad */
83 qnx4_readdir
, /* readdir */
84 NULL
, /* poll - default */
85 NULL
, /* ioctl - default */
87 NULL
, /* no special open code */
88 NULL
, /* no special flush code */
89 NULL
, /* no special release code */
90 file_fsync
, /* default fsync */
91 NULL
, /* default fasync */
92 NULL
, /* default check_media_change */
93 NULL
, /* default revalidate */
96 struct inode_operations qnx4_dir_inode_operations
=
99 #ifdef CONFIG_QNX4FS_RW
106 #ifdef CONFIG_QNX4FS_RW
107 qnx4_unlink
, /* unlink */
113 #ifdef CONFIG_QNX4FS_RW
114 qnx4_rmdir
, /* rmdir */
121 NULL
, /* follow_link */
122 NULL
, /* get_block */
124 NULL
, /* writepage */
125 NULL
, /* flushpage */
127 NULL
, /* permission */
129 NULL
/* revalidate */