|
9 | 9 | #include <stdbool.h>
|
10 | 10 | #include <errno.h>
|
11 | 11 | #include <platform/mmap.h>
|
| 12 | +#include <platform/platform.h> |
12 | 13 | #include <kernel/sched.h>
|
13 | 14 | #include <kernel/socket.h>
|
14 | 15 | #include <kernel/syscalls.h>
|
15 | 16 | #include <kernel/logger.h>
|
16 | 17 | #include <kernel/memory.h>
|
| 18 | +#include <kernel/file.h> |
17 | 19 |
|
18 | 20 | /* This is the dispatcher for system calls, many of which need a wrapper for
|
19 | 21 | * their behavior. This ensures the exposed functionality is always as close
|
@@ -96,7 +98,19 @@ void syscallDispatchMSleep(SyscallRequest *req) {
|
96 | 98 | req->ret = msleep(req->thread, req->params[0]);
|
97 | 99 | }
|
98 | 100 |
|
99 |
| -/* TODO: Group 2: File System */ |
| 101 | +/* Group 2: File System */ |
| 102 | + |
| 103 | +void syscallDispatchMount(SyscallRequest *req) { |
| 104 | + if(syscallVerifyPointer(req, req->params[0], MAX_FILE_PATH) && |
| 105 | + syscallVerifyPointer(req, req->params[1], MAX_FILE_PATH) && |
| 106 | + syscallVerifyPointer(req, req->params[2], 32)) { |
| 107 | + uint64_t id = platformRand(); |
| 108 | + req->requestID = id; |
| 109 | + req->external = true; |
| 110 | + |
| 111 | + mount(req->thread, id, (const char *)req->params[0], (const char *)req->params[1], (const char *)req->params[2], req->params[3]); |
| 112 | + } |
| 113 | +} |
100 | 114 |
|
101 | 115 | /* Group 3: Interprocess Communication */
|
102 | 116 |
|
@@ -240,7 +254,7 @@ void (*syscallDispatchTable[])(SyscallRequest *) = {
|
240 | 254 | NULL, // 25 - rmdir()
|
241 | 255 | NULL, // 26 - utime()
|
242 | 256 | NULL, // 27 - chroot()
|
243 |
| - NULL, // 28 - mount() |
| 257 | + syscallDispatchMount, // 28 - mount() |
244 | 258 | NULL, // 29 - umount()
|
245 | 259 | NULL, // 30 - fnctl()
|
246 | 260 |
|
|
0 commit comments