From ce00d1677d7a419b427e7f11963eee982a55a231 Mon Sep 17 00:00:00 2001 From: dzwdz Date: Thu, 4 Aug 2022 23:06:57 +0200 Subject: do some simple TODOs, organize the rest; general code maintainance --- src/kernel/arch/amd64/driver/util.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 src/kernel/arch/amd64/driver/util.c (limited to 'src/kernel/arch/amd64/driver/util.c') diff --git a/src/kernel/arch/amd64/driver/util.c b/src/kernel/arch/amd64/driver/util.c new file mode 100644 index 0000000..b03e582 --- /dev/null +++ b/src/kernel/arch/amd64/driver/util.c @@ -0,0 +1,16 @@ +#include +#include +#include +#include +#include + +int req_readcopy(struct vfs_request *req, const void *buf, size_t len) { + if (!req->caller) return -1; + assert(req->type == VFSOP_READ); + fs_normslice(&req->offset, &req->output.len, len, false); + virt_cpy_to( + req->caller->pages, req->output.buf, + buf + req->offset, req->output.len); + /* read errors are ignored. TODO write a spec */ + return req->output.len; +} -- cgit v1.2.3