diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/devfs.c | 8 | ||||
-rw-r--r-- | fs/fs.c | 19 |
2 files changed, 27 insertions, 0 deletions
diff --git a/fs/devfs.c b/fs/devfs.c index 5e60362f3f..aafcc34439 100644 --- a/fs/devfs.c +++ b/fs/devfs.c @@ -50,6 +50,13 @@ static int devfs_erase(struct device_d *_dev, FILE *f, size_t count, unsigned lo return dev_erase(dev, count, offset); } +static int devfs_memmap(struct device_d *_dev, FILE *f, void **map, int flags) +{ + struct device_d *dev = f->inode; + + return dev_memmap(dev, map, flags); +} + static int devfs_open(struct device_d *_dev, FILE *file, const char *filename) { struct device_d *dev = get_device_by_id(filename + 1); @@ -146,6 +153,7 @@ static struct fs_driver_d devfs_driver = { .closedir = devfs_closedir, .stat = devfs_stat, .erase = devfs_erase, + .memmap = devfs_memmap, .flags = FS_DRIVER_NO_DEV, .drv = { .type = DEVICE_TYPE_FS, @@ -516,6 +516,25 @@ int erase(int fd, size_t count, unsigned long offset) return errno; } +void *memmap(int fd, int flags) +{ + struct device_d *dev; + struct fs_driver_d *fsdrv; + FILE *f = &files[fd]; + void *ret = NULL; + + dev = f->dev; + + fsdrv = (struct fs_driver_d *)dev->driver->type_data; + + if (fsdrv->memmap) + errno = fsdrv->memmap(dev, f, &ret, flags); + else + errno = -EINVAL; + + return ret; +} + int close(int fd) { struct device_d *dev; |