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>
This commit is contained in:

committed by
Greg Kroah-Hartman

parent
a26cd7226c
commit
13b3086d2e
@@ -1,5 +1,6 @@
|
||||
struct sysfs_dirent {
|
||||
atomic_t s_count;
|
||||
struct sysfs_dirent * s_parent;
|
||||
struct list_head s_sibling;
|
||||
struct list_head s_children;
|
||||
void * s_element;
|
||||
|
Reference in New Issue
Block a user