From nobody Tue Feb 10 03:44:52 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=1620651003; cv=none; d=zohomail.com; s=zohoarc; b=RciqY1b0hLwB/OSVwBLtuDRcleWO4acVcc8ybnoZMXmirY25Qd3/IJohQ5yV9IFLKJeKTG2pT8yChMS7hiTdc3eAdy58FO+BMquscjwNqfxnNQbO8TP95LqAbAKgZnsvsvAvEoHuVsD8U4W0vHdBP2XNnDiOUTSOvy75eqN8XPY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1620651003; h=Content-Type:Content-Transfer-Encoding:Cc: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=KxZPZe0UlEDpm5GY1uoETzBdVq/e93SkF7WRUob/+D8=; b=ctl2Hr77tyAbmtV64tjSQ2OUExj5DxMHRF+HTl6Xfovto8LxMTHky1wykkHhEaB5HzRsM7+Yp45050lKU0b6gjKNqrycRW4xwmqycA6HQ3D12BwmGCG7mj4ZtQ6cO0Hou2SBmmiyacGSgd2VlJBn63f7VjQhxtT4rzNHO4/ccnI= 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) header.from= 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 1620651003902874.5184103955067; Mon, 10 May 2021 05:50:03 -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-165-xUN_RA07MbO3RqAAr-9U2Q-1; Mon, 10 May 2021 08:49:14 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2481C9F937; Mon, 10 May 2021 12:49:08 +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 0278A5D9F2; Mon, 10 May 2021 12:49:08 +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 B88CF8E1E; Mon, 10 May 2021 12:49:07 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 14ACms3t005662 for ; Mon, 10 May 2021 08:48:54 -0400 Received: by smtp.corp.redhat.com (Postfix) id 1ECCE2C8A1; Mon, 10 May 2021 12:48:54 +0000 (UTC) Received: from work.redhat.com (ovpn-113-46.ams2.redhat.com [10.36.113.46]) by smtp.corp.redhat.com (Postfix) with ESMTP id 60FC25F707; Mon, 10 May 2021 12:48:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1620651002; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=KxZPZe0UlEDpm5GY1uoETzBdVq/e93SkF7WRUob/+D8=; b=XZt1J6hgIdw1NI3CjBY+Z1iwT+p4L/eQ1HNwUTl5FhiWnpveJ5w+vJHVmQqVGO4vuzFujD urKTcZquVsXLTFt3s3swi0KkI4Fk3gMR/2ds1KPdUti2eUwT69v0keRbmxDuMj23WB3Z0Z 5BF79y++rcRjg4QVhNyhxps4bvJO9Xg= X-MC-Unique: xUN_RA07MbO3RqAAr-9U2Q-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 07/10] virNodeDevCapsDefParseXML: Use virXMLProp* Date: Mon, 10 May 2021 14:48:38 +0200 Message-Id: <20210510124841.123066-8-twiederh@redhat.com> In-Reply-To: <20210510124841.123066-1-twiederh@redhat.com> References: <20210510124841.123066-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake 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.14 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: Tim Wiederhake --- src/conf/node_device_conf.c | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c index 34c8aa988e..b3d5bc1515 100644 --- a/src/conf/node_device_conf.c +++ b/src/conf/node_device_conf.c @@ -1972,24 +1972,13 @@ virNodeDevCapsDefParseXML(xmlXPathContextPtr ctxt, const char *virt_type) { virNodeDevCapsDef *caps; - g_autofree char *tmp =3D NULL; - int val, ret =3D -1; + int ret =3D -1; =20 caps =3D g_new0(virNodeDevCapsDef, 1); =20 - tmp =3D virXMLPropString(node, "type"); - if (!tmp) { - virReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("missing capability type")); + if (virXMLPropEnum(node, "type", virNodeDevCapTypeFromString, + VIR_XML_PROP_REQUIRED, &caps->data.type) < 0) goto error; - } - - if ((val =3D virNodeDevCapTypeFromString(tmp)) < 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unknown capability type '%s'"), tmp); - goto error; - } - caps->data.type =3D val; =20 switch (caps->data.type) { case VIR_NODE_DEV_CAP_SYSTEM: --=20 2.26.3