patch-2.1.45 linux/fs/minix/symlink.c

Next file: linux/fs/minix/truncate.c
Previous file: linux/fs/minix/namei.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.44/linux/fs/minix/symlink.c linux/fs/minix/symlink.c
@@ -15,6 +15,7 @@
 #include <asm/uaccess.h>
 
 static int minix_readlink(struct inode *, char *, int);
+static struct dentry *minix_follow_link(struct inode *, struct dentry *);
 
 /*
  * symlinks can't do much...
@@ -31,6 +32,7 @@
 	NULL,			/* mknod */
 	NULL,			/* rename */
 	minix_readlink,		/* readlink */
+	minix_follow_link,	/* follow_link */
 	NULL,			/* readpage */
 	NULL,			/* writepage */
 	NULL,			/* bmap */
@@ -38,6 +40,21 @@
 	NULL			/* permission */
 };
 
+static struct dentry * minix_follow_link(struct inode * inode, struct dentry * base)
+{
+	struct buffer_head * bh;
+
+	bh = minix_bread(inode, 0, 0);
+	if (!bh) {
+		dput(base);
+		return ERR_PTR(-EIO);
+	}
+	UPDATE_ATIME(inode);
+	base = lookup_dentry(bh->b_data, base, 1);
+	brelse(bh);
+	return base;
+}
+
 static int minix_readlink(struct inode * inode, char * buffer, int buflen)
 {
 	struct buffer_head * bh;
@@ -47,7 +64,6 @@
 	if (buflen > 1023)
 		buflen = 1023;
 	bh = minix_bread(inode, 0, 0);
-	iput(inode);
 	if (!bh)
 		return 0;
 	i = 0;

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov