From da3a50bf8be4c12b9a6effb51b41a8f44b740775 Mon Sep 17 00:00:00 2001 From: "Eric W. Biederman" Date: Tue, 30 Mar 2010 11:31:28 -0700 Subject: [PATCH] --- yaml --- r: 196055 b: refs/heads/master c: 746edb7ae8a1abdd39be2b28c03aa073183340db h: refs/heads/master i: 196053: 1832c0e7a912df4bd2a4f5014cf07c9656aab511 196051: 8067c8e74445b2f8f3492a856c55c79c18f60bb2 196047: 59dba99381dcb26ea76f65b58084c71a2981f07a v: v3 --- [refs] | 2 +- trunk/fs/sysfs/symlink.c | 20 ++++++++++++++++++++ trunk/include/linux/sysfs.h | 8 ++++++++ 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index 4f201e6dbabe..afb4f2012ab9 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: af10ec77b43335ab4e473e4087d85979caf02d65 +refs/heads/master: 746edb7ae8a1abdd39be2b28c03aa073183340db diff --git a/trunk/fs/sysfs/symlink.c b/trunk/fs/sysfs/symlink.c index b6ebdaa00f37..f71246bebfe4 100644 --- a/trunk/fs/sysfs/symlink.c +++ b/trunk/fs/sysfs/symlink.c @@ -108,6 +108,26 @@ int sysfs_create_link_nowarn(struct kobject *kobj, struct kobject *target, return sysfs_do_create_link(kobj, target, name, 0); } +/** + * sysfs_delete_link - remove symlink in object's directory. + * @kobj: object we're acting for. + * @targ: object we're pointing to. + * @name: name of the symlink to remove. + * + * Unlike sysfs_remove_link sysfs_delete_link has enough information + * to successfully delete symlinks in tagged directories. + */ +void sysfs_delete_link(struct kobject *kobj, struct kobject *targ, + const char *name) +{ + const void *ns = NULL; + spin_lock(&sysfs_assoc_lock); + if (targ->sd) + ns = targ->sd->s_ns; + spin_unlock(&sysfs_assoc_lock); + sysfs_hash_and_remove(kobj->sd, ns, name); +} + /** * sysfs_remove_link - remove symlink in object's directory. * @kobj: object we're acting for. diff --git a/trunk/include/linux/sysfs.h b/trunk/include/linux/sysfs.h index 1885d21b0c80..976c4664b216 100644 --- a/trunk/include/linux/sysfs.h +++ b/trunk/include/linux/sysfs.h @@ -155,6 +155,9 @@ void sysfs_remove_link(struct kobject *kobj, const char *name); int sysfs_rename_link(struct kobject *kobj, struct kobject *target, const char *old_name, const char *new_name); +void sysfs_delete_link(struct kobject *dir, struct kobject *targ, + const char *name); + int __must_check sysfs_create_group(struct kobject *kobj, const struct attribute_group *grp); int sysfs_update_group(struct kobject *kobj, @@ -269,6 +272,11 @@ static inline int sysfs_rename_link(struct kobject *k, struct kobject *t, return 0; } +static inline void sysfs_delete_link(struct kobject *k, struct kobject *t, + const char *name) +{ +} + static inline int sysfs_create_group(struct kobject *kobj, const struct attribute_group *grp) {