aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2013-11-28 14:54:25 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-11-29 20:48:14 -0500
commit2d0cfbec2a95c16818960fda1dfa815fd1a62070 (patch)
tree8c11e1e9b99eec3c527e63f0ef1ca6af1858dab2
parent496f73944a4a974f89d48920bf368aec8841b195 (diff)
sysfs, kernfs: remove sysfs_add_one()
sysfs_add_one() is a wrapper around __sysfs_add_one() which prints out duplicate name warning if __sysfs_add_one() fails with -EEXIST. The previous kernfs conversions moved all dup warnings to sysfs interface functions and sysfs_add_one() doesn't have any user left. Remove sysfs_add_one() and update __sysfs_add_one() to take its name. This patch doesn't make any functional changes. Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--fs/sysfs/dir.c41
-rw-r--r--fs/sysfs/file.c2
-rw-r--r--fs/sysfs/symlink.c2
-rw-r--r--fs/sysfs/sysfs.h2
4 files changed, 6 insertions, 41 deletions
diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c
index cfbf4091fe5c..e88e9a94a083 100644
--- a/fs/sysfs/dir.c
+++ b/fs/sysfs/dir.c
@@ -395,7 +395,7 @@ void sysfs_addrm_start(struct sysfs_addrm_cxt *acxt)
395} 395}
396 396
397/** 397/**
398 * __sysfs_add_one - add sysfs_dirent to parent without warning 398 * sysfs_add_one - add sysfs_dirent to parent without warning
399 * @acxt: addrm context to use 399 * @acxt: addrm context to use
400 * @sd: sysfs_dirent to be added 400 * @sd: sysfs_dirent to be added
401 * @parent_sd: the parent sysfs_dirent to add @sd to 401 * @parent_sd: the parent sysfs_dirent to add @sd to
@@ -415,8 +415,8 @@ void sysfs_addrm_start(struct sysfs_addrm_cxt *acxt)
415 * 0 on success, -EEXIST if entry with the given name already 415 * 0 on success, -EEXIST if entry with the given name already
416 * exists. 416 * exists.
417 */ 417 */
418int __sysfs_add_one(struct sysfs_addrm_cxt *acxt, struct sysfs_dirent *sd, 418int sysfs_add_one(struct sysfs_addrm_cxt *acxt, struct sysfs_dirent *sd,
419 struct sysfs_dirent *parent_sd) 419 struct sysfs_dirent *parent_sd)
420{ 420{
421 bool has_ns = parent_sd->s_flags & SYSFS_FLAG_NS; 421 bool has_ns = parent_sd->s_flags & SYSFS_FLAG_NS;
422 struct sysfs_inode_attrs *ps_iattr; 422 struct sysfs_inode_attrs *ps_iattr;
@@ -488,39 +488,6 @@ void sysfs_warn_dup(struct sysfs_dirent *parent, const char *name)
488} 488}
489 489
490/** 490/**
491 * sysfs_add_one - add sysfs_dirent to parent
492 * @acxt: addrm context to use
493 * @sd: sysfs_dirent to be added
494 * @parent_sd: the parent sysfs_dirent to add @sd to
495 *
496 * Get @parent_sd and set @sd->s_parent to it and increment nlink of
497 * the parent inode if @sd is a directory and link into the children
498 * list of the parent.
499 *
500 * This function should be called between calls to
501 * sysfs_addrm_start() and sysfs_addrm_finish() and should be
502 * passed the same @acxt as passed to sysfs_addrm_start().
503 *
504 * LOCKING:
505 * Determined by sysfs_addrm_start().
506 *
507 * RETURNS:
508 * 0 on success, -EEXIST if entry with the given name already
509 * exists.
510 */
511int sysfs_add_one(struct sysfs_addrm_cxt *acxt, struct sysfs_dirent *sd,
512 struct sysfs_dirent *parent_sd)
513{
514 int ret;
515
516 ret = __sysfs_add_one(acxt, sd, parent_sd);
517
518 if (ret == -EEXIST)
519 sysfs_warn_dup(parent_sd, sd->s_name);
520 return ret;
521}
522
523/**
524 * sysfs_remove_one - remove sysfs_dirent from parent 491 * sysfs_remove_one - remove sysfs_dirent from parent
525 * @acxt: addrm context to use 492 * @acxt: addrm context to use
526 * @sd: sysfs_dirent to be removed 493 * @sd: sysfs_dirent to be removed
@@ -694,7 +661,7 @@ struct sysfs_dirent *kernfs_create_dir_ns(struct sysfs_dirent *parent,
694 661
695 /* link in */ 662 /* link in */
696 sysfs_addrm_start(&acxt); 663 sysfs_addrm_start(&acxt);
697 rc = __sysfs_add_one(&acxt, sd, parent); 664 rc = sysfs_add_one(&acxt, sd, parent);
698 sysfs_addrm_finish(&acxt); 665 sysfs_addrm_finish(&acxt);
699 666
700 if (!rc) 667 if (!rc)
diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c
index 69cca0f4ccf3..9852450867cf 100644
--- a/fs/sysfs/file.c
+++ b/fs/sysfs/file.c
@@ -1007,7 +1007,7 @@ struct sysfs_dirent *kernfs_create_file_ns(struct sysfs_dirent *parent,
1007 sd->s_flags |= SYSFS_FLAG_HAS_MMAP; 1007 sd->s_flags |= SYSFS_FLAG_HAS_MMAP;
1008 1008
1009 sysfs_addrm_start(&acxt); 1009 sysfs_addrm_start(&acxt);
1010 rc = __sysfs_add_one(&acxt, sd, parent); 1010 rc = sysfs_add_one(&acxt, sd, parent);
1011 sysfs_addrm_finish(&acxt); 1011 sysfs_addrm_finish(&acxt);
1012 1012
1013 if (rc) { 1013 if (rc) {
diff --git a/fs/sysfs/symlink.c b/fs/sysfs/symlink.c
index 352fbbbc0551..76efeab6db4e 100644
--- a/fs/sysfs/symlink.c
+++ b/fs/sysfs/symlink.c
@@ -47,7 +47,7 @@ struct sysfs_dirent *kernfs_create_link(struct sysfs_dirent *parent,
47 sysfs_get(target); /* ref owned by symlink */ 47 sysfs_get(target); /* ref owned by symlink */
48 48
49 sysfs_addrm_start(&acxt); 49 sysfs_addrm_start(&acxt);
50 error = __sysfs_add_one(&acxt, sd, parent); 50 error = sysfs_add_one(&acxt, sd, parent);
51 sysfs_addrm_finish(&acxt); 51 sysfs_addrm_finish(&acxt);
52 52
53 if (!error) 53 if (!error)
diff --git a/fs/sysfs/sysfs.h b/fs/sysfs/sysfs.h
index 28898fa551c6..a6542d27bd9b 100644
--- a/fs/sysfs/sysfs.h
+++ b/fs/sysfs/sysfs.h
@@ -167,8 +167,6 @@ struct sysfs_dirent *sysfs_get_active(struct sysfs_dirent *sd);
167void sysfs_put_active(struct sysfs_dirent *sd); 167void sysfs_put_active(struct sysfs_dirent *sd);
168void sysfs_addrm_start(struct sysfs_addrm_cxt *acxt); 168void sysfs_addrm_start(struct sysfs_addrm_cxt *acxt);
169void sysfs_warn_dup(struct sysfs_dirent *parent, const char *name); 169void sysfs_warn_dup(struct sysfs_dirent *parent, const char *name);
170int __sysfs_add_one(struct sysfs_addrm_cxt *acxt, struct sysfs_dirent *sd,
171 struct sysfs_dirent *parent_sd);
172int sysfs_add_one(struct sysfs_addrm_cxt *acxt, struct sysfs_dirent *sd, 170int sysfs_add_one(struct sysfs_addrm_cxt *acxt, struct sysfs_dirent *sd,
173 struct sysfs_dirent *parent_sd); 171 struct sysfs_dirent *parent_sd);
174void sysfs_addrm_finish(struct sysfs_addrm_cxt *acxt); 172void sysfs_addrm_finish(struct sysfs_addrm_cxt *acxt);