diff options
Diffstat (limited to 'src/sys')
-rw-r--r-- | src/sys/include/sys/mount.h | 11 | ||||
-rw-r--r-- | src/sys/os/vfs_mount.c | 22 |
2 files changed, 33 insertions, 0 deletions
diff --git a/src/sys/include/sys/mount.h b/src/sys/include/sys/mount.h index 3c4d0be..c93eb2b 100644 --- a/src/sys/include/sys/mount.h +++ b/src/sys/include/sys/mount.h @@ -118,6 +118,17 @@ struct vfsops { }; /* + * Lookup a mountpoint existing on the system + * + * @name: Name of mountpoint + * @mp_res: Result of mountpoint is written here + * + * Returns zero on success, otherwise a less than zero + * value to indicate failure + */ +int mount_lookup(const char *name, struct mount **mp_res); + +/* * Mount a specific filesystem * * @margs: Mount arguments 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 |