From nobody Tue May 14 00:25:39 2024 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=1620650940; cv=none; d=zohomail.com; s=zohoarc; b=K2guU+JUOzDE4c1Pd5wYiOzo0bN8cslewTe/pIfMbFz+6REEIRfp28begFn+8HpIvOIaBYyk7cWvbxRUQ/BMNjBTAitjeq4L2Q0b5ITHlM/0+7xClfLHNkQavVkENQKc0K3ZGjzvIMSPq90u9zR5+RZYDM1Uzg9DmuAuVLaLOkY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1620650940; 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=NknhAQqWRiKtQk61xr6Q7xkifLdEbEj4ZJuAadhulDc=; b=XqPCWE+LmT7q1aSASTFmNurvZ8I+UOwTQjetGM4aPRMvcq9MTW6aUfJ5jfExWugrzcJwZPTMqafS3lk6dfYoGKCZvVieYytZaP4MPSZRYqKrLTESRqwTF4XtLVjca2tm5LQ3vbzTm7MqRkYEHJYKKXvX3vSsHfHNhFuJIvw2mnQ= 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 1620650940690803.1917339674845; Mon, 10 May 2021 05:49:00 -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-228-r5GkCTT6OkOBAQIP5dAjNA-1; Mon, 10 May 2021 08:48:56 -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 93F57108C283; Mon, 10 May 2021 12:48:51 +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 3F2F25D9FC; Mon, 10 May 2021 12:48:51 +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 0F2F444A63; Mon, 10 May 2021 12:48:49 +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 14ACml3b005593 for ; Mon, 10 May 2021 08:48:47 -0400 Received: by smtp.corp.redhat.com (Postfix) id 543AD1724D; Mon, 10 May 2021 12:48:47 +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 926355F707; Mon, 10 May 2021 12:48:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1620650938; 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=NknhAQqWRiKtQk61xr6Q7xkifLdEbEj4ZJuAadhulDc=; b=K3EDEWCCUZI8C0FO/L8p5x8kJ4GnW0yT217LbjGcCLLcIlymzKwxfQl1u3BaWsQu+2kjya 8Nh+jG2h5NLqL8YA49Ah/SWIHmSxar6+pvqsGWvm9U2tGQIR7ZY34yDZ8CYQXqlH/nPHbD kY5YZuKUrPb2NOCl7ZYybEccifdL7cM= X-MC-Unique: r5GkCTT6OkOBAQIP5dAjNA-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 01/10] virDomainObjParseXML: Use virXMLProp* Date: Mon, 10 May 2021 14:48:32 +0200 Message-Id: <20210510124841.123066-2-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 Reviewed-by: Michal Privoznik --- src/conf/domain_conf.c | 36 +++++++++++++----------------------- 1 file changed, 13 insertions(+), 23 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index e8632e4d73..0d396cbdda 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -20354,7 +20354,7 @@ virDomainObjParseXML(xmlDocPtr xml, virDomainObj *obj; size_t i; int n; - int state; + virDomainState state; int reason =3D 0; void *parseOpaque =3D NULL; g_autofree char *tmp =3D NULL; @@ -20377,17 +20377,9 @@ virDomainObjParseXML(xmlDocPtr xml, if (!obj->def) goto error; =20 - if (!(tmp =3D virXMLPropString(ctxt->node, "state"))) { - virReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("missing domain state")); + if (virXMLPropEnum(ctxt->node, "state", virDomainStateTypeFromString, + VIR_XML_PROP_REQUIRED, &state) < 0) goto error; - } - if ((state =3D virDomainStateTypeFromString(tmp)) < 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("invalid domain state '%s'"), tmp); - goto error; - } - VIR_FREE(tmp); =20 if ((tmp =3D virXMLPropString(ctxt->node, "reason"))) { if ((reason =3D virDomainStateReasonFromString(state, tmp)) < 0) { @@ -20409,18 +20401,16 @@ virDomainObjParseXML(xmlDocPtr xml, if ((n =3D virXPathNodeSet("./taint", ctxt, &taintNodes)) < 0) goto error; for (i =3D 0; i < n; i++) { - char *str =3D virXMLPropString(taintNodes[i], "flag"); - if (str) { - int flag =3D virDomainTaintTypeFromString(str); - if (flag < 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Unknown taint flag %s"), str); - VIR_FREE(str); - goto error; - } - VIR_FREE(str); - virDomainObjTaint(obj, flag); - } + int rc; + virDomainTaintFlags taint; + + if ((rc =3D virXMLPropEnum(taintNodes[i], "flag", + virDomainTaintTypeFromString, + VIR_XML_PROP_NONE, &taint)) < 0) + goto error; + + if (rc =3D=3D 1) + virDomainObjTaint(obj, taint); } =20 if ((n =3D virXPathNodeSet("./deprecation", ctxt, &depNodes)) < 0) --=20 2.26.3 From nobody Tue May 14 00:25:39 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=1620650943; cv=none; d=zohomail.com; s=zohoarc; b=cc9E1TRLAyISfa5J0VdLwmlTPJYMyTp68ZV0oQ9EwaRitfWQsdpW5DE/EAbFs4xkaM8b5tvtN5UAIV6GRIo0026mS1GsOPtgDMRFp8IwWmSW1OLVGWelKP+hCWybzxTyhLrO7SLGoVJBujLUEwQ8PoULH1hshYLwKYGI+cux5Pg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1620650943; 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=fxzyWr56YqYhEULI+1ic4/xQHhRWVlJQ/UYz4CgUbRc=; b=YRFBg7hBHT8DsbqAYRVzKw6N1tf7SUiZ0jNDuKHdAohf4xi7hh1ki69mAb3+i6h6Go9GVxCjjWoqvMBfjk2IZrrRhVqcTqXJMoU/QtnFJ1raBdyY4UnZ5mySpdIyBpSsLteLWpffUxGf2WQLqU6uGlAHeo1EcKpVHkDG94M54eM= 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 1620650942749174.74052268233027; Mon, 10 May 2021 05:49:02 -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-47-vWCI0JNEN0Kbm9TuVEiDWw-1; Mon, 10 May 2021 08:48:57 -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 84F811854E26; Mon, 10 May 2021 12:48:51 +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 366D561094; Mon, 10 May 2021 12:48:51 +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 26D5344A65; Mon, 10 May 2021 12:48:50 +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 14ACmmVJ005600 for ; Mon, 10 May 2021 08:48:48 -0400 Received: by smtp.corp.redhat.com (Postfix) id 84F1E1724D; Mon, 10 May 2021 12:48:48 +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 B608C2C6FB; Mon, 10 May 2021 12:48:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1620650941; 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=fxzyWr56YqYhEULI+1ic4/xQHhRWVlJQ/UYz4CgUbRc=; b=BDHBgPZfm8SXI12EOEiqWFSgzWZHOQA7/dxPVamJ1x5C5dKG8EVr/H2j5JQKwFd6GJvtrd X53BrdI3hQAeryUT0ufHIG7YiYGAuF0ASI4+RZMuC4Y+acHrpuN7FfQN4l8bpIt7GxV649 zQVZKuF0qZd+6dFG3wfArXigF1jLT6U= X-MC-Unique: vWCI0JNEN0Kbm9TuVEiDWw-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 02/10] virDomainObjParseXML: Use g_autoptr Date: Mon, 10 May 2021 14:48:33 +0200 Message-Id: <20210510124841.123066-3-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.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: Tim Wiederhake Reviewed-by: Michal Privoznik --- src/conf/domain_conf.c | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 0d396cbdda..7044701fac 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -20351,7 +20351,7 @@ virDomainObjParseXML(xmlDocPtr xml, long val; xmlNodePtr config; xmlNodePtr oldnode; - virDomainObj *obj; + g_autoptr(virDomainObj) obj =3D NULL; size_t i; int n; virDomainState state; @@ -20367,7 +20367,7 @@ virDomainObjParseXML(xmlDocPtr xml, if (!(config =3D virXPathNode("./domain", ctxt))) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("no domain config")); - goto error; + return NULL; } =20 oldnode =3D ctxt->node; @@ -20375,17 +20375,17 @@ virDomainObjParseXML(xmlDocPtr xml, obj->def =3D virDomainDefParseXML(xml, ctxt, xmlopt, flags); ctxt->node =3D oldnode; if (!obj->def) - goto error; + return NULL; =20 if (virXMLPropEnum(ctxt->node, "state", virDomainStateTypeFromString, VIR_XML_PROP_REQUIRED, &state) < 0) - goto error; + return NULL; =20 if ((tmp =3D virXMLPropString(ctxt->node, "reason"))) { if ((reason =3D virDomainStateReasonFromString(state, tmp)) < 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("invalid domain state reason '%s'"), tmp); - goto error; + return NULL; } } =20 @@ -20394,12 +20394,12 @@ virDomainObjParseXML(xmlDocPtr xml, if (virXPathLong("string(./@pid)", ctxt, &val) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("invalid pid")); - goto error; + return NULL; } obj->pid =3D (pid_t)val; =20 if ((n =3D virXPathNodeSet("./taint", ctxt, &taintNodes)) < 0) - goto error; + return NULL; for (i =3D 0; i < n; i++) { int rc; virDomainTaintFlags taint; @@ -20407,14 +20407,14 @@ virDomainObjParseXML(xmlDocPtr xml, if ((rc =3D virXMLPropEnum(taintNodes[i], "flag", virDomainTaintTypeFromString, VIR_XML_PROP_NONE, &taint)) < 0) - goto error; + return NULL; =20 if (rc =3D=3D 1) virDomainObjTaint(obj, taint); } =20 if ((n =3D virXPathNodeSet("./deprecation", ctxt, &depNodes)) < 0) - goto error; + return NULL; for (i =3D 0; i < n; i++) { g_autofree char *str =3D virXMLNodeContentString(depNodes[i]); virDomainObjDeprecation(obj, str); @@ -20422,24 +20422,20 @@ virDomainObjParseXML(xmlDocPtr xml, =20 if (xmlopt->privateData.parse && xmlopt->privateData.parse(ctxt, obj, &xmlopt->config) < 0) - goto error; + return NULL; =20 if (xmlopt->privateData.getParseOpaque) parseOpaque =3D xmlopt->privateData.getParseOpaque(obj); =20 /* callback to fill driver specific domain aspects */ if (virDomainDefPostParse(obj->def, flags, xmlopt, parseOpaque) < 0) - goto error; + return NULL; =20 /* validate configuration */ if (virDomainDefValidate(obj->def, flags, xmlopt, parseOpaque) < 0) - goto error; - - return obj; + return NULL; =20 - error: - virObjectUnref(obj); - return NULL; + return g_steal_pointer(&obj); } =20 =20 --=20 2.26.3 From nobody Tue May 14 00:25:39 2024 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=1620650951; cv=none; d=zohomail.com; s=zohoarc; b=dkh6+5Bfn7m0PUfFrTGmf+alHr0+kTHyQjQgNqEugwwUh2yRhK4uFhWafZiRXg+m/MNZsvL7wZHMnYpXxY/Txr4GAVasB/8/jnkVY66AOuQTwjZYW8hW3b+35M7YZxK+CQrLWAW5q/jSl2u0yFcPVpSTsp9d4kAAZsRgmbarxj4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1620650951; 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=1ILJDq1wDS4MY/O3ZzPZ7Fqa+uFznI9U+qSGILx+IiY=; b=Lldv2/x+m0M1F0bXvNAkHnnHm7tVnllaHmKl+ZzvUmrTRknZ8Nzb1uQolO+8gd/kQeHhYMwEfYAlcmGGD7l394MIgAD+QBMiSyGiR4zrtrlmAmahZXgPmBLPt9X12VjkC00LYsSpSsnopXsQ3fpOI3Ht1j/33S+8vhco1gwy9f8= 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 1620650951510440.34318066448; Mon, 10 May 2021 05:49:11 -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-154-a80vHPotPdyB-8vQHIeVJQ-1; Mon, 10 May 2021 08:49:08 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 64D699F92E; Mon, 10 May 2021 12:49:02 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 47B2E60D54; Mon, 10 May 2021 12:49:02 +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 15B03180B464; Mon, 10 May 2021 12:49:02 +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 14ACmnn9005613 for ; Mon, 10 May 2021 08:48:49 -0400 Received: by smtp.corp.redhat.com (Postfix) id 9A11F5F707; Mon, 10 May 2021 12:48:49 +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 D6C8B2C6FB; Mon, 10 May 2021 12:48:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1620650950; 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=1ILJDq1wDS4MY/O3ZzPZ7Fqa+uFznI9U+qSGILx+IiY=; b=dLJzZRNA9u6vPIGhP98VKBAqTw1AUsQL5L8CiuqbreU+7F5brBwGcQrDuaBahehquPML4u sO4WY/8welu495GE8FlHJPXh2I9qqJ7vrkZkospSHDns2pPvdiv85ZYvw3jEZB8ppuYCgg 3EVKS7I5scg2NMh9VJF+JoBco4/vcBw= X-MC-Unique: a80vHPotPdyB-8vQHIeVJQ-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 03/10] virNetworkDHCPLeaseTimeDef: Make expiry unsigned long long Date: Mon, 10 May 2021 14:48:34 +0200 Message-Id: <20210510124841.123066-4-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.13 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" The width of `unsigned long` differs on 32 bit and 64 bit architectures. There is no compelling reason why the maximum DHCP lease time should depend on the architecture. Signed-off-by: Tim Wiederhake Reviewed-by: Michal Privoznik --- src/conf/network_conf.c | 8 ++++---- src/conf/network_conf.h | 2 +- src/network/bridge_driver.c | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c index d6eafa3f57..c3c335135b 100644 --- a/src/conf/network_conf.c +++ b/src/conf/network_conf.c @@ -412,13 +412,13 @@ virNetworkDHCPLeaseTimeDefParseXML(virNetworkDHCPLeas= eTimeDef **lease, virNetworkDHCPLeaseTimeDef *new_lease =3D NULL; g_autofree char *expirystr =3D NULL; g_autofree char *unitstr =3D NULL; - unsigned long expiry; + unsigned long long expiry; int unit =3D VIR_NETWORK_DHCP_LEASETIME_UNIT_MINUTES; =20 if (!(expirystr =3D virXMLPropString(node, "expiry"))) return 0; =20 - if (virStrToLong_ul(expirystr, NULL, 10, &expiry) < 0) { + if (virStrToLong_ull(expirystr, NULL, 10, &expiry) < 0) { virReportError(VIR_ERR_XML_ERROR, _("failed to parse expiry value '%s'"), expirystr); return -1; @@ -2312,7 +2312,7 @@ virNetworkIPDefFormat(virBuffer *buf, if (!lease->expiry) { virBufferAddLit(buf, "\n"); } else { - virBufferAsprintf(buf, "\n", + virBufferAsprintf(buf, "\n", lease->expiry, virNetworkDHCPLeaseTimeUnitTypeToStr= ing(lease->unit)); } @@ -2344,7 +2344,7 @@ virNetworkIPDefFormat(virBuffer *buf, if (!lease->expiry) { virBufferAddLit(buf, "\n"); } else { - virBufferAsprintf(buf, "\n", + virBufferAsprintf(buf, "\n", lease->expiry, virNetworkDHCPLeaseTimeUnitTypeToStr= ing(lease->unit)); } diff --git a/src/conf/network_conf.h b/src/conf/network_conf.h index a7e6b7a2a6..6199f3f588 100644 --- a/src/conf/network_conf.h +++ b/src/conf/network_conf.h @@ -105,7 +105,7 @@ VIR_ENUM_DECL(virNetworkForwardDriverName); =20 typedef struct _virNetworkDHCPLeaseTimeDef virNetworkDHCPLeaseTimeDef; struct _virNetworkDHCPLeaseTimeDef { - unsigned long expiry; + unsigned long long expiry; virNetworkDHCPLeaseTimeUnitType unit; }; =20 diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index ee3f9dab0a..a711b34c48 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -988,7 +988,7 @@ networkBuildDnsmasqLeaseTime(virNetworkDHCPLeaseTimeDef= *lease) } else { unit =3D virNetworkDHCPLeaseTimeUnitTypeToString(lease->unit); /* We get only first compatible char from string: 's', 'm' or 'h' = */ - virBufferAsprintf(&buf, "%lu%c", lease->expiry, unit[0]); + virBufferAsprintf(&buf, "%llu%c", lease->expiry, unit[0]); } =20 return virBufferContentAndReset(&buf); --=20 2.26.3 From nobody Tue May 14 00:25:39 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=1620650953; cv=none; d=zohomail.com; s=zohoarc; b=AAC4kBlf2L5BdYlg7pf0DXwQQJUrZo2Hbvm+WMWYDKVfcp5thMR+v9L4uox5xcnnHsRgI9A64bI6gMDfngFKdfap4a7Itkbjm8Gew5ETxO/pzlV0VV5QuMrPpEHxLZut2RizxS2+C3nD1ATZw1MY+xCT/V4FalXrbBk+tjjK864= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1620650953; 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=MKnAfu8caghIPeeXIJ9h6xenfFwPAGrXgWSxLwuHpEU=; b=C7ucJH9wJhxyQ7xJ1AflyNyyxBeQWsHfc4B9xtJIhBub2CBqG+Sbp6JzTrZoCe5qQ3PBjhvi9Nq76IDEYzujijhX6KSeqCQH83E2u/jQLesL11wkqTFc4v2UTqwAP4AIShyFkH8ioHKHYX5fUE0SU+PkhhbkxQKDdqoBdFY9m9E= 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 1620650953356842.937986574061; Mon, 10 May 2021 05:49:13 -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-491-Olr-u-twNJqTwd4SU7dTlg-1; Mon, 10 May 2021 08:49:08 -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 36F508189CC; Mon, 10 May 2021 12:49:00 +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 0A1E21037F34; Mon, 10 May 2021 12:49:00 +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 C1A0344A6C; Mon, 10 May 2021 12:48:59 +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 14ACmoAb005623 for ; Mon, 10 May 2021 08:48:50 -0400 Received: by smtp.corp.redhat.com (Postfix) id C83A05F9B0; Mon, 10 May 2021 12:48:50 +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 024055F707; Mon, 10 May 2021 12:48:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1620650952; 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=MKnAfu8caghIPeeXIJ9h6xenfFwPAGrXgWSxLwuHpEU=; b=ImLbVzp6ppFH6OPRi1kNBrCjXsjynTLhfa90F3eu7I9pVIRpAGqVAHtSwyvkvA9PtaCyQA ZyAGXeclvyMsLAaf66VkPCxzuPFNBZKy0kwWzaFnK+NSaJcB+CNnpxSpHInsrkpkP2qBz6 w4jlx/3vdsjelNMIPF2dyVwhDYqf+Tw= X-MC-Unique: Olr-u-twNJqTwd4SU7dTlg-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 04/10] virNetworkDHCPLeaseTimeDefParseXML: Use virXMLProp* Date: Mon, 10 May 2021 14:48:35 +0200 Message-Id: <20210510124841.123066-5-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.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) Content-Type: text/plain; charset="utf-8" Signed-off-by: Tim Wiederhake Reviewed-by: Michal Privoznik --- src/conf/network_conf.c | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c index c3c335135b..a9eadff29c 100644 --- a/src/conf/network_conf.c +++ b/src/conf/network_conf.c @@ -410,27 +410,21 @@ virNetworkDHCPLeaseTimeDefParseXML(virNetworkDHCPLeas= eTimeDef **lease, xmlNodePtr node) { virNetworkDHCPLeaseTimeDef *new_lease =3D NULL; - g_autofree char *expirystr =3D NULL; - g_autofree char *unitstr =3D NULL; unsigned long long expiry; - int unit =3D VIR_NETWORK_DHCP_LEASETIME_UNIT_MINUTES; + virNetworkDHCPLeaseTimeUnitType unit; + int rc; =20 - if (!(expirystr =3D virXMLPropString(node, "expiry"))) + if ((rc =3D virXMLPropULongLong(node, "expiry", 0, VIR_XML_PROP_NONE, = &expiry)) < 0) + return -1; + + if (rc =3D=3D 0) return 0; =20 - if (virStrToLong_ull(expirystr, NULL, 10, &expiry) < 0) { - virReportError(VIR_ERR_XML_ERROR, - _("failed to parse expiry value '%s'"), expirystr); + if (virXMLPropEnumDefault(node, "unit", + virNetworkDHCPLeaseTimeUnitTypeFromString, + VIR_XML_PROP_NONE, &unit, + VIR_NETWORK_DHCP_LEASETIME_UNIT_MINUTES) < 0) return -1; - } - - if ((unitstr =3D virXMLPropString(node, "unit"))) { - if ((unit =3D virNetworkDHCPLeaseTimeUnitTypeFromString(unitstr)) = < 0) { - virReportError(VIR_ERR_XML_ERROR, - _("Invalid unit: %s"), unitstr); - return -1; - } - } =20 /* infinite */ if (expiry > 0) { --=20 2.26.3 From nobody Tue May 14 00:25:39 2024 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=1620651004; cv=none; d=zohomail.com; s=zohoarc; b=fMpZrg/VScS6YVFDhWoYNApWtlPbzQnnq2/p39r53rw+sSSE4hQD5uG8oAavk+mFmczlPoBem84z+2sAp4s7w63IX7btJvw3qsW3XEu8Y8O2OZqXdOsB5qxNVVL20WU2TzINNgMiexYDhvFNmRWIOk9x9Dhz+o3a8NZcLMOGE9Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1620651004; 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=f27f6Q1Y9rPt0Wu4xMLu03TaKA2t/zmO3SL40exPi4E=; b=JbE86VqGHc89waJdR0ABIfeEWWtrcbKFdw0sJhB6RQB7fxiCTRWXpt3IUOlVuHoM+jRt/94pRIMOSJX1oNPZVfeJXa/SA8uqpvdu9lcx17AF0ZPU5sNQMUXGePSYFT6Ok7HZg88Swnyb9of2v+yWCJbSg7Pel/upXD5nuWudYHg= 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 1620651004233264.1619051088053; Mon, 10 May 2021 05:50:04 -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-450-kK8-BwfXOgu2NgjWkLEmOQ-1; Mon, 10 May 2021 08:49:12 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 29CE5107ACFE; Mon, 10 May 2021 12:49:05 +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 F138A19D9D; Mon, 10 May 2021 12:49:04 +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 B7B845535C; Mon, 10 May 2021 12:49:04 +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 14ACmpKv005641 for ; Mon, 10 May 2021 08:48:51 -0400 Received: by smtp.corp.redhat.com (Postfix) id DD8FE5F707; Mon, 10 May 2021 12:48:51 +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 296BE5F9B0; Mon, 10 May 2021 12:48:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1620651003; 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=f27f6Q1Y9rPt0Wu4xMLu03TaKA2t/zmO3SL40exPi4E=; b=XsfO875cR/DHIojgF9ufEkqlUxbrm399omIawDM8zFZ2H47ceAmW8amjfpWGv8Jco9+D5/ gWHr/aJmJ9kp9A2FakeNnHGOD1UZsHV9PRLVh+COX5jp8QnYlJkHGvdyfLYjrlV1GhMK4L ZTkx9OnIXC4srkfAYTNPer7E4CrcMOI= X-MC-Unique: kK8-BwfXOgu2NgjWkLEmOQ-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 05/10] virPCIEDeviceInfoLinkParseXML: Use virXMLProp* Date: Mon, 10 May 2021 14:48:36 +0200 Message-Id: <20210510124841.123066-6-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.84 on 10.5.11.23 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 Reviewed-by: Michal Privoznik --- src/conf/node_device_conf.c | 34 ++++++---------------------------- 1 file changed, 6 insertions(+), 28 deletions(-) diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c index faa36c1944..ef09ed0a6f 100644 --- a/src/conf/node_device_conf.c +++ b/src/conf/node_device_conf.c @@ -1601,38 +1601,16 @@ virPCIEDeviceInfoLinkParseXML(xmlXPathContextPtr ct= xt, virPCIELink *lnk) { VIR_XPATH_NODE_AUTORESTORE(ctxt) - int speed; - g_autofree char *speedStr =3D NULL; - g_autofree char *portStr =3D NULL; =20 - ctxt->node =3D linkNode; - - if (virXPathUInt("number(./@width)", ctxt, &lnk->width) < 0) { - virReportError(VIR_ERR_XML_DETAIL, "%s", - _("mandatory attribute 'width' is missing or malfor= med")); + if (virXMLPropUInt(linkNode, "width", 0, VIR_XML_PROP_REQUIRED, &lnk->= width) < 0) return -1; - } =20 - if ((speedStr =3D virXPathString("string(./@speed)", ctxt))) { - if ((speed =3D virPCIELinkSpeedTypeFromString(speedStr)) < 0) { - virReportError(VIR_ERR_XML_DETAIL, - _("malformed 'speed' attribute: %s"), - speedStr); - return -1; - } - lnk->speed =3D speed; - } + if (virXMLPropEnum(linkNode, "speed", virPCIELinkSpeedTypeFromString, + VIR_XML_PROP_NONE, &lnk->speed) < 0) + return -1; =20 - if ((portStr =3D virXPathString("string(./@port)", ctxt))) { - if (virStrToLong_i(portStr, NULL, 10, &lnk->port) < 0) { - virReportError(VIR_ERR_XML_DETAIL, - _("malformed 'port' attribute: %s"), - portStr); - return -1; - } - } else { - lnk->port =3D -1; - } + if (virXMLPropInt(linkNode, "port", 10, VIR_XML_PROP_NONE, &lnk->port,= -1) < 0) + return -1; =20 return 0; } --=20 2.26.3 From nobody Tue May 14 00:25:39 2024 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=1620650952; cv=none; d=zohomail.com; s=zohoarc; b=QhOeo6rm3AcE4mmeXgVFKCOtSE2zYY4XOIiZQ5szee8bJqdNv8nVQ1POHXIiU4rkXmBjY0diM+/KYNRw1SgloG6UO4L3aDQ6pBwstAlo0pCM3+F9RqDH/rnG20UPaabPxmRFYzz565Ca6WxhFSv7PsPv7Ov+vzAbCqM4de+ShUM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1620650952; 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=BJp900EDBKN4q+C5CTDI3OMvcJV6uYMt4CjVXF9NHa4=; b=k+SbXln/tXUpW5iOE3xzexXw5ad7duSJOqFuekemZBhiS1K3uHTqgV7UrF2oS6TzXcdpGCyXGFgy8UGzoUhNoPpxhxRaBQwNfeT0fqp4OJY8+mURmRvsm6T1nTjgp2ZBY+KxgCxuXPMvUcrBxFBCi8OYqNAt9Yx7XEO+74kvXCo= 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 1620650952639211.462059031963; Mon, 10 May 2021 05:49:12 -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-600-iav11ZMyPLypHGU1EKvlCw-1; Mon, 10 May 2021 08:49:09 -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 263B79F92D; Mon, 10 May 2021 12:49:03 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E9DEB1037F33; Mon, 10 May 2021 12:49:02 +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 B006F1801028; Mon, 10 May 2021 12:49:02 +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 14ACmrv1005656 for ; Mon, 10 May 2021 08:48:53 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0B3A25F707; Mon, 10 May 2021 12:48:53 +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 432245F9B0; Mon, 10 May 2021 12:48:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1620650951; 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=BJp900EDBKN4q+C5CTDI3OMvcJV6uYMt4CjVXF9NHa4=; b=gvyZJIEDJIbb/5PCPUvxzdL8wjgjPdXwg/W7vO6VVqLWB2PxFDBi9JLwRe5kb9yjo0jtjg mjgpjZ9+TKjaRWpHNVM+ediT6XnZVPevOatr9OxK1fBSUN3b3oTmH4xsKqbIOuEAdVTqyW XifnvPxkqDtr/L78i431/q2rGwwOCMc= X-MC-Unique: iav11ZMyPLypHGU1EKvlCw-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 06/10] virPCIEDeviceInfoLinkParseXML: Remove unused parameter ctxt Date: Mon, 10 May 2021 14:48:37 +0200 Message-Id: <20210510124841.123066-7-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.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) Content-Type: text/plain; charset="utf-8" Signed-off-by: Tim Wiederhake Reviewed-by: Michal Privoznik --- src/conf/node_device_conf.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c index ef09ed0a6f..34c8aa988e 100644 --- a/src/conf/node_device_conf.c +++ b/src/conf/node_device_conf.c @@ -1596,12 +1596,9 @@ virNodeDevCapPCIDevIommuGroupParseXML(xmlXPathContex= tPtr ctxt, =20 =20 static int -virPCIEDeviceInfoLinkParseXML(xmlXPathContextPtr ctxt, - xmlNodePtr linkNode, +virPCIEDeviceInfoLinkParseXML(xmlNodePtr linkNode, virPCIELink *lnk) { - VIR_XPATH_NODE_AUTORESTORE(ctxt) - if (virXMLPropUInt(linkNode, "width", 0, VIR_XML_PROP_REQUIRED, &lnk->= width) < 0) return -1; =20 @@ -1629,16 +1626,14 @@ virPCIEDeviceInfoParseXML(xmlXPathContextPtr ctxt, if ((lnk =3D virXPathNode("./link[@validity=3D'cap']", ctxt))) { pci_express->link_cap =3D g_new0(virPCIELink, 1); =20 - if (virPCIEDeviceInfoLinkParseXML(ctxt, lnk, - pci_express->link_cap) < 0) + if (virPCIEDeviceInfoLinkParseXML(lnk, pci_express->link_cap) < 0) return -1; } =20 if ((lnk =3D virXPathNode("./link[@validity=3D'sta']", ctxt))) { pci_express->link_sta =3D g_new0(virPCIELink, 1); =20 - if (virPCIEDeviceInfoLinkParseXML(ctxt, lnk, - pci_express->link_sta) < 0) + if (virPCIEDeviceInfoLinkParseXML(lnk, pci_express->link_sta) < 0) return -1; } =20 --=20 2.26.3 From nobody Tue May 14 00:25:39 2024 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 Reviewed-by: Michal Privoznik --- 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 From nobody Tue May 14 00:25:39 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=1620650950; cv=none; d=zohomail.com; s=zohoarc; b=OtwjXYp8lFknmGmx+VFL9pPQXFBAG7/U7+3TqFMyzRd05S7yzi2HfTgFKlKLSSNAwIXmQbyPextHSogqZKdn4QQvQA36qgNS+teuLMyYWoy1hD8+nrsf2xuhKkD/RiuvHXReJ0x0DuvFoqDMKFBz+wnZTYXIgFNovrPki+c8MAU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1620650950; 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=l5HEDqulPUgX0Om7hVVIulyqtOwKcdOOd2L0OgU6ovE=; b=Hdl+gHsg8nKggISoBAngttjQLhpz5e8ls4InnLtzmxC2vFn2Vx25diMQ+uciIJxszdI3zwXQLbnuVbm9MddAG+3GWb2S+i5/kXzrJxny9wg2WRrZjroYEsjqhx2ZcShCE+rpYSIvtLOg0+SDt9UuEu2tqeqATmsMwIfOAa1S5Zs= 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 1620650950683101.34467124780406; Mon, 10 May 2021 05:49:10 -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-453-1LK_sLkMM6uvc1RsvW3zwg-1; Mon, 10 May 2021 08:49:07 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 44D739F933; Mon, 10 May 2021 12:49:00 +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 20DC118217; Mon, 10 May 2021 12:49:00 +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 DA82744A6E; Mon, 10 May 2021 12:48:59 +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 14ACmtHI005675 for ; Mon, 10 May 2021 08:48:55 -0400 Received: by smtp.corp.redhat.com (Postfix) id 2FD751E6; Mon, 10 May 2021 12:48:55 +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 7664B5F9B0; Mon, 10 May 2021 12:48:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1620650949; 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=l5HEDqulPUgX0Om7hVVIulyqtOwKcdOOd2L0OgU6ovE=; b=i7NblkIPNOzt6l4UVJ5KvYfUoUWRNSxL/JVtU3kKms89+IrxPDQ5P1AxShCXJeNeI2GpmX Ews7HzdzdXU4+JX+vjYSHLl5QLj3G+H48Yyj3gytZG+mO/xWXn3uSE5nsYtrfEsPvFGzAj IwyyC67/iqic1oUuvn8MGn+oVivfNuM= X-MC-Unique: 1LK_sLkMM6uvc1RsvW3zwg-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 08/10] conf: node_device: Register autoptr cleanup function for virNodeDevCapsDef Date: Mon, 10 May 2021 14:48:39 +0200 Message-Id: <20210510124841.123066-9-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.16 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 Reviewed-by: Michal Privoznik --- src/conf/node_device_conf.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/conf/node_device_conf.h b/src/conf/node_device_conf.h index 85790ad96c..a60562e4fe 100644 --- a/src/conf/node_device_conf.h +++ b/src/conf/node_device_conf.h @@ -377,6 +377,8 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(virNodeDeviceDef, virNode= DeviceDefFree); void virNodeDevCapsDefFree(virNodeDevCapsDef *caps); =20 +G_DEFINE_AUTOPTR_CLEANUP_FUNC(virNodeDevCapsDef, virNodeDevCapsDefFree); + #define VIR_CONNECT_LIST_NODE_DEVICES_FILTERS_CAP \ (VIR_CONNECT_LIST_NODE_DEVICES_CAP_SYSTEM | \ VIR_CONNECT_LIST_NODE_DEVICES_CAP_PCI_DEV | \ --=20 2.26.3 From nobody Tue May 14 00:25:39 2024 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=1620650960; cv=none; d=zohomail.com; s=zohoarc; b=AelgzeHEKNNWOFlZNZ7ARzSPv0s3eBCmrVatbRY2dcjFFOYnrJiPUpMVbtgGkk60ZL1nGrZwfVha9DTU4uqmrfIybe1ZQIdVYLCOEOauUwdF4P8c39wdtYwtj+elaeCKihMH0GglMr0Ur3ZXtxjBxdDVud0EMR+4Jx7Yex2tFFs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1620650960; 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=tcba9n9ng4qsHbgitZ+eKsRL6LVpHOeup60eX4tTVDE=; b=jAmSILgE0Km9Mkb13FOi1/J3HqIED7BwApJS9Pr0sr6LMDldUHjLVPqQF5u6fj6e3VsHKC9MPtpEMJp14Ng9aGZfOYsHwy1ROgHare7KA1LNbxCrTJTmTsV6cpMzFL5B+iVasY8myfSWF/cdfc7g/aWOgL2uEAyumv+E4hNUaVg= 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 1620650960034558.8705762174278; Mon, 10 May 2021 05:49:20 -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-58-QGFhycd4Nqua-QNzHhjXjA-1; Mon, 10 May 2021 08:49:15 -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 1E6D8107ACED; Mon, 10 May 2021 12:49:11 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id F24675D9F0; Mon, 10 May 2021 12:49:10 +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 BE6301801028; Mon, 10 May 2021 12:49:10 +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 14ACmuNq005682 for ; Mon, 10 May 2021 08:48:56 -0400 Received: by smtp.corp.redhat.com (Postfix) id 4C4871E6; Mon, 10 May 2021 12:48:56 +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 87CDB2C6FB; Mon, 10 May 2021 12:48:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1620650958; 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=tcba9n9ng4qsHbgitZ+eKsRL6LVpHOeup60eX4tTVDE=; b=X3tNMXTg+zq3z2tn/t7aAS639iardyY1zbKoLhPg+xD+y9+D6Rr/uSNPy31QMxyDnp0WdT P6S85ban+rJOjI8OGjak4IETDlpOfcaRYioUT+o29O10C5Ww0vbijAAazxPHYG+RO2aw0C DTazSc6slRNIQuHd886+HJ3x7CQJjRw= X-MC-Unique: QGFhycd4Nqua-QNzHhjXjA-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 09/10] virNodeDevCapsDefParseXML: Use g_autoptr Date: Mon, 10 May 2021 14:48:40 +0200 Message-Id: <20210510124841.123066-10-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 Reviewed-by: Michal Privoznik --- src/conf/node_device_conf.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c index b3d5bc1515..04014f75dc 100644 --- a/src/conf/node_device_conf.c +++ b/src/conf/node_device_conf.c @@ -1971,14 +1971,12 @@ virNodeDevCapsDefParseXML(xmlXPathContextPtr ctxt, int create, const char *virt_type) { - virNodeDevCapsDef *caps; + g_autoptr(virNodeDevCapsDef) caps =3D g_new0(virNodeDevCapsDef, 1); int ret =3D -1; =20 - caps =3D g_new0(virNodeDevCapsDef, 1); - if (virXMLPropEnum(node, "type", virNodeDevCapTypeFromString, VIR_XML_PROP_REQUIRED, &caps->data.type) < 0) - goto error; + return NULL; =20 switch (caps->data.type) { case VIR_NODE_DEV_CAP_SYSTEM: @@ -2050,12 +2048,9 @@ virNodeDevCapsDefParseXML(xmlXPathContextPtr ctxt, } =20 if (ret < 0) - goto error; - return caps; + return NULL; =20 - error: - virNodeDevCapsDefFree(caps); - return NULL; + return g_steal_pointer(&caps); } =20 =20 --=20 2.26.3 From nobody Tue May 14 00:25:39 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=1620650962; cv=none; d=zohomail.com; s=zohoarc; b=gp6KWWFqMXwAkvjBhgBCTaJ5n1rDXwiUOypOkAU9ABNG8ldhXqcRoHLInbEZhJ8z4O1mUoEYAHpUak5JrNE3xJzW88mqEP23aOYDGsE3ZAb6pGlqIyzk6+ODJlXFQOxzJceYlzPXBwhg/reqK8T41etvtt1xG0ZVuyhtY3Lh6aA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1620650962; 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=U1mGg+AYW//2Njrc1hDrJ702Dk5COMdywaTvBaVcxFg=; b=GmiPo2S0YUN5M13tCRi/urSmiMysCZygDWeF2Dg/jzQOBLVF+4qfL5CDSYXooKpCUhTbYVXjOnU94yqRiutWLBRioyeUUs9qZVQ7Yk3or93hiIKO4AvQF8RYcgVQWppOE7U0EBplav+elLxzWJq66D3zVXPqKb8G3nvtGiEy2jk= 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 1620650962975637.1752692385519; Mon, 10 May 2021 05:49:22 -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-385-bkbgPm63ODO470MbtneGgQ-1; Mon, 10 May 2021 08:49:19 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 95D1C1854E2B; Mon, 10 May 2021 12:49:13 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 718E160C5B; Mon, 10 May 2021 12:49:13 +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 3AD9E180102A; Mon, 10 May 2021 12:49:13 +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 14ACmvgZ005691 for ; Mon, 10 May 2021 08:48:57 -0400 Received: by smtp.corp.redhat.com (Postfix) id 619485FC14; Mon, 10 May 2021 12:48:57 +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 A0E111E6; Mon, 10 May 2021 12:48:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1620650961; 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=U1mGg+AYW//2Njrc1hDrJ702Dk5COMdywaTvBaVcxFg=; b=GnH+z9d1iUeK9Zxr9v5tM590eiSTpmV+l/sUtOUV9t+wiQv8wFUaw5dKasH/fD55MIIEqJ uW92xqx3Rc7jwC1ZX+iuzjaOCj9sRVZxmkZPRL3aX1vcN/Ds1yTXg3Q5t7VJTlq9jL5/cU iP1l8uYNhey7oTqZOlOe4XX7tTo3Jr0= X-MC-Unique: bkbgPm63ODO470MbtneGgQ-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 10/10] virNodeDeviceDefParseXML: Use virXMLProp* Date: Mon, 10 May 2021 14:48:41 +0200 Message-Id: <20210510124841.123066-11-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.13 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 Reviewed-by: Michal Privoznik --- src/conf/node_device_conf.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c index 04014f75dc..4477a8d9d2 100644 --- a/src/conf/node_device_conf.c +++ b/src/conf/node_device_conf.c @@ -2089,24 +2089,13 @@ virNodeDeviceDefParseXML(xmlXPathContextPtr ctxt, =20 for (i =3D 0, m =3D 0; i < n; i++) { xmlNodePtr node =3D nodes[i]; - g_autofree char *tmp =3D virXMLPropString(node, "type"); - int val; + virNodeDevDevnodeType val; =20 - if (!tmp) { - virReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("missing devnode type")); + if (virXMLPropEnum(node, "type", virNodeDevDevnodeTypeFromString, + VIR_XML_PROP_REQUIRED, &val) < 0) goto error; - } - - val =3D virNodeDevDevnodeTypeFromString(tmp); - - if (val < 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unknown devnode type '%s'"), tmp); - goto error; - } =20 - switch ((virNodeDevDevnodeType)val) { + switch (val) { case VIR_NODE_DEV_DEVNODE_DEV: if (!(def->devnode =3D virXMLNodeContentString(node))) goto error; --=20 2.26.3