summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2013-11-28 14:54:19 -0500
committerPawel Osmialowski <p.osmialowsk@mcdsrvbld02.digital.local>2015-03-27 14:37:27 +0100
commitf1fe8ab7263237fbcc89b3bbd072385dc6947382 (patch)
tree06c518c7f132b5e14c12e73e06543de3ee79861e
parent34f6ed6a83faefbeefedc376f9cf1226d8cc2332 (diff)
downloadlinux-3.10-f1fe8ab7263237fbcc89b3bbd072385dc6947382.tar.gz
linux-3.10-f1fe8ab7263237fbcc89b3bbd072385dc6947382.tar.bz2
linux-3.10-f1fe8ab7263237fbcc89b3bbd072385dc6947382.zip
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>
-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 1e4d28740e3..68cd32b57af 100644
--- a/fs/sysfs/file.c
+++ b/fs/sysfs/file.c
@@ -669,7 +669,7 @@ static void sysfs_put_open_dirent(struct sysfs_dirent *sd,
kfree(od);
}
-static int sysfs_open_file(struct inode *inode, struct file *file)
+static int kernfs_file_open(struct inode *inode, struct file *file)
{
struct sysfs_dirent *attr_sd = file->f_path.dentry->d_fsdata;
struct kobject *kobj = attr_sd->s_parent->priv;
@@ -754,7 +754,7 @@ err_out:
return error;
}
-static int sysfs_release(struct inode *inode, struct file *filp)
+static int kernfs_file_release(struct inode *inode, struct file *filp)
{
struct sysfs_dirent *sd = filp->f_path.dentry->d_fsdata;
struct sysfs_open_file *of = sysfs_of(filp);
@@ -805,7 +805,7 @@ void sysfs_unmap_bin_file(struct sysfs_dirent *sd)
* to see if it supports poll (Neither 'poll' nor 'select' return
* an appropriate error code). When in doubt, set a suitable timeout value.
*/
-static unsigned int sysfs_poll(struct file *filp, poll_table *wait)
+static unsigned int kernfs_file_poll(struct file *filp, poll_table *wait)
{
struct sysfs_open_file *of = sysfs_of(filp);
struct sysfs_dirent *attr_sd = filp->f_path.dentry->d_fsdata;
@@ -864,24 +864,14 @@ void sysfs_notify(struct kobject *k, const char *dir, const char *attr)
}
EXPORT_SYMBOL_GPL(sysfs_notify);
-const struct file_operations sysfs_file_operations = {
+const struct file_operations kernfs_file_operations = {
.read = kernfs_file_read,
.write = kernfs_file_write,
.llseek = generic_file_llseek,
.mmap = kernfs_file_mmap,
- .open = sysfs_open_file,
- .release = sysfs_release,
- .poll = sysfs_poll,
-};
-
-const struct file_operations sysfs_bin_operations = {
- .read = kernfs_file_read,
- .write = kernfs_file_write,
- .llseek = generic_file_llseek,
- .mmap = kernfs_file_mmap,
- .open = sysfs_open_file,
- .release = sysfs_release,
- .poll = sysfs_poll,
+ .open = kernfs_file_open,
+ .release = kernfs_file_release,
+ .poll = kernfs_file_poll,
};
int sysfs_add_file_mode_ns(struct sysfs_dirent *dir_sd,
diff --git a/fs/sysfs/inode.c b/fs/sysfs/inode.c
index 81cc8585b32..4c463dabfc6 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)
break;
case SYSFS_KOBJ_ATTR:
inode->i_size = PAGE_SIZE;
- inode->i_fop = &sysfs_file_operations;
+ inode->i_fop = &kernfs_file_operations;
break;
case SYSFS_KOBJ_BIN_ATTR:
bin_attr = sd->priv;
inode->i_size = bin_attr->size;
- inode->i_fop = &sysfs_bin_operations;
+ inode->i_fop = &kernfs_file_operations;
break;
case SYSFS_KOBJ_LINK:
inode->i_op = &sysfs_symlink_inode_operations;
diff --git a/fs/sysfs/sysfs.h b/fs/sysfs/sysfs.h
index 8e580c19008..0021a32002f 100644
--- a/fs/sysfs/sysfs.h
+++ b/fs/sysfs/sysfs.h
@@ -211,8 +211,7 @@ int sysfs_inode_init(void);
/*
* file.c
*/
-extern const struct file_operations sysfs_file_operations;
-extern const struct file_operations sysfs_bin_operations;
+extern const struct file_operations kernfs_file_operations;
int sysfs_add_file(struct sysfs_dirent *dir_sd,
const struct attribute *attr, int type);