sysfs: separate out sysfs_attach_dentry()

Consolidate sd <-> dentry association into sysfs_attach_dentry() and
call it after dentry and inode are properly set up.  This is in
preparation of sysfs_drop_dentry() updates.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
Tejun Heo
2007-06-14 03:45:16 +09:00
committed by Greg Kroah-Hartman
parent 73107cb3ad
commit 198a2a8470
3 changed files with 30 additions and 36 deletions

View File

@ -156,13 +156,13 @@ struct inode * sysfs_new_inode(mode_t mode, struct sysfs_dirent * sd)
return inode;
}
int sysfs_create(struct dentry * dentry, int mode, int (*init)(struct inode *))
int sysfs_create(struct sysfs_dirent *sd, struct dentry *dentry, int mode,
int (*init)(struct inode *))
{
int error = 0;
struct inode * inode = NULL;
if (dentry) {
if (!dentry->d_inode) {
struct sysfs_dirent * sd = dentry->d_fsdata;
if ((inode = sysfs_new_inode(mode, sd))) {
if (dentry->d_parent && dentry->d_parent->d_inode) {
struct inode *p_inode = dentry->d_parent->d_inode;