Skip to contentSkip to conversation

(2/9) symlink patchkit (against -bk current)

PATCH New [email protected] 1 participant 1 message Jun 22, 2004

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 (2/9) symlink patchkit (against -bk current)

ext2 conversion (helper functions for that one will be actually
used a lot by other filesystems, so to fs/namei.c they go)

fs/ext2/symlink.c +7 -11
diff -urN RC7-bk5-core/fs/ext2/symlink.c RC7-bk5-ext2/fs/ext2/symlink.c
@@ -19,23 +19,19 @@
 
 #include "ext2.h"
 #include "xattr.h"
-
-static int
-ext2_readlink(struct dentry *dentry, char __user *buffer, int buflen)
-{
-	struct ext2_inode_info *ei = EXT2_I(dentry->d_inode);
-	return vfs_readlink(dentry, buffer, buflen, (char *)ei->i_data);
-}
+#include <linux/namei.h>
 
 static int ext2_follow_link(struct dentry *dentry, struct nameidata *nd)
 {
 	struct ext2_inode_info *ei = EXT2_I(dentry->d_inode);
-	return vfs_follow_link(nd, (char *)ei->i_data);
+	nd_set_link(nd, (char *)ei->i_data);
+	return 0;
 }
 
 struct inode_operations ext2_symlink_inode_operations = {
-	.readlink	= page_readlink,
-	.follow_link	= page_follow_link,
+	.readlink	= generic_readlink,
+	.follow_link	= page_follow_link_light,
+	.put_link	= page_put_link,
 	.setxattr	= ext2_setxattr,
 	.getxattr	= ext2_getxattr,
 	.listxattr	= ext2_listxattr,
@@ -43,7 +39,7 @@
 };
  
 struct inode_operations ext2_fast_symlink_inode_operations = {
-	.readlink	= ext2_readlink,
+	.readlink	= generic_readlink,
 	.follow_link	= ext2_follow_link,
 	.setxattr	= ext2_setxattr,
 	.getxattr	= ext2_getxattr,
fs/namei.c +47 -2

76 lines not on this page · raw message

include/linux/fs.h +3 -0
diff -urN RC7-bk5-core/include/linux/fs.h RC7-bk5-ext2/include/linux/fs.h
@@ -1468,8 +1468,11 @@
 extern int vfs_follow_link(struct nameidata *, const char *);
 extern int page_readlink(struct dentry *, char __user *, int);
 extern int page_follow_link(struct dentry *, struct nameidata *);
+extern int page_follow_link_light(struct dentry *, struct nameidata *);
+extern void page_put_link(struct dentry *, struct nameidata *);
 extern int page_symlink(struct inode *inode, const char *symname, int len);
 extern struct inode_operations page_symlink_inode_operations;
+extern int generic_readlink(struct dentry *, char __user *, int);
 extern void generic_fillattr(struct inode *, struct kstat *);
 extern int vfs_getattr(struct vfsmount *, struct dentry *, struct kstat *);
 void inode_add_bytes(struct inode *inode, loff_t bytes);