diff options
author | Tejun Heo <htejun@gmail.com> | 2007-06-13 14:45:14 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2007-07-11 19:09:04 -0400 |
commit | 13b3086d2ea483cbcae5a4236446cecc082a72cf (patch) | |
tree | f6932aaf486a302aa7b03857d780bafda33db2d6 /fs/sysfs/sysfs.h | |
parent | a26cd7226c24c3be5dd5f48a74832fe64beb8489 (diff) |
sysfs: add sysfs_dirent->s_parent
Add sysfs_dirent->s_parent. With this patch, each sd points to and
holds a reference to its parent. This allows walking sysfs tree
without referencing sd->s_dentry which can go away anytime if the user
doesn't control when it's deleted.
sd->s_parent is initialized and parent is referenced in
sysfs_attach_dirent(). Reference to parent is released when the sd is
released, so as long as reference to a sd is held, s_parent can be
followed.
dentry walk in sysfs_readdir() is convereted to s_parent walk.
This will be used to reimplement symlink such that it uses only
sysfs_dirent tree.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'fs/sysfs/sysfs.h')
-rw-r--r-- | fs/sysfs/sysfs.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/sysfs/sysfs.h b/fs/sysfs/sysfs.h index f8f49cc5c852..ce05d6fd7522 100644 --- a/fs/sysfs/sysfs.h +++ b/fs/sysfs/sysfs.h | |||
@@ -1,5 +1,6 @@ | |||
1 | struct sysfs_dirent { | 1 | struct sysfs_dirent { |
2 | atomic_t s_count; | 2 | atomic_t s_count; |
3 | struct sysfs_dirent * s_parent; | ||
3 | struct list_head s_sibling; | 4 | struct list_head s_sibling; |
4 | struct list_head s_children; | 5 | struct list_head s_children; |
5 | void * s_element; | 6 | void * s_element; |