aboutsummaryrefslogtreecommitdiffstats
path: root/fs/sysfs
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2013-11-28 14:54:19 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-11-29 20:35:05 -0500
commitc6fb449515f23edea828fb90a460d3622e261dba (patch)
tree033c7d86147c0773f06854e40f76feae8df3c22e /fs/sysfs
parentfdbffaa478fc77e999cbe2ac0dcfbf609103e675 (diff)
sysfs, kernfs: prepare open, release, poll paths for kernfs
We're in the process of separating out core sysfs functionality into kernfs which will deal with sysfs_dirents directly. This patch prepares the rest - open, release and poll. There isn't much to do. Just renaming is enough. As sysfs_file_operations and sysfs_bin_operations are identical now, use the same file_operations for both - kernfs_file_operations. This patch doesn't introduce any behavior changes. Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/sysfs')
-rw-r--r--fs/sysfs/file.c24
-rw-r--r--fs/sysfs/inode.c4
-rw-r--r--fs/sysfs/sysfs.h3
3 files changed, 10 insertions, 21 deletions
diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c
index 2e24e89bd92b..a43df04c81f9 100644
--- a/fs/sysfs/file.c
+++ b/fs/sysfs/file.c
@@ -668,7 +668,7 @@ static void sysfs_put_open_dirent(struct sysfs_dirent *sd,
668 kfree(od); 668 kfree(od);
669} 669}
670 670
671static int sysfs_open_file(struct inode *inode, struct file *file) 671static int kernfs_file_open(struct inode *inode, struct file *file)
672{ 672{
673 struct sysfs_dirent *attr_sd = file->f_path.dentry->d_fsdata; 673 struct sysfs_dirent *attr_sd = file->f_path.dentry->d_fsdata;
674 struct kobject *kobj = attr_sd->s_parent->priv; 674 struct kobject *kobj = attr_sd->s_parent->priv;
@@ -771,7 +771,7 @@ err_out:
771 return error; 771 return error;
772} 772}
773 773
774static int sysfs_release(struct inode *inode, struct file *filp) 774static int kernfs_file_release(struct inode *inode, struct file *filp)
775{ 775{
776 struct sysfs_dirent *sd = filp->f_path.dentry->d_fsdata; 776 struct sysfs_dirent *sd = filp->f_path.dentry->d_fsdata;
777 struct sysfs_open_file *of = sysfs_of(filp); 777 struct sysfs_open_file *of = sysfs_of(filp);
@@ -822,7 +822,7 @@ void sysfs_unmap_bin_file(struct sysfs_dirent *sd)
822 * to see if it supports poll (Neither 'poll' nor 'select' return 822 * to see if it supports poll (Neither 'poll' nor 'select' return
823 * an appropriate error code). When in doubt, set a suitable timeout value. 823 * an appropriate error code). When in doubt, set a suitable timeout value.
824 */ 824 */
825static unsigned int sysfs_poll(struct file *filp, poll_table *wait) 825static unsigned int kernfs_file_poll(struct file *filp, poll_table *wait)
826{ 826{
827 struct sysfs_open_file *of = sysfs_of(filp); 827 struct sysfs_open_file *of = sysfs_of(filp);
828 struct sysfs_dirent *attr_sd = filp->f_path.dentry->d_fsdata; 828 struct sysfs_dirent *attr_sd = filp->f_path.dentry->d_fsdata;
@@ -881,24 +881,14 @@ void sysfs_notify(struct kobject *k, const char *dir, const char *attr)
881} 881}
882EXPORT_SYMBOL_GPL(sysfs_notify); 882EXPORT_SYMBOL_GPL(sysfs_notify);
883 883
884const struct file_operations sysfs_file_operations = { 884const struct file_operations kernfs_file_operations = {
885 .read = kernfs_file_read, 885 .read = kernfs_file_read,
886 .write = kernfs_file_write, 886 .write = kernfs_file_write,
887 .llseek = generic_file_llseek, 887 .llseek = generic_file_llseek,
888 .mmap = kernfs_file_mmap, 888 .mmap = kernfs_file_mmap,
889 .open = sysfs_open_file, 889 .open = kernfs_file_open,
890 .release = sysfs_release, 890 .release = kernfs_file_release,
891 .poll = sysfs_poll, 891 .poll = kernfs_file_poll,
892};
893
894const struct file_operations sysfs_bin_operations = {
895 .read = kernfs_file_read,
896 .write = kernfs_file_write,
897 .llseek = generic_file_llseek,
898 .mmap = kernfs_file_mmap,
899 .open = sysfs_open_file,
900 .release = sysfs_release,
901 .poll = sysfs_poll,
902}; 892};
903 893
904int sysfs_add_file_mode_ns(struct sysfs_dirent *dir_sd, 894int sysfs_add_file_mode_ns(struct sysfs_dirent *dir_sd,
diff --git a/fs/sysfs/inode.c b/fs/sysfs/inode.c
index 81cc8585b32c..4c463dabfc6a 100644
--- a/fs/sysfs/inode.c
+++ b/fs/sysfs/inode.c
@@ -272,12 +272,12 @@ static void sysfs_init_inode(struct sysfs_dirent *sd, struct inode *inode)
272 break; 272 break;
273 case SYSFS_KOBJ_ATTR: 273 case SYSFS_KOBJ_ATTR:
274 inode->i_size = PAGE_SIZE; 274 inode->i_size = PAGE_SIZE;
275 inode->i_fop = &sysfs_file_operations; 275 inode->i_fop = &kernfs_file_operations;
276 break; 276 break;
277 case SYSFS_KOBJ_BIN_ATTR: 277 case SYSFS_KOBJ_BIN_ATTR:
278 bin_attr = sd->priv; 278 bin_attr = sd->priv;
279 inode->i_size = bin_attr->size; 279 inode->i_size = bin_attr->size;
280 inode->i_fop = &sysfs_bin_operations; 280 inode->i_fop = &kernfs_file_operations;
281 break; 281 break;
282 case SYSFS_KOBJ_LINK: 282 case SYSFS_KOBJ_LINK:
283 inode->i_op = &sysfs_symlink_inode_operations; 283 inode->i_op = &sysfs_symlink_inode_operations;
diff --git a/fs/sysfs/sysfs.h b/fs/sysfs/sysfs.h
index 9ac234ef4943..619250d2d7c1 100644
--- a/fs/sysfs/sysfs.h
+++ b/fs/sysfs/sysfs.h
@@ -212,8 +212,7 @@ int sysfs_inode_init(void);
212/* 212/*
213 * file.c 213 * file.c
214 */ 214 */
215extern const struct file_operations sysfs_file_operations; 215extern const struct file_operations kernfs_file_operations;
216extern const struct file_operations sysfs_bin_operations;
217 216
218int sysfs_add_file(struct sysfs_dirent *dir_sd, 217int sysfs_add_file(struct sysfs_dirent *dir_sd,
219 const struct attribute *attr, int type); 218 const struct attribute *attr, int type);