• Tejun Heo's avatar
    sysfs: add sysfs_dirent->s_parent · 13b3086d
    Tejun Heo authored
    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: default avatarTejun Heo <htejun@gmail.com>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
    13b3086d
sysfs.h 3.56 KB