aboutsummaryrefslogtreecommitdiffstats
path: root/fs/kernfs/dir.c
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2013-12-11 14:11:57 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-12-11 20:39:20 -0500
commita797bfc30532388e8a11ca726df60cdd77aa8675 (patch)
tree4e769d1d1dd394423e849091c39cefd6855ff53f /fs/kernfs/dir.c
parentdf23fc39bce03bb26e63bea57fc5f5bf6882d74b (diff)
kernfs: s/sysfs/kernfs/ in global variables
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 <tj@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/kernfs/dir.c')
-rw-r--r--fs/kernfs/dir.c64
1 files changed, 32 insertions, 32 deletions
diff --git a/fs/kernfs/dir.c b/fs/kernfs/dir.c
index bc8a3b367a8c..d3c66237474f 100644
--- a/fs/kernfs/dir.c
+++ b/fs/kernfs/dir.c
@@ -17,7 +17,7 @@
17 17
18#include "kernfs-internal.h" 18#include "kernfs-internal.h"
19 19
20DEFINE_MUTEX(sysfs_mutex); 20DEFINE_MUTEX(kernfs_mutex);
21 21
22#define rb_to_kn(X) rb_entry((X), struct kernfs_node, rb) 22#define rb_to_kn(X) rb_entry((X), struct kernfs_node, rb)
23 23
@@ -68,7 +68,7 @@ static int sysfs_sd_compare(const struct kernfs_node *left,
68 * @kn->parent->dir.children. 68 * @kn->parent->dir.children.
69 * 69 *
70 * Locking: 70 * Locking:
71 * mutex_lock(sysfs_mutex) 71 * mutex_lock(kernfs_mutex)
72 * 72 *
73 * RETURNS: 73 * RETURNS:
74 * 0 on susccess -EEXIST on failure. 74 * 0 on susccess -EEXIST on failure.
@@ -109,7 +109,7 @@ static int sysfs_link_sibling(struct kernfs_node *kn)
109 * kn->parent->dir.children. 109 * kn->parent->dir.children.
110 * 110 *
111 * Locking: 111 * Locking:
112 * mutex_lock(sysfs_mutex) 112 * mutex_lock(kernfs_mutex)
113 */ 113 */
114static void sysfs_unlink_sibling(struct kernfs_node *kn) 114static void sysfs_unlink_sibling(struct kernfs_node *kn)
115{ 115{
@@ -251,7 +251,7 @@ void kernfs_put(struct kernfs_node *kn)
251 } 251 }
252 kfree(kn->iattr); 252 kfree(kn->iattr);
253 ida_simple_remove(&root->ino_ida, kn->ino); 253 ida_simple_remove(&root->ino_ida, kn->ino);
254 kmem_cache_free(sysfs_dir_cachep, kn); 254 kmem_cache_free(kernfs_node_cache, kn);
255 255
256 kn = parent; 256 kn = parent;
257 if (kn) { 257 if (kn) {
@@ -279,7 +279,7 @@ static int sysfs_dentry_revalidate(struct dentry *dentry, unsigned int flags)
279 return -ECHILD; 279 return -ECHILD;
280 280
281 kn = dentry->d_fsdata; 281 kn = dentry->d_fsdata;
282 mutex_lock(&sysfs_mutex); 282 mutex_lock(&kernfs_mutex);
283 283
284 /* The sysfs dirent has been deleted */ 284 /* The sysfs dirent has been deleted */
285 if (kn->flags & KERNFS_REMOVED) 285 if (kn->flags & KERNFS_REMOVED)
@@ -298,7 +298,7 @@ static int sysfs_dentry_revalidate(struct dentry *dentry, unsigned int flags)
298 kernfs_info(dentry->d_sb)->ns != kn->ns) 298 kernfs_info(dentry->d_sb)->ns != kn->ns)
299 goto out_bad; 299 goto out_bad;
300 300
301 mutex_unlock(&sysfs_mutex); 301 mutex_unlock(&kernfs_mutex);
302out_valid: 302out_valid:
303 return 1; 303 return 1;
304out_bad: 304out_bad:
@@ -312,7 +312,7 @@ out_bad:
312 * is performed at its new name the dentry will be readded 312 * is performed at its new name the dentry will be readded
313 * to the dcache hashes. 313 * to the dcache hashes.
314 */ 314 */
315 mutex_unlock(&sysfs_mutex); 315 mutex_unlock(&kernfs_mutex);
316 316
317 /* If we have submounts we must allow the vfs caches 317 /* If we have submounts we must allow the vfs caches
318 * to lie about the state of the filesystem to prevent 318 * to lie about the state of the filesystem to prevent
@@ -329,7 +329,7 @@ static void sysfs_dentry_release(struct dentry *dentry)
329 kernfs_put(dentry->d_fsdata); 329 kernfs_put(dentry->d_fsdata);
330} 330}
331 331
332const struct dentry_operations sysfs_dentry_ops = { 332const struct dentry_operations kernfs_dops = {
333 .d_revalidate = sysfs_dentry_revalidate, 333 .d_revalidate = sysfs_dentry_revalidate,
334 .d_delete = sysfs_dentry_delete, 334 .d_delete = sysfs_dentry_delete,
335 .d_release = sysfs_dentry_release, 335 .d_release = sysfs_dentry_release,
@@ -348,7 +348,7 @@ struct kernfs_node *sysfs_new_dirent(struct kernfs_root *root,
348 return NULL; 348 return NULL;
349 } 349 }
350 350
351 kn = kmem_cache_zalloc(sysfs_dir_cachep, GFP_KERNEL); 351 kn = kmem_cache_zalloc(kernfs_node_cache, GFP_KERNEL);
352 if (!kn) 352 if (!kn)
353 goto err_out1; 353 goto err_out1;
354 354
@@ -367,7 +367,7 @@ struct kernfs_node *sysfs_new_dirent(struct kernfs_root *root,
367 return kn; 367 return kn;
368 368
369 err_out2: 369 err_out2:
370 kmem_cache_free(sysfs_dir_cachep, kn); 370 kmem_cache_free(kernfs_node_cache, kn);
371 err_out1: 371 err_out1:
372 kfree(dup_name); 372 kfree(dup_name);
373 return NULL; 373 return NULL;
@@ -378,19 +378,19 @@ struct kernfs_node *sysfs_new_dirent(struct kernfs_root *root,
378 * @acxt: pointer to kernfs_addrm_cxt to be used 378 * @acxt: pointer to kernfs_addrm_cxt to be used
379 * 379 *
380 * This function is called when the caller is about to add or remove 380 * This function is called when the caller is about to add or remove
381 * kernfs_node. This function acquires sysfs_mutex. @acxt is used to 381 * kernfs_node. This function acquires kernfs_mutex. @acxt is used
382 * keep and pass context to other addrm functions. 382 * to keep and pass context to other addrm functions.
383 * 383 *
384 * LOCKING: 384 * LOCKING:
385 * Kernel thread context (may sleep). sysfs_mutex is locked on 385 * Kernel thread context (may sleep). kernfs_mutex is locked on
386 * return. 386 * return.
387 */ 387 */
388void sysfs_addrm_start(struct kernfs_addrm_cxt *acxt) 388void sysfs_addrm_start(struct kernfs_addrm_cxt *acxt)
389 __acquires(sysfs_mutex) 389 __acquires(kernfs_mutex)
390{ 390{
391 memset(acxt, 0, sizeof(*acxt)); 391 memset(acxt, 0, sizeof(*acxt));
392 392
393 mutex_lock(&sysfs_mutex); 393 mutex_lock(&kernfs_mutex);
394} 394}
395 395
396/** 396/**
@@ -503,13 +503,13 @@ static void sysfs_remove_one(struct kernfs_addrm_cxt *acxt,
503 * cleaned up. 503 * cleaned up.
504 * 504 *
505 * LOCKING: 505 * LOCKING:
506 * sysfs_mutex is released. 506 * kernfs_mutex is released.
507 */ 507 */
508void sysfs_addrm_finish(struct kernfs_addrm_cxt *acxt) 508void sysfs_addrm_finish(struct kernfs_addrm_cxt *acxt)
509 __releases(sysfs_mutex) 509 __releases(kernfs_mutex)
510{ 510{
511 /* release resources acquired by sysfs_addrm_start() */ 511 /* release resources acquired by sysfs_addrm_start() */
512 mutex_unlock(&sysfs_mutex); 512 mutex_unlock(&kernfs_mutex);
513 513
514 /* kill removed kernfs_nodes */ 514 /* kill removed kernfs_nodes */
515 while (acxt->removed) { 515 while (acxt->removed) {
@@ -540,7 +540,7 @@ static struct kernfs_node *kernfs_find_ns(struct kernfs_node *parent,
540 bool has_ns = kernfs_ns_enabled(parent); 540 bool has_ns = kernfs_ns_enabled(parent);
541 unsigned int hash; 541 unsigned int hash;
542 542
543 lockdep_assert_held(&sysfs_mutex); 543 lockdep_assert_held(&kernfs_mutex);
544 544
545 if (has_ns != (bool)ns) { 545 if (has_ns != (bool)ns) {
546 WARN(1, KERN_WARNING "sysfs: ns %s in '%s' for '%s'\n", 546 WARN(1, KERN_WARNING "sysfs: ns %s in '%s' for '%s'\n",
@@ -580,10 +580,10 @@ struct kernfs_node *kernfs_find_and_get_ns(struct kernfs_node *parent,
580{ 580{
581 struct kernfs_node *kn; 581 struct kernfs_node *kn;
582 582
583 mutex_lock(&sysfs_mutex); 583 mutex_lock(&kernfs_mutex);
584 kn = kernfs_find_ns(parent, name, ns); 584 kn = kernfs_find_ns(parent, name, ns);
585 kernfs_get(kn); 585 kernfs_get(kn);
586 mutex_unlock(&sysfs_mutex); 586 mutex_unlock(&kernfs_mutex);
587 587
588 return kn; 588 return kn;
589} 589}
@@ -683,7 +683,7 @@ static struct dentry *sysfs_lookup(struct inode *dir, struct dentry *dentry,
683 struct inode *inode; 683 struct inode *inode;
684 const void *ns = NULL; 684 const void *ns = NULL;
685 685
686 mutex_lock(&sysfs_mutex); 686 mutex_lock(&kernfs_mutex);
687 687
688 if (kernfs_ns_enabled(parent)) 688 if (kernfs_ns_enabled(parent))
689 ns = kernfs_info(dir->i_sb)->ns; 689 ns = kernfs_info(dir->i_sb)->ns;
@@ -708,11 +708,11 @@ static struct dentry *sysfs_lookup(struct inode *dir, struct dentry *dentry,
708 /* instantiate and hash dentry */ 708 /* instantiate and hash dentry */
709 ret = d_materialise_unique(dentry, inode); 709 ret = d_materialise_unique(dentry, inode);
710 out_unlock: 710 out_unlock:
711 mutex_unlock(&sysfs_mutex); 711 mutex_unlock(&kernfs_mutex);
712 return ret; 712 return ret;
713} 713}
714 714
715const struct inode_operations sysfs_dir_inode_operations = { 715const struct inode_operations kernfs_dir_iops = {
716 .lookup = sysfs_lookup, 716 .lookup = sysfs_lookup,
717 .permission = sysfs_permission, 717 .permission = sysfs_permission,
718 .setattr = sysfs_setattr, 718 .setattr = sysfs_setattr,
@@ -759,7 +759,7 @@ static struct kernfs_node *sysfs_next_descendant_post(struct kernfs_node *pos,
759{ 759{
760 struct rb_node *rbn; 760 struct rb_node *rbn;
761 761
762 lockdep_assert_held(&sysfs_mutex); 762 lockdep_assert_held(&kernfs_mutex);
763 763
764 /* if first iteration, visit leftmost descendant which may be root */ 764 /* if first iteration, visit leftmost descendant which may be root */
765 if (!pos) 765 if (!pos)
@@ -859,7 +859,7 @@ int kernfs_rename_ns(struct kernfs_node *kn, struct kernfs_node *new_parent,
859{ 859{
860 int error; 860 int error;
861 861
862 mutex_lock(&sysfs_mutex); 862 mutex_lock(&kernfs_mutex);
863 863
864 error = 0; 864 error = 0;
865 if ((kn->parent == new_parent) && (kn->ns == new_ns) && 865 if ((kn->parent == new_parent) && (kn->ns == new_ns) &&
@@ -894,7 +894,7 @@ int kernfs_rename_ns(struct kernfs_node *kn, struct kernfs_node *new_parent,
894 894
895 error = 0; 895 error = 0;
896 out: 896 out:
897 mutex_unlock(&sysfs_mutex); 897 mutex_unlock(&kernfs_mutex);
898 return error; 898 return error;
899} 899}
900 900
@@ -968,7 +968,7 @@ static int sysfs_readdir(struct file *file, struct dir_context *ctx)
968 968
969 if (!dir_emit_dots(file, ctx)) 969 if (!dir_emit_dots(file, ctx))
970 return 0; 970 return 0;
971 mutex_lock(&sysfs_mutex); 971 mutex_lock(&kernfs_mutex);
972 972
973 if (kernfs_ns_enabled(parent)) 973 if (kernfs_ns_enabled(parent))
974 ns = kernfs_info(dentry->d_sb)->ns; 974 ns = kernfs_info(dentry->d_sb)->ns;
@@ -985,12 +985,12 @@ static int sysfs_readdir(struct file *file, struct dir_context *ctx)
985 file->private_data = pos; 985 file->private_data = pos;
986 kernfs_get(pos); 986 kernfs_get(pos);
987 987
988 mutex_unlock(&sysfs_mutex); 988 mutex_unlock(&kernfs_mutex);
989 if (!dir_emit(ctx, name, len, ino, type)) 989 if (!dir_emit(ctx, name, len, ino, type))
990 return 0; 990 return 0;
991 mutex_lock(&sysfs_mutex); 991 mutex_lock(&kernfs_mutex);
992 } 992 }
993 mutex_unlock(&sysfs_mutex); 993 mutex_unlock(&kernfs_mutex);
994 file->private_data = NULL; 994 file->private_data = NULL;
995 ctx->pos = INT_MAX; 995 ctx->pos = INT_MAX;
996 return 0; 996 return 0;
@@ -1008,7 +1008,7 @@ static loff_t sysfs_dir_llseek(struct file *file, loff_t offset, int whence)
1008 return ret; 1008 return ret;
1009} 1009}
1010 1010
1011const struct file_operations sysfs_dir_operations = { 1011const struct file_operations kernfs_dir_fops = {
1012 .read = generic_read_dir, 1012 .read = generic_read_dir,
1013 .iterate = sysfs_readdir, 1013 .iterate = sysfs_readdir,
1014 .release = sysfs_dir_release, 1014 .release = sysfs_dir_release,