From 6459b135d9f1cc1aee8d3564a6097ae21e30b2ac Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Wed, 10 Jun 2009 21:15:06 +0200 Subject: Get rid of DEVICE_TYPE_FS usage Signed-off-by: Sascha Hauer --- fs/cramfs/cramfs.c | 3 +-- fs/devfs.c | 3 +-- fs/fs.c | 27 +++++++++++++++++---------- fs/ramfs.c | 3 +-- 4 files changed, 20 insertions(+), 16 deletions(-) (limited to 'fs') diff --git a/fs/cramfs/cramfs.c b/fs/cramfs/cramfs.c index 62f15d6271..4ab9f08071 100644 --- a/fs/cramfs/cramfs.c +++ b/fs/cramfs/cramfs.c @@ -455,7 +455,6 @@ static struct fs_driver_d cramfs_driver = { .closedir = cramfs_closedir, .stat = cramfs_stat, .drv = { - .type = DEVICE_TYPE_FS, .probe = cramfs_probe, .remove = cramfs_remove, .name = "cramfs", @@ -465,7 +464,7 @@ static struct fs_driver_d cramfs_driver = { static int cramfs_init(void) { - return register_driver(&cramfs_driver.drv); + return register_fs_driver(&cramfs_driver); } device_initcall(cramfs_init); diff --git a/fs/devfs.c b/fs/devfs.c index a945c31998..9b9fb93c5f 100644 --- a/fs/devfs.c +++ b/fs/devfs.c @@ -264,7 +264,6 @@ static struct fs_driver_d devfs_driver = { .memmap = devfs_memmap, .flags = FS_DRIVER_NO_DEV, .drv = { - .type = DEVICE_TYPE_FS, .probe = devfs_probe, .remove = devfs_delete, .name = "devfs", @@ -274,7 +273,7 @@ static struct fs_driver_d devfs_driver = { static int devfs_init(void) { - return register_driver(&devfs_driver.drv); + return register_fs_driver(&devfs_driver); } device_initcall(devfs_init); diff --git a/fs/fs.c b/fs/fs.c index 6f278c0e1f..fc7ada064f 100644 --- a/fs/fs.c +++ b/fs/fs.c @@ -635,6 +635,16 @@ int close(int fd) } EXPORT_SYMBOL(close); +static LIST_HEAD(fs_driver_list); + +int register_fs_driver(struct fs_driver_d *fsdrv) +{ + list_add_tail(&fsdrv->list, &fs_driver_list); + register_driver(&fsdrv->drv); + return 0; +} +EXPORT_SYMBOL(register_fs_driver); + /* * Mount a device to a directory. * We do this by registering a new device on which the filesystem @@ -643,8 +653,7 @@ EXPORT_SYMBOL(close); */ int mount(const char *device, const char *fsname, const char *_path) { - struct driver_d *drv; - struct fs_driver_d *fs_drv; + struct fs_driver_d *fs_drv = NULL, *f; struct mtab_entry *entry; struct fs_device_d *fsdev; struct device_d *dev, *parent_device = NULL; @@ -666,13 +675,14 @@ int mount(const char *device, const char *fsname, const char *_path) goto out; } - drv = get_driver_by_name(fsname); - if (!drv) { - errno = -ENODEV; - goto out; + list_for_each_entry(f, &fs_driver_list, list) { + if (!strcmp(f->drv.name, fsname)) { + fs_drv = f; + break; + } } - if (drv->type != DEVICE_TYPE_FS) { + if (!fs_drv) { errno = -EINVAL; goto out; } @@ -688,8 +698,6 @@ int mount(const char *device, const char *fsname, const char *_path) } } - fs_drv = drv->type_data; - if (!fs_drv->flags & FS_DRIVER_NO_DEV) { parent_device = get_device_by_id(device + 5); if (!parent_device) { @@ -701,7 +709,6 @@ int mount(const char *device, const char *fsname, const char *_path) fsdev = xzalloc(sizeof(struct fs_device_d)); fsdev->parent = parent_device; sprintf(fsdev->dev.name, "%s", fsname); - fsdev->dev.type = DEVICE_TYPE_FS; fsdev->dev.type_data = fsdev; if ((ret = register_device(&fsdev->dev))) { diff --git a/fs/ramfs.c b/fs/ramfs.c index 6d675df195..9aad4f6b0a 100644 --- a/fs/ramfs.c +++ b/fs/ramfs.c @@ -560,7 +560,6 @@ static struct fs_driver_d ramfs_driver = { .stat = ramfs_stat, .flags = FS_DRIVER_NO_DEV, .drv = { - .type = DEVICE_TYPE_FS, .probe = ramfs_probe, .remove = ramfs_remove, .name = "ramfs", @@ -570,7 +569,7 @@ static struct fs_driver_d ramfs_driver = { static int ramfs_init(void) { - return register_driver(&ramfs_driver.drv); + return register_fs_driver(&ramfs_driver); } device_initcall(ramfs_init); -- cgit v1.2.3