ufs: switch to simple_follow_link()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
Al Viro 2015-05-02 10:28:56 -04:00
parent 5723cb01f0
commit 4b8061a67f
3 changed files with 6 additions and 15 deletions

View File

@ -572,9 +572,10 @@ static void ufs_set_inode_ops(struct inode *inode)
inode->i_fop = &ufs_dir_operations;
inode->i_mapping->a_ops = &ufs_aops;
} else if (S_ISLNK(inode->i_mode)) {
if (!inode->i_blocks)
if (!inode->i_blocks) {
inode->i_op = &ufs_fast_symlink_inode_operations;
else {
inode->i_link = (char *)UFS_I(inode)->i_u1.i_symlink;
} else {
inode->i_op = &ufs_symlink_inode_operations;
inode->i_mapping->a_ops = &ufs_aops;
}

View File

@ -144,7 +144,8 @@ static int ufs_symlink (struct inode * dir, struct dentry * dentry,
} else {
/* fast symlink */
inode->i_op = &ufs_fast_symlink_inode_operations;
memcpy(UFS_I(inode)->i_u1.i_symlink, symname, l);
inode->i_link = (char *)UFS_I(inode)->i_u1.i_symlink;
memcpy(inode->i_link, symname, l);
inode->i_size = l-1;
}
mark_inode_dirty(inode);

View File

@ -25,23 +25,12 @@
* ext2 symlink handling code
*/
#include <linux/fs.h>
#include <linux/namei.h>
#include "ufs_fs.h"
#include "ufs.h"
static void *ufs_follow_link(struct dentry *dentry, struct nameidata *nd)
{
struct ufs_inode_info *p = UFS_I(d_inode(dentry));
nd_set_link(nd, (char*)p->i_u1.i_symlink);
return NULL;
}
const struct inode_operations ufs_fast_symlink_inode_operations = {
.readlink = generic_readlink,
.follow_link = ufs_follow_link,
.follow_link = simple_follow_link,
.setattr = ufs_setattr,
};