From 3d346d6582e7de82982cb08dd98d63c6a3b38fe5 Mon Sep 17 00:00:00 2001 From: dv Date: Sun, 16 Apr 2023 12:52:54 +0000 Subject: [PATCH] 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. --- usr.sbin/vmd/vioraw.c | 15 +++++++-------- 1 file 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 * @@ -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); } /* -- 2.20.1