From 5ba14923f7c68bdb170fa8cf6bdcc54224feb0f6 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Tue, 9 Apr 2024 22:49:31 -0400 Subject: kernel: vfs_lookup: Try looking up in mountlist Signed-off-by: Ian Moffett --- sys/kern/vfs_lookup.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c index 3153444..ea73d1a 100644 --- a/sys/kern/vfs_lookup.c +++ b/sys/kern/vfs_lookup.c @@ -129,6 +129,7 @@ int vfs_path_to_node(const char *path, struct vnode **vp) { struct vnode *vnode = g_root_vnode; + struct mount *mp; struct fs_info *fs; char *name; int s = 0, fs_caps = 0; @@ -139,6 +140,13 @@ vfs_path_to_node(const char *path, struct vnode **vp) return -EINVAL; } + /* See if we have a mountpoint with this name */ + name = vfs_get_fname_at(path, 0); + if (vfs_get_mp(name, &mp) == 0) { + fs = mp->fs; + vnode = fs->vnode; + } + /* Fetch filesystem capabilities if we can */ if (vnode->fs != NULL) { fs = vnode->fs; @@ -151,7 +159,7 @@ vfs_path_to_node(const char *path, struct vnode **vp) * it'll give us a vnode. */ if (__TEST(fs_caps, FSCAP_FULLPATH)) { - s = vfs_vget(g_root_vnode, path, &vnode); + s = vfs_vget(vnode, path, &vnode); goto done; } -- cgit v1.2.3