diff -aurpN -X /home/fletch/.diff.exclude 640-smp_boot_id/fs/sysfs/mount.c 651-sysfs_backing_store1/fs/sysfs/mount.c --- 640-smp_boot_id/fs/sysfs/mount.c Fri May 30 19:02:19 2003 +++ 651-sysfs_backing_store1/fs/sysfs/mount.c Thu Jan 1 23:24:30 2004 @@ -20,6 +20,14 @@ struct super_block * sysfs_sb = NULL; static struct super_operations sysfs_ops = { .statfs = simple_statfs, .drop_inode = generic_delete_inode, + .umount_begin = sysfs_umount_begin, +}; + +struct sysfs_dirent sysfs_root = { + .s_sibling = LIST_HEAD_INIT(sysfs_root.s_sibling), + .s_children = LIST_HEAD_INIT(sysfs_root.s_children), + .s_element = NULL, + .s_type = SYSFS_ROOT, }; static int sysfs_fill_super(struct super_block *sb, void *data, int silent) @@ -35,8 +43,8 @@ static int sysfs_fill_super(struct super inode = sysfs_new_inode(S_IFDIR | S_IRWXU | S_IRUGO | S_IXUGO); if (inode) { - inode->i_op = &simple_dir_inode_operations; - inode->i_fop = &simple_dir_operations; + inode->i_op = &sysfs_dir_inode_operations; + inode->i_fop = &sysfs_dir_operations; /* directory inodes start off with i_nlink == 2 (for "." entry) */ inode->i_nlink++; } else { @@ -50,6 +58,7 @@ static int sysfs_fill_super(struct super iput(inode); return -ENOMEM; } + root->d_fsdata = &sysfs_root; sb->s_root = root; return 0; } @@ -58,6 +67,14 @@ static struct super_block *sysfs_get_sb( int flags, const char *dev_name, void *data) { return get_sb_single(fs_type, flags, data, sysfs_fill_super); +} + +void sysfs_umount_begin(struct super_block * sb) +{ + lock_super(sb); + if (sb->s_root) + shrink_dcache_parent(sb->s_root); + unlock_super(sb); } static struct file_system_type sysfs_fs_type = { diff -aurpN -X /home/fletch/.diff.exclude 640-smp_boot_id/include/linux/sysfs.h 651-sysfs_backing_store1/include/linux/sysfs.h --- 640-smp_boot_id/include/linux/sysfs.h Tue Sep 2 09:55:56 2003 +++ 651-sysfs_backing_store1/include/linux/sysfs.h Thu Jan 1 23:24:30 2004 @@ -9,6 +9,8 @@ #ifndef _SYSFS_H_ #define _SYSFS_H_ +#include + struct kobject; struct module; @@ -32,6 +34,21 @@ struct sysfs_ops { ssize_t (*show)(struct kobject *, struct attribute *,char *); ssize_t (*store)(struct kobject *,struct attribute *,const char *, size_t); }; + +struct sysfs_dirent { + atomic_t s_count; + struct list_head s_sibling; + struct list_head s_children; + void * s_element; + int s_type; + struct dentry * s_dentry; +}; + +#define SYSFS_ROOT 0x0001 +#define SYSFS_KOBJECT 0x0002 +#define SYSFS_KOBJ_ATTR 0x0004 +#define SYSFS_KOBJ_BIN_ATTR 0x0008 +#define SYSFS_KOBJ_ATTR_GROUP 0x0010 extern int sysfs_create_dir(struct kobject *);