Commit 51225039 authored by Tejun Heo's avatar Tejun Heo Committed by Greg Kroah-Hartman

sysfs: make directory dentries and inodes reclaimable

This patch makes dentries and inodes for sysfs directories
reclaimable.

* sysfs_notify() is modified to walk sysfs_dirent tree instead of
  dentry tree.

* sysfs_update_file() and sysfs_chmod_file() use sysfs_get_dentry() to
  grab the victim dentry.

* sysfs_rename_dir() and sysfs_move_dir() grab all dentries using
  sysfs_get_dentry() on startup.

* Dentries for all shadowed directories are pinned in memory to serve
  as lookup start point.
Signed-off-by: default avatarTejun Heo <htejun@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 53e0ae92
...@@ -568,9 +568,9 @@ static void sysfs_drop_dentry(struct sysfs_dirent *sd) ...@@ -568,9 +568,9 @@ static void sysfs_drop_dentry(struct sysfs_dirent *sd)
spin_unlock(&dcache_lock); spin_unlock(&dcache_lock);
spin_unlock(&sysfs_assoc_lock); spin_unlock(&sysfs_assoc_lock);
/* dentries for shadowed inodes are pinned, unpin */
if (dentry && sysfs_is_shadowed_inode(dentry->d_inode))
dput(dentry); dput(dentry);
/* XXX: unpin if directory, this will go away soon */
if (sysfs_type(sd) == SYSFS_DIR)
dput(dentry); dput(dentry);
/* adjust nlink and update timestamp */ /* adjust nlink and update timestamp */
...@@ -686,69 +686,29 @@ struct sysfs_dirent *sysfs_get_dirent(struct sysfs_dirent *parent_sd, ...@@ -686,69 +686,29 @@ struct sysfs_dirent *sysfs_get_dirent(struct sysfs_dirent *parent_sd,
static int create_dir(struct kobject *kobj, struct sysfs_dirent *parent_sd, static int create_dir(struct kobject *kobj, struct sysfs_dirent *parent_sd,
const char *name, struct sysfs_dirent **p_sd) const char *name, struct sysfs_dirent **p_sd)
{ {
struct dentry *parent = parent_sd->s_dentry;
struct sysfs_addrm_cxt acxt;
int error;
umode_t mode = S_IFDIR| S_IRWXU | S_IRUGO | S_IXUGO; umode_t mode = S_IFDIR| S_IRWXU | S_IRUGO | S_IXUGO;
struct dentry *dentry; struct sysfs_addrm_cxt acxt;
struct inode *inode;
struct sysfs_dirent *sd; struct sysfs_dirent *sd;
sysfs_addrm_start(&acxt, parent_sd);
/* allocate */ /* allocate */
dentry = lookup_one_len(name, parent, strlen(name));
if (IS_ERR(dentry)) {
error = PTR_ERR(dentry);
goto out_finish;
}
error = -EEXIST;
if (dentry->d_inode)
goto out_dput;
error = -ENOMEM;
sd = sysfs_new_dirent(name, mode, SYSFS_DIR); sd = sysfs_new_dirent(name, mode, SYSFS_DIR);
if (!sd) if (!sd)
goto out_drop; return -ENOMEM;
sd->s_elem.dir.kobj = kobj; sd->s_elem.dir.kobj = kobj;
inode = sysfs_get_inode(sd);
if (!inode)
goto out_sput;
if (inode->i_state & I_NEW) {
inode->i_op = &sysfs_dir_inode_operations;
inode->i_fop = &sysfs_dir_operations;
/* directory inodes start off with i_nlink == 2 (for ".") */
inc_nlink(inode);
}
/* link in */ /* link in */
error = -EEXIST; sysfs_addrm_start(&acxt, parent_sd);
if (sysfs_find_dirent(parent_sd, name)) if (!sysfs_find_dirent(parent_sd, name)) {
goto out_iput;
sysfs_add_one(&acxt, sd); sysfs_add_one(&acxt, sd);
sysfs_link_sibling(sd); sysfs_link_sibling(sd);
sysfs_instantiate(dentry, inode); }
sysfs_attach_dentry(sd, dentry); if (sysfs_addrm_finish(&acxt)) {
*p_sd = sd; *p_sd = sd;
error = 0; return 0;
goto out_finish; /* pin directory dentry in core */ }
out_iput:
iput(inode);
out_sput:
sysfs_put(sd); sysfs_put(sd);
out_drop: return -EEXIST;
d_drop(dentry);
out_dput:
dput(dentry);
out_finish:
sysfs_addrm_finish(&acxt);
return error;
} }
int sysfs_create_subdir(struct kobject *kobj, const char *name, int sysfs_create_subdir(struct kobject *kobj, const char *name,
...@@ -785,6 +745,17 @@ int sysfs_create_dir(struct kobject *kobj, ...@@ -785,6 +745,17 @@ int sysfs_create_dir(struct kobject *kobj,
return error; return error;
} }
static int sysfs_count_nlink(struct sysfs_dirent *sd)
{
struct sysfs_dirent *child;
int nr = 0;
for (child = sd->s_children; child; child = child->s_sibling)
if (sysfs_type(child) == SYSFS_DIR)
nr++;
return nr + 2;
}
static struct dentry * sysfs_lookup(struct inode *dir, struct dentry *dentry, static struct dentry * sysfs_lookup(struct inode *dir, struct dentry *dentry,
struct nameidata *nd) struct nameidata *nd)
{ {
...@@ -795,7 +766,7 @@ static struct dentry * sysfs_lookup(struct inode *dir, struct dentry *dentry, ...@@ -795,7 +766,7 @@ static struct dentry * sysfs_lookup(struct inode *dir, struct dentry *dentry,
int found = 0; int found = 0;
for (sd = parent_sd->s_children; sd; sd = sd->s_sibling) { for (sd = parent_sd->s_children; sd; sd = sd->s_sibling) {
if ((sysfs_type(sd) & SYSFS_NOT_PINNED) && if (sysfs_type(sd) &&
!strcmp(sd->s_name, dentry->d_name.name)) { !strcmp(sd->s_name, dentry->d_name.name)) {
found = 1; found = 1;
break; break;
...@@ -816,6 +787,11 @@ static struct dentry * sysfs_lookup(struct inode *dir, struct dentry *dentry, ...@@ -816,6 +787,11 @@ static struct dentry * sysfs_lookup(struct inode *dir, struct dentry *dentry,
if (inode->i_state & I_NEW) { if (inode->i_state & I_NEW) {
/* initialize inode according to type */ /* initialize inode according to type */
switch (sysfs_type(sd)) { switch (sysfs_type(sd)) {
case SYSFS_DIR:
inode->i_op = &sysfs_dir_inode_operations;
inode->i_fop = &sysfs_dir_operations;
inode->i_nlink = sysfs_count_nlink(sd);
break;
case SYSFS_KOBJ_ATTR: case SYSFS_KOBJ_ATTR:
inode->i_size = PAGE_SIZE; inode->i_size = PAGE_SIZE;
inode->i_fop = &sysfs_file_operations; inode->i_fop = &sysfs_file_operations;
...@@ -876,7 +852,7 @@ static void __sysfs_remove_dir(struct sysfs_dirent *dir_sd) ...@@ -876,7 +852,7 @@ static void __sysfs_remove_dir(struct sysfs_dirent *dir_sd)
while (*pos) { while (*pos) {
struct sysfs_dirent *sd = *pos; struct sysfs_dirent *sd = *pos;
if (sysfs_type(sd) && (sysfs_type(sd) & SYSFS_NOT_PINNED)) { if (sysfs_type(sd) && sysfs_type(sd) != SYSFS_DIR) {
*pos = sd->s_sibling; *pos = sd->s_sibling;
sd->s_sibling = NULL; sd->s_sibling = NULL;
sysfs_remove_one(&acxt, sd); sysfs_remove_one(&acxt, sd);
...@@ -912,14 +888,25 @@ int sysfs_rename_dir(struct kobject *kobj, struct sysfs_dirent *new_parent_sd, ...@@ -912,14 +888,25 @@ int sysfs_rename_dir(struct kobject *kobj, struct sysfs_dirent *new_parent_sd,
const char *new_name) const char *new_name)
{ {
struct sysfs_dirent *sd = kobj->sd; struct sysfs_dirent *sd = kobj->sd;
struct dentry *new_parent = new_parent_sd->s_dentry; struct dentry *new_parent = NULL;
struct dentry *new_dentry; struct dentry *old_dentry = NULL, *new_dentry = NULL;
char *dup_name; const char *dup_name = NULL;
int error; int error;
if (!new_parent_sd) /* get dentries */
return -EFAULT; old_dentry = sysfs_get_dentry(sd);
if (IS_ERR(old_dentry)) {
error = PTR_ERR(old_dentry);
goto out_dput;
}
new_parent = sysfs_get_dentry(new_parent_sd);
if (IS_ERR(new_parent)) {
error = PTR_ERR(new_parent);
goto out_dput;
}
/* lock new_parent and get dentry for new name */
mutex_lock(&new_parent->d_inode->i_mutex); mutex_lock(&new_parent->d_inode->i_mutex);
new_dentry = lookup_one_len(new_name, new_parent, strlen(new_name)); new_dentry = lookup_one_len(new_name, new_parent, strlen(new_name));
...@@ -933,14 +920,14 @@ int sysfs_rename_dir(struct kobject *kobj, struct sysfs_dirent *new_parent_sd, ...@@ -933,14 +920,14 @@ int sysfs_rename_dir(struct kobject *kobj, struct sysfs_dirent *new_parent_sd,
* shadows of the same directory * shadows of the same directory
*/ */
error = -EINVAL; error = -EINVAL;
if (sd->s_parent->s_dentry->d_inode != new_parent->d_inode || if (old_dentry->d_parent->d_inode != new_parent->d_inode ||
new_dentry->d_parent->d_inode != new_parent->d_inode || new_dentry->d_parent->d_inode != new_parent->d_inode ||
new_dentry == sd->s_dentry) old_dentry == new_dentry)
goto out_dput; goto out_unlock;
error = -EEXIST; error = -EEXIST;
if (new_dentry->d_inode) if (new_dentry->d_inode)
goto out_dput; goto out_unlock;
/* rename kobject and sysfs_dirent */ /* rename kobject and sysfs_dirent */
error = -ENOMEM; error = -ENOMEM;
...@@ -950,9 +937,9 @@ int sysfs_rename_dir(struct kobject *kobj, struct sysfs_dirent *new_parent_sd, ...@@ -950,9 +937,9 @@ int sysfs_rename_dir(struct kobject *kobj, struct sysfs_dirent *new_parent_sd,
error = kobject_set_name(kobj, "%s", new_name); error = kobject_set_name(kobj, "%s", new_name);
if (error) if (error)
goto out_free; goto out_drop;
kfree(sd->s_name); dup_name = sd->s_name;
sd->s_name = new_name; sd->s_name = new_name;
/* move under the new parent */ /* move under the new parent */
...@@ -972,45 +959,58 @@ int sysfs_rename_dir(struct kobject *kobj, struct sysfs_dirent *new_parent_sd, ...@@ -972,45 +959,58 @@ int sysfs_rename_dir(struct kobject *kobj, struct sysfs_dirent *new_parent_sd,
error = 0; error = 0;
goto out_unlock; goto out_unlock;
out_free:
kfree(dup_name);
out_drop: out_drop:
d_drop(new_dentry); d_drop(new_dentry);
out_dput:
dput(new_dentry);
out_unlock: out_unlock:
mutex_unlock(&new_parent->d_inode->i_mutex); mutex_unlock(&new_parent->d_inode->i_mutex);
out_dput:
kfree(dup_name);
dput(new_parent);
dput(old_dentry);
dput(new_dentry);
return error; return error;
} }
int sysfs_move_dir(struct kobject *kobj, struct kobject *new_parent) int sysfs_move_dir(struct kobject *kobj, struct kobject *new_parent_kobj)
{ {
struct dentry *old_parent_dentry, *new_parent_dentry, *new_dentry; struct sysfs_dirent *sd = kobj->sd;
struct sysfs_dirent *new_parent_sd, *sd; struct sysfs_dirent *new_parent_sd;
struct dentry *old_parent, *new_parent = NULL;
struct dentry *old_dentry = NULL, *new_dentry = NULL;
int error; int error;
old_parent_dentry = kobj->parent ? BUG_ON(!sd->s_parent);
kobj->parent->sd->s_dentry : sysfs_mount->mnt_sb->s_root; new_parent_sd = new_parent_kobj->sd ? new_parent_kobj->sd : &sysfs_root;
new_parent_dentry = new_parent ?
new_parent->sd->s_dentry : sysfs_mount->mnt_sb->s_root; /* get dentries */
old_dentry = sysfs_get_dentry(sd);
if (IS_ERR(old_dentry)) {
error = PTR_ERR(old_dentry);
goto out_dput;
}
old_parent = sd->s_parent->s_dentry;
new_parent = sysfs_get_dentry(new_parent_sd);
if (IS_ERR(new_parent)) {
error = PTR_ERR(new_parent);
goto out_dput;
}
if (old_parent_dentry->d_inode == new_parent_dentry->d_inode) if (old_parent->d_inode == new_parent->d_inode) {
return 0; /* nothing to move */ error = 0;
goto out_dput; /* nothing to move */
}
again: again:
mutex_lock(&old_parent_dentry->d_inode->i_mutex); mutex_lock(&old_parent->d_inode->i_mutex);
if (!mutex_trylock(&new_parent_dentry->d_inode->i_mutex)) { if (!mutex_trylock(&new_parent->d_inode->i_mutex)) {
mutex_unlock(&old_parent_dentry->d_inode->i_mutex); mutex_unlock(&old_parent->d_inode->i_mutex);
goto again; goto again;
} }
new_parent_sd = new_parent_dentry->d_fsdata; new_dentry = lookup_one_len(kobj->name, new_parent, strlen(kobj->name));
sd = kobj->sd;
new_dentry = lookup_one_len(kobj->name, new_parent_dentry,
strlen(kobj->name));
if (IS_ERR(new_dentry)) { if (IS_ERR(new_dentry)) {
error = PTR_ERR(new_dentry); error = PTR_ERR(new_dentry);
goto out; goto out_unlock;
} else } else
error = 0; error = 0;
d_add(new_dentry, NULL); d_add(new_dentry, NULL);
...@@ -1027,10 +1027,14 @@ again: ...@@ -1027,10 +1027,14 @@ again:
sysfs_link_sibling(sd); sysfs_link_sibling(sd);
mutex_unlock(&sysfs_mutex); mutex_unlock(&sysfs_mutex);
out:
mutex_unlock(&new_parent_dentry->d_inode->i_mutex);
mutex_unlock(&old_parent_dentry->d_inode->i_mutex);
out_unlock:
mutex_unlock(&new_parent->d_inode->i_mutex);
mutex_unlock(&old_parent->d_inode->i_mutex);
out_dput:
dput(new_parent);
dput(old_dentry);
dput(new_dentry);
return error; return error;
} }
...@@ -1191,12 +1195,20 @@ static loff_t sysfs_dir_lseek(struct file * file, loff_t offset, int origin) ...@@ -1191,12 +1195,20 @@ static loff_t sysfs_dir_lseek(struct file * file, loff_t offset, int origin)
int sysfs_make_shadowed_dir(struct kobject *kobj, int sysfs_make_shadowed_dir(struct kobject *kobj,
void * (*follow_link)(struct dentry *, struct nameidata *)) void * (*follow_link)(struct dentry *, struct nameidata *))
{ {
struct dentry *dentry;
struct inode *inode; struct inode *inode;
struct inode_operations *i_op; struct inode_operations *i_op;
inode = kobj->sd->s_dentry->d_inode; /* get dentry for @kobj->sd, dentry of a shadowed dir is pinned */
if (inode->i_op != &sysfs_dir_inode_operations) dentry = sysfs_get_dentry(kobj->sd);
if (IS_ERR(dentry))
return PTR_ERR(dentry);
inode = dentry->d_inode;
if (inode->i_op != &sysfs_dir_inode_operations) {
dput(dentry);
return -EINVAL; return -EINVAL;
}
i_op = kmalloc(sizeof(*i_op), GFP_KERNEL); i_op = kmalloc(sizeof(*i_op), GFP_KERNEL);
if (!i_op) if (!i_op)
...@@ -1223,17 +1235,23 @@ int sysfs_make_shadowed_dir(struct kobject *kobj, ...@@ -1223,17 +1235,23 @@ int sysfs_make_shadowed_dir(struct kobject *kobj,
struct sysfs_dirent *sysfs_create_shadow_dir(struct kobject *kobj) struct sysfs_dirent *sysfs_create_shadow_dir(struct kobject *kobj)
{ {
struct dentry *dir = kobj->sd->s_dentry; struct sysfs_dirent *parent_sd = kobj->sd->s_parent;
struct inode *inode = dir->d_inode; struct dentry *dir, *parent, *shadow;
struct dentry *parent = dir->d_parent; struct inode *inode;
struct sysfs_dirent *parent_sd = parent->d_fsdata;
struct dentry *shadow;
struct sysfs_dirent *sd; struct sysfs_dirent *sd;
struct sysfs_addrm_cxt acxt; struct sysfs_addrm_cxt acxt;
dir = sysfs_get_dentry(kobj->sd);
if (IS_ERR(dir)) {
sd = (void *)dir;
goto out;
}
parent = dir->d_parent;
inode = dir->d_inode;
sd = ERR_PTR(-EINVAL); sd = ERR_PTR(-EINVAL);
if (!sysfs_is_shadowed_inode(inode)) if (!sysfs_is_shadowed_inode(inode))
goto out; goto out_dput;
shadow = d_alloc(parent, &dir->d_name); shadow = d_alloc(parent, &dir->d_name);
if (!shadow) if (!shadow)
...@@ -1258,12 +1276,15 @@ struct sysfs_dirent *sysfs_create_shadow_dir(struct kobject *kobj) ...@@ -1258,12 +1276,15 @@ struct sysfs_dirent *sysfs_create_shadow_dir(struct kobject *kobj)
dget(shadow); /* Extra count - pin the dentry in core */ dget(shadow); /* Extra count - pin the dentry in core */
out: goto out_dput;
return sd;
nomem: nomem:
dput(shadow); dput(shadow);
sd = ERR_PTR(-ENOMEM); sd = ERR_PTR(-ENOMEM);
goto out; out_dput:
dput(dir);
out:
return sd;
} }
/** /**
......
...@@ -362,43 +362,22 @@ static unsigned int sysfs_poll(struct file *filp, poll_table *wait) ...@@ -362,43 +362,22 @@ static unsigned int sysfs_poll(struct file *filp, poll_table *wait)
return POLLERR|POLLPRI; return POLLERR|POLLPRI;
} }
void sysfs_notify(struct kobject *k, char *dir, char *attr)
static struct dentry *step_down(struct dentry *dir, const char * name)
{ {
struct dentry * de; struct sysfs_dirent *sd = k->sd;
if (dir == NULL || dir->d_inode == NULL)
return NULL;
mutex_lock(&dir->d_inode->i_mutex);
de = lookup_one_len(name, dir, strlen(name));
mutex_unlock(&dir->d_inode->i_mutex);
dput(dir);
if (IS_ERR(de))
return NULL;
if (de->d_inode == NULL) {
dput(de);
return NULL;
}
return de;
}
void sysfs_notify(struct kobject * k, char *dir, char *attr) mutex_lock(&sysfs_mutex);
{
struct dentry *de = k->sd->s_dentry; if (sd && dir)
if (de) sd = sysfs_find_dirent(sd, dir);
dget(de); if (sd && attr)
if (de && dir) sd = sysfs_find_dirent(sd, attr);
de = step_down(de, dir); if (sd) {
if (de && attr)
de = step_down(de, attr);
if (de) {
struct sysfs_dirent * sd = de->d_fsdata;
if (sd)
atomic_inc(&sd->s_event); atomic_inc(&sd->s_event);
wake_up_interruptible(&k->poll); wake_up_interruptible(&k->poll);
dput(de);
} }
mutex_unlock(&sysfs_mutex);
} }
EXPORT_SYMBOL_GPL(sysfs_notify); EXPORT_SYMBOL_GPL(sysfs_notify);
...@@ -485,30 +464,31 @@ EXPORT_SYMBOL_GPL(sysfs_add_file_to_group); ...@@ -485,30 +464,31 @@ EXPORT_SYMBOL_GPL(sysfs_add_file_to_group);
*/ */
int sysfs_update_file(struct kobject * kobj, const struct attribute * attr) int sysfs_update_file(struct kobject * kobj, const struct attribute * attr)
{ {
struct dentry *dir = kobj->sd->s_dentry; struct sysfs_dirent *victim_sd = NULL;
struct dentry * victim; struct dentry *victim = NULL;
int res = -ENOENT; int rc;
mutex_lock(&dir->d_inode->i_mutex);
victim = lookup_one_len(attr->name, dir, strlen(attr->name));
if (!IS_ERR(victim)) {
/* make sure dentry is really there */
if (victim->d_inode &&
(victim->d_parent->d_inode == dir->d_inode)) {
victim->d_inode->i_mtime = CURRENT_TIME;
fsnotify_modify(victim);
res = 0;
} else
d_drop(victim);
/** rc = -ENOENT;
* Drop the reference acquired from lookup_one_len() above. victim_sd = sysfs_get_dirent(kobj->sd, attr->name);
*/ if (!victim_sd)
dput(victim); goto out;
victim = sysfs_get_dentry(victim_sd);
if (IS_ERR(victim)) {
rc = PTR_ERR(victim);
victim = NULL;
goto out;
} }
mutex_unlock(&dir->d_inode->i_mutex);
return res; mutex_lock(&victim->d_inode->i_mutex);
victim->d_inode->i_mtime = CURRENT_TIME;
fsnotify_modify(victim);
mutex_unlock(&victim->d_inode->i_mutex);
rc = 0;
out:
dput(victim);
sysfs_put(victim_sd);
return rc;
} }
...@@ -521,30 +501,34 @@ int sysfs_update_file(struct kobject * kobj, const struct attribute * attr) ...@@ -521,30 +501,34 @@ int sysfs_update_file(struct kobject * kobj, const struct attribute * attr)
*/ */
int sysfs_chmod_file(struct kobject *kobj, struct attribute *attr, mode_t mode) int sysfs_chmod_file(struct kobject *kobj, struct attribute *attr, mode_t mode)
{ {
struct dentry *dir = kobj->sd->s_dentry; struct sysfs_dirent *victim_sd = NULL;
struct dentry *victim; struct dentry *victim = NULL;
struct inode * inode; struct inode * inode;
struct iattr newattrs; struct iattr newattrs;
int res = -ENOENT; int rc;
rc = -ENOENT;
victim_sd = sysfs_get_dirent(kobj->sd, attr->name);
if (!victim_sd)
goto out;
victim = sysfs_get_dentry(victim_sd);
if (IS_ERR(victim)) {
rc = PTR_ERR(victim);
victim = NULL;
goto out;
}
mutex_lock(&dir->d_inode->i_mutex);
victim = lookup_one_len(attr->name, dir, strlen(attr->name));
if (!IS_ERR(victim)) {
if (victim->d_inode &&
(victim->d_parent->d_inode == dir->d_inode)) {
inode = victim->d_inode; inode = victim->d_inode;
mutex_lock(&inode->i_mutex); mutex_lock(&inode->i_mutex);
newattrs.ia_mode = (mode & S_IALLUGO) | newattrs.ia_mode = (mode & S_IALLUGO) | (inode->i_mode & ~S_IALLUGO);
(inode->i_mode & ~S_IALLUGO);
newattrs.ia_valid = ATTR_MODE | ATTR_CTIME; newattrs.ia_valid = ATTR_MODE | ATTR_CTIME;
res = notify_change(victim, &newattrs); rc = notify_change(victim, &newattrs);
mutex_unlock(&inode->i_mutex); mutex_unlock(&inode->i_mutex);
} out:
dput(victim); dput(victim);
} sysfs_put(victim_sd);
mutex_unlock(&dir->d_inode->i_mutex); return rc;
return res;
} }
EXPORT_SYMBOL_GPL(sysfs_chmod_file); EXPORT_SYMBOL_GPL(sysfs_chmod_file);
......
...@@ -24,7 +24,7 @@ static const struct super_operations sysfs_ops = { ...@@ -24,7 +24,7 @@ static const struct super_operations sysfs_ops = {
.drop_inode = sysfs_delete_inode, .drop_inode = sysfs_delete_inode,
}; };
static struct sysfs_dirent sysfs_root = { struct sysfs_dirent sysfs_root = {
.s_count = ATOMIC_INIT(1), .s_count = ATOMIC_INIT(1),
.s_flags = SYSFS_ROOT, .s_flags = SYSFS_ROOT,
.s_mode = S_IFDIR | S_IRWXU | S_IRUGO | S_IXUGO, .s_mode = S_IFDIR | S_IRWXU | S_IRUGO | S_IXUGO,
......
...@@ -52,6 +52,7 @@ struct sysfs_addrm_cxt { ...@@ -52,6 +52,7 @@ struct sysfs_addrm_cxt {
}; };
extern struct vfsmount * sysfs_mount; extern struct vfsmount * sysfs_mount;
extern struct sysfs_dirent sysfs_root;
extern struct kmem_cache *sysfs_dir_cachep; extern struct kmem_cache *sysfs_dir_cachep;
extern struct dentry *sysfs_get_dentry(struct sysfs_dirent *sd); extern struct dentry *sysfs_get_dentry(struct sysfs_dirent *sd);
......
...@@ -81,7 +81,6 @@ struct sysfs_ops { ...@@ -81,7 +81,6 @@ struct sysfs_ops {
#define SYSFS_KOBJ_ATTR 0x0004 #define SYSFS_KOBJ_ATTR 0x0004
#define SYSFS_KOBJ_BIN_ATTR 0x0008 #define SYSFS_KOBJ_BIN_ATTR 0x0008
#define SYSFS_KOBJ_LINK 0x0020 #define SYSFS_KOBJ_LINK 0x0020
#define SYSFS_NOT_PINNED (SYSFS_KOBJ_ATTR | SYSFS_KOBJ_BIN_ATTR | SYSFS_KOBJ_LINK)
#define SYSFS_COPY_NAME (SYSFS_DIR | SYSFS_KOBJ_LINK) #define SYSFS_COPY_NAME (SYSFS_DIR | SYSFS_KOBJ_LINK)
#define SYSFS_FLAG_MASK ~SYSFS_TYPE_MASK #define SYSFS_FLAG_MASK ~SYSFS_TYPE_MASK
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment