aboutsummaryrefslogtreecommitdiffstats
path: root/fs/sysfs/symlink.c
diff options
context:
space:
mode:
authorTejun Heo <htejun@gmail.com>2007-06-13 14:45:15 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2007-07-11 19:09:04 -0400
commit0c096b507f15397da890051ee73de4266d3941fb (patch)
treec6b7d204a493157b3926bdb46500313eee9f9690 /fs/sysfs/symlink.c
parent13b3086d2ea483cbcae5a4236446cecc082a72cf (diff)
sysfs: add sysfs_dirent->s_name
Add s_name to sysfs_dirent. This is to further reduce dependency to the associated dentry. Name is copied for directories and symlinks but not for attributes. Where possible, name dereferences are converted to use sd->s_name. sysfs_symlink->link_name and sysfs_get_name() are unused now and removed. This change allows symlink to be implemented using sysfs_dirent tree proper, which is the last remaining dentry-dependent sysfs walk. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'fs/sysfs/symlink.c')
-rw-r--r--fs/sysfs/symlink.c8
1 files changed, 1 insertions, 7 deletions
diff --git a/fs/sysfs/symlink.c b/fs/sysfs/symlink.c
index d96bb9cbc9d4..c72820450e7c 100644
--- a/fs/sysfs/symlink.c
+++ b/fs/sysfs/symlink.c
@@ -57,14 +57,9 @@ static int sysfs_add_link(struct dentry * parent, const char * name, struct kobj
57 if (!sl) 57 if (!sl)
58 goto err_out; 58 goto err_out;
59 59
60 sl->link_name = kmalloc(strlen(name) + 1, GFP_KERNEL);
61 if (!sl->link_name)
62 goto err_out;
63
64 strcpy(sl->link_name, name);
65 sl->target_kobj = kobject_get(target); 60 sl->target_kobj = kobject_get(target);
66 61
67 sd = sysfs_new_dirent(sl, S_IFLNK|S_IRWXUGO, SYSFS_KOBJ_LINK); 62 sd = sysfs_new_dirent(name, sl, S_IFLNK|S_IRWXUGO, SYSFS_KOBJ_LINK);
68 if (!sd) 63 if (!sd)
69 goto err_out; 64 goto err_out;
70 sysfs_attach_dirent(sd, parent_sd, NULL); 65 sysfs_attach_dirent(sd, parent_sd, NULL);
@@ -74,7 +69,6 @@ static int sysfs_add_link(struct dentry * parent, const char * name, struct kobj
74 err_out: 69 err_out:
75 if (sl) { 70 if (sl) {
76 kobject_put(sl->target_kobj); 71 kobject_put(sl->target_kobj);
77 kfree(sl->link_name);
78 kfree(sl); 72 kfree(sl);
79 } 73 }
80 return error; 74 return error;