summaryrefslogtreecommitdiff
path: root/usr.sbin/vmd/virtio.c
diff options
context:
space:
mode:
authorccardenas <ccardenas@cvs.openbsd.org>2018-09-19 04:29:22 +0000
committerccardenas <ccardenas@cvs.openbsd.org>2018-09-19 04:29:22 +0000
commit6f514c141b51fd641a140b0e9b1b0b4c992fa0c1 (patch)
tree2ae2f71bab5d0982a38501c4d638afb4fbbf4c85 /usr.sbin/vmd/virtio.c
parent8082160e4b9dc503ffdfafdcc1d122091acd4cfc (diff)
Various clean up items for disks.
- qcow2: general cleanup - vioraw: check malloc - virtio: add function to sync disks - vm: call virtio_shutdown to sync disks when vm is finished executing Thanks to Ori Bernstein. Ok miko@
Diffstat (limited to 'usr.sbin/vmd/virtio.c')
-rw-r--r--usr.sbin/vmd/virtio.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/usr.sbin/vmd/virtio.c b/usr.sbin/vmd/virtio.c
index cdff71aed69..05734cfae34 100644
--- a/usr.sbin/vmd/virtio.c
+++ b/usr.sbin/vmd/virtio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: virtio.c,v 1.68 2018/09/13 04:23:36 pd Exp $ */
+/* $OpenBSD: virtio.c,v 1.69 2018/09/19 04:29:21 ccardenas Exp $ */
/*
* Copyright (c) 2015 Mike Larkin <mlarkin@openbsd.org>
@@ -2009,6 +2009,17 @@ virtio_init(struct vmd_vm *vm, int child_cdrom, int *child_disks,
evtimer_set(&vmmci.timeout, vmmci_timeout, NULL);
}
+void
+virtio_shutdown(struct vmd_vm *vm)
+{
+ int i;
+
+ /* ensure that our disks are synced */
+ vioscsi->file.close(vioscsi->file.p);
+ for (i = 0; i < nr_vioblk; i++)
+ vioblk[i].file.close(vioblk[i].file.p);
+}
+
int
vmmci_restore(int fd, uint32_t vm_id)
{