2 * QNX4 file system, Linux implementation.
6 * Using parts of the xiafs filesystem.
10 * 28-05-1998 by Richard Frowijn : first release.
11 * 21-06-1998 by Frank Denis : ugly changes to make it compile on Linux 2.1.99+
14 /* THIS FILE HAS TO BE REWRITTEN */
16 #include <linux/errno.h>
17 #include <linux/sched.h>
19 #include <linux/qnx4_fs.h>
20 #include <linux/stat.h>
22 #include <asm/segment.h>
23 #include <asm/uaccess.h>
25 static int qnx4_readlink(struct dentry
*, char *, int);
26 static struct dentry
*qnx4_follow_link(struct dentry
*, struct dentry
*, unsigned int follow
);
29 * symlinks can't do much...
31 struct inode_operations qnx4_symlink_inode_operations
=
33 NULL
, /* no file-operations */
43 qnx4_readlink
, /* readlink */
44 qnx4_follow_link
, /* follow_link */
52 static struct dentry
*qnx4_follow_link(struct dentry
*dentry
,
53 struct dentry
*base
, unsigned int follow
)
56 struct inode
*inode
= dentry
->d_inode
;
57 struct buffer_head
*bh
;
60 return ERR_PTR(-ENOENT
);
62 if (current
->link_count
> 5) {
63 return ERR_PTR(-ELOOP
);
65 if (!(bh
= qnx4_bread(inode
, 0, 0))) {
68 current
->link_count
++;
69 current
->link_count
--;
73 printk("qnx4: qnx4_follow_link needs to be fixed.\n");
78 static int qnx4_readlink(struct dentry
*dentry
, char *buffer
, int buflen
)
80 struct inode
*inode
= dentry
->d_inode
;
81 struct buffer_head
*bh
;
84 struct qnx4_inode_info
*qnx4_ino
;
86 QNX4DEBUG(("qnx4: qnx4_readlink() called\n"));
88 if (buffer
== NULL
|| inode
== NULL
|| !S_ISLNK(inode
->i_mode
)) {
91 qnx4_ino
= &inode
->u
.qnx4_i
;
95 bh
= bread(inode
->i_dev
, qnx4_ino
->i_first_xtnt
.xtnt_blk
,
97 QNX4DEBUG(("qnx4: qnx4_bread sym called -> [%s]\n",
100 QNX4DEBUG(("qnx4: NULL symlink bh\n"));
103 if (bh
->b_data
[0] != 0) {
105 while (i
< buflen
&& (c
= bh
->b_data
[i
])) {
107 put_user(c
, buffer
++);
113 memcpy(buffer
, "fixme", 5);