From 2d7f2350559dde046e95bcc28c1f89f41f5a6d75 Mon Sep 17 00:00:00 2001 From: "Luke T. Shumaker" Date: Sat, 7 Jun 2025 15:23:29 -0600 Subject: lib9p_srv: Adopt a pread_to-like interface --- cmd/sbc_harness/fs_harness_uptime_txt.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'cmd/sbc_harness/fs_harness_uptime_txt.c') diff --git a/cmd/sbc_harness/fs_harness_uptime_txt.c b/cmd/sbc_harness/fs_harness_uptime_txt.c index 4d35385..9fa6bcc 100644 --- a/cmd/sbc_harness/fs_harness_uptime_txt.c +++ b/cmd/sbc_harness/fs_harness_uptime_txt.c @@ -107,8 +107,8 @@ static struct lib9p_qid uptime_fio_ioqid(struct uptime_fio *self) { return uptime_file_qid(self->parent); } -static iovec_or_error uptime_fio_pread(struct uptime_fio *self, struct lib9p_srv_ctx *ctx, - uint32_t byte_count, uint64_t byte_offset) { +static error uptime_fio_pread(struct uptime_fio *self, struct lib9p_srv_ctx *ctx, + lo_interface io_writer dst, uint64_t byte_offset, uint32_t byte_count) { assert(self); assert(ctx); @@ -118,16 +118,13 @@ static iovec_or_error uptime_fio_pread(struct uptime_fio *self, struct lib9p_srv } if (byte_offset > (uint64_t)self->buf_len) - 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 > self->buf_len) end_off = self->buf_len; - return ERROR_NEW_VAL(iovec, ((struct iovec){ - .iov_base = &self->buf[beg_off], - .iov_len = end_off-beg_off, - })); + return io_write(dst, &self->buf[beg_off], end_off-beg_off).err; } static uint32_t_or_error uptime_fio_pwrite(struct uptime_fio *self, struct lib9p_srv_ctx *ctx, -- cgit v1.2.3-2-g168b