summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2024-04-09 22:49:31 -0400
committerIan Moffett <ian@osmora.org>2024-04-09 22:51:26 -0400
commit5ba14923f7c68bdb170fa8cf6bdcc54224feb0f6 (patch)
tree84aac54f8275658f0d54a374c51dd5f7af72eaf7
parente326f77a5441abbacd23b8309a59e744999779ca (diff)
kernel: vfs_lookup: Try looking up in mountlist
Signed-off-by: Ian Moffett <ian@osmora.org>
-rw-r--r--sys/kern/vfs_lookup.c10
1 files changed, 9 insertions, 1 deletions
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;
}