git: c2b34d060705 - main - bhyvectl: Convert to use vm_openf()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 05 Nov 2024 01:40:54 UTC
The branch main has been updated by markj:
URL: https://cgit.FreeBSD.org/src/commit/?id=c2b34d060705879d78bbce7e62f9fb35fb13bc55
commit c2b34d060705879d78bbce7e62f9fb35fb13bc55
Author: Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2024-11-05 01:36:52 +0000
Commit: Mark Johnston <markj@FreeBSD.org>
CommitDate: 2024-11-05 01:40:41 +0000
bhyvectl: Convert to use vm_openf()
Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D47031
---
usr.sbin/bhyvectl/bhyvectl.c | 21 ++++++++-------------
1 file changed, 8 insertions(+), 13 deletions(-)
diff --git a/usr.sbin/bhyvectl/bhyvectl.c b/usr.sbin/bhyvectl/bhyvectl.c
index 5e23860d711c..41055678ac30 100644
--- a/usr.sbin/bhyvectl/bhyvectl.c
+++ b/usr.sbin/bhyvectl/bhyvectl.c
@@ -388,22 +388,17 @@ main(int argc, char *argv[])
if (vmname == NULL)
usage(opts);
- error = 0;
-
- if (!error && create)
- error = vm_create(vmname);
- if (!error) {
- ctx = vm_open(vmname);
- if (ctx == NULL) {
- fprintf(stderr,
- "vm_open: %s could not be opened: %s\n",
- vmname, strerror(errno));
- exit(1);
- }
- vcpu = vm_vcpu_open(ctx, vcpuid);
+ ctx = vm_openf(vmname, create ? VMMAPI_OPEN_CREATE : 0);
+ if (ctx == NULL) {
+ fprintf(stderr,
+ "vm_open: %s could not be opened: %s\n",
+ vmname, strerror(errno));
+ exit(1);
}
+ vcpu = vm_vcpu_open(ctx, vcpuid);
+ error = 0;
if (!error && memsize)
error = vm_setup_memory(ctx, memsize, VM_MMAP_ALL);