Get rid of DEVICE_TYPE_FS usage
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
parent
8fe9c1fa46
commit
6459b135d9
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
27
fs/fs.c
27
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))) {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -76,6 +76,8 @@ struct fs_driver_d {
|
|||
struct driver_d drv;
|
||||
|
||||
unsigned long flags;
|
||||
|
||||
struct list_head list;
|
||||
};
|
||||
|
||||
struct mtab_entry {
|
||||
|
@ -166,4 +168,7 @@ void *read_file(const char *filename, size_t *size);
|
|||
*/
|
||||
char *normalise_path(const char *path);
|
||||
|
||||
/* Register a new filesystem driver */
|
||||
int register_fs_driver(struct fs_driver_d *fsdrv);
|
||||
|
||||
#endif /* __FS_H */
|
||||
|
|
|
@ -271,10 +271,6 @@ static int do_devinfo_subtree(struct device_d *dev, int depth, char edge)
|
|||
|
||||
if (*dev->id)
|
||||
printf("%c----%s\n", edge, dev->id);
|
||||
else if (dev->type == DEVICE_TYPE_FS)
|
||||
printf("%c----filesystem: %s\n", edge,
|
||||
fsdev_get_mountpoint((struct fs_device_d *)
|
||||
dev->type_data));
|
||||
|
||||
if (!list_empty(&dev->children)) {
|
||||
device_for_each_child(dev, child) {
|
||||
|
|
Loading…
Reference in New Issue