From 059b2450fb71520e9d0ee1e26dd5bb48c9b6ddf7 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Mon, 6 Oct 2025 17:46:47 -0400 Subject: kern: syscall: Add SYS_mount syscall This commit introduces the system call for mounting filesystems. As of now, only the fstype and target params are supported Signed-off-by: Ian Moffett --- src/sys/include/compat/unix/syscall.h | 4 +++- src/sys/include/sys/mount.h | 31 +++++++++++++++++++++++-------- src/sys/include/sys/syscall.h | 1 + 3 files changed, 27 insertions(+), 9 deletions(-) (limited to 'src/sys/include') diff --git a/src/sys/include/compat/unix/syscall.h b/src/sys/include/compat/unix/syscall.h index ab464c4..5339d47 100644 --- a/src/sys/include/compat/unix/syscall.h +++ b/src/sys/include/compat/unix/syscall.h @@ -32,6 +32,7 @@ #include #include +#include #include /* @@ -61,7 +62,8 @@ scret_t(*g_unix_sctab[])(struct syscall_args *) = { [SYS_write] = sys_write, [SYS_cross] = sys_cross, [SYS_query] = sys_query, - [SYS_spawn] = sys_spawn + [SYS_spawn] = sys_spawn, + [SYS_mount] = sys_mount }; #endif /* !_NEED_UNIX_SCTAB */ diff --git a/src/sys/include/sys/mount.h b/src/sys/include/sys/mount.h index 4e39279..6d041ee 100644 --- a/src/sys/include/sys/mount.h +++ b/src/sys/include/sys/mount.h @@ -31,22 +31,32 @@ #define _SYS_MOUNT_H_ #include +#include #include +#if defined(_KERNEL) #include +#endif /* defined(_KERNEL) */ -#if defined(_KERNEL) +/* + * Mount filesystem string names + */ +#define MOUNT_INITRD "initrd" /* Initial ramdisk */ +#define MOUNT_DEVFS "devfs" /* Device filesystem */ /* - * Number of bytes allowed in a filesystem - * name including the null termination + * The mount system call */ -#define FSNAME_MAX 16 +int mount( + const char *source, const char *target, const char *fstype, + unsigned long mountflags, void *data +); +#if defined(_KERNEL) /* - * Mount filesystem string names + * Number of bytes allowed in a filesystem + * name including the null termination */ -#define MOUNT_INITRD "initrd" /* Initial ramdisk */ -#define MOUNT_DEVFS "devfs" /* Device filesystem */ +#define FSNAME_MAX 16 /* Forward declarations */ struct fs_info; @@ -155,7 +165,7 @@ int mount_lookup(const char *name, struct mount **mp_res); * Returns zero on success, otherwise a less than zero * failure upon failure. */ -int mount(struct mount_args *margs, uint32_t flags); +int kmount(struct mount_args *margs, uint32_t flags); /* * Initialize a mountpoint to a known state @@ -178,5 +188,10 @@ int mountlist_init(struct mountlist *mlp); */ int mount_alloc(const char *name, struct mount **mp_res); +/* + * Mount system call + */ +scret_t sys_mount(struct syscall_args *scargs); + #endif /* !_KERNEL */ #endif /* !_SYS_MOUNT_H_ */ diff --git a/src/sys/include/sys/syscall.h b/src/sys/include/sys/syscall.h index c1c06bb..4121d54 100644 --- a/src/sys/include/sys/syscall.h +++ b/src/sys/include/sys/syscall.h @@ -49,6 +49,7 @@ #define SYS_sigaction 0x04 #define SYS_query 0x05 /* query a border (mandatory) */ #define SYS_spawn 0x06 /* spawn a process */ +#define SYS_mount 0x07 /* mount a filesystem */ typedef __ssize_t scret_t; typedef __ssize_t scarg_t; -- cgit v1.2.3