diff options
author | dzwdz | 2021-09-05 15:32:00 +0200 |
---|---|---|
committer | dzwdz | 2021-09-05 15:32:00 +0200 |
commit | f229b2e8a6ca840af8f3ac26cc2f412891a99a5e (patch) | |
tree | eafe7e435cc011b0b1e8cdf396f3e6b27f6a4ee3 /src/kernel/vfs/root.c | |
parent | 613de4db61dd99e7d2049b0a303e167fa711030b (diff) |
root vfs: implement writing to /tty
Diffstat (limited to 'src/kernel/vfs/root.c')
-rw-r--r-- | src/kernel/vfs/root.c | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/src/kernel/vfs/root.c b/src/kernel/vfs/root.c index c90557b..0f11a5b 100644 --- a/src/kernel/vfs/root.c +++ b/src/kernel/vfs/root.c @@ -1,6 +1,9 @@ -#include <kernel/vfs/root.h> -#include <kernel/util.h> +#include <kernel/mem.h> #include <kernel/panic.h> +#include <kernel/proc.h> +#include <kernel/types.h> +#include <kernel/util.h> +#include <kernel/vfs/root.h> int vfs_root_handler(struct vfs_op_request *req) { switch (req->op.type) { @@ -10,7 +13,20 @@ int vfs_root_handler(struct vfs_op_request *req) { return 0; } return -1; - default: - panic(); + case VFSOP_WRITE: + switch (req->op.rw.id) { + // every id corresponds to a special file type + // this is a shit way to do this but :shrug: + case 0: { // tty + struct virt_iter iter; + virt_iter_new(&iter, req->op.rw.buf, req->op.rw.buf_len, + req->caller->pages, true, false); + while (virt_iter_next(&iter)) + tty_write(iter.frag, iter.frag_len); + return iter.prior; + } + default: panic(); + } + default: panic(); } } |