From a35003744359df6aede61877d727ca6efc4c6c68 Mon Sep 17 00:00:00 2001 From: asou Date: Sun, 28 May 2023 05:28:50 +0000 Subject: [PATCH] Used number of bytes instead of number of 512 byte sectors. ok dv@ --- usr.sbin/vmd/vioblk.c | 4 ++-- usr.sbin/vmd/vioqcow2.c | 4 ++-- usr.sbin/vmd/vioraw.c | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/usr.sbin/vmd/vioblk.c b/usr.sbin/vmd/vioblk.c index 33d447a9438..7bc76c4daed 100644 --- a/usr.sbin/vmd/vioblk.c +++ b/usr.sbin/vmd/vioblk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vioblk.c,v 1.3 2023/05/13 23:15:28 dv Exp $ */ +/* $OpenBSD: vioblk.c,v 1.4 2023/05/28 05:28:50 asou Exp $ */ /* * Copyright (c) 2023 Dave Voutila @@ -144,7 +144,7 @@ vioblk_main(int fd, int fd_vmm) log_warnx("failed to init disk %s image", disk_type(type)); goto fail; } - vioblk->sz = szp; + vioblk->sz = szp / 512; log_debug("%s: initialized vioblk[%d] with %s image (sz=%lld)", __func__, vioblk->idx, disk_type(type), vioblk->sz); diff --git a/usr.sbin/vmd/vioqcow2.c b/usr.sbin/vmd/vioqcow2.c index 96f830d58bf..c648d668132 100644 --- a/usr.sbin/vmd/vioqcow2.c +++ b/usr.sbin/vmd/vioqcow2.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vioqcow2.c,v 1.22 2023/04/28 18:52:22 dv Exp $ */ +/* $OpenBSD: vioqcow2.c,v 1.23 2023/05/28 05:28:50 asou Exp $ */ /* * Copyright (c) 2018 Ori Bernstein @@ -130,7 +130,7 @@ virtio_qcow2_init(struct virtio_backing *file, off_t *szp, int *fd, size_t nfd) file->pread = qc2_pread; file->pwrite = qc2_pwrite; file->close = qc2_close; - *szp = diskp->disksz / 512; + *szp = diskp->disksz; return 0; } diff --git a/usr.sbin/vmd/vioraw.c b/usr.sbin/vmd/vioraw.c index 4050efd1a5d..fb74303c915 100644 --- a/usr.sbin/vmd/vioraw.c +++ b/usr.sbin/vmd/vioraw.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vioraw.c,v 1.9 2023/04/27 22:47:27 dv Exp $ */ +/* $OpenBSD: vioraw.c,v 1.10 2023/05/28 05:28:50 asou Exp $ */ /* * Copyright (c) 2018 Ori Bernstein * @@ -47,7 +47,7 @@ raw_close(void *file, int stayopen) /* * Initializes a raw disk image backing file from an fd. Stores the - * number of 512-byte sectors in *szp, returning -1 for error, 0 for success. + * number of bytes in *szp, returning -1 for error, 0 for success. */ int virtio_raw_init(struct virtio_backing *file, off_t *szp, int *fd, size_t nfd) @@ -70,7 +70,7 @@ virtio_raw_init(struct virtio_backing *file, off_t *szp, int *fd, size_t nfd) file->pread = raw_pread; file->pwrite = raw_pwrite; file->close = raw_close; - *szp = sz / 512; + *szp = sz; return (0); } -- 2.20.1