[code]void __init start_kernel(void) vfs_caches_init(totalram_pages); void __init mnt_init(void) err = sysfs_init(); err = register_filesystem(&sysfs_fs_type); register_filesystem(&sysfs_fs_type); static struct file_system_type sysfs_fs_type = { .name = "sysfs", .get_sb = sysfs_get_sb, .kill_sb = sysfs_kill_sb, }; //創建一顆vfs樹 static int sysfs_get_sb(struct file_system_type *fs_type, sysfs_fill_super(struct super_block *sb, void *data, int silent) sysfs_get_inode sysfs_init_inode用戶空間,在linux開機啟動腳本init.rc中執行掛載
mount -t sysfs sysfs /sys