From nobody Mon Feb 9 12:29:19 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 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=1606762568; cv=none; d=zohomail.com; s=zohoarc; b=F72ZrlcCOajfwILUkW5rm3ZVSfQzt9jpx7G3fgl1Xws/cWR8am1RM91+zY4BoCNvUnhqdybC/uMZX5+w0iT1NtbFS572F78qexkCCjGwPwX91VvsWsm5EZRUcnalZfwBJVpkkbo2w8qOSOE4oDVjG2FL6dC2VBlcwviq580KF3M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1606762568; h=Content-Type:Content-Transfer-Encoding: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; bh=OvtWnigs4Jw4QZLfxUDdsAwF35ygN/e0yuwWSojNV1U=; b=CD7n347sYt4YZu521RAyDXoyN59deykx16qP2WQxpiOCVXfF8TssLjY69qtCV0jHcQHrOsTFyau+g9jHtNl1SrjuY9OfO6SEH2r8MRBfPZP1kUm7Uv/BO2K1/7Bv//1C/l9oPHR+3bCE1vZwBaVVnDfO0Hc9IRVNSMHG7GG+jak= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1606762568553916.5649466022438; Mon, 30 Nov 2020 10:56:08 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-310-7SqxM7sGNJiDmkAtw_v1FA-1; Mon, 30 Nov 2020 13:56:05 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 89929817B83; Mon, 30 Nov 2020 18:55:59 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3C00A5D9DC; Mon, 30 Nov 2020 18:55:59 +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 0B2084E590; Mon, 30 Nov 2020 18:55:59 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0AUIthPT014164 for ; Mon, 30 Nov 2020 13:55:43 -0500 Received: by smtp.corp.redhat.com (Postfix) id 4584860C67; Mon, 30 Nov 2020 18:55:43 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3216A60BE2 for ; Mon, 30 Nov 2020 18:55:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1606762567; h=from:from:sender:sender: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: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=OvtWnigs4Jw4QZLfxUDdsAwF35ygN/e0yuwWSojNV1U=; b=V+xUXtQkjabe871abQ7nfafMhDAwkHwxHIZ7Vy6Xp1QkexP9ux/b3x4ujx/ky3xFY4vTkp NuMSAJlaGhUjfdj/5gct5BlVo2Njq9iIIDFJ3SeOcvQbFflOYOXoXWEZiBOEtxmV6CvTbS VGo5iTNii8UryYCT92zIZuZBDcKcUqA= X-MC-Unique: 7SqxM7sGNJiDmkAtw_v1FA-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 01/24] qemuMonitorJSONSetMigrationParams: Take double pointer for @params Date: Mon, 30 Nov 2020 19:55:14 +0100 Message-Id: <20a29388b8509cb7c9531407008e5d508825bd03.1606762032.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" This allows simplification of the caller as well as will enable a later refactor of qemuMonitorJSONMakeCommandInternal. Signed-off-by: Peter Krempa --- src/qemu/qemu_migration_params.c | 9 +++------ src/qemu/qemu_monitor.c | 11 +++-------- src/qemu/qemu_monitor.h | 2 +- src/qemu/qemu_monitor_json.c | 5 +++-- src/qemu/qemu_monitor_json.h | 2 +- 5 files changed, 11 insertions(+), 18 deletions(-) diff --git a/src/qemu/qemu_migration_params.c b/src/qemu/qemu_migration_par= ams.c index df5560d39f..d1d59aeb01 100644 --- a/src/qemu/qemu_migration_params.c +++ b/src/qemu/qemu_migration_params.c @@ -843,12 +843,9 @@ qemuMigrationParamsApply(virQEMUDriverPtr driver, if (!(params =3D qemuMigrationParamsToJSON(migParams))) goto cleanup; - if (virJSONValueObjectKeysNumber(params) > 0) { - rc =3D qemuMonitorSetMigrationParams(priv->mon, params); - params =3D NULL; - if (rc < 0) - goto cleanup; - } + if (virJSONValueObjectKeysNumber(params) > 0 && + qemuMonitorSetMigrationParams(priv->mon, ¶ms) < 0) + goto cleanup; ret =3D 0; diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index f2ed165b22..f8287d375f 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -2492,22 +2492,17 @@ qemuMonitorGetMigrationParams(qemuMonitorPtr mon, * @mon: Pointer to the monitor object. * @params: Migration parameters. * - * The @params object is consumed and should not be referenced by the call= er - * after this function returns. + * The @params object is consumed and cleared. * * Returns 0 on success, -1 on error. */ int qemuMonitorSetMigrationParams(qemuMonitorPtr mon, - virJSONValuePtr params) + virJSONValuePtr *params) { - QEMU_CHECK_MONITOR_GOTO(mon, error); + QEMU_CHECK_MONITOR(mon); return qemuMonitorJSONSetMigrationParams(mon, params); - - error: - virJSONValueFree(params); - return -1; } diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index d301568e40..c8b9111633 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -799,7 +799,7 @@ int qemuMonitorSetMigrationCacheSize(qemuMonitorPtr mon, int qemuMonitorGetMigrationParams(qemuMonitorPtr mon, virJSONValuePtr *params); int qemuMonitorSetMigrationParams(qemuMonitorPtr mon, - virJSONValuePtr params); + virJSONValuePtr *params); typedef enum { QEMU_MONITOR_MIGRATION_STATUS_INACTIVE, diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 723bdb4426..bb454bf49d 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -3501,12 +3501,13 @@ qemuMonitorJSONGetMigrationParams(qemuMonitorPtr mo= n, int qemuMonitorJSONSetMigrationParams(qemuMonitorPtr mon, - virJSONValuePtr params) + virJSONValuePtr *params) { g_autoptr(virJSONValue) cmd =3D NULL; g_autoptr(virJSONValue) reply =3D NULL; + virJSONValuePtr par =3D g_steal_pointer(params); - if (!(cmd =3D qemuMonitorJSONMakeCommandInternal("migrate-set-paramete= rs", params))) + if (!(cmd =3D qemuMonitorJSONMakeCommandInternal("migrate-set-paramete= rs", par))) return -1; if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0) diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h index b588722d90..b3f3e79041 100644 --- a/src/qemu/qemu_monitor_json.h +++ b/src/qemu/qemu_monitor_json.h @@ -142,7 +142,7 @@ int qemuMonitorJSONSetMigrationCacheSize(qemuMonitorPtr= mon, int qemuMonitorJSONGetMigrationParams(qemuMonitorPtr mon, virJSONValuePtr *params); int qemuMonitorJSONSetMigrationParams(qemuMonitorPtr mon, - virJSONValuePtr params); + virJSONValuePtr *params); int qemuMonitorJSONGetMigrationStats(qemuMonitorPtr mon, qemuMonitorMigrationStatsPtr stats, --=20 2.28.0