16 #include <linux/module.h>
48 spin_lock(&sysfs_assoc_lock);
51 spin_unlock(&sysfs_assoc_lock);
62 ns_type = sysfs_ns_type(parent_sd);
64 sd->
s_ns = target->
ktype->namespace(target);
71 (ns_type == sysfs_ns_type(sd->
s_symlink.target_sd->s_parent))) {
79 "sysfs: symlink across ns_types %s/%s -> %s/%s\n",
82 sd->
s_symlink.target_sd->s_parent->s_name,
107 return sysfs_do_create_link(kobj, target, name, 1);
122 return sysfs_do_create_link(kobj, target, name, 0);
139 if (targ->
sd && sysfs_ns_type(kobj->
sd))
158 parent_sd = kobj->
sd;
173 const char *old,
const char *
new)
176 const void *old_ns =
NULL, *new_ns =
NULL;
182 parent_sd = kobj->
sd;
185 old_ns = targ->
sd->s_ns;
195 if (sd->
s_symlink.target_sd->s_dir.kobj != targ)
198 if (sysfs_ns_type(parent_sd))
199 new_ns = targ->
ktype->namespace(targ);
208 static int sysfs_get_target_path(
struct sysfs_dirent *parent_sd,
232 while (sd->
s_parent && sd != base) {
246 while (sd->
s_parent && sd != base) {
260 static int sysfs_getlink(
struct dentry *
dentry,
char * path)
268 error = sysfs_get_target_path(parent_sd, target_sd, path);
279 error = sysfs_getlink(dentry, (
char *) page);
283 nd_set_link(nd, error ? ERR_PTR(error) : (
char *)page);
287 static void sysfs_put_link(
struct dentry *dentry,
struct nameidata *nd,
void *
cookie)
289 char *page = nd_get_link(nd);
297 .follow_link = sysfs_follow_link,
298 .put_link = sysfs_put_link,