Skip to content

Commit

Permalink
sysfs: Allow removal of symlinks in the sysfs root
Browse files Browse the repository at this point in the history
Allow callers of sysfs_remove_link() to pass a NULL kobj, in which case
sysfs_root will be used as the parent directory. This allows us to tear down
top level symlinks created via sysfs_create_link(), which already has
similar handling of a NULL parent object.

Signed-off-by: Mark Fasheh <mfasheh@suse.com>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Mark Fasheh committed Apr 18, 2008
1 parent 5cc3bf2 commit a839c5a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion fs/sysfs/symlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,14 @@ int sysfs_create_link(struct kobject * kobj, struct kobject * target, const char

void sysfs_remove_link(struct kobject * kobj, const char * name)
{
sysfs_hash_and_remove(kobj->sd, name);
struct sysfs_dirent *parent_sd = NULL;

if (!kobj)
parent_sd = &sysfs_root;
else
parent_sd = kobj->sd;

sysfs_hash_and_remove(parent_sd, name);
}

static int sysfs_get_target_path(struct sysfs_dirent *parent_sd,
Expand Down

0 comments on commit a839c5a

Please sign in to comment.