diff options
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/sbc_harness/fs_harness_flash_bin.c | 15 | ||||
-rw-r--r-- | cmd/sbc_harness/fs_harness_uptime_txt.c | 11 |
2 files changed, 9 insertions, 17 deletions
diff --git a/cmd/sbc_harness/fs_harness_flash_bin.c b/cmd/sbc_harness/fs_harness_flash_bin.c index 9a5bb2f..e5c3026 100644 --- a/cmd/sbc_harness/fs_harness_flash_bin.c +++ b/cmd/sbc_harness/fs_harness_flash_bin.c @@ -221,13 +221,13 @@ static void flash_file_iofree(struct flash_file *self) { ab_flash_finalize(self->wbuf.dat); } -static iovec_or_error flash_file_pread(struct flash_file *self, struct lib9p_srv_ctx *ctx, - uint32_t byte_count, uint64_t byte_offset) { +static error flash_file_pread(struct flash_file *self, struct lib9p_srv_ctx *ctx, + lo_interface io_writer dst, uint64_t byte_offset, uint32_t byte_count) { assert(self); assert(ctx); if (byte_offset > DATA_SIZE) - return ERROR_NEW_ERR(iovec, error_new(E_POSIX_EINVAL, "offset is past the chip size")); + return error_new(E_POSIX_EINVAL, "offset is past the chip size"); /* Assume that somewhere down the line the iovec we return * will be passed to DMA. We don't want the DMA engine to hit @@ -237,9 +237,7 @@ static iovec_or_error flash_file_pread(struct flash_file *self, struct lib9p_srv * DMA engine can only have a DREQ on one side of the channel. */ if (byte_offset == DATA_SIZE) - return ERROR_NEW_VAL(iovec, ((struct iovec){ - .iov_len = 0, - })); + return io_write(dst, NULL, 0).err; size_t sector_base = LM_ROUND_DOWN(byte_offset, FLASH_SECTOR_SIZE); if (byte_offset + byte_count > sector_base + FLASH_SECTOR_SIZE) byte_count = (sector_base + FLASH_SECTOR_SIZE) - byte_offset; @@ -251,10 +249,7 @@ static iovec_or_error flash_file_pread(struct flash_file *self, struct lib9p_srv memcpy(self->rbuf.dat, DATA_START+sector_base, FLASH_SECTOR_SIZE); } - return ERROR_NEW_VAL(iovec, ((struct iovec){ - .iov_base = &self->rbuf.dat[byte_offset-sector_base], - .iov_len = byte_count, - })); + return io_write(dst, &self->rbuf.dat[byte_offset-sector_base], byte_count).err; } /* TODO: Short/corrupt writes are dangerous. This should either (1) 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, |