From 27b2905dd7d2b75c3cbcb5edb05d3c5e0b92b876 Mon Sep 17 00:00:00 2001 From: Marvin Friedrich Date: Sat, 17 Oct 2026 11:25:53 +0200 Subject: [PATCH] move iovec_iter_kernel out of header --- core/lib/iovec.c | 16 ++++++++++++++++ include/zinnia/iovec.h | 16 +--------------- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/core/lib/iovec.c b/core/lib/iovec.c index 44a1cfe..497c2cc 100644 --- a/core/lib/iovec.c +++ b/core/lib/iovec.c @@ -44,6 +44,22 @@ static errno_t iovec_iter_copy(iovec_iter_t* iter, void* buf, size_t len, bool t return status; } +iovec_iter_t iovec_iter_kernel(iovec_t* iovecs, size_t count) { + size_t total = 0; + for (size_t i = 0; i < count; i++) + total += iovecs[i].len; + + return (iovec_iter_t){ + .iovecs = iovecs, + .iovecs_len = count, + .total_len = total, + .total_offset = 0, + .current_idx = 0, + .current_offset = 0, + .user = false, + }; +} + errno_t iovec_iter_copy_to(iovec_iter_t* iter, const void* src, size_t len, size_t* out_copied) { return iovec_iter_copy(iter, (void*)src, len, true, out_copied); } diff --git a/include/zinnia/iovec.h b/include/zinnia/iovec.h index d997746..0bbd0c0 100644 --- a/include/zinnia/iovec.h +++ b/include/zinnia/iovec.h @@ -24,21 +24,7 @@ static inline size_t iovec_iter_len(iovec_iter_t* iter) { } // Creates an iovec iterator over kernel memory. -static inline iovec_iter_t iovec_iter_kernel(iovec_t* iovecs, size_t count) { - size_t total = 0; - for (size_t i = 0; i < count; i++) - total += iovecs[i].len; - - return (iovec_iter_t){ - .iovecs = iovecs, - .iovecs_len = count, - .total_len = total, - .total_offset = 0, - .current_idx = 0, - .current_offset = 0, - .user = false, - }; -} +iovec_iter_t iovec_iter_kernel(iovec_t* iovecs, size_t count); // Copies up to `len` bytes from `src` into the iterator and advances it. // Returns the amount of bytes actually copied in `out_copied`.