Commit c525aadd authored by Tejun Heo's avatar Tejun Heo Committed by Greg Kroah-Hartman

kernfs: s/sysfs/kernfs/ in various data structures

kernfs has just been separated out from sysfs and we're already in
full conflict mode.  Nothing can make the situation any worse.  Let's
take the chance to name things properly.

This patch performs the following renames.

* s/sysfs_open_dirent/kernfs_open_node/
* s/sysfs_open_file/kernfs_open_file/
* s/sysfs_inode_attrs/kernfs_iattrs/
* s/sysfs_addrm_cxt/kernfs_addrm_cxt/
* s/sysfs_super_info/kernfs_super_info/
* s/sysfs_info()/kernfs_info()/
* s/sysfs_open_dirent_lock/kernfs_open_node_lock/
* s/sysfs_open_file_mutex/kernfs_open_file_mutex/
* s/sysfs_of()/kernfs_of()/

This patch is strictly rename only and doesn't introduce any
functional difference.
Signed-off-by: default avatarTejun Heo <tj@kernel.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent adc5e8b5
...@@ -295,7 +295,7 @@ static int sysfs_dentry_revalidate(struct dentry *dentry, unsigned int flags) ...@@ -295,7 +295,7 @@ static int sysfs_dentry_revalidate(struct dentry *dentry, unsigned int flags)
/* The sysfs dirent has been moved to a different namespace */ /* The sysfs dirent has been moved to a different namespace */
if (kn->parent && kernfs_ns_enabled(kn->parent) && if (kn->parent && kernfs_ns_enabled(kn->parent) &&
sysfs_info(dentry->d_sb)->ns != kn->ns) kernfs_info(dentry->d_sb)->ns != kn->ns)
goto out_bad; goto out_bad;
mutex_unlock(&sysfs_mutex); mutex_unlock(&sysfs_mutex);
...@@ -375,7 +375,7 @@ struct kernfs_node *sysfs_new_dirent(struct kernfs_root *root, ...@@ -375,7 +375,7 @@ struct kernfs_node *sysfs_new_dirent(struct kernfs_root *root,
/** /**
* sysfs_addrm_start - prepare for kernfs_node add/remove * sysfs_addrm_start - prepare for kernfs_node add/remove
* @acxt: pointer to sysfs_addrm_cxt to be used * @acxt: pointer to kernfs_addrm_cxt to be used
* *
* This function is called when the caller is about to add or remove * This function is called when the caller is about to add or remove
* kernfs_node. This function acquires sysfs_mutex. @acxt is used to * kernfs_node. This function acquires sysfs_mutex. @acxt is used to
...@@ -385,7 +385,7 @@ struct kernfs_node *sysfs_new_dirent(struct kernfs_root *root, ...@@ -385,7 +385,7 @@ struct kernfs_node *sysfs_new_dirent(struct kernfs_root *root,
* Kernel thread context (may sleep). sysfs_mutex is locked on * Kernel thread context (may sleep). sysfs_mutex is locked on
* return. * return.
*/ */
void sysfs_addrm_start(struct sysfs_addrm_cxt *acxt) void sysfs_addrm_start(struct kernfs_addrm_cxt *acxt)
__acquires(sysfs_mutex) __acquires(sysfs_mutex)
{ {
memset(acxt, 0, sizeof(*acxt)); memset(acxt, 0, sizeof(*acxt));
...@@ -414,11 +414,11 @@ void sysfs_addrm_start(struct sysfs_addrm_cxt *acxt) ...@@ -414,11 +414,11 @@ void sysfs_addrm_start(struct sysfs_addrm_cxt *acxt)
* 0 on success, -EEXIST if entry with the given name already * 0 on success, -EEXIST if entry with the given name already
* exists. * exists.
*/ */
int sysfs_add_one(struct sysfs_addrm_cxt *acxt, struct kernfs_node *kn, int sysfs_add_one(struct kernfs_addrm_cxt *acxt, struct kernfs_node *kn,
struct kernfs_node *parent) struct kernfs_node *parent)
{ {
bool has_ns = kernfs_ns_enabled(parent); bool has_ns = kernfs_ns_enabled(parent);
struct sysfs_inode_attrs *ps_iattr; struct kernfs_iattrs *ps_iattr;
int ret; int ret;
if (has_ns != (bool)kn->ns) { if (has_ns != (bool)kn->ns) {
...@@ -466,10 +466,10 @@ int sysfs_add_one(struct sysfs_addrm_cxt *acxt, struct kernfs_node *kn, ...@@ -466,10 +466,10 @@ int sysfs_add_one(struct sysfs_addrm_cxt *acxt, struct kernfs_node *kn,
* LOCKING: * LOCKING:
* Determined by sysfs_addrm_start(). * Determined by sysfs_addrm_start().
*/ */
static void sysfs_remove_one(struct sysfs_addrm_cxt *acxt, static void sysfs_remove_one(struct kernfs_addrm_cxt *acxt,
struct kernfs_node *kn) struct kernfs_node *kn)
{ {
struct sysfs_inode_attrs *ps_iattr; struct kernfs_iattrs *ps_iattr;
/* /*
* Removal can be called multiple times on the same node. Only the * Removal can be called multiple times on the same node. Only the
...@@ -505,7 +505,7 @@ static void sysfs_remove_one(struct sysfs_addrm_cxt *acxt, ...@@ -505,7 +505,7 @@ static void sysfs_remove_one(struct sysfs_addrm_cxt *acxt,
* LOCKING: * LOCKING:
* sysfs_mutex is released. * sysfs_mutex is released.
*/ */
void sysfs_addrm_finish(struct sysfs_addrm_cxt *acxt) void sysfs_addrm_finish(struct kernfs_addrm_cxt *acxt)
__releases(sysfs_mutex) __releases(sysfs_mutex)
{ {
/* release resources acquired by sysfs_addrm_start() */ /* release resources acquired by sysfs_addrm_start() */
...@@ -649,7 +649,7 @@ struct kernfs_node *kernfs_create_dir_ns(struct kernfs_node *parent, ...@@ -649,7 +649,7 @@ struct kernfs_node *kernfs_create_dir_ns(struct kernfs_node *parent,
const void *ns) const void *ns)
{ {
umode_t mode = S_IFDIR | S_IRWXU | S_IRUGO | S_IXUGO; umode_t mode = S_IFDIR | S_IRWXU | S_IRUGO | S_IXUGO;
struct sysfs_addrm_cxt acxt; struct kernfs_addrm_cxt acxt;
struct kernfs_node *kn; struct kernfs_node *kn;
int rc; int rc;
...@@ -686,7 +686,7 @@ static struct dentry *sysfs_lookup(struct inode *dir, struct dentry *dentry, ...@@ -686,7 +686,7 @@ static struct dentry *sysfs_lookup(struct inode *dir, struct dentry *dentry,
mutex_lock(&sysfs_mutex); mutex_lock(&sysfs_mutex);
if (kernfs_ns_enabled(parent)) if (kernfs_ns_enabled(parent))
ns = sysfs_info(dir->i_sb)->ns; ns = kernfs_info(dir->i_sb)->ns;
kn = kernfs_find_ns(parent, dentry->d_name.name, ns); kn = kernfs_find_ns(parent, dentry->d_name.name, ns);
...@@ -778,7 +778,7 @@ static struct kernfs_node *sysfs_next_descendant_post(struct kernfs_node *pos, ...@@ -778,7 +778,7 @@ static struct kernfs_node *sysfs_next_descendant_post(struct kernfs_node *pos,
return pos->parent; return pos->parent;
} }
static void __kernfs_remove(struct sysfs_addrm_cxt *acxt, static void __kernfs_remove(struct kernfs_addrm_cxt *acxt,
struct kernfs_node *kn) struct kernfs_node *kn)
{ {
struct kernfs_node *pos, *next; struct kernfs_node *pos, *next;
...@@ -805,7 +805,7 @@ static void __kernfs_remove(struct sysfs_addrm_cxt *acxt, ...@@ -805,7 +805,7 @@ static void __kernfs_remove(struct sysfs_addrm_cxt *acxt,
*/ */
void kernfs_remove(struct kernfs_node *kn) void kernfs_remove(struct kernfs_node *kn)
{ {
struct sysfs_addrm_cxt acxt; struct kernfs_addrm_cxt acxt;
sysfs_addrm_start(&acxt); sysfs_addrm_start(&acxt);
__kernfs_remove(&acxt, kn); __kernfs_remove(&acxt, kn);
...@@ -824,7 +824,7 @@ void kernfs_remove(struct kernfs_node *kn) ...@@ -824,7 +824,7 @@ void kernfs_remove(struct kernfs_node *kn)
int kernfs_remove_by_name_ns(struct kernfs_node *parent, const char *name, int kernfs_remove_by_name_ns(struct kernfs_node *parent, const char *name,
const void *ns) const void *ns)
{ {
struct sysfs_addrm_cxt acxt; struct kernfs_addrm_cxt acxt;
struct kernfs_node *kn; struct kernfs_node *kn;
if (!parent) { if (!parent) {
...@@ -971,7 +971,7 @@ static int sysfs_readdir(struct file *file, struct dir_context *ctx) ...@@ -971,7 +971,7 @@ static int sysfs_readdir(struct file *file, struct dir_context *ctx)
mutex_lock(&sysfs_mutex); mutex_lock(&sysfs_mutex);
if (kernfs_ns_enabled(parent)) if (kernfs_ns_enabled(parent))
ns = sysfs_info(dentry->d_sb)->ns; ns = kernfs_info(dentry->d_sb)->ns;
for (pos = sysfs_dir_pos(ns, parent, ctx->pos, pos); for (pos = sysfs_dir_pos(ns, parent, ctx->pos, pos);
pos; pos;
......
This diff is collapsed.
...@@ -46,14 +46,14 @@ void __init sysfs_inode_init(void) ...@@ -46,14 +46,14 @@ void __init sysfs_inode_init(void)
panic("failed to init sysfs_backing_dev_info"); panic("failed to init sysfs_backing_dev_info");
} }
static struct sysfs_inode_attrs *sysfs_inode_attrs(struct kernfs_node *kn) static struct kernfs_iattrs *kernfs_iattrs(struct kernfs_node *kn)
{ {
struct iattr *iattrs; struct iattr *iattrs;
if (kn->iattr) if (kn->iattr)
return kn->iattr; return kn->iattr;
kn->iattr = kzalloc(sizeof(struct sysfs_inode_attrs), GFP_KERNEL); kn->iattr = kzalloc(sizeof(struct kernfs_iattrs), GFP_KERNEL);
if (!kn->iattr) if (!kn->iattr)
return NULL; return NULL;
iattrs = &kn->iattr->ia_iattr; iattrs = &kn->iattr->ia_iattr;
...@@ -71,11 +71,11 @@ static struct sysfs_inode_attrs *sysfs_inode_attrs(struct kernfs_node *kn) ...@@ -71,11 +71,11 @@ static struct sysfs_inode_attrs *sysfs_inode_attrs(struct kernfs_node *kn)
static int __kernfs_setattr(struct kernfs_node *kn, const struct iattr *iattr) static int __kernfs_setattr(struct kernfs_node *kn, const struct iattr *iattr)
{ {
struct sysfs_inode_attrs *attrs; struct kernfs_iattrs *attrs;
struct iattr *iattrs; struct iattr *iattrs;
unsigned int ia_valid = iattr->ia_valid; unsigned int ia_valid = iattr->ia_valid;
attrs = sysfs_inode_attrs(kn); attrs = kernfs_iattrs(kn);
if (!attrs) if (!attrs)
return -ENOMEM; return -ENOMEM;
...@@ -144,11 +144,11 @@ int sysfs_setattr(struct dentry *dentry, struct iattr *iattr) ...@@ -144,11 +144,11 @@ int sysfs_setattr(struct dentry *dentry, struct iattr *iattr)
static int sysfs_sd_setsecdata(struct kernfs_node *kn, void **secdata, static int sysfs_sd_setsecdata(struct kernfs_node *kn, void **secdata,
u32 *secdata_len) u32 *secdata_len)
{ {
struct sysfs_inode_attrs *attrs; struct kernfs_iattrs *attrs;
void *old_secdata; void *old_secdata;
size_t old_secdata_len; size_t old_secdata_len;
attrs = sysfs_inode_attrs(kn); attrs = kernfs_iattrs(kn);
if (!attrs) if (!attrs)
return -ENOMEM; return -ENOMEM;
...@@ -167,12 +167,12 @@ int sysfs_setxattr(struct dentry *dentry, const char *name, const void *value, ...@@ -167,12 +167,12 @@ int sysfs_setxattr(struct dentry *dentry, const char *name, const void *value,
size_t size, int flags) size_t size, int flags)
{ {
struct kernfs_node *kn = dentry->d_fsdata; struct kernfs_node *kn = dentry->d_fsdata;
struct sysfs_inode_attrs *attrs; struct kernfs_iattrs *attrs;
void *secdata; void *secdata;
int error; int error;
u32 secdata_len = 0; u32 secdata_len = 0;
attrs = sysfs_inode_attrs(kn); attrs = kernfs_iattrs(kn);
if (!attrs) if (!attrs)
return -ENOMEM; return -ENOMEM;
...@@ -205,9 +205,9 @@ int sysfs_setxattr(struct dentry *dentry, const char *name, const void *value, ...@@ -205,9 +205,9 @@ int sysfs_setxattr(struct dentry *dentry, const char *name, const void *value,
int sysfs_removexattr(struct dentry *dentry, const char *name) int sysfs_removexattr(struct dentry *dentry, const char *name)
{ {
struct kernfs_node *kn = dentry->d_fsdata; struct kernfs_node *kn = dentry->d_fsdata;
struct sysfs_inode_attrs *attrs; struct kernfs_iattrs *attrs;
attrs = sysfs_inode_attrs(kn); attrs = kernfs_iattrs(kn);
if (!attrs) if (!attrs)
return -ENOMEM; return -ENOMEM;
...@@ -218,9 +218,9 @@ ssize_t sysfs_getxattr(struct dentry *dentry, const char *name, void *buf, ...@@ -218,9 +218,9 @@ ssize_t sysfs_getxattr(struct dentry *dentry, const char *name, void *buf,
size_t size) size_t size)
{ {
struct kernfs_node *kn = dentry->d_fsdata; struct kernfs_node *kn = dentry->d_fsdata;
struct sysfs_inode_attrs *attrs; struct kernfs_iattrs *attrs;
attrs = sysfs_inode_attrs(kn); attrs = kernfs_iattrs(kn);
if (!attrs) if (!attrs)
return -ENOMEM; return -ENOMEM;
...@@ -230,9 +230,9 @@ ssize_t sysfs_getxattr(struct dentry *dentry, const char *name, void *buf, ...@@ -230,9 +230,9 @@ ssize_t sysfs_getxattr(struct dentry *dentry, const char *name, void *buf,
ssize_t sysfs_listxattr(struct dentry *dentry, char *buf, size_t size) ssize_t sysfs_listxattr(struct dentry *dentry, char *buf, size_t size)
{ {
struct kernfs_node *kn = dentry->d_fsdata; struct kernfs_node *kn = dentry->d_fsdata;
struct sysfs_inode_attrs *attrs; struct kernfs_iattrs *attrs;
attrs = sysfs_inode_attrs(kn); attrs = kernfs_iattrs(kn);
if (!attrs) if (!attrs)
return -ENOMEM; return -ENOMEM;
...@@ -256,7 +256,7 @@ static inline void set_inode_attr(struct inode *inode, struct iattr *iattr) ...@@ -256,7 +256,7 @@ static inline void set_inode_attr(struct inode *inode, struct iattr *iattr)
static void sysfs_refresh_inode(struct kernfs_node *kn, struct inode *inode) static void sysfs_refresh_inode(struct kernfs_node *kn, struct inode *inode)
{ {
struct sysfs_inode_attrs *attrs = kn->iattr; struct kernfs_iattrs *attrs = kn->iattr;
inode->i_mode = kn->mode; inode->i_mode = kn->mode;
if (attrs) { if (attrs) {
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
#include <linux/kernfs.h> #include <linux/kernfs.h>
struct sysfs_inode_attrs { struct kernfs_iattrs {
struct iattr ia_iattr; struct iattr ia_iattr;
void *ia_secdata; void *ia_secdata;
u32 ia_secdata_len; u32 ia_secdata_len;
...@@ -47,14 +47,14 @@ static inline struct kernfs_root *kernfs_root(struct kernfs_node *kn) ...@@ -47,14 +47,14 @@ static inline struct kernfs_root *kernfs_root(struct kernfs_node *kn)
/* /*
* Context structure to be used while adding/removing nodes. * Context structure to be used while adding/removing nodes.
*/ */
struct sysfs_addrm_cxt { struct kernfs_addrm_cxt {
struct kernfs_node *removed; struct kernfs_node *removed;
}; };
/* /*
* mount.c * mount.c
*/ */
struct sysfs_super_info { struct kernfs_super_info {
/* /*
* The root associated with this super_block. Each super_block is * The root associated with this super_block. Each super_block is
* identified by the root and ns it's associated with. * identified by the root and ns it's associated with.
...@@ -63,13 +63,13 @@ struct sysfs_super_info { ...@@ -63,13 +63,13 @@ struct sysfs_super_info {
/* /*
* Each sb is associated with one namespace tag, currently the * Each sb is associated with one namespace tag, currently the
* network namespace of the task which mounted this sysfs instance. * network namespace of the task which mounted this kernfs
* If multiple tags become necessary, make the following an array * instance. If multiple tags become necessary, make the following
* and compare kernfs_node tag against every entry. * an array and compare kernfs_node tag against every entry.
*/ */
const void *ns; const void *ns;
}; };
#define sysfs_info(SB) ((struct sysfs_super_info *)(SB->s_fs_info)) #define kernfs_info(SB) ((struct kernfs_super_info *)(SB->s_fs_info))
extern struct kmem_cache *sysfs_dir_cachep; extern struct kmem_cache *sysfs_dir_cachep;
...@@ -100,10 +100,10 @@ extern const struct inode_operations sysfs_dir_inode_operations; ...@@ -100,10 +100,10 @@ extern const struct inode_operations sysfs_dir_inode_operations;
struct kernfs_node *sysfs_get_active(struct kernfs_node *kn); struct kernfs_node *sysfs_get_active(struct kernfs_node *kn);
void sysfs_put_active(struct kernfs_node *kn); void sysfs_put_active(struct kernfs_node *kn);
void sysfs_addrm_start(struct sysfs_addrm_cxt *acxt); void sysfs_addrm_start(struct kernfs_addrm_cxt *acxt);
int sysfs_add_one(struct sysfs_addrm_cxt *acxt, struct kernfs_node *kn, int sysfs_add_one(struct kernfs_addrm_cxt *acxt, struct kernfs_node *kn,
struct kernfs_node *parent); struct kernfs_node *parent);
void sysfs_addrm_finish(struct sysfs_addrm_cxt *acxt); void sysfs_addrm_finish(struct kernfs_addrm_cxt *acxt);
struct kernfs_node *sysfs_new_dirent(struct kernfs_root *root, struct kernfs_node *sysfs_new_dirent(struct kernfs_root *root,
const char *name, umode_t mode, int type); const char *name, umode_t mode, int type);
......
...@@ -27,7 +27,7 @@ static const struct super_operations sysfs_ops = { ...@@ -27,7 +27,7 @@ static const struct super_operations sysfs_ops = {
static int sysfs_fill_super(struct super_block *sb) static int sysfs_fill_super(struct super_block *sb)
{ {
struct sysfs_super_info *info = sysfs_info(sb); struct kernfs_super_info *info = kernfs_info(sb);
struct inode *inode; struct inode *inode;
struct dentry *root; struct dentry *root;
...@@ -61,8 +61,8 @@ static int sysfs_fill_super(struct super_block *sb) ...@@ -61,8 +61,8 @@ static int sysfs_fill_super(struct super_block *sb)
static int sysfs_test_super(struct super_block *sb, void *data) static int sysfs_test_super(struct super_block *sb, void *data)
{ {
struct sysfs_super_info *sb_info = sysfs_info(sb); struct kernfs_super_info *sb_info = kernfs_info(sb);
struct sysfs_super_info *info = data; struct kernfs_super_info *info = data;
return sb_info->root == info->root && sb_info->ns == info->ns; return sb_info->root == info->root && sb_info->ns == info->ns;
} }
...@@ -84,7 +84,7 @@ static int sysfs_set_super(struct super_block *sb, void *data) ...@@ -84,7 +84,7 @@ static int sysfs_set_super(struct super_block *sb, void *data)
*/ */
const void *kernfs_super_ns(struct super_block *sb) const void *kernfs_super_ns(struct super_block *sb)
{ {
struct sysfs_super_info *info = sysfs_info(sb); struct kernfs_super_info *info = kernfs_info(sb);
return info->ns; return info->ns;
} }
...@@ -107,7 +107,7 @@ struct dentry *kernfs_mount_ns(struct file_system_type *fs_type, int flags, ...@@ -107,7 +107,7 @@ struct dentry *kernfs_mount_ns(struct file_system_type *fs_type, int flags,
struct kernfs_root *root, const void *ns) struct kernfs_root *root, const void *ns)
{ {
struct super_block *sb; struct super_block *sb;
struct sysfs_super_info *info; struct kernfs_super_info *info;
int error; int error;
info = kzalloc(sizeof(*info), GFP_KERNEL); info = kzalloc(sizeof(*info), GFP_KERNEL);
...@@ -144,12 +144,12 @@ struct dentry *kernfs_mount_ns(struct file_system_type *fs_type, int flags, ...@@ -144,12 +144,12 @@ struct dentry *kernfs_mount_ns(struct file_system_type *fs_type, int flags,
*/ */
void kernfs_kill_sb(struct super_block *sb) void kernfs_kill_sb(struct super_block *sb)
{ {
struct sysfs_super_info *info = sysfs_info(sb); struct kernfs_super_info *info = kernfs_info(sb);
struct kernfs_node *root_kn = sb->s_root->d_fsdata; struct kernfs_node *root_kn = sb->s_root->d_fsdata;
/* /*
* Remove the superblock from fs_supers/s_instances * Remove the superblock from fs_supers/s_instances
* so we can't find it, before freeing sysfs_super_info. * so we can't find it, before freeing kernfs_super_info.
*/ */
kill_anon_super(sb); kill_anon_super(sb);
kfree(info); kfree(info);
......
...@@ -27,7 +27,7 @@ struct kernfs_node *kernfs_create_link(struct kernfs_node *parent, ...@@ -27,7 +27,7 @@ struct kernfs_node *kernfs_create_link(struct kernfs_node *parent,
struct kernfs_node *target) struct kernfs_node *target)
{ {
struct kernfs_node *kn; struct kernfs_node *kn;
struct sysfs_addrm_cxt acxt; struct kernfs_addrm_cxt acxt;
int error; int error;
kn = sysfs_new_dirent(kernfs_root(parent), name, S_IFLNK|S_IRWXUGO, kn = sysfs_new_dirent(kernfs_root(parent), name, S_IFLNK|S_IRWXUGO,
......
...@@ -41,7 +41,7 @@ static const struct sysfs_ops *sysfs_file_ops(struct kernfs_node *kn) ...@@ -41,7 +41,7 @@ static const struct sysfs_ops *sysfs_file_ops(struct kernfs_node *kn)
*/ */
static int sysfs_kf_seq_show(struct seq_file *sf, void *v) static int sysfs_kf_seq_show(struct seq_file *sf, void *v)
{ {
struct sysfs_open_file *of = sf->private; struct kernfs_open_file *of = sf->private;
struct kobject *kobj = of->kn->parent->priv; struct kobject *kobj = of->kn->parent->priv;
const struct sysfs_ops *ops = sysfs_file_ops(of->kn); const struct sysfs_ops *ops = sysfs_file_ops(of->kn);
ssize_t count; ssize_t count;
...@@ -78,7 +78,7 @@ static int sysfs_kf_seq_show(struct seq_file *sf, void *v) ...@@ -78,7 +78,7 @@ static int sysfs_kf_seq_show(struct seq_file *sf, void *v)
return 0; return 0;
} }
static ssize_t sysfs_kf_bin_read(struct sysfs_open_file *of, char *buf, static ssize_t sysfs_kf_bin_read(struct kernfs_open_file *of, char *buf,
size_t count, loff_t pos) size_t count, loff_t pos)
{ {
struct bin_attribute *battr = of->kn->priv; struct bin_attribute *battr = of->kn->priv;
...@@ -102,7 +102,7 @@ static ssize_t sysfs_kf_bin_read(struct sysfs_open_file *of, char *buf, ...@@ -102,7 +102,7 @@ static ssize_t sysfs_kf_bin_read(struct sysfs_open_file *of, char *buf,
} }
/* kernfs write callback for regular sysfs files */ /* kernfs write callback for regular sysfs files */
static ssize_t sysfs_kf_write(struct sysfs_open_file *of, char *buf, static ssize_t sysfs_kf_write(struct kernfs_open_file *of, char *buf,
size_t count, loff_t pos) size_t count, loff_t pos)
{ {
const struct sysfs_ops *ops = sysfs_file_ops(of->kn); const struct sysfs_ops *ops = sysfs_file_ops(of->kn);
...@@ -115,7 +115,7 @@ static ssize_t sysfs_kf_write(struct sysfs_open_file *of, char *buf, ...@@ -115,7 +115,7 @@ static ssize_t sysfs_kf_write(struct sysfs_open_file *of, char *buf,
} }
/* kernfs write callback for bin sysfs files */ /* kernfs write callback for bin sysfs files */
static ssize_t sysfs_kf_bin_write(struct sysfs_open_file *of, char *buf, static ssize_t sysfs_kf_bin_write(struct kernfs_open_file *of, char *buf,
size_t count, loff_t pos) size_t count, loff_t pos)
{ {
struct bin_attribute *battr = of->kn->priv; struct bin_attribute *battr = of->kn->priv;
...@@ -136,7 +136,7 @@ static ssize_t sysfs_kf_bin_write(struct sysfs_open_file *of, char *buf, ...@@ -136,7 +136,7 @@ static ssize_t sysfs_kf_bin_write(struct sysfs_open_file *of, char *buf,
return battr->write(of->file, kobj, battr, buf, pos, count); return battr->write(of->file, kobj, battr, buf, pos, count);
} }
static int sysfs_kf_bin_mmap(struct sysfs_open_file *of, static int sysfs_kf_bin_mmap(struct kernfs_open_file *of,
struct vm_area_struct *vma) struct vm_area_struct *vma)
{ {
struct bin_attribute *battr = of->kn->priv; struct bin_attribute *battr = of->kn->priv;
......
...@@ -24,8 +24,8 @@ struct vm_area_struct; ...@@ -24,8 +24,8 @@ struct vm_area_struct;
struct super_block; struct super_block;
struct file_system_type; struct file_system_type;
struct sysfs_open_dirent; struct kernfs_open_node;
struct sysfs_inode_attrs; struct kernfs_iattrs;
enum kernfs_node_type { enum kernfs_node_type {
SYSFS_DIR = 0x0001, SYSFS_DIR = 0x0001,
...@@ -65,7 +65,7 @@ struct kernfs_elem_symlink { ...@@ -65,7 +65,7 @@ struct kernfs_elem_symlink {
struct kernfs_elem_attr { struct kernfs_elem_attr {
const struct kernfs_ops *ops; const struct kernfs_ops *ops;
struct sysfs_open_dirent *open; struct kernfs_open_node *open;
loff_t size; loff_t size;
}; };
...@@ -108,7 +108,7 @@ struct kernfs_node { ...@@ -108,7 +108,7 @@ struct kernfs_node {
unsigned short flags; unsigned short flags;
umode_t mode; umode_t mode;
unsigned int ino; unsigned int ino;
struct sysfs_inode_attrs *iattr; struct kernfs_iattrs *iattr;
}; };
struct kernfs_root { struct kernfs_root {
...@@ -119,7 +119,7 @@ struct kernfs_root { ...@@ -119,7 +119,7 @@ struct kernfs_root {
struct ida ino_ida; struct ida ino_ida;
}; };
struct sysfs_open_file { struct kernfs_open_file {
/* published fields */ /* published fields */
struct kernfs_node *kn; struct kernfs_node *kn;
struct file *file; struct file *file;
...@@ -140,7 +140,7 @@ struct kernfs_ops { ...@@ -140,7 +140,7 @@ struct kernfs_ops {
* If seq_show() is present, seq_file path is active. Other seq * If seq_show() is present, seq_file path is active. Other seq
* operations are optional and if not implemented, the behavior is * operations are optional and if not implemented, the behavior is
* equivalent to single_open(). @sf->private points to the * equivalent to single_open(). @sf->private points to the
* associated sysfs_open_file. * associated kernfs_open_file.
* *
* read() is bounced through kernel buffer and a read larger than * read() is bounced through kernel buffer and a read larger than
* PAGE_SIZE results in partial operation of PAGE_SIZE. * PAGE_SIZE results in partial operation of PAGE_SIZE.
...@@ -151,17 +151,17 @@ struct kernfs_ops { ...@@ -151,17 +151,17 @@ struct kernfs_ops {
void *(*seq_next)(struct seq_file *sf, void *v, loff_t *ppos); void *(*seq_next)(struct seq_file *sf, void *v, loff_t *ppos);
void (*seq_stop)(struct seq_file *sf, void *v); void (*seq_stop)(struct seq_file *sf, void *v);
ssize_t (*read)(struct sysfs_open_file *of, char *buf, size_t bytes, ssize_t (*read)(struct kernfs_open_file *of, char *buf, size_t bytes,
loff_t off); loff_t off);
/* /*
* write() is bounced through kernel buffer and a write larger than * write() is bounced through kernel buffer and a write larger than
* PAGE_SIZE results in partial operation of PAGE_SIZE. * PAGE_SIZE results in partial operation of PAGE_SIZE.
*/ */
ssize_t (*write)(struct sysfs_open_file *of, char *buf, size_t bytes, ssize_t (*write)(struct kernfs_open_file *of, char *buf, size_t bytes,
loff_t off); loff_t off);
int (*mmap)(struct sysfs_open_file *of, struct vm_area_struct *vma); int (*mmap)(struct kernfs_open_file *of, struct vm_area_struct *vma);
#ifdef CONFIG_DEBUG_LOCK_ALLOC #ifdef CONFIG_DEBUG_LOCK_ALLOC
struct lock_class_key lockdep_key; struct lock_class_key lockdep_key;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment