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.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/lib9p_util/static.c b/lib9p_util/static.c
index 50bb129..7f1e6b7 100644
--- a/lib9p_util/static.c
+++ b/lib9p_util/static.c
@@ -218,27 +218,27 @@ static uint32_t util9p_static_file_iounit(struct util9p_static_file *self) {
assert(self);
return 0;
}
-static uint32_t util9p_static_file_pread(struct util9p_static_file *self, struct lib9p_srv_ctx *ctx,
- void *buf,
- uint32_t byte_count,
- uint64_t byte_offset) {
+static void util9p_static_file_pread(struct util9p_static_file *self, struct lib9p_srv_ctx *ctx,
+ uint32_t byte_count, uint64_t byte_offset,
+ struct iovec *ret) {
assert(self);
assert(ctx);
+ assert(ret);
size_t data_size = util9p_static_file_size(self);
if (byte_offset > (uint64_t)data_size) {
lib9p_error(&ctx->basectx,
LINUX_EINVAL, "offset is past end-of-file length");
- return 0;
+ return;
}
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;
- memcpy(buf, &self->data_start[beg_off], end_off-beg_off);
- return (uint32_t)(end_off-beg_off);
+ ret->iov_base = &self->data_start[beg_off];
+ ret->iov_len = end_off-beg_off;
}
static uint32_t util9p_static_file_pwrite(struct util9p_static_file *self, struct lib9p_srv_ctx *ctx,
void *LM_UNUSED(buf),