aboutsummaryrefslogtreecommitdiffstats
path: root/fs/libfs.c
diff options
context:
space:
mode:
authorStephen Boyd <sboyd@codeaurora.org>2012-04-05 17:25:09 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-04-05 18:25:50 -0400
commit20955e891d828b2027281fe3295dae6af8e0423b (patch)
tree551b8b4a3515f3b99e357e8cef5bc2e5d5051d50 /fs/libfs.c
parent7563ec4c211ba59c2331dc6b94a068250345c387 (diff)
libfs: add simple_open()
debugfs and a few other drivers use an open-coded version of simple_open() to pass a pointer from the file to the read/write file ops. Add support for this simple case to libfs so that we can remove the many duplicate copies of this simple function. Signed-off-by: Stephen Boyd <sboyd@codeaurora.org> Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/libfs.c')
-rw-r--r--fs/libfs.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/fs/libfs.c b/fs/libfs.c
index 4a0d1f06da57..358094f0433d 100644
--- a/fs/libfs.c
+++ b/fs/libfs.c
@@ -264,6 +264,13 @@ Enomem:
264 return ERR_PTR(-ENOMEM); 264 return ERR_PTR(-ENOMEM);
265} 265}
266 266
267int simple_open(struct inode *inode, struct file *file)
268{
269 if (inode->i_private)
270 file->private_data = inode->i_private;
271 return 0;
272}
273
267int simple_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry) 274int simple_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry)
268{ 275{
269 struct inode *inode = old_dentry->d_inode; 276 struct inode *inode = old_dentry->d_inode;
@@ -984,6 +991,7 @@ EXPORT_SYMBOL(simple_dir_operations);
984EXPORT_SYMBOL(simple_empty); 991EXPORT_SYMBOL(simple_empty);
985EXPORT_SYMBOL(simple_fill_super); 992EXPORT_SYMBOL(simple_fill_super);
986EXPORT_SYMBOL(simple_getattr); 993EXPORT_SYMBOL(simple_getattr);
994EXPORT_SYMBOL(simple_open);
987EXPORT_SYMBOL(simple_link); 995EXPORT_SYMBOL(simple_link);
988EXPORT_SYMBOL(simple_lookup); 996EXPORT_SYMBOL(simple_lookup);
989EXPORT_SYMBOL(simple_pin_fs); 997EXPORT_SYMBOL(simple_pin_fs);