summaryrefslogtreecommitdiff
path: root/src/kernel/fd.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/kernel/fd.c')
-rw-r--r--src/kernel/fd.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/kernel/fd.c b/src/kernel/fd.c
index c495c8c..77fea05 100644
--- a/src/kernel/fd.c
+++ b/src/kernel/fd.c
@@ -3,34 +3,35 @@
#include <kernel/panic.h>
#include <kernel/proc.h>
-static int fdop_special_tty(enum fdop fdop, struct fd *fd, user_ptr ptr, size_t len);
+static int fdop_special_tty(struct fdop_args *args);
-int fdop_dispatch(enum fdop fdop, struct fd *fd, user_ptr ptr, size_t len) {
- switch(fd->type) {
+int fdop_dispatch(struct fdop_args args) {
+ switch(args.fd->type) {
case FD_EMPTY:
return -1;
case FD_SPECIAL_TTY:
- return fdop_special_tty(fdop, fd, ptr, len);
+ return fdop_special_tty(&args);
default:
panic();
}
}
-static int fdop_special_tty(enum fdop fdop, struct fd *fd, user_ptr ptr, size_t len) {
- switch(fdop) {
+static int fdop_special_tty(struct fdop_args *args) {
+ switch(args->type) {
case FDOP_READ:
return -1; // input not implemented yet
case FDOP_WRITE: {
struct virt_iter iter;
- virt_iter_new(&iter, ptr, len, process_current->pages, true, false);
+ virt_iter_new(&iter, args->rw.ptr, args->rw.len,
+ process_current->pages, true, false);
while (virt_iter_next(&iter))
tty_write(iter.frag, iter.frag_len);
return iter.prior;
}
case FDOP_CLOSE:
- fd->type = FD_EMPTY;
+ args->fd->type = FD_EMPTY;
return 0;
default: panic();