aboutsummaryrefslogtreecommitdiffstats
path: root/fs/sysfs/dir.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/sysfs/dir.c')
-rw-r--r--fs/sysfs/dir.c37
1 files changed, 0 insertions, 37 deletions
diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c
index 54ca4bc02dcf..5a70a93fc2f7 100644
--- a/fs/sysfs/dir.c
+++ b/fs/sysfs/dir.c
@@ -748,24 +748,12 @@ int sysfs_create_dir(struct kobject * kobj)
748 return error; 748 return error;
749} 749}
750 750
751static int sysfs_count_nlink(struct sysfs_dirent *sd)
752{
753 struct sysfs_dirent *child;
754 int nr = 0;
755
756 for (child = sd->s_children; child; child = child->s_sibling)
757 if (sysfs_type(child) == SYSFS_DIR)
758 nr++;
759 return nr + 2;
760}
761
762static struct dentry * sysfs_lookup(struct inode *dir, struct dentry *dentry, 751static struct dentry * sysfs_lookup(struct inode *dir, struct dentry *dentry,
763 struct nameidata *nd) 752 struct nameidata *nd)
764{ 753{
765 struct dentry *ret = NULL; 754 struct dentry *ret = NULL;
766 struct sysfs_dirent *parent_sd = dentry->d_parent->d_fsdata; 755 struct sysfs_dirent *parent_sd = dentry->d_parent->d_fsdata;
767 struct sysfs_dirent *sd; 756 struct sysfs_dirent *sd;
768 struct bin_attribute *bin_attr;
769 struct inode *inode; 757 struct inode *inode;
770 758
771 mutex_lock(&sysfs_mutex); 759 mutex_lock(&sysfs_mutex);
@@ -785,31 +773,6 @@ static struct dentry * sysfs_lookup(struct inode *dir, struct dentry *dentry,
785 goto out_unlock; 773 goto out_unlock;
786 } 774 }
787 775
788 if (inode->i_state & I_NEW) {
789 /* initialize inode according to type */
790 switch (sysfs_type(sd)) {
791 case SYSFS_DIR:
792 inode->i_op = &sysfs_dir_inode_operations;
793 inode->i_fop = &sysfs_dir_operations;
794 inode->i_nlink = sysfs_count_nlink(sd);
795 break;
796 case SYSFS_KOBJ_ATTR:
797 inode->i_size = PAGE_SIZE;
798 inode->i_fop = &sysfs_file_operations;
799 break;
800 case SYSFS_KOBJ_BIN_ATTR:
801 bin_attr = sd->s_elem.bin_attr.bin_attr;
802 inode->i_size = bin_attr->size;
803 inode->i_fop = &bin_fops;
804 break;
805 case SYSFS_KOBJ_LINK:
806 inode->i_op = &sysfs_symlink_inode_operations;
807 break;
808 default:
809 BUG();
810 }
811 }
812
813 sysfs_instantiate(dentry, inode); 776 sysfs_instantiate(dentry, inode);
814 sysfs_attach_dentry(sd, dentry); 777 sysfs_attach_dentry(sd, dentry);
815 778