diff options
Diffstat (limited to 'src/user/app')
-rw-r--r-- | src/user/app/init/driver/initctl.c | 9 | ||||
-rw-r--r-- | src/user/app/init/driver/ps2.c | 9 | ||||
-rw-r--r-- | src/user/app/login/login.c | 9 | ||||
-rw-r--r-- | src/user/app/tests/kernel/path.c | 7 | ||||
-rw-r--r-- | src/user/app/tmpfs/tmpfs.c | 27 | ||||
-rw-r--r-- | src/user/app/vterm/vterm.c | 11 |
6 files changed, 39 insertions, 33 deletions
diff --git a/src/user/app/init/driver/initctl.c b/src/user/app/init/driver/initctl.c index c31e8fb..34171de 100644 --- a/src/user/app/init/driver/initctl.c +++ b/src/user/app/init/driver/initctl.c @@ -4,15 +4,16 @@ #include <errno.h> #include <string.h> #include <unistd.h> +#include <user/lib/compat.h> void initctl_drv(handle_t killswitch) { struct fs_wait_response res; char buf[64]; const size_t buflen = sizeof buf; - while (!_syscall_fs_wait(buf, buflen, &res)) { + while (!c0_fs_wait(buf, buflen, &res)) { switch (res.op) { case VFSOP_OPEN: - _syscall_fs_respond(NULL, res.len == 0 ? 0 : -1, 0); + c0_fs_respond(NULL, res.len == 0 ? 0 : -1, 0); break; case VFSOP_WRITE: /* null terminate */ @@ -30,10 +31,10 @@ void initctl_drv(handle_t killswitch) { _syscall_write(killswitch, "halt", 4, 0, 0); exit(1); } - _syscall_fs_respond(NULL, res.len, 0); + c0_fs_respond(NULL, res.len, 0); break; default: - _syscall_fs_respond(NULL, -ENOSYS, 0); + c0_fs_respond(NULL, -ENOSYS, 0); break; } } diff --git a/src/user/app/init/driver/ps2.c b/src/user/app/init/driver/ps2.c index 7653f83..961ea53 100644 --- a/src/user/app/init/driver/ps2.c +++ b/src/user/app/init/driver/ps2.c @@ -3,6 +3,7 @@ #include <shared/container/ring.h> #include <stdbool.h> #include <unistd.h> +#include <user/lib/compat.h> static const char keymap_lower[] = { @@ -53,10 +54,10 @@ static void main_loop(void) { static char buf[512]; struct fs_wait_response res; int ret; - while (!_syscall_fs_wait(buf, sizeof buf, &res)) { + while (!c0_fs_wait(buf, sizeof buf, &res)) { switch (res.op) { case VFSOP_OPEN: - _syscall_fs_respond(NULL, 1, 0); + c0_fs_respond(NULL, 1, 0); break; case VFSOP_READ: @@ -68,11 +69,11 @@ static void main_loop(void) { parse_scancode(buf[i]); } ret = ring_get((void*)&backlog, buf, res.capacity); - _syscall_fs_respond(buf, ret, 0); + c0_fs_respond(buf, ret, 0); break; default: - _syscall_fs_respond(NULL, -1, 0); + c0_fs_respond(NULL, -1, 0); break; } } diff --git a/src/user/app/login/login.c b/src/user/app/login/login.c index 241bcfe..9f8ba6d 100644 --- a/src/user/app/login/login.c +++ b/src/user/app/login/login.c @@ -6,6 +6,7 @@ #include <stdio.h> #include <string.h> #include <unistd.h> +#include <user/lib/compat.h> #include <user/lib/fs/misc.h> static const char *shell = "/bin/shell"; @@ -39,12 +40,12 @@ static void drv(const char *prefix) { struct fs_wait_response res; size_t prefixlen = strlen(prefix); char buf[128]; - while (!_syscall_fs_wait(buf, sizeof buf, &res)) { + while (!c0_fs_wait(buf, sizeof buf, &res)) { switch (res.op) { handle_t h; case VFSOP_OPEN: if (res.len == sizeof buf) { - _syscall_fs_respond(NULL, -1, 0); + c0_fs_respond(NULL, -1, 0); break; } buf[res.len] = '\0'; @@ -56,11 +57,11 @@ static void drv(const char *prefix) { } else { h = -EACCES; } - _syscall_fs_respond(NULL, h, FSR_DELEGATE); + c0_fs_respond(NULL, h, FSR_DELEGATE); break; default: - _syscall_fs_respond(NULL, -1, 0); + c0_fs_respond(NULL, -1, 0); break; } } diff --git a/src/user/app/tests/kernel/path.c b/src/user/app/tests/kernel/path.c index e25154d..5fb3123 100644 --- a/src/user/app/tests/kernel/path.c +++ b/src/user/app/tests/kernel/path.c @@ -1,6 +1,7 @@ #include "../tests.h" #include <camellia/path.h> #include <string.h> +#include <user/lib/compat.h> #include <user/lib/fs/misc.h> static void test_path_simplify(void) { @@ -66,9 +67,9 @@ static void mount_resolve_drv(const char *path) { if (fork2_n_mount(path)) return; struct fs_wait_response res; - while (!_syscall_fs_wait(NULL, 0, &res)) { - // TODO does the first argument of _syscall_fs_respond need to be non-const? - _syscall_fs_respond((void*)path, strlen(path), 0); + while (!c0_fs_wait(NULL, 0, &res)) { + // TODO does the first argument of c0_fs_respond need to be non-const? + c0_fs_respond((void*)path, strlen(path), 0); } exit(1); } diff --git a/src/user/app/tmpfs/tmpfs.c b/src/user/app/tmpfs/tmpfs.c index 401bab3..606d682 100644 --- a/src/user/app/tmpfs/tmpfs.c +++ b/src/user/app/tmpfs/tmpfs.c @@ -7,6 +7,7 @@ #include <stddef.h> #include <stdlib.h> #include <unistd.h> +#include <user/lib/compat.h> #include <user/lib/fs/dir.h> struct node { @@ -103,11 +104,11 @@ int main(void) { char *buf = malloc(buflen); struct fs_wait_response res; struct node *ptr; - while (!_syscall_fs_wait(buf, buflen, &res)) { + while (!c0_fs_wait(buf, buflen, &res)) { switch (res.op) { case VFSOP_OPEN: ptr = tmpfs_open(buf, &res); - _syscall_fs_respond(ptr, ptr ? 0 : -1, 0); + c0_fs_respond(ptr, ptr ? 0 : -1, 0); break; case VFSOP_READ: @@ -117,23 +118,23 @@ int main(void) { dir_start(&db, res.offset, buf, buflen); for (struct node *iter = ptr->child; iter; iter = iter->sibling) dir_append(&db, iter->name); - _syscall_fs_respond(buf, dir_finish(&db), 0); + c0_fs_respond(buf, dir_finish(&db), 0); } else { fs_normslice(&res.offset, &res.len, ptr->size, false); - _syscall_fs_respond(ptr->buf + res.offset, res.len, 0); + c0_fs_respond(ptr->buf + res.offset, res.len, 0); } break; case VFSOP_WRITE: ptr = (void*)res.id; if (ptr == &special_root) { - _syscall_fs_respond(NULL, -1, 0); + c0_fs_respond(NULL, -1, 0); break; } if (res.len > 0 && !ptr->buf) { ptr->buf = malloc(256); if (!ptr->buf) { - _syscall_fs_respond(NULL, -1, 0); + c0_fs_respond(NULL, -1, 0); break; } memset(ptr->buf, 0, 256); @@ -146,7 +147,7 @@ int main(void) { while (newcap && newcap <= res.offset + res.len) newcap *= 2; if (!newcap) { /* overflow */ - _syscall_fs_respond(NULL, -1, 0); + c0_fs_respond(NULL, -1, 0); break; } ptr->capacity = newcap; @@ -157,7 +158,7 @@ int main(void) { if ((res.flags & WRITE_TRUNCATE) || ptr->size < res.offset + res.len) { ptr->size = res.offset + res.len; } - _syscall_fs_respond(NULL, res.len, 0); + c0_fs_respond(NULL, res.len, 0); break; case VFSOP_GETSIZE: @@ -168,25 +169,25 @@ int main(void) { dir_start(&db, res.offset, NULL, buflen); for (struct node *iter = ptr->child; iter; iter = iter->sibling) dir_append(&db, iter->name); - _syscall_fs_respond(NULL, dir_finish(&db), 0); + c0_fs_respond(NULL, dir_finish(&db), 0); } else { - _syscall_fs_respond(NULL, ptr->size, 0); + c0_fs_respond(NULL, ptr->size, 0); } break; case VFSOP_REMOVE: ptr = (void*)res.id; - _syscall_fs_respond(NULL, remove_node(ptr), 0); + c0_fs_respond(NULL, remove_node(ptr), 0); break; case VFSOP_CLOSE: ptr = (void*)res.id; handle_down(ptr); - _syscall_fs_respond(NULL, -1, 0); + c0_fs_respond(NULL, -1, 0); break; default: - _syscall_fs_respond(NULL, -1, 0); + c0_fs_respond(NULL, -1, 0); break; } } diff --git a/src/user/app/vterm/vterm.c b/src/user/app/vterm/vterm.c index 7ae24c2..102513d 100644 --- a/src/user/app/vterm/vterm.c +++ b/src/user/app/vterm/vterm.c @@ -5,6 +5,7 @@ #include <stdlib.h> #include <string.h> #include <unistd.h> +#include <user/lib/compat.h> struct point cursor = {0}; @@ -38,26 +39,26 @@ int main(void) { static char buf[512]; struct fs_wait_response res; - while (!_syscall_fs_wait(buf, sizeof buf, &res)) { + while (!c0_fs_wait(buf, sizeof buf, &res)) { switch (res.op) { case VFSOP_OPEN: // TODO check path - _syscall_fs_respond(NULL, 0, 0); + c0_fs_respond(NULL, 0, 0); break; case VFSOP_WRITE: if (res.flags) { - _syscall_fs_respond(NULL, -1, 0); + c0_fs_respond(NULL, -1, 0); } else { for (size_t i = 0; i < res.len; i++) in_char(buf[i]); dirty_flush(&dirty, &fb); - _syscall_fs_respond(NULL, res.len, 0); + c0_fs_respond(NULL, res.len, 0); } break; default: - _syscall_fs_respond(NULL, -1, 0); + c0_fs_respond(NULL, -1, 0); break; } } |