From: Christoph Hellwig <hch@lst.de>
To: xfs@oss.sgi.com
Subject: [PATCH 3/4] xfs: use ->readlink to implement the readlink_by_handle ioctl
Date: Wed, 23 Mar 2016 14:48:54 +0100 [thread overview]
Message-ID: <1458740935-31260-4-git-send-email-hch@lst.de> (raw)
In-Reply-To: <1458740935-31260-1-git-send-email-hch@lst.de>
Also drop the now unused readlink_copy export.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
fs/namei.c | 1 -
fs/xfs/xfs_ioctl.c | 18 ++----------------
2 files changed, 2 insertions(+), 17 deletions(-)
diff --git a/fs/namei.c b/fs/namei.c
index f624d13..33b02dd 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -4554,7 +4554,6 @@ int readlink_copy(char __user *buffer, int buflen, const char *link)
out:
return len;
}
-EXPORT_SYMBOL(readlink_copy);
/*
* A helper for ->readlink(). This should be used *ONLY* for symlinks that
diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c
index bcb6c19..68569b8 100644
--- a/fs/xfs/xfs_ioctl.c
+++ b/fs/xfs/xfs_ioctl.c
@@ -277,7 +277,6 @@ xfs_readlink_by_handle(
{
struct dentry *dentry;
__u32 olen;
- void *link;
int error;
if (!capable(CAP_SYS_ADMIN))
@@ -288,7 +287,7 @@ xfs_readlink_by_handle(
return PTR_ERR(dentry);
/* Restrict this handle operation to symlinks only. */
- if (!d_is_symlink(dentry)) {
+ if (!dentry->d_inode->i_op->readlink) {
error = -EINVAL;
goto out_dput;
}
@@ -298,21 +297,8 @@ xfs_readlink_by_handle(
goto out_dput;
}
- link = kmalloc(MAXPATHLEN+1, GFP_KERNEL);
- if (!link) {
- error = -ENOMEM;
- goto out_dput;
- }
-
- error = xfs_readlink(XFS_I(d_inode(dentry)), link);
- if (error)
- goto out_kfree;
- error = readlink_copy(hreq->ohandle, olen, link);
- if (error)
- goto out_kfree;
+ error = dentry->d_inode->i_op->readlink(dentry, hreq->ohandle, olen);
- out_kfree:
- kfree(link);
out_dput:
dput(dentry);
return error;
--
2.1.4
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2016-03-23 13:49 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-23 13:48 support RCU lookups for inline symlinks Christoph Hellwig
2016-03-23 13:48 ` [PATCH 1/4] xfs: factor out a helper to initialize a local format inode fork Christoph Hellwig
2016-03-23 13:48 ` [PATCH 2/4] xfs: set up inode operation vectors later Christoph Hellwig
2016-03-23 23:05 ` Dave Chinner
2016-03-23 23:26 ` Christoph Hellwig
2016-03-23 23:45 ` Dave Chinner
2016-03-23 13:48 ` Christoph Hellwig [this message]
2016-03-23 13:48 ` [PATCH 4/4] xfs: optimize inline symlinks Christoph Hellwig
2016-04-05 21:55 ` support RCU lookups for " Dave Chinner
2016-04-07 23:21 ` Christoph Hellwig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1458740935-31260-4-git-send-email-hch@lst.de \
--to=hch@lst.de \
--cc=xfs@oss.sgi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox