aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/sysfs/symlink.c20
-rw-r--r--include/linux/sysfs.h8
2 files changed, 28 insertions, 0 deletions
diff --git a/fs/sysfs/symlink.c b/fs/sysfs/symlink.c
index b6ebdaa00f37..f71246bebfe4 100644
--- a/fs/sysfs/symlink.c
+++ b/fs/sysfs/symlink.c
@@ -109,6 +109,26 @@ int sysfs_create_link_nowarn(struct kobject *kobj, struct kobject *target,
109} 109}
110 110
111/** 111/**
112 * sysfs_delete_link - remove symlink in object's directory.
113 * @kobj: object we're acting for.
114 * @targ: object we're pointing to.
115 * @name: name of the symlink to remove.
116 *
117 * Unlike sysfs_remove_link sysfs_delete_link has enough information
118 * to successfully delete symlinks in tagged directories.
119 */
120void sysfs_delete_link(struct kobject *kobj, struct kobject *targ,
121 const char *name)
122{
123 const void *ns = NULL;
124 spin_lock(&sysfs_assoc_lock);
125 if (targ->sd)
126 ns = targ->sd->s_ns;
127 spin_unlock(&sysfs_assoc_lock);
128 sysfs_hash_and_remove(kobj->sd, ns, name);
129}
130
131/**
112 * sysfs_remove_link - remove symlink in object's directory. 132 * sysfs_remove_link - remove symlink in object's directory.
113 * @kobj: object we're acting for. 133 * @kobj: object we're acting for.
114 * @name: name of the symlink to remove. 134 * @name: name of the symlink to remove.
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
index 1885d21b0c80..976c4664b216 100644
--- a/include/linux/sysfs.h
+++ b/include/linux/sysfs.h
@@ -155,6 +155,9 @@ void sysfs_remove_link(struct kobject *kobj, const char *name);
155int sysfs_rename_link(struct kobject *kobj, struct kobject *target, 155int sysfs_rename_link(struct kobject *kobj, struct kobject *target,
156 const char *old_name, const char *new_name); 156 const char *old_name, const char *new_name);
157 157
158void sysfs_delete_link(struct kobject *dir, struct kobject *targ,
159 const char *name);
160
158int __must_check sysfs_create_group(struct kobject *kobj, 161int __must_check sysfs_create_group(struct kobject *kobj,
159 const struct attribute_group *grp); 162 const struct attribute_group *grp);
160int sysfs_update_group(struct kobject *kobj, 163int sysfs_update_group(struct kobject *kobj,
@@ -269,6 +272,11 @@ static inline int sysfs_rename_link(struct kobject *k, struct kobject *t,
269 return 0; 272 return 0;
270} 273}
271 274
275static inline void sysfs_delete_link(struct kobject *k, struct kobject *t,
276 const char *name)
277{
278}
279
272static inline int sysfs_create_group(struct kobject *kobj, 280static inline int sysfs_create_group(struct kobject *kobj,
273 const struct attribute_group *grp) 281 const struct attribute_group *grp)
274{ 282{