From nobody Wed Oct 22 12:27:07 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1759929502; cv=none; d=zohomail.com; s=zohoarc; b=cjvTJeizWGiMo1tBeq9Ur4vZQMA/C2QDpeSYa2l7ov3KJL9Xr26KTe2CnWlJPWY7JxeIBuGLri4XIgwGLagkKypgzzse85AjUQw7slPACMxmrS4da97gC3ev/HrIxE1ZAuY2FcgsQPByk7fN2pZz6QTBiFcsrI0gxV73r8OA6zc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1759929502; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id:Cc; bh=/2/gQAYm9p4nfblTFlP3auNgWeyt3PKpYiIvErs1cxc=; b=cfKoC7Js5PtuNEz1acvDexV1Tj5Dzqgjmh/QWYTR82LDca/OjYOycktLwqhpzIO4xtg5EfpsnLu070oHRsVz268RWDDQVJ74BnHZ4aUEPSRNuL7/6EzpY3XYNsjbl5Rf7id8odG5yZeIpB4g5dUHpu71SzQwkbQ0X1Frq0nevWk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1759929502133239.06063037332865; Wed, 8 Oct 2025 06:18:22 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 8CEB3443E6; Wed, 8 Oct 2025 09:18:21 -0400 (EDT) Received: from [172.19.199.17] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id AB4B044674; Wed, 8 Oct 2025 09:12:28 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 15FD444186; Wed, 8 Oct 2025 08:55:38 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 7883844326 for ; Wed, 8 Oct 2025 08:54:24 -0400 (EDT) Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-226-Gvzj0BGvNYeJZGazNKDGDw-1; Wed, 08 Oct 2025 08:54:22 -0400 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 29ED819560BE for ; Wed, 8 Oct 2025 12:54:22 +0000 (UTC) Received: from localhost.localdomain (unknown [10.43.3.236]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 74D6419560A2 for ; Wed, 8 Oct 2025 12:54:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_PASS autolearn=unavailable autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1759928064; h=from:from: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; bh=/2/gQAYm9p4nfblTFlP3auNgWeyt3PKpYiIvErs1cxc=; b=ULAl4g/jXeRP4WAX4ez9vp3/nO66w/V5TGuGVAK9y9ufh6+4ESOtrzEj6jSYVAhe/NU/hj BZ0vCSEA3ROWzDi76q4t7mSYKQAXea0jvkIvykdCM9YWzjcEyF5zWwuj2vmQeSeGstT/+Q UhpMXVKqHn5gVSep2IdPf2aRWyZkeJY= X-MC-Unique: Gvzj0BGvNYeJZGazNKDGDw-1 X-Mimecast-MFC-AGG-ID: Gvzj0BGvNYeJZGazNKDGDw_1759928062 To: devel@lists.libvirt.org Subject: [PATCH v2 14/29] qemu: Use virXPathTristateBool() Date: Wed, 8 Oct 2025 14:53:46 +0200 Message-ID: <3da3fea40ea1470da7501625ef91b07f2b61881f.1759927755.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: nTEnwzNUgQffm7yySQcVI6FvyXF03VOhweCc3P_OBAg_1759928062 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: MOZFD4KZXFIVH7SY3CI4MFWPEYQXAWEN X-Message-ID-Hash: MOZFD4KZXFIVH7SY3CI4MFWPEYQXAWEN X-MailFrom: mprivozn@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Michal Privoznik via Devel Reply-To: Michal Privoznik X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1759929520292154100 Content-Type: text/plain; charset="utf-8"; x-default="true" From: Michal Privoznik There are two places in our code base which can use freshly introduced virXPathTristateBool(): qemuStorageSourcePrivateDataParse() and qemuDomainObjPrivateXMLParseBlockjobs(). Signed-off-by: Michal Privoznik Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_domain.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index b39fabfbb4..d675a5d7ee 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -2073,7 +2073,7 @@ qemuStorageSourcePrivateDataParse(xmlXPathContextPtr = ctxt, g_autofree char *authalias =3D NULL; g_autofree char *httpcookiealias =3D NULL; g_autofree char *tlskeyalias =3D NULL; - g_autofree char *thresholdEventWithIndex =3D NULL; + virTristateBool thresholdEventWithIndex; bool fdsetPresent =3D false; unsigned int fdSetID; int enccount; @@ -2139,9 +2139,10 @@ qemuStorageSourcePrivateDataParse(xmlXPathContextPtr= ctxt, if (virStorageSourcePrivateDataParseRelPath(ctxt, src) < 0) return -1; =20 - if ((thresholdEventWithIndex =3D virXPathString("string(./thresholdEve= nt/@indexUsed)", ctxt)) && - virTristateBoolTypeFromString(thresholdEventWithIndex) =3D=3D VIR_= TRISTATE_BOOL_YES) - src->thresholdEventWithIndex =3D true; + if (virXPathTristateBool("string(./thresholdEvent/@indexUsed)", + ctxt, &thresholdEventWithIndex) >=3D 0) { + virTristateBoolToBool(thresholdEventWithIndex, &src->thresholdEven= tWithIndex); + } =20 if ((nbdkitnode =3D virXPathNode("nbdkit", ctxt))) { if (qemuStorageSourcePrivateDataParseNbdkit(nbdkitnode, ctxt, src)= < 0) @@ -3210,13 +3211,10 @@ qemuDomainObjPrivateXMLParseBlockjobs(virDomainObj = *vm, { g_autofree xmlNodePtr *nodes =3D NULL; ssize_t nnodes =3D 0; - g_autofree char *active =3D NULL; - int tmp; size_t i; =20 - if ((active =3D virXPathString("string(./blockjobs/@active)", ctxt)) && - (tmp =3D virTristateBoolTypeFromString(active)) > 0) - priv->reconnectBlockjobs =3D tmp; + virXPathTristateBool("string(./blockjobs/@active)", + ctxt, &priv->reconnectBlockjobs); =20 if ((nnodes =3D virXPathNodeSet("./blockjobs/blockjob", ctxt, &nodes))= < 0) return -1; --=20 2.49.1