diff options
-rw-r--r-- | sys/fs/devfs.c | 5 | ||||
-rw-r--r-- | sys/fs/initramfs.c | 5 | ||||
-rw-r--r-- | sys/include/sys/mount.h | 3 | ||||
-rw-r--r-- | sys/kern/vfs_init.c | 2 | ||||
-rw-r--r-- | sys/kern/vfs_mount.c | 18 |
5 files changed, 21 insertions, 12 deletions
diff --git a/sys/fs/devfs.c b/sys/fs/devfs.c index 8b273db..cb4a3ba 100644 --- a/sys/fs/devfs.c +++ b/sys/fs/devfs.c @@ -140,8 +140,11 @@ vop_read(struct vnode *vp, struct sio_txn *sio) } static int -devfs_init(struct fs_info *info) +devfs_init(struct fs_info *info, struct vnode *source) { + if (source != NULL) + return -EINVAL; + TAILQ_INIT(&nodes); nodelist_init = true; return 0; diff --git a/sys/fs/initramfs.c b/sys/fs/initramfs.c index b7f0c71..e15c00d 100644 --- a/sys/fs/initramfs.c +++ b/sys/fs/initramfs.c @@ -193,8 +193,11 @@ getsize(const char *in) } static int -initramfs_init(struct fs_info *info) +initramfs_init(struct fs_info *info, struct vnode *source) { + if (source != NULL) + return -EINVAL; + initramfs = get_module("/boot/initramfs.tar", &initramfs_size); info->caps = FSCAP_FULLPATH; diff --git a/sys/include/sys/mount.h b/sys/include/sys/mount.h index a9478e7..b208bf7 100644 --- a/sys/include/sys/mount.h +++ b/sys/include/sys/mount.h @@ -39,9 +39,10 @@ struct fs_info; struct mount; +struct vnode; struct vfsops { - int(*init)(struct fs_info *info); + int(*init)(struct fs_info *info, struct vnode *source); }; struct mount { diff --git a/sys/kern/vfs_init.c b/sys/kern/vfs_init.c index 8b0b119..fa20af3 100644 --- a/sys/kern/vfs_init.c +++ b/sys/kern/vfs_init.c @@ -78,7 +78,7 @@ vfs_init(void) __assert(vfsops->init != NULL); __assert(vfs_mount(info->name, 0, info) == 0); - vfsops->init(info); + vfsops->init(info, NULL); } g_root_vnode->vops = &g_initramfs_vops; diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c index 25ad17d..27d0ec3 100644 --- a/sys/kern/vfs_mount.c +++ b/sys/kern/vfs_mount.c @@ -65,6 +65,7 @@ static int mount(const char *source, const char *target, const char *filesystemtype, unsigned long mountflags, const void *data) { + struct vnode *source_vnode; struct fs_info *info; int status; @@ -79,13 +80,14 @@ mount(const char *source, const char *target, const char *filesystemtype, if (mountflags != 0) return -EINVAL; - /* - * Locate source. - * - * XXX: Only "none" is currently supported. - */ - if (strcmp(source, "none") != 0) - return -ENOENT; + /* Locate source, if any */ + if (strcmp(source, "none") == 0) { + source_vnode = NULL; + } else { + status = vfs_path_to_node(source, &source_vnode); + if (status != 0) + return status; + } /* Locate filesystem */ info = vfs_byname(filesystemtype); @@ -99,7 +101,7 @@ mount(const char *source, const char *target, const char *filesystemtype, /* Initialize filesystem if needed */ if (info->vfsops->init != NULL) - return info->vfsops->init(info); + return info->vfsops->init(info, source_vnode); return 0; } |