diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/sysfs/file.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c index 98b0910ad80c..8d4d839a9d88 100644 --- a/fs/sysfs/file.c +++ b/fs/sysfs/file.c | |||
@@ -502,6 +502,30 @@ int sysfs_create_file(struct kobject * kobj, const struct attribute * attr) | |||
502 | 502 | ||
503 | 503 | ||
504 | /** | 504 | /** |
505 | * sysfs_add_file_to_group - add an attribute file to a pre-existing group. | ||
506 | * @kobj: object we're acting for. | ||
507 | * @attr: attribute descriptor. | ||
508 | * @group: group name. | ||
509 | */ | ||
510 | int sysfs_add_file_to_group(struct kobject *kobj, | ||
511 | const struct attribute *attr, const char *group) | ||
512 | { | ||
513 | struct dentry *dir; | ||
514 | int error; | ||
515 | |||
516 | dir = lookup_one_len(group, kobj->dentry, strlen(group)); | ||
517 | if (IS_ERR(dir)) | ||
518 | error = PTR_ERR(dir); | ||
519 | else { | ||
520 | error = sysfs_add_file(dir, attr, SYSFS_KOBJ_ATTR); | ||
521 | dput(dir); | ||
522 | } | ||
523 | return error; | ||
524 | } | ||
525 | EXPORT_SYMBOL_GPL(sysfs_add_file_to_group); | ||
526 | |||
527 | |||
528 | /** | ||
505 | * sysfs_update_file - update the modified timestamp on an object attribute. | 529 | * sysfs_update_file - update the modified timestamp on an object attribute. |
506 | * @kobj: object we're acting for. | 530 | * @kobj: object we're acting for. |
507 | * @attr: attribute descriptor. | 531 | * @attr: attribute descriptor. |
@@ -586,6 +610,26 @@ void sysfs_remove_file(struct kobject * kobj, const struct attribute * attr) | |||
586 | } | 610 | } |
587 | 611 | ||
588 | 612 | ||
613 | /** | ||
614 | * sysfs_remove_file_from_group - remove an attribute file from a group. | ||
615 | * @kobj: object we're acting for. | ||
616 | * @attr: attribute descriptor. | ||
617 | * @group: group name. | ||
618 | */ | ||
619 | void sysfs_remove_file_from_group(struct kobject *kobj, | ||
620 | const struct attribute *attr, const char *group) | ||
621 | { | ||
622 | struct dentry *dir; | ||
623 | |||
624 | dir = lookup_one_len(group, kobj->dentry, strlen(group)); | ||
625 | if (!IS_ERR(dir)) { | ||
626 | sysfs_hash_and_remove(dir, attr->name); | ||
627 | dput(dir); | ||
628 | } | ||
629 | } | ||
630 | EXPORT_SYMBOL_GPL(sysfs_remove_file_from_group); | ||
631 | |||
632 | |||
589 | EXPORT_SYMBOL_GPL(sysfs_create_file); | 633 | EXPORT_SYMBOL_GPL(sysfs_create_file); |
590 | EXPORT_SYMBOL_GPL(sysfs_remove_file); | 634 | EXPORT_SYMBOL_GPL(sysfs_remove_file); |
591 | EXPORT_SYMBOL_GPL(sysfs_update_file); | 635 | EXPORT_SYMBOL_GPL(sysfs_update_file); |