summaryrefslogtreecommitdiff
path: root/src/sys/os/vfs_init.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/sys/os/vfs_init.c')
-rw-r--r--src/sys/os/vfs_init.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/sys/os/vfs_init.c b/src/sys/os/vfs_init.c
index b40b74d..496fb67 100644
--- a/src/sys/os/vfs_init.c
+++ b/src/sys/os/vfs_init.c
@@ -32,6 +32,7 @@
#include <sys/param.h>
#include <sys/mount.h>
#include <os/vfs.h>
+#include <string.h>
/*
* The filesystem table
@@ -41,6 +42,31 @@ static struct fs_info fstab[] = {
};
/*
+ * Get entry by name
+ */
+int
+vfs_by_name(const char *name, struct fs_info **resp)
+{
+ size_t nelem;
+ int retval = -ENOENT;
+
+ if (name == NULL || resp == NULL) {
+ return -EINVAL;
+ }
+
+ nelem = NELEM(fstab);
+ for (int i = 0; i < nelem; ++i) {
+ if (strcmp(fstab[i].name, name) == 0) {
+ *resp = &fstab[i];
+ retval = 0;
+ break;
+ }
+ }
+
+ return retval;
+}
+
+/*
* Get entry by index
*/
int