From nobody Sat Feb 7 08:53:28 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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 170.10.133.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=1632145801; cv=none; d=zohomail.com; s=zohoarc; b=nLil3ivAXNW1VZHQP2z6NjqvL7i445BYc/jvBCHXjv2vhzDAlbpQeEfpSZk3VI/Oio4WlIQEXvOzTMtiob0Xvrg+p/XW/PxXxIFVBZ4GCXaysb4nM4dvrzTkcJ9PlfqsKIN2N9zKmzAvGViUpMFqInf7/f/JOF+wRWvMoKahjlQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1632145801; 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=IXCuE9/cAoFaF+/KfqOQK1nZ1wO+yALSJ6rneHruwVQ=; b=PTT8RMHB8z8bcVfMnOJUk6Ak3wWQQ/oeZdd8R0q2ZqAr/GjViyhW3/URBVpv2zZUlYWAfZ/DSQev/2l6J2GlIjRhW3Smfj20Q3COnYhBW77vy6Yf/LrSOMGYOpgR6jhsbipCpdMbtTO8CBvvBgAfAceHfSO14U5OYYMAmqpW5ME= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 163214580186144.029610770617865; Mon, 20 Sep 2021 06:50:01 -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-122-1HONAVUqNhyJ3L4siCA6Mg-1; Mon, 20 Sep 2021 09:49:58 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E03678145EF; Mon, 20 Sep 2021 13:49:53 +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 8F64A1017CF1; Mon, 20 Sep 2021 13:49:53 +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 3DBB44E9F4; Mon, 20 Sep 2021 13:49:53 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 18KDnpCF009272 for ; Mon, 20 Sep 2021 09:49:51 -0400 Received: by smtp.corp.redhat.com (Postfix) id 78EA16D992; Mon, 20 Sep 2021 13:49:51 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.16]) by smtp.corp.redhat.com (Postfix) with ESMTP id CE5B71346F for ; Mon, 20 Sep 2021 13:49:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1632145800; 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=IXCuE9/cAoFaF+/KfqOQK1nZ1wO+yALSJ6rneHruwVQ=; b=DvPEa7JCkjhXyNvYQlPY0mie4wdHPW3wHdXnzpFvqRsg9bRwoJg8eLwGPaa33pUtd6ZMBV Wli5pf8XEmewbh673E9u6cEU9IR3LbSz3OmvZ37zGr+PNjoeQBcWT6ZRXKYym9rEteyoaQ bmNrXMBRH5X6lJWw1+dFWSVzaUCan68= X-MC-Unique: 1HONAVUqNhyJ3L4siCA6Mg-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [RFC PATCH 2/7] virQEMUQAPISchemaTraverseEnum: Use the modern 'members' array Date: Mon, 20 Sep 2021 15:49:33 +0200 Message-Id: <1bebc39301cc9e558e96a9ffb1edbeeded38a06b.1632145487.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 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.84 on 10.5.11.22 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) X-ZM-MESSAGEID: 1632145803604100003 Content-Type: text/plain; charset="utf-8" Starting from QEMU-6.2 enum members are reported as an array of objects under new name "values" so that extra data can be reported for each member. Modify the code so that we prefer 'members' and skip 'values' completely if we've used 'members'. Signed-off-by: Peter Krempa --- src/qemu/qemu_qapi.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/qemu/qemu_qapi.c b/src/qemu/qemu_qapi.c index 165ecf1180..790f7c0fee 100644 --- a/src/qemu/qemu_qapi.c +++ b/src/qemu/qemu_qapi.c @@ -243,6 +243,7 @@ virQEMUQAPISchemaTraverseEnum(virJSONValue *cur, { const char *query =3D virQEMUQAPISchemaTraverseContextNextQuery(ctxt); virJSONValue *values; + virJSONValue *members; size_t i; if (query[0] !=3D '^') @@ -253,6 +254,22 @@ virQEMUQAPISchemaTraverseEnum(virJSONValue *cur, query++; + /* qemu-6.2 added a "members" array superseding "values" */ + if ((members =3D virJSONValueObjectGetArray(cur, "members"))) { + for (i =3D 0; i < virJSONValueArraySize(members); i++) { + virJSONValue *member =3D virJSONValueArrayGet(members, i); + const char *name; + + if (!member || !(name =3D virJSONValueObjectGetString(member, = "name"))) + return -2; + + if (STREQ(name, query)) + return 1; + } + + return 0; + } + if (!(values =3D virJSONValueObjectGetArray(cur, "values"))) return -2; --=20 2.31.1