summaryrefslogtreecommitdiff
path: root/src/init/tar.c
diff options
context:
space:
mode:
authordzwdz2021-09-20 18:54:40 +0200
committerdzwdz2021-09-20 18:54:40 +0200
commit29bcaabe450e1bbd906111c5c83407d80abd584d (patch)
treee898b1f3994c67c157c834ee8bcd2e7bb7176b63 /src/init/tar.c
parent7ba8059015fd08a952d48ab71bf91202ea4f06eb (diff)
use a single struct for all fs_wait return values
Diffstat (limited to 'src/init/tar.c')
-rw-r--r--src/init/tar.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/init/tar.c b/src/init/tar.c
index 43efe3b..74e4c83 100644
--- a/src/init/tar.c
+++ b/src/init/tar.c
@@ -3,6 +3,8 @@
#include <shared/syscalls.h>
#include <stdint.h>
+#define BUF_SIZE 64
+
extern int tty_fd;
// TODO struct tar
@@ -12,20 +14,19 @@ static void *tar_find(const char *path, size_t path_len, void *base, size_t base
static int oct_parse(char *str, size_t len);
void tar_driver(handle_t back, void *base) {
- static char buf[64];
- int len;
- void *id; // IDs usually are integers, but here i'm using them as pointers
- // to the metadata sectors
+ static char buf[BUF_SIZE];
+ struct fs_wait_response res;
for (;;) {
- len = 64;
- switch (_syscall_fs_wait(back, buf, &len, (int*)&id)) {
+ switch (_syscall_fs_wait(back, buf, BUF_SIZE, &res)) {
case VFSOP_OPEN:
- _syscall_fs_respond(NULL, tar_open(buf, len, base, ~0));
+ _syscall_fs_respond(NULL, tar_open(buf, res.len, base, ~0));
break;
- case VFSOP_READ:
- _syscall_fs_respond(id + 512, tar_size(id));
+ case VFSOP_READ: {
+ void *meta = (void*)res.id;
+ _syscall_fs_respond(meta + 512, tar_size(meta));
break;
+ }
default:
_syscall_fs_respond(NULL, -1); // unsupported