From ea0630ef550a3ed7bc38d54c8acab6c7ed075aba Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Tue, 26 Mar 2024 21:49:29 -0400 Subject: kernel: Use 'sio_txn' for file I/O Signed-off-by: Ian Moffett --- sys/fs/initramfs.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'sys/fs') diff --git a/sys/fs/initramfs.c b/sys/fs/initramfs.c index 5b31bf9..897a3d4 100644 --- a/sys/fs/initramfs.c +++ b/sys/fs/initramfs.c @@ -121,11 +121,12 @@ vop_vget(struct vnode *parent, const char *name, struct vnode **vp) } static int -vop_read(struct vnode *vp, char *buf, size_t count) +vop_read(struct vnode *vp, struct sio_txn *sio) { struct tar_hdr *hdr; size_t size; char *contents; + char *buf = sio->buf; if (vp->data == NULL) { return -EIO; @@ -135,14 +136,14 @@ vop_read(struct vnode *vp, char *buf, size_t count) size = getsize(hdr->size); contents = hdr_to_contents(hdr); - for (size_t i = 0; i < count; ++i) { + for (size_t i = sio->offset; i < sio->len; ++i) { if (i >= size) { return i + 1; } buf[i] = contents[i]; } - return count; + return sio->len; } static char * -- cgit v1.2.3