Skip to content

Commit

Permalink
kernfs: s/sysfs/kernfs/ in global variables
Browse files Browse the repository at this point in the history
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_mutex/kernfs_mutex/
* s/sysfs_dentry_ops/kernfs_dops/
* s/sysfs_dir_operations/kernfs_dir_fops/
* s/sysfs_dir_inode_operations/kernfs_dir_iops/
* s/kernfs_file_operations/kernfs_file_fops/ - renamed for consistency
* s/sysfs_symlink_inode_operations/kernfs_symlink_iops/
* s/sysfs_aops/kernfs_aops/
* s/sysfs_backing_dev_info/kernfs_bdi/
* s/sysfs_inode_operations/kernfs_iops/
* s/sysfs_dir_cachep/kernfs_node_cache/
* s/sysfs_ops/kernfs_sops/

This patch is strictly rename only and doesn't introduce any
functional difference.

Signed-off-by: Tejun Heo <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
htejun authored and gregkh committed Dec 12, 2013
1 parent df23fc3 commit a797bfc
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 73 deletions.
64 changes: 32 additions & 32 deletions fs/kernfs/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

#include "kernfs-internal.h"

DEFINE_MUTEX(sysfs_mutex);
DEFINE_MUTEX(kernfs_mutex);

#define rb_to_kn(X) rb_entry((X), struct kernfs_node, rb)

Expand Down Expand Up @@ -68,7 +68,7 @@ static int sysfs_sd_compare(const struct kernfs_node *left,
* @kn->parent->dir.children.
*
* Locking:
* mutex_lock(sysfs_mutex)
* mutex_lock(kernfs_mutex)
*
* RETURNS:
* 0 on susccess -EEXIST on failure.
Expand Down Expand Up @@ -109,7 +109,7 @@ static int sysfs_link_sibling(struct kernfs_node *kn)
* kn->parent->dir.children.
*
* Locking:
* mutex_lock(sysfs_mutex)
* mutex_lock(kernfs_mutex)
*/
static void sysfs_unlink_sibling(struct kernfs_node *kn)
{
Expand Down Expand Up @@ -251,7 +251,7 @@ void kernfs_put(struct kernfs_node *kn)
}
kfree(kn->iattr);
ida_simple_remove(&root->ino_ida, kn->ino);
kmem_cache_free(sysfs_dir_cachep, kn);
kmem_cache_free(kernfs_node_cache, kn);

kn = parent;
if (kn) {
Expand Down Expand Up @@ -279,7 +279,7 @@ static int sysfs_dentry_revalidate(struct dentry *dentry, unsigned int flags)
return -ECHILD;

kn = dentry->d_fsdata;
mutex_lock(&sysfs_mutex);
mutex_lock(&kernfs_mutex);

/* The sysfs dirent has been deleted */
if (kn->flags & KERNFS_REMOVED)
Expand All @@ -298,7 +298,7 @@ static int sysfs_dentry_revalidate(struct dentry *dentry, unsigned int flags)
kernfs_info(dentry->d_sb)->ns != kn->ns)
goto out_bad;

mutex_unlock(&sysfs_mutex);
mutex_unlock(&kernfs_mutex);
out_valid:
return 1;
out_bad:
Expand All @@ -312,7 +312,7 @@ static int sysfs_dentry_revalidate(struct dentry *dentry, unsigned int flags)
* is performed at its new name the dentry will be readded
* to the dcache hashes.
*/
mutex_unlock(&sysfs_mutex);
mutex_unlock(&kernfs_mutex);

/* If we have submounts we must allow the vfs caches
* to lie about the state of the filesystem to prevent
Expand All @@ -329,7 +329,7 @@ static void sysfs_dentry_release(struct dentry *dentry)
kernfs_put(dentry->d_fsdata);
}

const struct dentry_operations sysfs_dentry_ops = {
const struct dentry_operations kernfs_dops = {
.d_revalidate = sysfs_dentry_revalidate,
.d_delete = sysfs_dentry_delete,
.d_release = sysfs_dentry_release,
Expand All @@ -348,7 +348,7 @@ struct kernfs_node *sysfs_new_dirent(struct kernfs_root *root,
return NULL;
}

kn = kmem_cache_zalloc(sysfs_dir_cachep, GFP_KERNEL);
kn = kmem_cache_zalloc(kernfs_node_cache, GFP_KERNEL);
if (!kn)
goto err_out1;

Expand All @@ -367,7 +367,7 @@ struct kernfs_node *sysfs_new_dirent(struct kernfs_root *root,
return kn;

err_out2:
kmem_cache_free(sysfs_dir_cachep, kn);
kmem_cache_free(kernfs_node_cache, kn);
err_out1:
kfree(dup_name);
return NULL;
Expand All @@ -378,19 +378,19 @@ struct kernfs_node *sysfs_new_dirent(struct kernfs_root *root,
* @acxt: pointer to kernfs_addrm_cxt to be used
*
* This function is called when the caller is about to add or remove
* kernfs_node. This function acquires sysfs_mutex. @acxt is used to
* keep and pass context to other addrm functions.
* kernfs_node. This function acquires kernfs_mutex. @acxt is used
* to keep and pass context to other addrm functions.
*
* LOCKING:
* Kernel thread context (may sleep). sysfs_mutex is locked on
* Kernel thread context (may sleep). kernfs_mutex is locked on
* return.
*/
void sysfs_addrm_start(struct kernfs_addrm_cxt *acxt)
__acquires(sysfs_mutex)
__acquires(kernfs_mutex)
{
memset(acxt, 0, sizeof(*acxt));

mutex_lock(&sysfs_mutex);
mutex_lock(&kernfs_mutex);
}

/**
Expand Down Expand Up @@ -503,13 +503,13 @@ static void sysfs_remove_one(struct kernfs_addrm_cxt *acxt,
* cleaned up.
*
* LOCKING:
* sysfs_mutex is released.
* kernfs_mutex is released.
*/
void sysfs_addrm_finish(struct kernfs_addrm_cxt *acxt)
__releases(sysfs_mutex)
__releases(kernfs_mutex)
{
/* release resources acquired by sysfs_addrm_start() */
mutex_unlock(&sysfs_mutex);
mutex_unlock(&kernfs_mutex);

/* kill removed kernfs_nodes */
while (acxt->removed) {
Expand Down Expand Up @@ -540,7 +540,7 @@ static struct kernfs_node *kernfs_find_ns(struct kernfs_node *parent,
bool has_ns = kernfs_ns_enabled(parent);
unsigned int hash;

lockdep_assert_held(&sysfs_mutex);
lockdep_assert_held(&kernfs_mutex);

if (has_ns != (bool)ns) {
WARN(1, KERN_WARNING "sysfs: ns %s in '%s' for '%s'\n",
Expand Down Expand Up @@ -580,10 +580,10 @@ struct kernfs_node *kernfs_find_and_get_ns(struct kernfs_node *parent,
{
struct kernfs_node *kn;

mutex_lock(&sysfs_mutex);
mutex_lock(&kernfs_mutex);
kn = kernfs_find_ns(parent, name, ns);
kernfs_get(kn);
mutex_unlock(&sysfs_mutex);
mutex_unlock(&kernfs_mutex);

return kn;
}
Expand Down Expand Up @@ -683,7 +683,7 @@ static struct dentry *sysfs_lookup(struct inode *dir, struct dentry *dentry,
struct inode *inode;
const void *ns = NULL;

mutex_lock(&sysfs_mutex);
mutex_lock(&kernfs_mutex);

if (kernfs_ns_enabled(parent))
ns = kernfs_info(dir->i_sb)->ns;
Expand All @@ -708,11 +708,11 @@ static struct dentry *sysfs_lookup(struct inode *dir, struct dentry *dentry,
/* instantiate and hash dentry */
ret = d_materialise_unique(dentry, inode);
out_unlock:
mutex_unlock(&sysfs_mutex);
mutex_unlock(&kernfs_mutex);
return ret;
}

const struct inode_operations sysfs_dir_inode_operations = {
const struct inode_operations kernfs_dir_iops = {
.lookup = sysfs_lookup,
.permission = sysfs_permission,
.setattr = sysfs_setattr,
Expand Down Expand Up @@ -759,7 +759,7 @@ static struct kernfs_node *sysfs_next_descendant_post(struct kernfs_node *pos,
{
struct rb_node *rbn;

lockdep_assert_held(&sysfs_mutex);
lockdep_assert_held(&kernfs_mutex);

/* if first iteration, visit leftmost descendant which may be root */
if (!pos)
Expand Down Expand Up @@ -859,7 +859,7 @@ int kernfs_rename_ns(struct kernfs_node *kn, struct kernfs_node *new_parent,
{
int error;

mutex_lock(&sysfs_mutex);
mutex_lock(&kernfs_mutex);

error = 0;
if ((kn->parent == new_parent) && (kn->ns == new_ns) &&
Expand Down Expand Up @@ -894,7 +894,7 @@ int kernfs_rename_ns(struct kernfs_node *kn, struct kernfs_node *new_parent,

error = 0;
out:
mutex_unlock(&sysfs_mutex);
mutex_unlock(&kernfs_mutex);
return error;
}

Expand Down Expand Up @@ -968,7 +968,7 @@ static int sysfs_readdir(struct file *file, struct dir_context *ctx)

if (!dir_emit_dots(file, ctx))
return 0;
mutex_lock(&sysfs_mutex);
mutex_lock(&kernfs_mutex);

if (kernfs_ns_enabled(parent))
ns = kernfs_info(dentry->d_sb)->ns;
Expand All @@ -985,12 +985,12 @@ static int sysfs_readdir(struct file *file, struct dir_context *ctx)
file->private_data = pos;
kernfs_get(pos);

mutex_unlock(&sysfs_mutex);
mutex_unlock(&kernfs_mutex);
if (!dir_emit(ctx, name, len, ino, type))
return 0;
mutex_lock(&sysfs_mutex);
mutex_lock(&kernfs_mutex);
}
mutex_unlock(&sysfs_mutex);
mutex_unlock(&kernfs_mutex);
file->private_data = NULL;
ctx->pos = INT_MAX;
return 0;
Expand All @@ -1008,7 +1008,7 @@ static loff_t sysfs_dir_llseek(struct file *file, loff_t offset, int whence)
return ret;
}

const struct file_operations sysfs_dir_operations = {
const struct file_operations kernfs_dir_fops = {
.read = generic_read_dir,
.iterate = sysfs_readdir,
.release = sysfs_dir_release,
Expand Down
2 changes: 1 addition & 1 deletion fs/kernfs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,7 @@ void kernfs_notify(struct kernfs_node *kn)
}
EXPORT_SYMBOL_GPL(kernfs_notify);

const struct file_operations kernfs_file_operations = {
const struct file_operations kernfs_file_fops = {
.read = kernfs_file_read,
.write = kernfs_file_write,
.llseek = generic_file_llseek,
Expand Down
46 changes: 23 additions & 23 deletions fs/kernfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,19 @@

#include "kernfs-internal.h"

static const struct address_space_operations sysfs_aops = {
static const struct address_space_operations kernfs_aops = {
.readpage = simple_readpage,
.write_begin = simple_write_begin,
.write_end = simple_write_end,
};

static struct backing_dev_info sysfs_backing_dev_info = {
.name = "sysfs",
static struct backing_dev_info kernfs_bdi = {
.name = "kernfs",
.ra_pages = 0, /* No readahead */
.capabilities = BDI_CAP_NO_ACCT_AND_WRITEBACK,
};

static const struct inode_operations sysfs_inode_operations = {
static const struct inode_operations kernfs_iops = {
.permission = sysfs_permission,
.setattr = sysfs_setattr,
.getattr = sysfs_getattr,
Expand All @@ -42,8 +42,8 @@ static const struct inode_operations sysfs_inode_operations = {

void __init sysfs_inode_init(void)
{
if (bdi_init(&sysfs_backing_dev_info))
panic("failed to init sysfs_backing_dev_info");
if (bdi_init(&kernfs_bdi))
panic("failed to init kernfs_bdi");
}

static struct kernfs_iattrs *kernfs_iattrs(struct kernfs_node *kn)
Expand Down Expand Up @@ -109,9 +109,9 @@ int kernfs_setattr(struct kernfs_node *kn, const struct iattr *iattr)
{
int ret;

mutex_lock(&sysfs_mutex);
mutex_lock(&kernfs_mutex);
ret = __kernfs_setattr(kn, iattr);
mutex_unlock(&sysfs_mutex);
mutex_unlock(&kernfs_mutex);
return ret;
}

Expand All @@ -124,7 +124,7 @@ int sysfs_setattr(struct dentry *dentry, struct iattr *iattr)
if (!kn)
return -EINVAL;

mutex_lock(&sysfs_mutex);
mutex_lock(&kernfs_mutex);
error = inode_change_ok(inode, iattr);
if (error)
goto out;
Expand All @@ -137,7 +137,7 @@ int sysfs_setattr(struct dentry *dentry, struct iattr *iattr)
setattr_copy(inode, iattr);

out:
mutex_unlock(&sysfs_mutex);
mutex_unlock(&kernfs_mutex);
return error;
}

Expand Down Expand Up @@ -187,9 +187,9 @@ int sysfs_setxattr(struct dentry *dentry, const char *name, const void *value,
if (error)
return error;

mutex_lock(&sysfs_mutex);
mutex_lock(&kernfs_mutex);
error = sysfs_sd_setsecdata(kn, &secdata, &secdata_len);
mutex_unlock(&sysfs_mutex);
mutex_unlock(&kernfs_mutex);

if (secdata)
security_release_secctx(secdata, secdata_len);
Expand Down Expand Up @@ -279,9 +279,9 @@ int sysfs_getattr(struct vfsmount *mnt, struct dentry *dentry,
struct kernfs_node *kn = dentry->d_fsdata;
struct inode *inode = dentry->d_inode;

mutex_lock(&sysfs_mutex);
mutex_lock(&kernfs_mutex);
sysfs_refresh_inode(kn, inode);
mutex_unlock(&sysfs_mutex);
mutex_unlock(&kernfs_mutex);

generic_fillattr(inode, stat);
return 0;
Expand All @@ -291,25 +291,25 @@ static void sysfs_init_inode(struct kernfs_node *kn, struct inode *inode)
{
kernfs_get(kn);
inode->i_private = kn;
inode->i_mapping->a_ops = &sysfs_aops;
inode->i_mapping->backing_dev_info = &sysfs_backing_dev_info;
inode->i_op = &sysfs_inode_operations;
inode->i_mapping->a_ops = &kernfs_aops;
inode->i_mapping->backing_dev_info = &kernfs_bdi;
inode->i_op = &kernfs_iops;

set_default_inode_attr(inode, kn->mode);
sysfs_refresh_inode(kn, inode);

/* initialize inode according to type */
switch (kernfs_type(kn)) {
case KERNFS_DIR:
inode->i_op = &sysfs_dir_inode_operations;
inode->i_fop = &sysfs_dir_operations;
inode->i_op = &kernfs_dir_iops;
inode->i_fop = &kernfs_dir_fops;
break;
case KERNFS_FILE:
inode->i_size = kn->attr.size;
inode->i_fop = &kernfs_file_operations;
inode->i_fop = &kernfs_file_fops;
break;
case KERNFS_LINK:
inode->i_op = &sysfs_symlink_inode_operations;
inode->i_op = &kernfs_symlink_iops;
break;
default:
BUG();
Expand Down Expand Up @@ -369,9 +369,9 @@ int sysfs_permission(struct inode *inode, int mask)

kn = inode->i_private;

mutex_lock(&sysfs_mutex);
mutex_lock(&kernfs_mutex);
sysfs_refresh_inode(kn, inode);
mutex_unlock(&sysfs_mutex);
mutex_unlock(&kernfs_mutex);

return generic_permission(inode, mask);
}
Loading

0 comments on commit a797bfc

Please sign in to comment.