[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1273679444-14903-6-git-send-email-aneesh.kumar@linux.vnet.ibm.com>
Date: Wed, 12 May 2010 21:20:40 +0530
From: "Aneesh Kumar K.V" <aneesh.kumar@...ux.vnet.ibm.com>
To: hch@...radead.org, viro@...iv.linux.org.uk, adilger@....com,
corbet@....net, serue@...ibm.com, neilb@...e.de
Cc: linux-fsdevel@...r.kernel.org, sfrench@...ibm.com,
philippe.deniel@....FR, linux-kernel@...r.kernel.org,
"Aneesh Kumar K.V" <aneesh.kumar@...ux.vnet.ibm.com>
Subject: [PATCH -V7 5/9] vfs: Add freadlink syscall
This enables to use open-by-handle and then get the link target
details of a symlink using the fd returned by handle
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@...ux.vnet.ibm.com>
---
fs/stat.c | 27 +++++++++++++++++++++++++++
1 files changed, 27 insertions(+), 0 deletions(-)
diff --git a/fs/stat.c b/fs/stat.c
index c4ecd52..0fbab00 100644
--- a/fs/stat.c
+++ b/fs/stat.c
@@ -314,6 +314,33 @@ SYSCALL_DEFINE3(readlink, const char __user *, path, char __user *, buf,
return sys_readlinkat(AT_FDCWD, path, buf, bufsiz);
}
+SYSCALL_DEFINE3(freadlink, int, fd, char __user *, buf,
+ int, bufsiz)
+{
+ int fput_needed;
+ struct file *file;
+ int error = -EBADF;
+ struct inode *inode;
+
+ file = fget_light(fd, &fput_needed);
+ if (!file)
+ return error;
+
+ inode = file->f_path.dentry->d_inode;
+ error = -EINVAL;
+ if (inode->i_op->readlink) {
+ error = security_inode_readlink(file->f_path.dentry);
+ if (!error) {
+ touch_atime(file->f_path.mnt, file->f_path.dentry);
+ error = inode->i_op->readlink(file->f_path.dentry,
+ buf, bufsiz);
+ }
+ }
+ fput_light(file, fput_needed);
+ return error;
+}
+
+
/* ---------- LFS-64 ----------- */
#ifdef __ARCH_WANT_STAT64
--
1.7.1.78.g212f0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists