summaryrefslogtreecommitdiff
path: root/src/sys/include
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2025-10-14 21:22:56 -0400
committerIan Moffett <ian@osmora.org>2025-10-14 21:27:55 -0400
commit9d3b3b602fc20246dda2a29c0926babbf1ea7fcd (patch)
treebe8513b85127429b362254ff8314a3ec9d5f911d /src/sys/include
parent58af5dfa5771045850be3086a2da18be44d3077a (diff)
kern: dms: Add initial DMS engine sources
The DMS engine handles performing I/O based on specific opcodes given to it and drives the callback wrappers. Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'src/sys/include')
-rw-r--r--src/sys/include/compat/unix/syscall.h4
-rw-r--r--src/sys/include/dms/dms.h6
-rw-r--r--src/sys/include/sys/dms.h60
-rw-r--r--src/sys/include/sys/syscall.h1
4 files changed, 70 insertions, 1 deletions
diff --git a/src/sys/include/compat/unix/syscall.h b/src/sys/include/compat/unix/syscall.h
index 13bd617..8b7e7d7 100644
--- a/src/sys/include/compat/unix/syscall.h
+++ b/src/sys/include/compat/unix/syscall.h
@@ -36,6 +36,7 @@
#include <sys/syscall.h>
#include <os/iotap.h>
#include <os/reboot.h>
+#include <dms/dms.h>
/*
* Exit the current process - exit(2) syscall
@@ -75,7 +76,8 @@ scret_t(*g_unix_sctab[])(struct syscall_args *) = {
[SYS_muxtap] = sys_muxtap,
[SYS_getargv] = sys_getargv,
[SYS_reboot] = sys_reboot,
- [SYS_waitpid] = sys_waitpid
+ [SYS_waitpid] = sys_waitpid,
+ [SYS_dmsio] = sys_dmsio
};
#endif /* !_NEED_UNIX_SCTAB */
diff --git a/src/sys/include/dms/dms.h b/src/sys/include/dms/dms.h
index 06e78ac..8453723 100644
--- a/src/sys/include/dms/dms.h
+++ b/src/sys/include/dms/dms.h
@@ -30,6 +30,7 @@
#ifndef _DMS_DMS_H_
#define _DMS_DMS_H_
+#include <sys/syscall.h>
#include <sys/queue.h>
#include <sys/cdefs.h>
#include <sys/types.h>
@@ -139,4 +140,9 @@ int dms_register(const char *name, struct dms_ops *ops, struct dms_disk **res);
*/
struct dms_disk *dms_get(disk_id_t disk_id);
+/*
+ * Perform I/O on a disk
+ */
+scret_t sys_dmsio(struct syscall_args *scargs);
+
#endif /* !_DMS_DMS_H_ */
diff --git a/src/sys/include/sys/dms.h b/src/sys/include/sys/dms.h
new file mode 100644
index 0000000..7d80c33
--- /dev/null
+++ b/src/sys/include/sys/dms.h
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2025 Ian Marco Moffett and L5 engineers
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the project nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _SYS_DMS_H_
+#define _SYS_DMS_H_ 1
+
+#include <sys/types.h>
+#if !defined(_KERNEL)
+#include <stdint.h>
+#include <stddef.h>
+#endif /* !_KERNEL */
+
+#define DMS_OPC_READ 0x00 /* Read from drive */
+#define DMS_OPC_WRITE 0x01 /* Write to drive */
+
+/*
+ * Represents data that can be sent between the
+ * DMS framework and certain user applications
+ *
+ * @id: ID of disk to operate on
+ * @opcode: Operation code
+ * @buf: Data buffer (direction depends on opcode)
+ * @offset: Offset to perform operation at (depends on opcode)
+ * @len: Length of buffer
+ */
+struct dms_frame {
+ uint16_t id;
+ uint8_t opcode;
+ void *buf;
+ off_t offset;
+ size_t len;
+};
+
+#endif /* !_SYS_DMS_H_ */
diff --git a/src/sys/include/sys/syscall.h b/src/sys/include/sys/syscall.h
index ac03055..2ff6087 100644
--- a/src/sys/include/sys/syscall.h
+++ b/src/sys/include/sys/syscall.h
@@ -55,6 +55,7 @@
#define SYS_getargv 0x0A /* get process argv */
#define SYS_reboot 0x0B /* reboot the system */
#define SYS_waitpid 0x0C /* wait for child to exit */
+#define SYS_dmsio 0x0D /* DMS I/O */
typedef __ssize_t scret_t;
typedef __ssize_t scarg_t;