mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-26 13:44:15 +08:00
ext2: use simple_follow_link()
Reviewed-by: Jan Kara <jack@suse.cz> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
61ba64fc07
commit
cbe0fa3858
@ -1403,6 +1403,7 @@ struct inode *ext2_iget (struct super_block *sb, unsigned long ino)
|
||||
inode->i_mapping->a_ops = &ext2_aops;
|
||||
} else if (S_ISLNK(inode->i_mode)) {
|
||||
if (ext2_inode_is_fast_symlink(inode)) {
|
||||
inode->i_link = (char *)ei->i_data;
|
||||
inode->i_op = &ext2_fast_symlink_inode_operations;
|
||||
nd_terminate_link(ei->i_data, inode->i_size,
|
||||
sizeof(ei->i_data) - 1);
|
||||
|
@ -189,7 +189,8 @@ static int ext2_symlink (struct inode * dir, struct dentry * dentry,
|
||||
} else {
|
||||
/* fast symlink */
|
||||
inode->i_op = &ext2_fast_symlink_inode_operations;
|
||||
memcpy((char*)(EXT2_I(inode)->i_data),symname,l);
|
||||
inode->i_link = (char*)EXT2_I(inode)->i_data;
|
||||
memcpy(inode->i_link, symname, l);
|
||||
inode->i_size = l-1;
|
||||
}
|
||||
mark_inode_dirty(inode);
|
||||
|
@ -19,14 +19,6 @@
|
||||
|
||||
#include "ext2.h"
|
||||
#include "xattr.h"
|
||||
#include <linux/namei.h>
|
||||
|
||||
static void *ext2_follow_link(struct dentry *dentry, struct nameidata *nd)
|
||||
{
|
||||
struct ext2_inode_info *ei = EXT2_I(d_inode(dentry));
|
||||
nd_set_link(nd, (char *)ei->i_data);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const struct inode_operations ext2_symlink_inode_operations = {
|
||||
.readlink = generic_readlink,
|
||||
@ -43,7 +35,7 @@ const struct inode_operations ext2_symlink_inode_operations = {
|
||||
|
||||
const struct inode_operations ext2_fast_symlink_inode_operations = {
|
||||
.readlink = generic_readlink,
|
||||
.follow_link = ext2_follow_link,
|
||||
.follow_link = simple_follow_link,
|
||||
.setattr = ext2_setattr,
|
||||
#ifdef CONFIG_EXT2_FS_XATTR
|
||||
.setxattr = generic_setxattr,
|
||||
|
Loading…
Reference in New Issue
Block a user