From nobody Sun Feb 8 22:35:20 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=1635511189; cv=none; d=zohomail.com; s=zohoarc; b=T0lYVg4zCXaZ47lkvWwi3MnMOm6id3ZUQMrOFPiq3OiW+PQ0Y0Rj6cUPQ90HZfcPkT6b/irZ/95wgagjzD2W3PCy2R5uduV9/m4gtTCZVgv+uRDUqItXzEBngVDVCGVKka9RjAYk0AZe+bK2wzkfh4NlCuBmbsNBgIwSCfxnU58= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1635511189; 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=EghxffMj7E/idQ+d4lkd4Sv0aVoHpM1nCZDx1OZFqB0=; b=oG4mQRgR50AGsmVHc8AYDYdvn+i38Kxsdi4JuWY/+sYcQFjlSCQRT1PP3c2eF3gh23NUDfVwRV97XEwpLtDv1cb1l121g+RykccdKYEjHiDOhZw1X3MPMFrk/8wetDRDgT6X+xDndrxriHrY5m1vQNd2Sy03/jN6zCh2UKifbXQ= 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 1635511189765490.6838037973466; Fri, 29 Oct 2021 05:39:49 -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-464-qZblANNTN4ecc2SNUausnw-1; Fri, 29 Oct 2021 08:39:44 -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 17A815074B; Fri, 29 Oct 2021 12:39:40 +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 F062510016F4; Fri, 29 Oct 2021 12:39:39 +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 BCF104EA30; Fri, 29 Oct 2021 12:39:39 +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 19TCdcop005800 for ; Fri, 29 Oct 2021 08:39:38 -0400 Received: by smtp.corp.redhat.com (Postfix) id 1387D2B0B8; Fri, 29 Oct 2021 12:39:38 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id F1F7060854 for ; Fri, 29 Oct 2021 12:39:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1635511188; 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=EghxffMj7E/idQ+d4lkd4Sv0aVoHpM1nCZDx1OZFqB0=; b=gSKrUjNpXKsE2+UQh34UZ78ppy3cZ/+PfxnwjtEIxieHtirwrwQM9+JW6o8TASafJcSQLS BBFUZ3Y65gAuitFv8wrXDlYw8txz8RT5WZ4nVsaHhp5XhYqR7SvAzn2aNkMV9zZ1bkHKsz gLM3aF7zeoszovdOt2JlYXWET4ac1jk= X-MC-Unique: qZblANNTN4ecc2SNUausnw-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH v2 3/8] virQEMUQAPISchemaTraverseEnum: Use the modern 'members' array Date: Fri, 29 Oct 2021 14:39:20 +0200 Message-Id: <76cf3b693c346a47f4bc805f6320f088849cb6ba.1635511106.git.pkrempa@redhat.com> 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 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: 1635511190096100003 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 Reviewed-by: Michal Privoznik --- 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