diff options
Diffstat (limited to 'fs/sysfs/dir.c')
| -rw-r--r-- | fs/sysfs/dir.c | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c index 8c0e4b92574f..aedaeba82ae5 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 | */ |
| 420 | int sysfs_add_one(struct sysfs_addrm_cxt *acxt, struct sysfs_dirent *sd) | 420 | int __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,36 @@ 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 | */ | ||
| 457 | int 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 | WARN(ret == -EEXIST, KERN_WARNING "sysfs: duplicate filename '%s' " | ||
| 463 | "can not be created\n", sd->s_name); | ||
| 464 | return ret; | ||
| 465 | } | ||
| 466 | |||
| 467 | /** | ||
| 438 | * sysfs_remove_one - remove sysfs_dirent from parent | 468 | * sysfs_remove_one - remove sysfs_dirent from parent |
| 439 | * @acxt: addrm context to use | 469 | * @acxt: addrm context to use |
| 440 | * @sd: sysfs_dirent to be removed | 470 | * @sd: sysfs_dirent to be removed |
