From eb36d836458803b5dcfa668fef487c52e5c45cdc Mon Sep 17 00:00:00 2001 From: dzwdz Date: Sun, 7 Aug 2022 18:55:59 +0200 Subject: kernel: ring_to_virt --- src/kernel/ring.c | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 src/kernel/ring.c (limited to 'src/kernel/ring.c') diff --git a/src/kernel/ring.c b/src/kernel/ring.c new file mode 100644 index 0000000..e25024a --- /dev/null +++ b/src/kernel/ring.c @@ -0,0 +1,11 @@ +#include +#include + +size_t ring_to_virt(ring_t *r, struct pagedir *pages, void __user *ubuf, size_t max) { + char tmp[32]; + if (max > sizeof tmp) max = sizeof tmp; + max = ring_get(r, tmp, max); + // TODO decide how write errors should be handled + virt_cpy_to(pages, ubuf, tmp, max); + return max; +} -- cgit v1.2.3