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

kernfs: s/sysfs/kernfs/ in internal functions and whatever is left

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_*()/kernfs_*()/ in all internal functions
* s/sysfs/kernfs/ in internal strings, comments and whatever is remaining
* Uniformly rename various vfs operations so that they're consistently
  named and distinguishable.

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 a797bfc3
This diff is collapsed.
This diff is collapsed.
......@@ -31,16 +31,16 @@ static struct backing_dev_info kernfs_bdi = {
};
static const struct inode_operations kernfs_iops = {
.permission = sysfs_permission,
.setattr = sysfs_setattr,
.getattr = sysfs_getattr,
.setxattr = sysfs_setxattr,
.removexattr = sysfs_removexattr,
.getxattr = sysfs_getxattr,
.listxattr = sysfs_listxattr,
.permission = kernfs_iop_permission,
.setattr = kernfs_iop_setattr,
.getattr = kernfs_iop_getattr,
.setxattr = kernfs_iop_setxattr,
.removexattr = kernfs_iop_removexattr,
.getxattr = kernfs_iop_getxattr,
.listxattr = kernfs_iop_listxattr,
};
void __init sysfs_inode_init(void)
void __init kernfs_inode_init(void)
{
if (bdi_init(&kernfs_bdi))
panic("failed to init kernfs_bdi");
......@@ -115,7 +115,7 @@ int kernfs_setattr(struct kernfs_node *kn, const struct iattr *iattr)
return ret;
}
int sysfs_setattr(struct dentry *dentry, struct iattr *iattr)
int kernfs_iop_setattr(struct dentry *dentry, struct iattr *iattr)
{
struct inode *inode = dentry->d_inode;
struct kernfs_node *kn = dentry->d_fsdata;
......@@ -141,8 +141,8 @@ int sysfs_setattr(struct dentry *dentry, struct iattr *iattr)
return error;
}
static int sysfs_sd_setsecdata(struct kernfs_node *kn, void **secdata,
u32 *secdata_len)
static int kernfs_node_setsecdata(struct kernfs_node *kn, void **secdata,
u32 *secdata_len)
{
struct kernfs_iattrs *attrs;
void *old_secdata;
......@@ -163,8 +163,8 @@ static int sysfs_sd_setsecdata(struct kernfs_node *kn, void **secdata,
return 0;
}
int sysfs_setxattr(struct dentry *dentry, const char *name, const void *value,
size_t size, int flags)
int kernfs_iop_setxattr(struct dentry *dentry, const char *name,
const void *value, size_t size, int flags)
{
struct kernfs_node *kn = dentry->d_fsdata;
struct kernfs_iattrs *attrs;
......@@ -188,7 +188,7 @@ int sysfs_setxattr(struct dentry *dentry, const char *name, const void *value,
return error;
mutex_lock(&kernfs_mutex);
error = sysfs_sd_setsecdata(kn, &secdata, &secdata_len);
error = kernfs_node_setsecdata(kn, &secdata, &secdata_len);
mutex_unlock(&kernfs_mutex);
if (secdata)
......@@ -202,7 +202,7 @@ int sysfs_setxattr(struct dentry *dentry, const char *name, const void *value,
return -EINVAL;
}
int sysfs_removexattr(struct dentry *dentry, const char *name)
int kernfs_iop_removexattr(struct dentry *dentry, const char *name)
{
struct kernfs_node *kn = dentry->d_fsdata;
struct kernfs_iattrs *attrs;
......@@ -214,8 +214,8 @@ int sysfs_removexattr(struct dentry *dentry, const char *name)
return simple_xattr_remove(&attrs->xattrs, name);
}
ssize_t sysfs_getxattr(struct dentry *dentry, const char *name, void *buf,
size_t size)
ssize_t kernfs_iop_getxattr(struct dentry *dentry, const char *name, void *buf,
size_t size)
{
struct kernfs_node *kn = dentry->d_fsdata;
struct kernfs_iattrs *attrs;
......@@ -227,7 +227,7 @@ ssize_t sysfs_getxattr(struct dentry *dentry, const char *name, void *buf,
return simple_xattr_get(&attrs->xattrs, name, buf, size);
}
ssize_t sysfs_listxattr(struct dentry *dentry, char *buf, size_t size)
ssize_t kernfs_iop_listxattr(struct dentry *dentry, char *buf, size_t size)
{
struct kernfs_node *kn = dentry->d_fsdata;
struct kernfs_iattrs *attrs;
......@@ -254,7 +254,7 @@ static inline void set_inode_attr(struct inode *inode, struct iattr *iattr)
inode->i_ctime = iattr->ia_ctime;
}
static void sysfs_refresh_inode(struct kernfs_node *kn, struct inode *inode)
static void kernfs_refresh_inode(struct kernfs_node *kn, struct inode *inode)
{
struct kernfs_iattrs *attrs = kn->iattr;
......@@ -273,21 +273,21 @@ static void sysfs_refresh_inode(struct kernfs_node *kn, struct inode *inode)
set_nlink(inode, kn->dir.subdirs + 2);
}
int sysfs_getattr(struct vfsmount *mnt, struct dentry *dentry,
struct kstat *stat)
int kernfs_iop_getattr(struct vfsmount *mnt, struct dentry *dentry,
struct kstat *stat)
{
struct kernfs_node *kn = dentry->d_fsdata;
struct inode *inode = dentry->d_inode;
mutex_lock(&kernfs_mutex);
sysfs_refresh_inode(kn, inode);
kernfs_refresh_inode(kn, inode);
mutex_unlock(&kernfs_mutex);
generic_fillattr(inode, stat);
return 0;
}
static void sysfs_init_inode(struct kernfs_node *kn, struct inode *inode)
static void kernfs_init_inode(struct kernfs_node *kn, struct inode *inode)
{
kernfs_get(kn);
inode->i_private = kn;
......@@ -296,7 +296,7 @@ static void sysfs_init_inode(struct kernfs_node *kn, struct inode *inode)
inode->i_op = &kernfs_iops;
set_default_inode_attr(inode, kn->mode);
sysfs_refresh_inode(kn, inode);
kernfs_refresh_inode(kn, inode);
/* initialize inode according to type */
switch (kernfs_type(kn)) {
......@@ -319,7 +319,7 @@ static void sysfs_init_inode(struct kernfs_node *kn, struct inode *inode)
}
/**
* sysfs_get_inode - get inode for kernfs_node
* kernfs_get_inode - get inode for kernfs_node
* @sb: super block
* @kn: kernfs_node to allocate inode for
*
......@@ -333,25 +333,25 @@ static void sysfs_init_inode(struct kernfs_node *kn, struct inode *inode)
* RETURNS:
* Pointer to allocated inode on success, NULL on failure.
*/
struct inode *sysfs_get_inode(struct super_block *sb, struct kernfs_node *kn)
struct inode *kernfs_get_inode(struct super_block *sb, struct kernfs_node *kn)
{
struct inode *inode;
inode = iget_locked(sb, kn->ino);
if (inode && (inode->i_state & I_NEW))
sysfs_init_inode(kn, inode);
kernfs_init_inode(kn, inode);
return inode;
}
/*
* The kernfs_node serves as both an inode and a directory entry for sysfs.
* To prevent the sysfs inode numbers from being freed prematurely we take
* a reference to kernfs_node from the sysfs inode. A
* The kernfs_node serves as both an inode and a directory entry for
* kernfs. To prevent the kernfs inode numbers from being freed
* prematurely we take a reference to kernfs_node from the kernfs inode. A
* super_operations.evict_inode() implementation is needed to drop that
* reference upon inode destruction.
*/
void sysfs_evict_inode(struct inode *inode)
void kernfs_evict_inode(struct inode *inode)
{
struct kernfs_node *kn = inode->i_private;
......@@ -360,7 +360,7 @@ void sysfs_evict_inode(struct inode *inode)
kernfs_put(kn);
}
int sysfs_permission(struct inode *inode, int mask)
int kernfs_iop_permission(struct inode *inode, int mask)
{
struct kernfs_node *kn;
......@@ -370,7 +370,7 @@ int sysfs_permission(struct inode *inode, int mask)
kn = inode->i_private;
mutex_lock(&kernfs_mutex);
sysfs_refresh_inode(kn, inode);
kernfs_refresh_inode(kn, inode);
mutex_unlock(&kernfs_mutex);
return generic_permission(inode, mask);
......
......@@ -76,19 +76,19 @@ extern struct kmem_cache *kernfs_node_cache;
/*
* inode.c
*/
struct inode *sysfs_get_inode(struct super_block *sb, struct kernfs_node *kn);
void sysfs_evict_inode(struct inode *inode);
int sysfs_permission(struct inode *inode, int mask);
int sysfs_setattr(struct dentry *dentry, struct iattr *iattr);
int sysfs_getattr(struct vfsmount *mnt, struct dentry *dentry,
struct kstat *stat);
int sysfs_setxattr(struct dentry *dentry, const char *name, const void *value,
size_t size, int flags);
int sysfs_removexattr(struct dentry *dentry, const char *name);
ssize_t sysfs_getxattr(struct dentry *dentry, const char *name, void *buf,
size_t size);
ssize_t sysfs_listxattr(struct dentry *dentry, char *buf, size_t size);
void sysfs_inode_init(void);
struct inode *kernfs_get_inode(struct super_block *sb, struct kernfs_node *kn);
void kernfs_evict_inode(struct inode *inode);
int kernfs_iop_permission(struct inode *inode, int mask);
int kernfs_iop_setattr(struct dentry *dentry, struct iattr *iattr);
int kernfs_iop_getattr(struct vfsmount *mnt, struct dentry *dentry,
struct kstat *stat);
int kernfs_iop_setxattr(struct dentry *dentry, const char *name, const void *value,
size_t size, int flags);
int kernfs_iop_removexattr(struct dentry *dentry, const char *name);
ssize_t kernfs_iop_getxattr(struct dentry *dentry, const char *name, void *buf,
size_t size);
ssize_t kernfs_iop_listxattr(struct dentry *dentry, char *buf, size_t size);
void kernfs_inode_init(void);
/*
* dir.c
......@@ -98,21 +98,21 @@ extern const struct dentry_operations kernfs_dops;
extern const struct file_operations kernfs_dir_fops;
extern const struct inode_operations kernfs_dir_iops;
struct kernfs_node *sysfs_get_active(struct kernfs_node *kn);
void sysfs_put_active(struct kernfs_node *kn);
void sysfs_addrm_start(struct kernfs_addrm_cxt *acxt);
int sysfs_add_one(struct kernfs_addrm_cxt *acxt, struct kernfs_node *kn,
struct kernfs_node *parent);
void sysfs_addrm_finish(struct kernfs_addrm_cxt *acxt);
struct kernfs_node *sysfs_new_dirent(struct kernfs_root *root,
const char *name, umode_t mode, int type);
struct kernfs_node *kernfs_get_active(struct kernfs_node *kn);
void kernfs_put_active(struct kernfs_node *kn);
void kernfs_addrm_start(struct kernfs_addrm_cxt *acxt);
int kernfs_add_one(struct kernfs_addrm_cxt *acxt, struct kernfs_node *kn,
struct kernfs_node *parent);
void kernfs_addrm_finish(struct kernfs_addrm_cxt *acxt);
struct kernfs_node *kernfs_new_node(struct kernfs_root *root, const char *name,
umode_t mode, int type);
/*
* file.c
*/
extern const struct file_operations kernfs_file_fops;
void sysfs_unmap_bin_file(struct kernfs_node *kn);
void kernfs_unmap_bin_file(struct kernfs_node *kn);
/*
* symlink.c
......
......@@ -22,10 +22,10 @@ struct kmem_cache *kernfs_node_cache;
static const struct super_operations kernfs_sops = {
.statfs = simple_statfs,
.drop_inode = generic_delete_inode,
.evict_inode = sysfs_evict_inode,
.evict_inode = kernfs_evict_inode,
};
static int sysfs_fill_super(struct super_block *sb)
static int kernfs_fill_super(struct super_block *sb)
{
struct kernfs_super_info *info = kernfs_info(sb);
struct inode *inode;
......@@ -39,10 +39,10 @@ static int sysfs_fill_super(struct super_block *sb)
/* get root inode, initialize and unlock it */
mutex_lock(&kernfs_mutex);
inode = sysfs_get_inode(sb, info->root->kn);
inode = kernfs_get_inode(sb, info->root->kn);
mutex_unlock(&kernfs_mutex);
if (!inode) {
pr_debug("sysfs: could not get root inode\n");
pr_debug("kernfs: could not get root inode\n");
return -ENOMEM;
}
......@@ -59,7 +59,7 @@ static int sysfs_fill_super(struct super_block *sb)
return 0;
}
static int sysfs_test_super(struct super_block *sb, void *data)
static int kernfs_test_super(struct super_block *sb, void *data)
{
struct kernfs_super_info *sb_info = kernfs_info(sb);
struct kernfs_super_info *info = data;
......@@ -67,7 +67,7 @@ static int sysfs_test_super(struct super_block *sb, void *data)
return sb_info->root == info->root && sb_info->ns == info->ns;
}
static int sysfs_set_super(struct super_block *sb, void *data)
static int kernfs_set_super(struct super_block *sb, void *data)
{
int error;
error = set_anon_super(sb, data);
......@@ -117,13 +117,13 @@ struct dentry *kernfs_mount_ns(struct file_system_type *fs_type, int flags,
info->root = root;
info->ns = ns;
sb = sget(fs_type, sysfs_test_super, sysfs_set_super, flags, info);
sb = sget(fs_type, kernfs_test_super, kernfs_set_super, flags, info);
if (IS_ERR(sb) || sb->s_fs_info != info)
kfree(info);
if (IS_ERR(sb))
return ERR_CAST(sb);
if (!sb->s_root) {
error = sysfs_fill_super(sb);
error = kernfs_fill_super(sb);
if (error) {
deactivate_locked_super(sb);
return ERR_PTR(error);
......@@ -161,5 +161,5 @@ void __init kernfs_init(void)
kernfs_node_cache = kmem_cache_create("kernfs_node_cache",
sizeof(struct kernfs_node),
0, SLAB_PANIC, NULL);
sysfs_inode_init();
kernfs_inode_init();
}
......@@ -30,8 +30,8 @@ struct kernfs_node *kernfs_create_link(struct kernfs_node *parent,
struct kernfs_addrm_cxt acxt;
int error;
kn = sysfs_new_dirent(kernfs_root(parent), name, S_IFLNK|S_IRWXUGO,
KERNFS_LINK);
kn = kernfs_new_node(kernfs_root(parent), name, S_IFLNK|S_IRWXUGO,
KERNFS_LINK);
if (!kn)
return ERR_PTR(-ENOMEM);
......@@ -40,9 +40,9 @@ struct kernfs_node *kernfs_create_link(struct kernfs_node *parent,
kn->symlink.target_kn = target;
kernfs_get(target); /* ref owned by symlink */
sysfs_addrm_start(&acxt);
error = sysfs_add_one(&acxt, kn, parent);
sysfs_addrm_finish(&acxt);
kernfs_addrm_start(&acxt);
error = kernfs_add_one(&acxt, kn, parent);
kernfs_addrm_finish(&acxt);
if (!error)
return kn;
......@@ -51,8 +51,8 @@ struct kernfs_node *kernfs_create_link(struct kernfs_node *parent,
return ERR_PTR(error);
}
static int sysfs_get_target_path(struct kernfs_node *parent,
struct kernfs_node *target, char *path)
static int kernfs_get_target_path(struct kernfs_node *parent,
struct kernfs_node *target, char *path)
{
struct kernfs_node *base, *kn;
char *s = path;
......@@ -103,7 +103,7 @@ static int sysfs_get_target_path(struct kernfs_node *parent,
return 0;
}
static int sysfs_getlink(struct dentry *dentry, char *path)
static int kernfs_getlink(struct dentry *dentry, char *path)
{
struct kernfs_node *kn = dentry->d_fsdata;
struct kernfs_node *parent = kn->parent;
......@@ -111,18 +111,18 @@ static int sysfs_getlink(struct dentry *dentry, char *path)
int error;
mutex_lock(&kernfs_mutex);
error = sysfs_get_target_path(parent, target, path);
error = kernfs_get_target_path(parent, target, path);
mutex_unlock(&kernfs_mutex);
return error;
}
static void *sysfs_follow_link(struct dentry *dentry, struct nameidata *nd)
static void *kernfs_iop_follow_link(struct dentry *dentry, struct nameidata *nd)
{
int error = -ENOMEM;
unsigned long page = get_zeroed_page(GFP_KERNEL);
if (page) {
error = sysfs_getlink(dentry, (char *) page);
error = kernfs_getlink(dentry, (char *) page);
if (error < 0)
free_page((unsigned long)page);
}
......@@ -130,8 +130,8 @@ static void *sysfs_follow_link(struct dentry *dentry, struct nameidata *nd)
return NULL;
}
static void sysfs_put_link(struct dentry *dentry, struct nameidata *nd,
void *cookie)
static void kernfs_iop_put_link(struct dentry *dentry, struct nameidata *nd,
void *cookie)
{
char *page = nd_get_link(nd);
if (!IS_ERR(page))
......@@ -139,14 +139,14 @@ static void sysfs_put_link(struct dentry *dentry, struct nameidata *nd,
}
const struct inode_operations kernfs_symlink_iops = {
.setxattr = sysfs_setxattr,
.removexattr = sysfs_removexattr,
.getxattr = sysfs_getxattr,
.listxattr = sysfs_listxattr,
.setxattr = kernfs_iop_setxattr,
.removexattr = kernfs_iop_removexattr,
.getxattr = kernfs_iop_getxattr,
.listxattr = kernfs_iop_listxattr,
.readlink = generic_readlink,
.follow_link = sysfs_follow_link,
.put_link = sysfs_put_link,
.setattr = sysfs_setattr,
.getattr = sysfs_getattr,
.permission = sysfs_permission,
.follow_link = kernfs_iop_follow_link,
.put_link = kernfs_iop_put_link,
.setattr = kernfs_iop_setattr,
.getattr = kernfs_iop_getattr,
.permission = kernfs_iop_permission,
};
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