From nobody Mon Feb 9 08:10:20 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1568914930; cv=none; d=zoho.com; s=zohoarc; b=ZlxeaV7H2IWI/fgf9IpBs3PeN5mmy03cufhuI6AzEXO/ou6CBy89QwSJIS5ZxGf0b0JPSr0w2wxt5L3rQVMkJoE/KaE8AM7NNS0h4av8YxSNIA12rA0XVFyyaTYgWuwqLzMC/S8zMG7t2ol3Vudx9hUNiRbooTWJbvF6vxHCc3Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1568914930; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=ZVmyYav0onq85aSUhEjvWwBS4/nyomAU9LL1sAUPGgg=; b=mRXL9n4BHVeADVWS9Q/iXCen2Vttt1tgaof1MixnxZhcShkqe8hvi78IN79absK069+haNqFFq7wXCn6hZRSE7oTNlaAx1zAY0pRc9/+v5U+fF/57UMX649eTxu5rTMt1efoCM6zkQ34OFRS5UGSLX0DM2I96R4OiANW69fovaM= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1568914930512253.8340634783043; Thu, 19 Sep 2019 10:42:10 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iB0QY-0004Qj-72; Thu, 19 Sep 2019 17:41:10 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iB0QW-0004Os-5x for xen-devel@lists.xenproject.org; Thu, 19 Sep 2019 17:41:08 +0000 Received: from esa1.hc3370-68.iphmx.com (unknown [216.71.145.142]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id a4c8820e-db04-11e9-b76c-bc764e2007e4; Thu, 19 Sep 2019 17:41:00 +0000 (UTC) X-Inumbo-ID: a4c8820e-db04-11e9-b76c-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1568914861; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=yMkoyQJsVoTpLNhCoQP/lLHBUZYMQj1kOvYaINRWLG4=; b=Aws0ABcfhi6+BIkFoJ+EiNadq3cCSOsIF0Bf0hXf8/+C9UwXY6KOi5jg 4deSHYS6W4qVqqy/6hklqCxvmXlEHHKnTtfEUQBt5MEY4yy0zQyRxMz8O J4ETDoDzC3tvcJ3jgtfmtu7URJoPEeUVD7TEQTJ5W16uOsUkhyQTKkmyG s=; Authentication-Results: esa1.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=anthony.perard@citrix.com; spf=Pass smtp.mailfrom=anthony.perard@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: None (esa1.hc3370-68.iphmx.com: no sender authenticity information available from domain of anthony.perard@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa1.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="anthony.perard@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa1.hc3370-68.iphmx.com: domain of anthony.perard@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa1.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="anthony.perard@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ~all" Received-SPF: None (esa1.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa1.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: IFlyovukdGqWVInKeV5wKnNXWuROLj/O6XJd7RNRFBAenOhtsaPfBLaV47XCI68q2aLNWWIe29 sgpfnctBtY3fUapGvvlSD4UOy8Ph6HFX5+R06xEuVX8U6YjqNj7vaVjO8FrZPcqxZYDxO7phBw lY2UqrAQj30j6WLC4kSBEAnaUYX5L6aOAGT/fb44UQ6jfG/rSFMhQ57B+WeO25OAfqR7Dm/lmB 47J5mLFAFf76oNpI5dkOwZNquKLrfGh9Vsti68WaXmGD+zSKTEnNOi94HyTmDW3nsIhsj2ACqU S0g= X-SBRS: 2.7 X-MesageID: 5864905 X-Ironport-Server: esa1.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.64,524,1559534400"; d="scan'208";a="5864905" From: Anthony PERARD To: Date: Thu, 19 Sep 2019 18:16:54 +0100 Message-ID: <20190919171656.899649-35-anthony.perard@citrix.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190919171656.899649-1-anthony.perard@citrix.com> References: <20190919171656.899649-1-anthony.perard@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH v2 34/35] libxl: libxl_qemu_monitor_command now uses ev_qmp X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Anthony PERARD , Ian Jackson , Wei Liu Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Signed-off-by: Anthony PERARD Acked-by: Ian Jackson --- tools/libxl/libxl_qmp.c | 52 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 50 insertions(+), 2 deletions(-) diff --git a/tools/libxl/libxl_qmp.c b/tools/libxl/libxl_qmp.c index 9639d491d991..9aabad74fabd 100644 --- a/tools/libxl/libxl_qmp.c +++ b/tools/libxl/libxl_qmp.c @@ -892,19 +892,67 @@ int libxl__qmp_hmp(libxl__gc *gc, int domid, const ch= ar *command_line, hmp_callback, output); } =20 + +typedef struct { + libxl__ev_qmp qmp; + char **output; /* user pointer */ +} qemu_monitor_command_state; + +static void qemu_monitor_command_done(libxl__egc *, libxl__ev_qmp *, + const libxl__json_object *response, + int rc); + int libxl_qemu_monitor_command(libxl_ctx *ctx, uint32_t domid, const char *command_line, char **output, const libxl_asyncop_how *ao_how) { AO_CREATE(ctx, domid, ao_how); + qemu_monitor_command_state *qmcs; + libxl__json_object *args =3D NULL; int rc; =20 - rc =3D libxl__qmp_hmp(gc, domid, command_line, output); + if (!output) { + rc =3D ERROR_INVAL; + goto out; + } =20 - libxl__ao_complete(egc, ao, rc); + GCNEW(qmcs); + libxl__ev_qmp_init(&qmcs->qmp); + qmcs->qmp.ao =3D ao; + qmcs->qmp.domid =3D domid; + qmcs->qmp.payload_fd =3D -1; + qmcs->qmp.callback =3D qemu_monitor_command_done; + qmcs->output =3D output; + libxl__qmp_param_add_string(gc, &args, "command-line", command_line); + rc =3D libxl__ev_qmp_send(gc, &qmcs->qmp, "human-monitor-command", arg= s); +out: + if (rc) return AO_CREATE_FAIL(rc); return AO_INPROGRESS; } =20 +static void qemu_monitor_command_done(libxl__egc *egc, libxl__ev_qmp *qmp, + const libxl__json_object *response, + int rc) +{ + STATE_AO_GC(qmp->ao); + qemu_monitor_command_state *qmcs =3D CONTAINER_OF(qmp, *qmcs, qmp); + + if (rc) goto out; + + if (!libxl__json_object_is_string(response)) { + rc =3D ERROR_QEMU_API; + LOGD(ERROR, qmp->domid, "Response has unexpected format"); + goto out; + } + + *(qmcs->output) =3D + libxl__strdup(NOGC, libxl__json_object_get_string(response)); + rc =3D 0; + +out: + libxl__ev_qmp_dispose(gc, qmp); + libxl__ao_complete(egc, ao, rc); +} =20 /* * Functions using libxl__ev_qmp --=20 Anthony PERARD _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel