summaryrefslogtreecommitdiff
path: root/lib9p_util/static.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib9p_util/static.c')
-rw-r--r--lib9p_util/static.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/lib9p_util/static.c b/lib9p_util/static.c
index d8b8ffc..6071e03 100644
--- a/lib9p_util/static.c
+++ b/lib9p_util/static.c
@@ -202,24 +202,21 @@ static uint32_t util9p_static_fio_iounit(struct util9p_static_file *self) {
assert(self);
return 0;
}
-static iovec_or_error util9p_static_fio_pread(struct util9p_static_file *self, struct lib9p_srv_ctx *ctx,
- uint32_t byte_count, uint64_t byte_offset) {
+static error util9p_static_fio_pread(struct util9p_static_file *self, struct lib9p_srv_ctx *ctx,
+ lo_interface io_writer dst, uint64_t byte_offset, uint32_t byte_count) {
assert(self);
assert(ctx);
size_t data_size = util9p_static_file_size(self);
if (byte_offset > (uint64_t)data_size)
- return ERROR_NEW_ERR(iovec, error_new(E_POSIX_EINVAL, "offset is past end-of-file length"));
+ return error_new(E_POSIX_EINVAL, "offset is past end-of-file length");
size_t beg_off = (size_t)byte_offset;
size_t end_off = beg_off + (size_t)byte_count;
if (end_off > data_size)
end_off = data_size;
- return ERROR_NEW_VAL(iovec, ((struct iovec){
- .iov_base = &self->data_start[beg_off],
- .iov_len = end_off-beg_off,
- }));
+ return io_write(dst, &self->data_start[beg_off], end_off-beg_off).err;
}
static uint32_t_or_error util9p_static_fio_pwrite(struct util9p_static_file *self, struct lib9p_srv_ctx *ctx,
void *LM_UNUSED(buf),