aboutsummaryrefslogtreecommitdiffstats
path: root/fs/sysfs/dir.c
diff options
context:
space:
mode:
authorCornelia Huck <cornelia.huck@de.ibm.com>2008-06-10 05:09:08 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2008-07-22 00:55:01 -0400
commit36ce6dad6e3cb3f050ed41e0beac0070d2062b25 (patch)
tree91c89c903b06dc8b76e66e7b2341bcd6085e81d0 /fs/sysfs/dir.c
parent0ad1d6f37cc3bb234c6e7ae30e40d1d40b9aa258 (diff)
driver core: Suppress sysfs warnings for device_rename().
driver core: Suppress sysfs warnings for device_rename(). Renaming network devices to an already existing name is not something we want sysfs to print a scary warning for, since the callers can deal with this correctly. So let's introduce sysfs_create_link_nowarn() which gets rid of the common warning. Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'fs/sysfs/dir.c')
-rw-r--r--fs/sysfs/dir.c37
1 files changed, 35 insertions, 2 deletions
diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c
index 8c0e4b92574f..c1a7efb310bf 100644
--- a/fs/sysfs/dir.c
+++ b/fs/sysfs/dir.c
@@ -398,7 +398,7 @@ void sysfs_addrm_start(struct sysfs_addrm_cxt *acxt,
398} 398}
399 399
400/** 400/**
401 * sysfs_add_one - add sysfs_dirent to parent 401 * __sysfs_add_one - add sysfs_dirent to parent without warning
402 * @acxt: addrm context to use 402 * @acxt: addrm context to use
403 * @sd: sysfs_dirent to be added 403 * @sd: sysfs_dirent to be added
404 * 404 *
@@ -417,7 +417,7 @@ void sysfs_addrm_start(struct sysfs_addrm_cxt *acxt,
417 * 0 on success, -EEXIST if entry with the given name already 417 * 0 on success, -EEXIST if entry with the given name already
418 * exists. 418 * exists.
419 */ 419 */
420int sysfs_add_one(struct sysfs_addrm_cxt *acxt, struct sysfs_dirent *sd) 420int __sysfs_add_one(struct sysfs_addrm_cxt *acxt, struct sysfs_dirent *sd)
421{ 421{
422 if (sysfs_find_dirent(acxt->parent_sd, sd->s_name)) 422 if (sysfs_find_dirent(acxt->parent_sd, sd->s_name))
423 return -EEXIST; 423 return -EEXIST;
@@ -435,6 +435,39 @@ int sysfs_add_one(struct sysfs_addrm_cxt *acxt, struct sysfs_dirent *sd)
435} 435}
436 436
437/** 437/**
438 * sysfs_add_one - add sysfs_dirent to parent
439 * @acxt: addrm context to use
440 * @sd: sysfs_dirent to be added
441 *
442 * Get @acxt->parent_sd and set sd->s_parent to it and increment
443 * nlink of parent inode if @sd is a directory and link into the
444 * children list of the parent.
445 *
446 * This function should be called between calls to
447 * sysfs_addrm_start() and sysfs_addrm_finish() and should be
448 * passed the same @acxt as passed to sysfs_addrm_start().
449 *
450 * LOCKING:
451 * Determined by sysfs_addrm_start().
452 *
453 * RETURNS:
454 * 0 on success, -EEXIST if entry with the given name already
455 * exists.
456 */
457int sysfs_add_one(struct sysfs_addrm_cxt *acxt, struct sysfs_dirent *sd)
458{
459 int ret;
460
461 ret = __sysfs_add_one(acxt, sd);
462 if (ret == -EEXIST) {
463 printk(KERN_WARNING "sysfs: duplicate filename '%s' "
464 "can not be created\n", sd->s_name);
465 WARN_ON(1);
466 }
467 return ret;
468}
469
470/**
438 * sysfs_remove_one - remove sysfs_dirent from parent 471 * sysfs_remove_one - remove sysfs_dirent from parent
439 * @acxt: addrm context to use 472 * @acxt: addrm context to use
440 * @sd: sysfs_dirent to be removed 473 * @sd: sysfs_dirent to be removed