diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2015-05-07 11:19:14 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2015-05-11 08:13:13 -0400 |
commit | ecc087ff14352aed52b8e775b4511e7f9cfc64ec (patch) | |
tree | 46a1845f647b8d59e28c49be683949a179b2ecdd | |
parent | 5f2c4179e129bdc47870a81a65d0aff85aa18293 (diff) |
new helper: free_page_put_link()
similar to kfree_put_link()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r-- | fs/configfs/symlink.c | 7 | ||||
-rw-r--r-- | fs/fuse/dir.c | 7 | ||||
-rw-r--r-- | fs/kernfs/symlink.c | 7 | ||||
-rw-r--r-- | fs/libfs.c | 6 | ||||
-rw-r--r-- | include/linux/fs.h | 1 |
5 files changed, 10 insertions, 18 deletions
diff --git a/fs/configfs/symlink.c b/fs/configfs/symlink.c index bc464c26e00e..ec5c8325b503 100644 --- a/fs/configfs/symlink.c +++ b/fs/configfs/symlink.c | |||
@@ -296,15 +296,10 @@ static const char *configfs_follow_link(struct dentry *dentry, void **cookie) | |||
296 | return ERR_PTR(error); | 296 | return ERR_PTR(error); |
297 | } | 297 | } |
298 | 298 | ||
299 | static void configfs_put_link(struct inode *unused, void *cookie) | ||
300 | { | ||
301 | free_page((unsigned long)cookie); | ||
302 | } | ||
303 | |||
304 | const struct inode_operations configfs_symlink_inode_operations = { | 299 | const struct inode_operations configfs_symlink_inode_operations = { |
305 | .follow_link = configfs_follow_link, | 300 | .follow_link = configfs_follow_link, |
306 | .readlink = generic_readlink, | 301 | .readlink = generic_readlink, |
307 | .put_link = configfs_put_link, | 302 | .put_link = free_page_put_link, |
308 | .setattr = configfs_setattr, | 303 | .setattr = configfs_setattr, |
309 | }; | 304 | }; |
310 | 305 | ||
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c index 9e704c124392..5e2e08712d3b 100644 --- a/fs/fuse/dir.c +++ b/fs/fuse/dir.c | |||
@@ -1395,11 +1395,6 @@ static const char *fuse_follow_link(struct dentry *dentry, void **cookie) | |||
1395 | return link; | 1395 | return link; |
1396 | } | 1396 | } |
1397 | 1397 | ||
1398 | static void fuse_put_link(struct inode *unused, void *cookie) | ||
1399 | { | ||
1400 | free_page((unsigned long) cookie); | ||
1401 | } | ||
1402 | |||
1403 | static int fuse_dir_open(struct inode *inode, struct file *file) | 1398 | static int fuse_dir_open(struct inode *inode, struct file *file) |
1404 | { | 1399 | { |
1405 | return fuse_open_common(inode, file, true); | 1400 | return fuse_open_common(inode, file, true); |
@@ -1915,7 +1910,7 @@ static const struct inode_operations fuse_common_inode_operations = { | |||
1915 | static const struct inode_operations fuse_symlink_inode_operations = { | 1910 | static const struct inode_operations fuse_symlink_inode_operations = { |
1916 | .setattr = fuse_setattr, | 1911 | .setattr = fuse_setattr, |
1917 | .follow_link = fuse_follow_link, | 1912 | .follow_link = fuse_follow_link, |
1918 | .put_link = fuse_put_link, | 1913 | .put_link = free_page_put_link, |
1919 | .readlink = generic_readlink, | 1914 | .readlink = generic_readlink, |
1920 | .getattr = fuse_getattr, | 1915 | .getattr = fuse_getattr, |
1921 | .setxattr = fuse_setxattr, | 1916 | .setxattr = fuse_setxattr, |
diff --git a/fs/kernfs/symlink.c b/fs/kernfs/symlink.c index f6aa2e5a76b4..db272528ab5b 100644 --- a/fs/kernfs/symlink.c +++ b/fs/kernfs/symlink.c | |||
@@ -126,11 +126,6 @@ static const char *kernfs_iop_follow_link(struct dentry *dentry, void **cookie) | |||
126 | return *cookie = (char *)page; | 126 | return *cookie = (char *)page; |
127 | } | 127 | } |
128 | 128 | ||
129 | static void kernfs_iop_put_link(struct inode *unused, void *cookie) | ||
130 | { | ||
131 | free_page((unsigned long)cookie); | ||
132 | } | ||
133 | |||
134 | const struct inode_operations kernfs_symlink_iops = { | 129 | const struct inode_operations kernfs_symlink_iops = { |
135 | .setxattr = kernfs_iop_setxattr, | 130 | .setxattr = kernfs_iop_setxattr, |
136 | .removexattr = kernfs_iop_removexattr, | 131 | .removexattr = kernfs_iop_removexattr, |
@@ -138,7 +133,7 @@ const struct inode_operations kernfs_symlink_iops = { | |||
138 | .listxattr = kernfs_iop_listxattr, | 133 | .listxattr = kernfs_iop_listxattr, |
139 | .readlink = generic_readlink, | 134 | .readlink = generic_readlink, |
140 | .follow_link = kernfs_iop_follow_link, | 135 | .follow_link = kernfs_iop_follow_link, |
141 | .put_link = kernfs_iop_put_link, | 136 | .put_link = free_page_put_link, |
142 | .setattr = kernfs_iop_setattr, | 137 | .setattr = kernfs_iop_setattr, |
143 | .getattr = kernfs_iop_getattr, | 138 | .getattr = kernfs_iop_getattr, |
144 | .permission = kernfs_iop_permission, | 139 | .permission = kernfs_iop_permission, |
diff --git a/fs/libfs.c b/fs/libfs.c index 01c337b0fec8..65e1feca8b98 100644 --- a/fs/libfs.c +++ b/fs/libfs.c | |||
@@ -1030,6 +1030,12 @@ void kfree_put_link(struct inode *unused, void *cookie) | |||
1030 | } | 1030 | } |
1031 | EXPORT_SYMBOL(kfree_put_link); | 1031 | EXPORT_SYMBOL(kfree_put_link); |
1032 | 1032 | ||
1033 | void free_page_put_link(struct inode *unused, void *cookie) | ||
1034 | { | ||
1035 | free_page((unsigned long) cookie); | ||
1036 | } | ||
1037 | EXPORT_SYMBOL(free_page_put_link); | ||
1038 | |||
1033 | /* | 1039 | /* |
1034 | * nop .set_page_dirty method so that people can use .page_mkwrite on | 1040 | * nop .set_page_dirty method so that people can use .page_mkwrite on |
1035 | * anon inodes. | 1041 | * anon inodes. |
diff --git a/include/linux/fs.h b/include/linux/fs.h index f21e3328f991..8f738512c874 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -2712,6 +2712,7 @@ extern int __page_symlink(struct inode *inode, const char *symname, int len, | |||
2712 | extern int page_symlink(struct inode *inode, const char *symname, int len); | 2712 | extern int page_symlink(struct inode *inode, const char *symname, int len); |
2713 | extern const struct inode_operations page_symlink_inode_operations; | 2713 | extern const struct inode_operations page_symlink_inode_operations; |
2714 | extern void kfree_put_link(struct inode *, void *); | 2714 | extern void kfree_put_link(struct inode *, void *); |
2715 | extern void free_page_put_link(struct inode *, void *); | ||
2715 | extern int generic_readlink(struct dentry *, char __user *, int); | 2716 | extern int generic_readlink(struct dentry *, char __user *, int); |
2716 | extern void generic_fillattr(struct inode *, struct kstat *); | 2717 | extern void generic_fillattr(struct inode *, struct kstat *); |
2717 | int vfs_getattr_nosec(struct path *path, struct kstat *stat); | 2718 | int vfs_getattr_nosec(struct path *path, struct kstat *stat); |