From nobody Wed May 15 14:48:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1621513387; cv=none; d=zohomail.com; s=zohoarc; b=QuzNEHdCem/ON+YOLIXCCO0+HvdMhg2dJOKbwUSZZkO8RyvZf98M7KdBOushrpMzXUFIoLuQylCQv2HhuBLIDKoUpmECRDqSBCCPBMbtZKh9UrlViz42dZOPjsNSG+9OLdk8PECo6FQ2cX0TsDAPBHKYPO0nQnYgXTrzQfBK1HQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621513387; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=KZcrrYkPPH66vu+luyvSt1w7Lso5t+Dj5oJ3lU+F4Ko=; b=ZNMENbx1Rsl1e5vTIEayjKYk+rmFYRIVNakbwHWNqpqixFnPi1f0EbbdRSpUoGpbctSfMU/3iyAtyd3R70gjxSnYTgHGs0gVPS4peZfutAPxsRNmBqUfOCfFB0JOMOY7g2bOEnmwg36Lymk/C/oIQDiuA6bbQcAuZI2GTGUMk9c= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1621513387969140.89094069021223; Thu, 20 May 2021 05:23:07 -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-307-kTHYq_VqOuC2Oej46J5duQ-1; Thu, 20 May 2021 08:23:04 -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 9327F107ACC7; Thu, 20 May 2021 12:22:58 +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 9F92460C4A; Thu, 20 May 2021 12:22:57 +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 8EA1E65D0C; Thu, 20 May 2021 12:22:55 +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 14KCD2U2029649 for ; Thu, 20 May 2021 08:13:02 -0400 Received: by smtp.corp.redhat.com (Postfix) id A0F9D608DB; Thu, 20 May 2021 12:13:02 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.194.244]) by smtp.corp.redhat.com (Postfix) with ESMTP id 24ECD687DB for ; Thu, 20 May 2021 12:12:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1621513386; 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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=KZcrrYkPPH66vu+luyvSt1w7Lso5t+Dj5oJ3lU+F4Ko=; b=Gr5EPkLwNXsUgNEjizK9pY4uVXCxqhXqw2m2UkLdWvY3BsTMYj4N3bpWTr2Y+xzTsoNqLM YCSgkXJBmGV0R0T8jraK68Mr+1F83F6o/SbXnO4jFVWWrhx63F7fLuC5H4XjatFDxYUfbR s5m+42HqR6AVO4RqPFSg1iO/aUBK0O0= X-MC-Unique: kTHYq_VqOuC2Oej46J5duQ-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH] virNodeDevCapMdevParseXML: Use virXMLPropEnum() for ./start/@type Date: Thu, 20 May 2021 14:12:56 +0200 Message-Id: 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.79 on 10.5.11.12 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) Content-Type: text/plain; charset="utf-8" Signed-off-by: Michal Privoznik --- Initially, this started as a fix for broken build, but Peter beat me to it. I figured it's worth sending anyway. src/conf/node_device_conf.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c index 5598d420fe..d9b7aff7db 100644 --- a/src/conf/node_device_conf.c +++ b/src/conf/node_device_conf.c @@ -1919,7 +1919,7 @@ virNodeDevCapMdevParseXML(xmlXPathContextPtr ctxt, g_autofree xmlNodePtr *attrs =3D NULL; size_t i; g_autofree char *uuidstr =3D NULL; - g_autofree char *starttype =3D NULL; + xmlNodePtr startNode =3D NULL; =20 ctxt->node =3D node; =20 @@ -1941,17 +1941,14 @@ virNodeDevCapMdevParseXML(xmlXPathContextPtr ctxt, virUUIDFormat(uuidbuf, mdev->uuid); } =20 - if ((starttype =3D virXPathString("string(./start[1]/@type)", ctxt))) { - int tmp; - if ((tmp =3D virNodeDevMdevStartTypeFromString(starttype)) < 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unknown mdev start type '%s' for '%s'"), sta= rttype, def->name); - return -1; - } + mdev->start =3D VIR_NODE_DEV_MDEV_START_MANUAL; =20 - mdev->start =3D tmp; - } else { - mdev->start =3D VIR_NODE_DEV_MDEV_START_MANUAL; + startNode =3D virXPathNode("./start[1]", ctxt); + if (startNode && + virXMLPropEnum(startNode, "type", + virNodeDevMdevStartTypeFromString, + VIR_XML_PROP_NONE, &mdev->start) < 0) { + return -1; } =20 /* 'iommuGroup' is optional, only report an error if the supplied valu= e is --=20 2.26.3