• Andrew Morton's avatar
    [PATCH] sysfs backing store - add sysfs_direct structure · c386f08b
    Andrew Morton authored
    From: Maneesh Soni <maneesh@in.ibm.com>
    
    o This patch introduces the new sysfs_dirent data structure. The sysfs_dirent
      is added to the dentry corresponding to each of the element which can be
      represented in sysfs like, kobject (directory), text or binary attributes
      (files), attribute groups (directory) and symlinks.
    
    o It uses dentry's d_fsdata field to attach the corresponding sysfs_dirent.
    
    o The sysfs_dirents are maintained in a tree of all the sysfs entries using the
      s_children and s_sibling list pointers.
    
    o This patch also changes how we access attributes and kobjects in
      file_operations from a given dentry, basically introducing one more level of
      indirection.
    
    o The sysfs_dirents are freed and the sysfs_dirent tree is updated accordingly
      upon the deletion of corresponding dentry. The sysfs dirents are kept alive
      as long as there is corresponding dentry around. The are freed when the
      dentry is finally out of dcache using the ->d_iput() method.
    
    o This also fixes the dentry leaks in case of error paths after sysfs has
      got a newly alocated (and hashed) dentry from sysfs_get_dentry() by
      d_drop()'ing the dentry.
    Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
    Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
    c386f08b
symlink.c 4.13 KB