summaryrefslogtreecommitdiff
path: root/usr.sbin/vmd/vioraw.c
diff options
context:
space:
mode:
authorDave Voutila <dv@cvs.openbsd.org>2023-04-16 12:52:55 +0000
committerDave Voutila <dv@cvs.openbsd.org>2023-04-16 12:52:55 +0000
commitb3cd7f448d77fbeed79154083f9f97d794344fb2 (patch)
treeb74e96f2cf432126bdbb53ee6c4e7a3356d58f2d /usr.sbin/vmd/vioraw.c
parent1fce41236487d6dff41d4677d9310c81278f4717 (diff)
vmd(8): correct comment in vioraw, cleanup formatting.
Comment incorrectly mentioned returning sectors when this function returns bytes; the logic in virtio.c computes the number of 512 byte sectors after calling virtio_raw_init. While here, adjust the formatting of return's to match the rest of vmd. No functional change.
Diffstat (limited to 'usr.sbin/vmd/vioraw.c')
-rw-r--r--usr.sbin/vmd/vioraw.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/usr.sbin/vmd/vioraw.c b/usr.sbin/vmd/vioraw.c
index 798399affb3..174bf406315 100644
--- a/usr.sbin/vmd/vioraw.c
+++ b/usr.sbin/vmd/vioraw.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vioraw.c,v 1.7 2022/05/04 23:17:25 dv Exp $ */
+/* $OpenBSD: vioraw.c,v 1.8 2023/04/16 12:52:54 dv Exp $ */
/*
* Copyright (c) 2018 Ori Bernstein <ori@eigenstate.org>
*
@@ -46,9 +46,8 @@ 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.
+ * Initializes a raw disk image backing file from an fd. Stores the
+ * 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)
@@ -57,21 +56,21 @@ virtio_raw_init(struct virtio_backing *file, off_t *szp, int *fd, size_t nfd)
int *fdp;
if (nfd != 1)
- return -1;
+ return (-1);
sz = lseek(fd[0], 0, SEEK_END);
if (sz == -1)
- return -1;
+ return (-1);
fdp = malloc(sizeof(int));
if (!fdp)
- return -1;
+ return (-1);
*fdp = fd[0];
file->p = fdp;
file->pread = raw_pread;
file->pwrite = raw_pwrite;
file->close = raw_close;
*szp = sz;
- return 0;
+ return (0);
}
/*