From nobody Tue Nov 05 01:40:54 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Xj9yt720Rz5cq8l; Tue, 05 Nov 2024 01:40:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Xj9yt4Q40z3wfS; Tue, 5 Nov 2024 01:40:54 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1730770854; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=wBFVm4T2yn3d1D4afyLm9EQ++RKcf+a9yg2uJJwyKZs=; b=a2PjF1o3HldhbUoe0VfQgixX1PicPs5Mo8Gb8IbMsdd6gt7e/XjOowhJP5qbDbB9ItLwvL A6M45M0ssO3Phh0hd4Up0+ZqFGa7bO2fbXlfrSOdPtRA1OIUbPsmuk1Un94GhvyoPSO0lh ucQBFMM9mJhwEeKHwcyL8x2nU5oLaBACZo7mulWiheX2DIh/IAypIo/V58O1TXjuwxGY09 dGRBopYhum77m2eo0qpJZfNxjqTjTBO4i3quxdpJ4aA5L8NWaLwrTB3eLVMej+Nb7v86yE wa29yT45c/TsAX6U+aE+au4fiQvqLFj0+7oyRkSAyRm5gg8Ez7NK43wnKnkYvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1730770854; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=wBFVm4T2yn3d1D4afyLm9EQ++RKcf+a9yg2uJJwyKZs=; b=GpULTDXG6JFI/6Fg9OHaGyZViL539So2FxrmChzLEiVBTYycu096dms7Jid9Co3y5fBWpD 7ikqI5tR7degG9eHe0+TzIKDqHSn1D1Y0dGMTaEI3ceSU1MNwXAx/OUFxHohgTF+GjZnO/ w5xWdizTItCPfR82bOtAgJ1rmoHJAL6SDXEfeqLIPXGXcfLzIaDvqn4zZVv7xeUHaYFHjH UnVzyqWXjlUV9i9Ln3jhDA7Hd7JS/CTrOTYmU3HmYCLK8WXymAmxhksQcHDRiv0L9OB6jn C4y2wmk0GnnA6P7cepJqjvr6/DY+X24lmGtwuBcvFGeWVXDQIFZ2zQ9Je2pVJA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1730770854; a=rsa-sha256; cv=none; b=lB31gLfrCwVwV6Hpz1n8nMD3ecTKVKreXTGkBLsy7Ip+2FTRwwxOhwQ4QVZry4hyCCukRV Awh/J3ceduBVXO2TvYb+tV6RwtgkT4xALbBXQoKkGU3GSer2kOaiXd0YKRM+w6gdi7+mwY p/O1FBwSvwV/Lxmu+UmjEOk35puWN20/Jcr4iBKeHQ8GaQdee+J2AxI81wDXEuJP8zYoAM wC+hsdHw48XQduGW7FZWQh8u4zg3vu/V52neYSlaAinoRWrWtYgbKeTG6la3IN7vrqE1Tx 8cszas3oiGPnvYaf9DBZtVdzembdgf6vkZJqz2pn/ghQ03r+nyquGnHEUvJmcA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Xj9yt2hXfzxnW; Tue, 5 Nov 2024 01:40:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4A51es7v062799; Tue, 5 Nov 2024 01:40:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4A51es92062796; Tue, 5 Nov 2024 01:40:54 GMT (envelope-from git) Date: Tue, 5 Nov 2024 01:40:54 GMT Message-Id: <202411050140.4A51es92062796@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: c2b34d060705 - main - bhyvectl: Convert to use vm_openf() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c2b34d060705879d78bbce7e62f9fb35fb13bc55 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=c2b34d060705879d78bbce7e62f9fb35fb13bc55 commit c2b34d060705879d78bbce7e62f9fb35fb13bc55 Author: Mark Johnston AuthorDate: 2024-11-05 01:36:52 +0000 Commit: Mark Johnston 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);