From nobody Sun Feb 8 17:03:25 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=1560937313; cv=none; d=zoho.com; s=zohoarc; b=NNX5I1WOvNnZUM1JrZS0jU87OkcXh5ebMwy7ShcHyRvs8zxsoMHlawl2C7rNGdXhkEE0gNlZBcLEQXvJdhD0gtHJz9Uy902APmr8P/tMiBvwL8dXr/Mxuv7JVxxnSYkyqf/L21uBubovE9TuLP0xM4u0eF84Ke5FS/fhqdMIAjA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560937313; 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:ARC-Authentication-Results; bh=CBOK9Kd6+n6/+XJIAUrpFtl1I0wP8PkxdTDLOwvh0UM=; b=c0k7bkFmzM+11gj5ZH1C+9iYaC+XiL7+AWsElZc+GCklSYUOpoTLzEytF5b6u76dqkEAodn8300la6B/FPMRKO2lZjdIW8/brLGi4xRlptCcVzeZGsEDDVr+Y3vexxCptzUpPdwZIY3L99vxc3hS2xXv/FzhzDqlSRsh0jAIeNU= 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 1560937313478695.3979891097829; Wed, 19 Jun 2019 02:41:53 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B6C0C128B5; Wed, 19 Jun 2019 09:41:51 +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 8CC475D719; Wed, 19 Jun 2019 09:41:51 +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 52F921806B1A; Wed, 19 Jun 2019 09:41:51 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x5J9cV6I024367 for ; Wed, 19 Jun 2019 05:38:31 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5A9DF5F7C2; Wed, 19 Jun 2019 09:38:31 +0000 (UTC) Received: from orkuz.int.mamuti.net (ovpn-204-21.brq.redhat.com [10.40.204.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2B87B5F7C1 for ; Wed, 19 Jun 2019 09:38:31 +0000 (UTC) Received: by orkuz.int.mamuti.net (Postfix, from userid 500) id BF5752A4128; Wed, 19 Jun 2019 11:38:23 +0200 (CEST) From: Jiri Denemark To: libvir-list@redhat.com Date: Wed, 19 Jun 2019 11:38:17 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 20/24] qemu: Add type filter to qemuMonitorJSONParsePropsList 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.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Wed, 19 Jun 2019 09:41:52 +0000 (UTC) Content-Type: text/plain; charset="utf-8" The function converts a list of QOM properties into a NULL-terminated array of property names. The new type parameter may be used to limit the result to properties of a specific type. Signed-off-by: Jiri Denemark --- src/qemu/qemu_monitor_json.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index ffa1fb5d57..efcef211ed 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -6206,11 +6206,13 @@ int qemuMonitorJSONSetObjectProperty(qemuMonitorPtr= mon, static int qemuMonitorJSONParsePropsList(virJSONValuePtr cmd, virJSONValuePtr reply, + const char *type, char ***props) { virJSONValuePtr data; char **proplist =3D NULL; size_t n =3D 0; + size_t count =3D 0; size_t i; int ret =3D -1; =20 @@ -6228,17 +6230,21 @@ qemuMonitorJSONParsePropsList(virJSONValuePtr cmd, virJSONValuePtr child =3D virJSONValueArrayGet(data, i); const char *tmp; =20 + if (type && + STRNEQ_NULLABLE(virJSONValueObjectGetString(child, "type"), ty= pe)) + continue; + if (!(tmp =3D virJSONValueObjectGetString(child, "name"))) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("reply data was missing 'name'")); goto cleanup; } =20 - if (VIR_STRDUP(proplist[i], tmp) < 0) + if (VIR_STRDUP(proplist[count++], tmp) < 0) goto cleanup; } =20 - ret =3D n; + ret =3D count; *props =3D proplist; proplist =3D NULL; =20 @@ -6271,7 +6277,7 @@ int qemuMonitorJSONGetDeviceProps(qemuMonitorPtr mon, goto cleanup; } =20 - ret =3D qemuMonitorJSONParsePropsList(cmd, reply, props); + ret =3D qemuMonitorJSONParsePropsList(cmd, reply, NULL, props); cleanup: virJSONValueFree(reply); virJSONValueFree(cmd); @@ -6303,7 +6309,7 @@ qemuMonitorJSONGetObjectProps(qemuMonitorPtr mon, goto cleanup; } =20 - ret =3D qemuMonitorJSONParsePropsList(cmd, reply, props); + ret =3D qemuMonitorJSONParsePropsList(cmd, reply, NULL, props); cleanup: virJSONValueFree(reply); virJSONValueFree(cmd); --=20 2.22.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list