From 75fc5c8f30b0a5dd5837df35948fc92861f30552 Mon Sep 17 00:00:00 2001
From: dzwdz
Date: Wed, 25 Aug 2021 11:29:44 +0200
Subject: use a tagged union for the fdop args

---
 src/kernel/syscalls.c | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

(limited to 'src/kernel/syscalls.c')

diff --git a/src/kernel/syscalls.c b/src/kernel/syscalls.c
index e0fb08b..bf17fd3 100644
--- a/src/kernel/syscalls.c
+++ b/src/kernel/syscalls.c
@@ -133,17 +133,28 @@ fail:
 
 int _syscall_fd_read(fd_t fd, user_ptr buf, int len) {
 	if (fd < 0 || fd >= FD_MAX) return -1;
-	return fdop_dispatch(FDOP_READ, &process_current->fds[fd], buf, len);
+	return fdop_dispatch((struct fdop_args){
+			.type = FDOP_READ, 
+			.fd = &process_current->fds[fd], 
+			.rw = {buf, len}
+		});
 }
 
 int _syscall_fd_write(fd_t fd, user_ptr buf, int len) {
 	if (fd < 0 || fd >= FD_MAX) return -1;
-	return fdop_dispatch(FDOP_WRITE, &process_current->fds[fd], buf, len);
+	return fdop_dispatch((struct fdop_args){
+			.type = FDOP_WRITE, 
+			.fd = &process_current->fds[fd], 
+			.rw = {buf, len}
+		});
 }
 
 int _syscall_fd_close(fd_t fd) {
 	if (fd < 0 || fd >= FD_MAX) return -1;
-	return fdop_dispatch(FDOP_CLOSE, &process_current->fds[fd], 0, 0);
+	return fdop_dispatch((struct fdop_args){
+			.type = FDOP_CLOSE, 
+			.fd = &process_current->fds[fd], 
+		});
 }
 
 int syscall_handler(int num, int a, int b, int c) {
-- 
cgit v1.2.3