From nobody Mon Feb 9 07:06:21 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1558361830; cv=none; d=zoho.com; s=zohoarc; b=KG9wYhLx7agOBsm1hoEy+YqWQkDwcqGFzMcVjPg7ZOf6FCe/IG8DnLeMP+rY36p0n6oMtDWnxRzRM1HHv6GBEUapdaV2mA17IXxUmB5B7VHL2V7714yU1ONEcGSpMGtIfi1JSdgLUlQzirur3tjczJx/k4mZGKYC98fp7/h1FcA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558361830; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=TTEZZmL9u243ghgniyS/wIMjxDU962xpXaNw9olFSK4=; b=T92IoXlCgY7dghid6bdevWX1YPmGX3K8AWOJZJQrUctB8Ve8xNXwfp1m9mx2RPzfa8mI92JpToX/adPAleeCK2blwgZHAOp2LayaOKeeKoT73BGjxjXGVgrIqMDvzbB/XTIiGzsBVC+Z9cONCxsWR3a0Gb3Ro8uG2u5fP09lHW8= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 155836183029471.63373335102222; Mon, 20 May 2019 07:17:10 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 18ED1821DE; Mon, 20 May 2019 14:16:59 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DF28D5D9C8; Mon, 20 May 2019 14:16:57 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 8AF8B1806B15; Mon, 20 May 2019 14:16:55 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x4KEGe5E021859 for ; Mon, 20 May 2019 10:16:40 -0400 Received: by smtp.corp.redhat.com (Postfix) id BF5E11001F41; Mon, 20 May 2019 14:16:40 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 221611019616; Mon, 20 May 2019 14:16:39 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Mon, 20 May 2019 16:16:33 +0200 Message-Id: <70835f848f2505343ccbc7a487f350b1f093ca04.1558361762.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH 4/4] qemu: monitor: Use VIR_AUTOPTR in qemuMonitorJSON(Drive/Blockdev)Mirror X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Mon, 20 May 2019 14:17:04 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_monitor_json.c | 71 ++++++++++++++---------------------- 1 file changed, 28 insertions(+), 43 deletions(-) diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 4152d44331..4f9a0cb960 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -4280,34 +4280,25 @@ qemuMonitorJSONDriveMirror(qemuMonitorPtr mon, bool shallow, bool reuse) { - int ret =3D -1; - virJSONValuePtr cmd; - virJSONValuePtr reply =3D NULL; + VIR_AUTOPTR(virJSONValue) cmd =3D NULL; + VIR_AUTOPTR(virJSONValue) reply =3D NULL; - cmd =3D qemuMonitorJSONMakeCommand("drive-mirror", - "s:device", device, - "s:target", file, - "Y:speed", speed, - "z:granularity", granularity, - "P:buf-size", buf_size, - "s:sync", shallow ? "top" : "full", - "s:mode", reuse ? "existing" : "absol= ute-paths", - "S:format", format, - NULL); - if (!cmd) + if (!(cmd =3D qemuMonitorJSONMakeCommand("drive-mirror", + "s:device", device, + "s:target", file, + "Y:speed", speed, + "z:granularity", granularity, + "P:buf-size", buf_size, + "s:sync", shallow ? "top" : "fu= ll", + "s:mode", reuse ? "existing" : = "absolute-paths", + "S:format", format, + NULL))) return -1; if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0) - goto cleanup; - - if (qemuMonitorJSONCheckError(cmd, reply) < 0) - goto cleanup; + return -1; - ret =3D 0; - cleanup: - virJSONValueFree(cmd); - virJSONValueFree(reply); - return ret; + return qemuMonitorJSONCheckError(cmd, reply); } @@ -4321,30 +4312,24 @@ qemuMonitorJSONBlockdevMirror(qemuMonitorPtr mon, unsigned long long buf_size, bool shallow) { - int ret =3D -1; - virJSONValuePtr cmd; - virJSONValuePtr reply =3D NULL; + VIR_AUTOPTR(virJSONValue) cmd =3D NULL; + VIR_AUTOPTR(virJSONValue) reply =3D NULL; - cmd =3D qemuMonitorJSONMakeCommand("blockdev-mirror", - "S:job-id", jobname, - "s:device", device, - "s:target", target, - "Y:speed", speed, - "z:granularity", granularity, - "P:buf-size", buf_size, - "s:sync", shallow ? "top" : "full", - NULL); - if (!cmd) + if (!(cmd =3D qemuMonitorJSONMakeCommand("blockdev-mirror", + "S:job-id", jobname, + "s:device", device, + "s:target", target, + "Y:speed", speed, + "z:granularity", granularity, + "P:buf-size", buf_size, + "s:sync", shallow ? "top" : "fu= ll", + NULL))) return -1; - if ((ret =3D qemuMonitorJSONCommand(mon, cmd, &reply)) < 0) - goto cleanup; - ret =3D qemuMonitorJSONCheckError(cmd, reply); + if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0) + return -1; - cleanup: - virJSONValueFree(cmd); - virJSONValueFree(reply); - return ret; + return qemuMonitorJSONCheckError(cmd, reply); } --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list