summaryrefslogtreecommitdiff
path: root/src/sys/os
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2025-09-19 13:20:40 -0400
committerIan Moffett <ian@osmora.org>2025-09-19 13:20:40 -0400
commit23f12d626f33bf03295ca4c1165155cfacec01ed (patch)
tree17a1f1efee1262521ce25fc14a21578e99dbc02e /src/sys/os
parentaa5bf63637a5c0aa6ccebd959461bfa1a9d8f0ff (diff)
kern: vfs: Add mountpoint lookup helper
Add helper function to lookup mountpoints such as '/' Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'src/sys/os')
-rw-r--r--src/sys/os/vfs_mount.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/sys/os/vfs_mount.c b/src/sys/os/vfs_mount.c
index bfb5fc8..8f09096 100644
--- a/src/sys/os/vfs_mount.c
+++ b/src/sys/os/vfs_mount.c
@@ -113,6 +113,28 @@ mount_to(struct mount_args *margs, struct mount **mp_res, int flags)
}
/*
+ * Lookup a specific mountpoint
+ */
+int
+mount_lookup(const char *name, struct mount **mp_res)
+{
+ struct mount *mp;
+
+ if (name == NULL || mp_res == NULL) {
+ return -EINVAL;
+ }
+
+ TAILQ_FOREACH(mp, &root.list, link) {
+ if (strcmp(mp->name, name) == 0) {
+ *mp_res = mp;
+ return 0;
+ }
+ }
+
+ return -ENOENT;
+}
+
+/*
* Allocate a new mountpoint
*/
int