summaryrefslogtreecommitdiff
path: root/src/kernel/vfs/root.c
diff options
context:
space:
mode:
authordzwdz2021-10-02 19:48:17 +0000
committerdzwdz2021-10-02 19:48:17 +0000
commit16a5b4c9ed410daba848a781f8b8978846c6b836 (patch)
treec305f5671da65a217ef934b602b8d8735790ab62 /src/kernel/vfs/root.c
parent1fb05a21e8ae570c4c3902ae5fe6635df029bcda (diff)
implement serial/tty input
Diffstat (limited to 'src/kernel/vfs/root.c')
-rw-r--r--src/kernel/vfs/root.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/kernel/vfs/root.c b/src/kernel/vfs/root.c
index dca81d2..7e957ef 100644
--- a/src/kernel/vfs/root.c
+++ b/src/kernel/vfs/root.c
@@ -13,12 +13,26 @@ int vfs_root_handler(struct vfs_request *req) {
return 0;
}
return -1;
- case VFSOP_WRITE:
+
+ case VFSOP_READ:
switch (req->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->output.buf, req->output.len,
+ req->caller->pages, true, false);
+ while (virt_iter_next(&iter))
+ tty_read(iter.frag, iter.frag_len);
+ return iter.prior;
+ }
+ default: panic_invalid_state();
+ }
+
+ case VFSOP_WRITE:
+ switch (req->id) {
+ case 0: { // tty
+ struct virt_iter iter;
virt_iter_new(&iter, req->input.buf, req->input.len,
req->caller->pages, true, false);
while (virt_iter_next(&iter))