From nobody Mon Feb 9 16:53:53 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 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=1588831103; cv=none; d=zohomail.com; s=zohoarc; b=e76jIWqGR/wbh50UHTDDOsXMo9d1Wmq9cd2codXSu4xjtaJS+SnQfJsvO4zV56TytJ4Xxn+lplKW/YPAiAaYpkNaPmgqeZ+G7cKJU3eWbqVs5FGvWW+c/d3Nc/dNSHvrndF1wP84Exo3bVRRdEgfOrwKhn8GfsqgBpbb62ojXOk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588831103; 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=LNT4vQvFEhaV9PIHEbWa3P7waCnA6QXGr7oavqT7GNw=; b=L8q+zRpa/RnKaq1PxthqR955zCMM+uTKoPEUi4i4f7xrhXRHgL4UA6mVLT1uvnw2OirvEVFTO5r4xNp0rYAyzJ/HsVqaPM5c85lwT5VrdV87XUe5gmYwvNU4XovhNcSWukZndy58gnvd0pNVMFzHW+J7Uc2orENnJpvK11l5SYY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 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-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1588831103256976.1980418283515; Wed, 6 May 2020 22:58:23 -0700 (PDT) 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-376-4QlRluS_O5C6yOqXC0axrw-1; Thu, 07 May 2020 01:58:19 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 03D37100CCC0; Thu, 7 May 2020 05:58:14 +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 EAE1460BEC; Thu, 7 May 2020 05:58:12 +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 6C4714CAA7; Thu, 7 May 2020 05:58:10 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0475w9IK015371 for ; Thu, 7 May 2020 01:58:09 -0400 Received: by smtp.corp.redhat.com (Postfix) id 285875D9DA; Thu, 7 May 2020 05:58:09 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.40.208.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8E7E15D9C5 for ; Thu, 7 May 2020 05:58:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588831101; 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=LNT4vQvFEhaV9PIHEbWa3P7waCnA6QXGr7oavqT7GNw=; b=Nsrqpji9Vn968LU5rT5eYt/EarviKjqKUIBk/OUKvcezo1VA+KWWMB5ahjqdWBiZyYzEvM SmTl4tW9ENUgiFGI4EwRb1Fj6vqHJW52PrFLM2i9aNEoDmfruwoXr1XNJadUqe900GSN7j Wj7AfoEgChgVu+Vul++7JRgkH5aqnXM= X-MC-Unique: 4QlRluS_O5C6yOqXC0axrw-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 1/8] virQEMUCapsProbeQMPDevices: Split up into logical chunks Date: Thu, 7 May 2020 07:57:56 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 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.12 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" The function was parsing 'qom-list-types' and then also calling function which parses 'device-list-properties' and also 'qom-list-properties'. Split it up into individual functions. Signed-off-by: Peter Krempa --- src/qemu/qemu_capabilities.c | 51 ++++++++++++++++++++++++------------ 1 file changed, 34 insertions(+), 17 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 2c6e36685e..dadbef32a2 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -2586,9 +2586,10 @@ virQEMUCapsProbeQMPGenericProps(virQEMUCapsPtr qemuC= aps, return 0; } + static int -virQEMUCapsProbeQMPDevices(virQEMUCapsPtr qemuCaps, - qemuMonitorPtr mon) +virQEMUCapsProbeQMPObjectTypes(virQEMUCapsPtr qemuCaps, + qemuMonitorPtr mon) { int nvalues; char **values; @@ -2601,22 +2602,34 @@ virQEMUCapsProbeQMPDevices(virQEMUCapsPtr qemuCaps, nvalues, values); virStringListFreeCount(values, nvalues); - if (virQEMUCapsProbeQMPGenericProps(qemuCaps, - mon, - virQEMUCapsDeviceProps, - G_N_ELEMENTS(virQEMUCapsDeviceProp= s), - qemuMonitorGetDeviceProps) < 0) - return -1; + return 0; +} - if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_QOM_LIST_PROPERTIES) && - virQEMUCapsProbeQMPGenericProps(qemuCaps, - mon, - virQEMUCapsObjectProps, - G_N_ELEMENTS(virQEMUCapsObjectProp= s), - qemuMonitorGetObjectProps) < 0) - return -1; - return 0; +static int +virQEMUCapsProbeQMPDeviceProperties(virQEMUCapsPtr qemuCaps, + qemuMonitorPtr mon) +{ + return virQEMUCapsProbeQMPGenericProps(qemuCaps, + mon, + virQEMUCapsDeviceProps, + G_N_ELEMENTS(virQEMUCapsDeviceP= rops), + qemuMonitorGetDeviceProps); +} + + +static int +virQEMUCapsProbeQMPObjectProperties(virQEMUCapsPtr qemuCaps, + qemuMonitorPtr mon) +{ + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_QOM_LIST_PROPERTIES)) + return 0; + + return virQEMUCapsProbeQMPGenericProps(qemuCaps, + mon, + virQEMUCapsObjectProps, + G_N_ELEMENTS(virQEMUCapsObjectP= rops), + qemuMonitorGetObjectProps); } @@ -5061,7 +5074,11 @@ virQEMUCapsInitQMPMonitor(virQEMUCapsPtr qemuCaps, if (virQEMUCapsProbeQMPEvents(qemuCaps, mon) < 0) return -1; - if (virQEMUCapsProbeQMPDevices(qemuCaps, mon) < 0) + if (virQEMUCapsProbeQMPObjectTypes(qemuCaps, mon) < 0) + return -1; + if (virQEMUCapsProbeQMPDeviceProperties(qemuCaps, mon) < 0) + return -1; + if (virQEMUCapsProbeQMPObjectProperties(qemuCaps, mon) < 0) return -1; if (virQEMUCapsProbeQMPMachineTypes(qemuCaps, type, mon) < 0) return -1; --=20 2.26.2