From nobody Sat Apr 27 18:55:48 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=1667315001; cv=none; d=zohomail.com; s=zohoarc; b=cmNNhYkVnOjRUhwaRz1DplKlo/uCO7S+X/hV1bEkUWOc6YAGrtquiMQ73vaCSugKOerUD3wbjfruGifLyFlbPukyUgHQ9TSnxLcPSaOVngGNCDTW68fvDKysbu0RSfuj/Syj4Nx+l1MD6KqgaqIvPUX/vzacExJBCm7WUy3RF3Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1667315001; 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=cx3prF0xW6ULg6EACbLHt5Bx5A7znQn81dMhBaSxQuA=; b=HYhtoYJeyABIy0V1vgchB8Pk1VgdjedbWnHxZhdGPON4bzHbqdFZAsWGT+gOmUSrm9rkFaWSRG98ZNSgQnrLIeNwrjAxZRabbl3HaqzQSUE2lbSkcCFwykoC1copBOHwFJxrRuv6kerpj19wcH0bplzt11Ch5yCKWq5co7AWIGY= 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 166731500148397.93633972776365; Tue, 1 Nov 2022 08:03:21 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-589-H9xXc3XvOwioX-VmcW8xLQ-1; Tue, 01 Nov 2022 11:03:06 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D8DD6800B30; Tue, 1 Nov 2022 15:02:38 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id C568540C94CE; Tue, 1 Nov 2022 15:02:38 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id A4ACB19465B3; Tue, 1 Nov 2022 15:02:38 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id E16591946594 for ; Tue, 1 Nov 2022 15:02:36 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id D54722166BB6; Tue, 1 Nov 2022 15:02:36 +0000 (UTC) Received: from speedmetal.redhat.com (ovpn-208-3.brq.redhat.com [10.40.208.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3B3682166B2D for ; Tue, 1 Nov 2022 15:02:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1667314999; 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=cx3prF0xW6ULg6EACbLHt5Bx5A7znQn81dMhBaSxQuA=; b=IA+aB4OdJ6B84hZwtq+VO+R+FJtZ7r7MEhnDoM342eWNW0aZZ/IFQik/mcP9DjHl27pF0r AA8DqsfdQ47r2EeYyhjALfHeUKvBLJ4SnWI+8fq0076xcsswl3edTn4VsohoFL2Yp7BSht 0iG5/XcZ893qOEkLiHY4zZe/emO2Szg= X-MC-Unique: H9xXc3XvOwioX-VmcW8xLQ-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 01/11] conf: domain: Refactor cleanup in virSysinfoBIOSParseXML Date: Tue, 1 Nov 2022 16:02:15 +0100 Message-Id: <94e773b5eadebe43b291f884bfddfaa2d5010177.1667314911.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 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: 1667315004148100002 Content-Type: text/plain; charset="utf-8" Register automatic cleanup for virSysinfoBIOSDef and use it to refactor the cleanup code paths in virSysinfoBIOSParseXML. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/conf/domain_conf.c | 19 ++++++------------- src/util/virsysinfo.h | 1 + 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 7984a15c46..15db12876e 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -12136,19 +12136,16 @@ virSysinfoBIOSParseXML(xmlNodePtr node, virSysinfoBIOSDef **bios) { VIR_XPATH_NODE_AUTORESTORE(ctxt) - int ret =3D -1; - virSysinfoBIOSDef *def; + g_autoptr(virSysinfoBIOSDef) def =3D g_new0(virSysinfoBIOSDef, 1); ctxt->node =3D node; if (!virXMLNodeNameEqual(node, "bios")) { virReportError(VIR_ERR_XML_ERROR, "%s", _("XML does not contain expected 'bios' element")); - return ret; + return -1; } - def =3D g_new0(virSysinfoBIOSDef, 1); - def->vendor =3D virXPathString("string(entry[@name=3D'vendor'])", ctxt= ); def->version =3D virXPathString("string(entry[@name=3D'version'])", ct= xt); def->date =3D virXPathString("string(entry[@name=3D'date'])", ctxt); @@ -12173,20 +12170,16 @@ virSysinfoBIOSParseXML(xmlNodePtr node, (year < 0 || (year >=3D 100 && year < 1900))) { virReportError(VIR_ERR_XML_DETAIL, "%s", _("Invalid BIOS 'date' format")); - goto cleanup; + return -1; } } if (!def->vendor && !def->version && - !def->date && !def->release) { - g_clear_pointer(&def, virSysinfoBIOSDefFree); - } + !def->date && !def->release) + return 0; *bios =3D g_steal_pointer(&def); - ret =3D 0; - cleanup: - virSysinfoBIOSDefFree(def); - return ret; + return 0; } static int diff --git a/src/util/virsysinfo.h b/src/util/virsysinfo.h index 97e0e18ddf..899193dc81 100644 --- a/src/util/virsysinfo.h +++ b/src/util/virsysinfo.h @@ -142,6 +142,7 @@ struct _virSysinfoDef { virSysinfoDef *virSysinfoRead(void); void virSysinfoBIOSDefFree(virSysinfoBIOSDef *def); +G_DEFINE_AUTOPTR_CLEANUP_FUNC(virSysinfoBIOSDef, virSysinfoBIOSDefFree); void virSysinfoSystemDefFree(virSysinfoSystemDef *def); void virSysinfoBaseBoardDefClear(virSysinfoBaseBoardDef *def); void virSysinfoChassisDefFree(virSysinfoChassisDef *def); --=20 2.37.3 From nobody Sat Apr 27 18:55:48 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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.129.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=1667314983; cv=none; d=zohomail.com; s=zohoarc; b=ePZiml25xZQabuEwZu7pQ5B88hJLMZzSaRsT3e//aJb7+axIvWeTmtqDEg0S+B8+/7WHJCbLiDN2D+G06ejg5VJkrWqasdguhxWK2uj/N+KGUDiQbi628iK9/iezfE/bBVF0osS8LecGMmFFbRXLyrTPzIdZhldj3YpnCrvG8JY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1667314983; 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=N3XwJLiwx89fwYHyfAJ+gQtq3IYC5Gd8+NnMmA1wrgg=; b=BohtdP7NujnQsgmln3sEWhNoP03e7XzHqv0NpEet5T0iK4sxOEpOPR7ZtLy9Ayu5gXFJElaTj/5RpYsdnMe6KOr+ovu/dIAhqtICzQ0Un+owYVlHjbeVTWsumc1eAj2sc50lFEaiadCJrWxE7TUqN8aJkZMaOAsZKXjiEX7BE+g= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.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.129.124]) by mx.zohomail.com with SMTPS id 1667314983548600.3259837990496; Tue, 1 Nov 2022 08:03:03 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-661-uJe5CnPlMWyypbk9-qLSbA-1; Tue, 01 Nov 2022 11:02:58 -0400 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 22A3880A0AE; Tue, 1 Nov 2022 15:02:40 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0E026492B18; Tue, 1 Nov 2022 15:02:40 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id D9CE019465B3; Tue, 1 Nov 2022 15:02:39 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 3C2291946A42 for ; Tue, 1 Nov 2022 15:02:39 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 2EB6B2166BC4; Tue, 1 Nov 2022 15:02:39 +0000 (UTC) Received: from speedmetal.redhat.com (ovpn-208-3.brq.redhat.com [10.40.208.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id AC6C72166B2D for ; Tue, 1 Nov 2022 15:02:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1667314981; 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=N3XwJLiwx89fwYHyfAJ+gQtq3IYC5Gd8+NnMmA1wrgg=; b=Ty7sopMSZlMsNTwMMHDEyf9TNXKLPwI5oNgKxz+HNV4whK5l9eLvFobnGg9vcGidBQkeXT svqteG56gij1vHLzTLfExWL+FXmLP4TOuZX52MyhHt/GqMZyKY1CjsWxP2C8UhZZVSUs8B 4sswzPmg4CFxisl6YxR+rTmRIY9SLs4= X-MC-Unique: uJe5CnPlMWyypbk9-qLSbA-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 02/11] conf: domain: Remove pointless XML node name validation in virSysinfoBIOSParseXML Date: Tue, 1 Nov 2022 16:02:16 +0100 Message-Id: <7d94c1640c6aa1b2d9cee7e6042bc7f511b7ba21.1667314911.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 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: 1667314984051100001 Content-Type: text/plain; charset="utf-8" The only caller passes 'node' argument originating from an XPath lookup for the 'bios' element, so there's no point in checking it once more. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/conf/domain_conf.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 15db12876e..eab2e98792 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -12140,12 +12140,6 @@ virSysinfoBIOSParseXML(xmlNodePtr node, ctxt->node =3D node; - if (!virXMLNodeNameEqual(node, "bios")) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("XML does not contain expected 'bios' element")); - return -1; - } - def->vendor =3D virXPathString("string(entry[@name=3D'vendor'])", ctxt= ); def->version =3D virXPathString("string(entry[@name=3D'version'])", ct= xt); def->date =3D virXPathString("string(entry[@name=3D'date'])", ctxt); --=20 2.37.3 From nobody Sat Apr 27 18:55:48 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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.129.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=1667314987; cv=none; d=zohomail.com; s=zohoarc; b=D7PfKcpvh0wzVIj/QKlyfh420XDQzsCz7B19EFGVFvjkdp007zEkJwAosnZzQ7QeUDhOSfIPTqx4fCl44LiCp3zLdhTwdXmHJn4ReciRU/jkaWSZw5ImROM6X4NADdrZVcHhyY1IzgauxODGyvdCjtlGzW/KttfgUYOM2R1pYB0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1667314987; 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=WoH3wWtbWiVqtcabWbWyICQTnEySx5zQtqtfvrKuP44=; b=VJ4iYPAjHx8ejzaFyaiQKyg1gioHJX7cDmzbXuDfPp0FfGq1Y+6kbZVs54V86ukhRqYoVND7JK7eErnAs/C8hAzr5ZHcz9kN5FQGL6LOlzImzLOl0+ozxnv8PaVfEEuGNiN0ntYCvFNSAVZhweMOh0KZQjWfdvD6neqkiByk6xM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.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.129.124]) by mx.zohomail.com with SMTPS id 1667314987938378.78405976673776; Tue, 1 Nov 2022 08:03:07 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-615-2Dw3BEHoMLWaDn5zMF3kxg-1; Tue, 01 Nov 2022 11:03:01 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5802C88B7B5; Tue, 1 Nov 2022 15:02:43 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 43F67C15BB9; Tue, 1 Nov 2022 15:02:43 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 279F919465B3; Tue, 1 Nov 2022 15:02:43 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 243771946594 for ; Tue, 1 Nov 2022 15:02:42 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 1853D2166BB3; Tue, 1 Nov 2022 15:02:42 +0000 (UTC) Received: from speedmetal.redhat.com (ovpn-208-3.brq.redhat.com [10.40.208.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 780D52166B2D for ; Tue, 1 Nov 2022 15:02:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1667314986; 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=WoH3wWtbWiVqtcabWbWyICQTnEySx5zQtqtfvrKuP44=; b=S5AIp2PYHUyrfzaq04HAHB6M7bP3l0j1vRhTq1GN3G9gZtlcCgRBT4CQeQUmvuLfh6hy1L XOm13w0xEl8qtsmoiSN+1fKuQMKAJNUbJVjcMUbryE+g3MYJtOK2gBC47f9vDYoLH0qG/b 8Fsd8QsQNSZwceeyo/e6pmb0+yf1Tlk= X-MC-Unique: 2Dw3BEHoMLWaDn5zMF3kxg-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 03/11] conf: domain: Reformat XPath queries in virSysinfoSystemParseXML Date: Tue, 1 Nov 2022 16:02:17 +0100 Message-Id: <8dd50d34fda4a17502eb986f6b844046da7b1ddf.1667314911.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 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: 1667314990069100003 Content-Type: text/plain; charset="utf-8" Remove the unneeded linebreaks after assignment operator. Only one line exceeds 80 colums and just by 4 characters. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/conf/domain_conf.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index eab2e98792..b0a978cc62 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -12198,14 +12198,10 @@ virSysinfoSystemParseXML(xmlNodePtr node, def =3D g_new0(virSysinfoSystemDef, 1); - def->manufacturer =3D - virXPathString("string(entry[@name=3D'manufacturer'])", ctxt); - def->product =3D - virXPathString("string(entry[@name=3D'product'])", ctxt); - def->version =3D - virXPathString("string(entry[@name=3D'version'])", ctxt); - def->serial =3D - virXPathString("string(entry[@name=3D'serial'])", ctxt); + def->manufacturer =3D virXPathString("string(entry[@name=3D'manufactur= er'])", ctxt); + def->product =3D virXPathString("string(entry[@name=3D'product'])", ct= xt); + def->version =3D virXPathString("string(entry[@name=3D'version'])", ct= xt); + def->serial =3D virXPathString("string(entry[@name=3D'serial'])", ctxt= ); tmpUUID =3D virXPathString("string(entry[@name=3D'uuid'])", ctxt); if (tmpUUID) { unsigned char uuidbuf[VIR_UUID_BUFLEN]; @@ -12232,10 +12228,8 @@ virSysinfoSystemParseXML(xmlNodePtr node, virUUIDFormat(uuidbuf, uuidstr); def->uuid =3D g_strdup(uuidstr); } - def->sku =3D - virXPathString("string(entry[@name=3D'sku'])", ctxt); - def->family =3D - virXPathString("string(entry[@name=3D'family'])", ctxt); + def->sku =3D virXPathString("string(entry[@name=3D'sku'])", ctxt); + def->family =3D virXPathString("string(entry[@name=3D'family'])", ctxt= ); if (!def->manufacturer && !def->product && !def->version && !def->serial && !def->uuid && !def->sku && !def->family) { --=20 2.37.3 From nobody Sat Apr 27 18:55:48 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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.129.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=1667314995; cv=none; d=zohomail.com; s=zohoarc; b=j7WGQosbDMoXFEAoQbJpuoS7E/QBfDQPvRh1ODCaCx8fX6iJlIspR54htFPexdaWBfNpEWA6TiArb7Fuw0dtYvZVlur+0hECa84HSqSqT2f3amTexNwIvP/cmwBlIj8MWvMVCWK5mw4KoekynFyHrhr9eosXjw0dFNdGkzmzojc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1667314995; 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=oiMOPs3b8tjngMab5APUB1Q/DmSGgiC0MUfPTbByzuU=; b=KNACVdVNgoMxt9duABFS/yBBWPxYHcibG6tAYKggGyAw3e0Nfib8689pEh47shy6ZQ1AOS0Tw306oFnKk164VyS3/fqTshfn31NhaP9PxMI3Za54N6jXIasHYYUGbvcf4z46nvBTMnAdW3rUNDdr1kw6eH3N6srSjt4cIwmQCII= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.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.129.124]) by mx.zohomail.com with SMTPS id 1667314995703549.2313242915887; Tue, 1 Nov 2022 08:03:15 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-56-UVaLgegrNESiNRivMUgjQQ-1; Tue, 01 Nov 2022 11:03:03 -0400 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 44405823F74; Tue, 1 Nov 2022 15:02:45 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 30326492B18; Tue, 1 Nov 2022 15:02:45 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 030C619465B3; Tue, 1 Nov 2022 15:02:45 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 9C3E81946594 for ; Tue, 1 Nov 2022 15:02:44 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 8ED412166BB3; Tue, 1 Nov 2022 15:02:44 +0000 (UTC) Received: from speedmetal.redhat.com (ovpn-208-3.brq.redhat.com [10.40.208.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 364792166B2D for ; Tue, 1 Nov 2022 15:02:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1667314992; 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=oiMOPs3b8tjngMab5APUB1Q/DmSGgiC0MUfPTbByzuU=; b=SKTVR5MRxyc2piQpz4rICznlY+TkcNmwikt6KRMbmtHfBTTdhWzhiwC2e9hkOANJfaFlsW X1ZEoXQ7BJu7qoe9apGCaeM36Ruzyis+BSu9LhXPwUKnnyN8cOv0fBOvh4PMv+xBFLnvKB VS4abhk5JN5LXUv6MDXxYRtJfI4hrm4= X-MC-Unique: UVaLgegrNESiNRivMUgjQQ-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 04/11] conf: domain: Refactor cleanup in virSysinfoSystemParseXML Date: Tue, 1 Nov 2022 16:02:18 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 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: 1667314996140100006 Content-Type: text/plain; charset="utf-8" Register automatic cleanup for virSysinfoSystemDef and use it to refactor the cleanup code paths in virSysinfoSystemParseXML. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/conf/domain_conf.c | 24 ++++++++---------------- src/util/virsysinfo.h | 1 + 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index b0a978cc62..8e9f415070 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -12184,8 +12184,7 @@ virSysinfoSystemParseXML(xmlNodePtr node, bool uuid_generated) { VIR_XPATH_NODE_AUTORESTORE(ctxt) - int ret =3D -1; - virSysinfoSystemDef *def; + g_autoptr(virSysinfoSystemDef) def =3D g_new0(virSysinfoSystemDef, 1); g_autofree char *tmpUUID =3D NULL; ctxt->node =3D node; @@ -12193,11 +12192,9 @@ virSysinfoSystemParseXML(xmlNodePtr node, if (!virXMLNodeNameEqual(node, "system")) { virReportError(VIR_ERR_XML_ERROR, "%s", _("XML does not contain expected 'system' element")= ); - return ret; + return -1; } - def =3D g_new0(virSysinfoSystemDef, 1); - def->manufacturer =3D virXPathString("string(entry[@name=3D'manufactur= er'])", ctxt); def->product =3D virXPathString("string(entry[@name=3D'product'])", ct= xt); def->version =3D virXPathString("string(entry[@name=3D'version'])", ct= xt); @@ -12209,15 +12206,14 @@ virSysinfoSystemParseXML(xmlNodePtr node, if (virUUIDParse(tmpUUID, uuidbuf) < 0) { virReportError(VIR_ERR_XML_DETAIL, "%s", _("malformed uuid element")); - goto cleanup; + return -1; } if (uuid_generated) { memcpy(domUUID, uuidbuf, VIR_UUID_BUFLEN); } else if (memcmp(domUUID, uuidbuf, VIR_UUID_BUFLEN) !=3D 0) { virReportError(VIR_ERR_XML_DETAIL, "%s", - _("UUID mismatch between and " - "")); - goto cleanup; + _("UUID mismatch between and ")= ); + return -1; } /* Although we've validated the UUID as good, virUUIDParse() is * lax with respect to allowing extraneous "-" and " ", but the @@ -12232,15 +12228,11 @@ virSysinfoSystemParseXML(xmlNodePtr node, def->family =3D virXPathString("string(entry[@name=3D'family'])", ctxt= ); if (!def->manufacturer && !def->product && !def->version && - !def->serial && !def->uuid && !def->sku && !def->family) { - g_clear_pointer(&def, virSysinfoSystemDefFree); - } + !def->serial && !def->uuid && !def->sku && !def->family) + return 0; *sysdef =3D g_steal_pointer(&def); - ret =3D 0; - cleanup: - virSysinfoSystemDefFree(def); - return ret; + return 0; } static int diff --git a/src/util/virsysinfo.h b/src/util/virsysinfo.h index 899193dc81..d9f15b06e2 100644 --- a/src/util/virsysinfo.h +++ b/src/util/virsysinfo.h @@ -144,6 +144,7 @@ virSysinfoDef *virSysinfoRead(void); void virSysinfoBIOSDefFree(virSysinfoBIOSDef *def); G_DEFINE_AUTOPTR_CLEANUP_FUNC(virSysinfoBIOSDef, virSysinfoBIOSDefFree); void virSysinfoSystemDefFree(virSysinfoSystemDef *def); +G_DEFINE_AUTOPTR_CLEANUP_FUNC(virSysinfoSystemDef, virSysinfoSystemDefFree= ); void virSysinfoBaseBoardDefClear(virSysinfoBaseBoardDef *def); void virSysinfoChassisDefFree(virSysinfoChassisDef *def); void virSysinfoOEMStringsDefFree(virSysinfoOEMStringsDef *def); --=20 2.37.3 From nobody Sat Apr 27 18:55:48 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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.129.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=1667314987; cv=none; d=zohomail.com; s=zohoarc; b=mGKZ03akGemE99m2SJSiWtRNY3WdWjP/nmxknwVzgjmqiYDuKQksZH8sbjMUSiXF0VHwRT5benmYuRENpAjZ237x+qwNG/ip8NgnwBI5mNKwfSONsBhmCrxPlli1BMb/HXbpF3ydn4ekx1NQjPzW/+APl1NVSQybczmmN4RpRns= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1667314987; 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=C1amr0YcJP0umo/BkxnSYO2fSywR6nzX40XYbDRzR2k=; b=OyeOJhlTkElOV7GqY1HvH9AuFj7cgyviVMFmmSbBsdJIWdcN/xsY5TFnhHpnkkQ28U+jA88cu9RWRQ+Ax/dl6M8mgGT0B18QBn4UOCPl4bgmTQiD/7aByk2eoo66HqHOh7JUZIgvilKA0peGHxoLbjIVMaUK08Atg1HIiDSWUVA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.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.129.124]) by mx.zohomail.com with SMTPS id 1667314987753897.2101375918238; Tue, 1 Nov 2022 08:03:07 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-53-s7YZoVgoNbOpQ8naV0dypw-1; Tue, 01 Nov 2022 11:03:02 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 69D5588F471; Tue, 1 Nov 2022 15:02:47 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5342640C2140; Tue, 1 Nov 2022 15:02:47 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 43FDF19465B3; Tue, 1 Nov 2022 15:02:47 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 80E8B19465B3 for ; Tue, 1 Nov 2022 15:02:46 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 62A062166BB3; Tue, 1 Nov 2022 15:02:46 +0000 (UTC) Received: from speedmetal.redhat.com (ovpn-208-3.brq.redhat.com [10.40.208.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0F1F32166B2D for ; Tue, 1 Nov 2022 15:02:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1667314986; 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=C1amr0YcJP0umo/BkxnSYO2fSywR6nzX40XYbDRzR2k=; b=GfcT6UC7KtlXnAXabCD0JG5J67LgxGKCizt4IbxjcZ+yaklsri+03RgCSPPYTxU4UgPfZG WtOhLJjGRRAWsMYfSUBjmu6UEZUNmVtWYgqSZom+o052hmzb7i2gg2uuDhhJeOWODtpaIG zIiJKCwMHtPP0aCEImbQlpAq/q4XGfA= X-MC-Unique: s7YZoVgoNbOpQ8naV0dypw-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 05/11] conf: domain: Remove pointless XML node name validation in virSysinfoSystemParseXML Date: Tue, 1 Nov 2022 16:02:19 +0100 Message-Id: <3a6654b8120047d914f7eac58a4179fb18151ced.1667314911.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 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: 1667314988064100001 Content-Type: text/plain; charset="utf-8" The only caller passes 'node' argument originating from an XPath lookup for the 'system' element, so there's no point in checking it once more. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/conf/domain_conf.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 8e9f415070..d9b77eddb4 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -12189,12 +12189,6 @@ virSysinfoSystemParseXML(xmlNodePtr node, ctxt->node =3D node; - if (!virXMLNodeNameEqual(node, "system")) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("XML does not contain expected 'system' element")= ); - return -1; - } - def->manufacturer =3D virXPathString("string(entry[@name=3D'manufactur= er'])", ctxt); def->product =3D virXPathString("string(entry[@name=3D'product'])", ct= xt); def->version =3D virXPathString("string(entry[@name=3D'version'])", ct= xt); --=20 2.37.3 From nobody Sat Apr 27 18:55:48 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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.129.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=1667315001; cv=none; d=zohomail.com; s=zohoarc; b=gVOO/wIWyONANsXWyqjH1Udd7kpNfF9Chp+tTMQ7qRanZJJP2MluFWcMnA36p3G2AOMS47Gcoy6WtGKhs/9mVMrAtfILPQgkM5bYFauYwOwFxz5LWWfbtryQnfApxwa/uS0UBxo5bwlZUEnlchfER5wnPIsVqFajmwT5tyU0jc4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1667315001; 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=W54tOgx8JhBcc1jjlO4oXMmx+Q66GrXAtWhVxstX1do=; b=Jwmk4XdFEAmNU/j+5dk3u3+Sk+/C3jBUHrs/ZqikYOUfLgSqHifHX7BK/gWvXzAEppnbWv/w7+B9oS24idcAKVJlHip7dZaTBUoA3dcO9RolVeknp+oLGoAocV9LMGTNQ0QEHG0THkLsZ7dsqH48KAEb/h/C7Rozh+HdQrPgZA4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.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.129.124]) by mx.zohomail.com with SMTPS id 1667315001826244.29867581969654; Tue, 1 Nov 2022 08:03:21 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-619-5s3J0WY8Pr6b7hwzUD6LbA-1; Tue, 01 Nov 2022 11:03:08 -0400 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id BC5888060A1; Tue, 1 Nov 2022 15:02:52 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id A623E492B18; Tue, 1 Nov 2022 15:02:52 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 884001946A42; Tue, 1 Nov 2022 15:02:52 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id D1B551946594 for ; Tue, 1 Nov 2022 15:02:50 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id B69B62166BB3; Tue, 1 Nov 2022 15:02:50 +0000 (UTC) Received: from speedmetal.redhat.com (ovpn-208-3.brq.redhat.com [10.40.208.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 22A222166B2D for ; Tue, 1 Nov 2022 15:02:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1667314999; 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=W54tOgx8JhBcc1jjlO4oXMmx+Q66GrXAtWhVxstX1do=; b=I40RcyPZNml03WAFRPhy1TYtHnk41q/wxSBEFnpv2AQiRF26rhte12XxkTx4WDRzVNWj+b pQesOnYsAFPLtZ7i+HJOhcKncyHtkcPikTByVUTUv+4OKvRNaXIhMlsXm1TPf3ewAsmi0s YOe/f2d5/pdRTH40VOW1uEDhO4YecVw= X-MC-Unique: 5s3J0WY8Pr6b7hwzUD6LbA-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 06/11] conf: domain: Reformat XPath queries in virSysinfoChassisParseXML Date: Tue, 1 Nov 2022 16:02:20 +0100 Message-Id: <4058fd948a7d289462e0f2ad80b1e4f2e230d015.1667314911.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 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: 1667315004143100001 Content-Type: text/plain; charset="utf-8" Remove the unneeded linebreaks after assignment operator. Only one line exceeds 80 colums and just by 4 characters. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/conf/domain_conf.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index d9b77eddb4..90478f2528 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -12336,16 +12336,11 @@ virSysinfoChassisParseXML(xmlNodePtr node, def =3D g_new0(virSysinfoChassisDef, 1); - def->manufacturer =3D - virXPathString("string(entry[@name=3D'manufacturer'])", ctxt); - def->version =3D - virXPathString("string(entry[@name=3D'version'])", ctxt); - def->serial =3D - virXPathString("string(entry[@name=3D'serial'])", ctxt); - def->asset =3D - virXPathString("string(entry[@name=3D'asset'])", ctxt); - def->sku =3D - virXPathString("string(entry[@name=3D'sku'])", ctxt); + def->manufacturer =3D virXPathString("string(entry[@name=3D'manufactur= er'])", ctxt); + def->version =3D virXPathString("string(entry[@name=3D'version'])", ct= xt); + def->serial =3D virXPathString("string(entry[@name=3D'serial'])", ctxt= ); + def->asset =3D virXPathString("string(entry[@name=3D'asset'])", ctxt); + def->sku =3D virXPathString("string(entry[@name=3D'sku'])", ctxt); if (!def->manufacturer && !def->version && !def->serial && !def->asset && !def->sku) { --=20 2.37.3 From nobody Sat Apr 27 18:55:48 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=1667314991; cv=none; d=zohomail.com; s=zohoarc; b=mK8j1Pf5ba16W4W4DcDKx9oMCCVkuwYXozafrYlSSctN6hLmARr/d+d8+IW7uT3y1xQUsDnJGllb3vbydO2CpFpFX7QZ1Kb+O8NWd02mzVqSfnp3lWgPObTHqLnmnqtN06VD8oVwYrKqpOisZGQdUwwnQfSdiJD/+Rj/QnGMTUk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1667314991; 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=dVb/lck+teYa0EoMT76hA8kF+HUmfkAcOhBgUffRMyU=; b=UsstVPN2kp9SlFAJYVvDi0WVStrzMebHzKz1rfkl21GwMIK4ao84cssYtt8oZTd/who57WAo0Yvvgb2o95e9j54jYsYdf7XLUZAxdmiFbhCnHDGzwgi5DDjArVQKktNJi07h6F4Ey/hMyV8uga6KEVX6o/zyAJ3dBWRwfeGbXhc= 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 1667314991699172.1779009240314; Tue, 1 Nov 2022 08:03:11 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-526-06wc0fHaN8iuKE-LY1nU5A-1; Tue, 01 Nov 2022 11:03:03 -0400 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id EB8D9185A7AF; Tue, 1 Nov 2022 15:02:53 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id D782B492B18; Tue, 1 Nov 2022 15:02:53 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id C4F5019465B3; Tue, 1 Nov 2022 15:02:53 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 7C6E51946594 for ; Tue, 1 Nov 2022 15:02:52 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 606F52166BB3; Tue, 1 Nov 2022 15:02:52 +0000 (UTC) Received: from speedmetal.redhat.com (ovpn-208-3.brq.redhat.com [10.40.208.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 42E262166B2D for ; Tue, 1 Nov 2022 15:02:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1667314987; 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=dVb/lck+teYa0EoMT76hA8kF+HUmfkAcOhBgUffRMyU=; b=foUgYqQSBPt0yL2Nng8QI583n6VzGRq8cjvyA5ut6wo0DjhoxLha5cyWl+oHWkZZIawTi7 h7/PJdh+P1o00JKS9qm0uEencKj6NoKcwK85tSX7uECiEZnz7L1scKssBgshEueWBYV0c8 UIwycuzhPJia4m5hh4m2Vfg1Ydoe+NI= X-MC-Unique: 06wc0fHaN8iuKE-LY1nU5A-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 07/11] conf: domain: Refactor cleanup in virSysinfoChassisParseXML Date: Tue, 1 Nov 2022 16:02:21 +0100 Message-Id: <4a5b28ed13bdb8b19eaa08237963270460dcd71a.1667314911.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 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: 1667314994129100002 Content-Type: text/plain; charset="utf-8" Register automatic cleanup for virSysinfoChassisDef and use it to refactor the cleanup code paths in virSysinfoChassisParseXML. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/conf/domain_conf.c | 16 +++++----------- src/util/virsysinfo.h | 1 + 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 90478f2528..e10b4d72f8 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -12323,19 +12323,16 @@ virSysinfoChassisParseXML(xmlNodePtr node, virSysinfoChassisDef **chassisdef) { VIR_XPATH_NODE_AUTORESTORE(ctxt) - int ret =3D -1; - virSysinfoChassisDef *def; + g_autoptr(virSysinfoChassisDef) def =3D g_new0(virSysinfoChassisDef, 1= ); ctxt->node =3D node; if (!xmlStrEqual(node->name, BAD_CAST "chassis")) { virReportError(VIR_ERR_XML_ERROR, "%s", _("XML does not contain expected 'chassis' element"= )); - return ret; + return -1; } - def =3D g_new0(virSysinfoChassisDef, 1); - def->manufacturer =3D virXPathString("string(entry[@name=3D'manufactur= er'])", ctxt); def->version =3D virXPathString("string(entry[@name=3D'version'])", ct= xt); def->serial =3D virXPathString("string(entry[@name=3D'serial'])", ctxt= ); @@ -12343,14 +12340,11 @@ virSysinfoChassisParseXML(xmlNodePtr node, def->sku =3D virXPathString("string(entry[@name=3D'sku'])", ctxt); if (!def->manufacturer && !def->version && - !def->serial && !def->asset && !def->sku) { - g_clear_pointer(&def, virSysinfoChassisDefFree); - } + !def->serial && !def->asset && !def->sku) + return 0; *chassisdef =3D g_steal_pointer(&def); - ret =3D 0; - virSysinfoChassisDefFree(def); - return ret; + return 0; } diff --git a/src/util/virsysinfo.h b/src/util/virsysinfo.h index d9f15b06e2..5fa91d9611 100644 --- a/src/util/virsysinfo.h +++ b/src/util/virsysinfo.h @@ -147,6 +147,7 @@ void virSysinfoSystemDefFree(virSysinfoSystemDef *def); G_DEFINE_AUTOPTR_CLEANUP_FUNC(virSysinfoSystemDef, virSysinfoSystemDefFree= ); void virSysinfoBaseBoardDefClear(virSysinfoBaseBoardDef *def); void virSysinfoChassisDefFree(virSysinfoChassisDef *def); +G_DEFINE_AUTOPTR_CLEANUP_FUNC(virSysinfoChassisDef, virSysinfoChassisDefFr= ee); void virSysinfoOEMStringsDefFree(virSysinfoOEMStringsDef *def); void virSysinfoDefFree(virSysinfoDef *def); --=20 2.37.3 From nobody Sat Apr 27 18:55:48 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=1667315051; cv=none; d=zohomail.com; s=zohoarc; b=ILMCkjEFY5zGZ5+3pP8VnqQnuxzTd3QoXQQ9c6R9Vcce3OunKiXJaD2EVPC224M5xvYOWMvIInIYHrS8P5mIvtVkfTyXsgC6A+S5R7bBxLkyEXeA8kG6xBKzhvG6I4UO2YMnunHHd+4H8zRAGWP/wb/4zIOHQgNsgnoifwC2tV8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1667315051; 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=+tpwhTNaAc5SvbhVT5y4VAkKY7BNuh4alltDTQBdUA0=; b=JBLQHbaTp6CT3qGSxeAHLvWo/mLy+PFt6r4sEQ7a8+cR7UCJCoOl2gTwSH+sCUSbOyccuY7Qf3hR7zy2gKLeQEFjiRqMPUkBq96XWoT8xowSh5bH12pZuaIxOeF6TvaSLJ9kHUNjlkcEA2l10OM7w3G770pyiKgrS0WUG2yjkG4= 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 1667315051722450.99574456593393; Tue, 1 Nov 2022 08:04:11 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-510-YmYMtWCsMxuTV0OFyEAdsA-1; Tue, 01 Nov 2022 11:03:07 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A6A7E823F09; Tue, 1 Nov 2022 15:02:56 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 942991731B; Tue, 1 Nov 2022 15:02:56 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 8219519465B3; Tue, 1 Nov 2022 15:02:56 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 0BE1B1946594 for ; Tue, 1 Nov 2022 15:02:55 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id F2CCF2166BB3; Tue, 1 Nov 2022 15:02:54 +0000 (UTC) Received: from speedmetal.redhat.com (ovpn-208-3.brq.redhat.com [10.40.208.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4F7322166B2D for ; Tue, 1 Nov 2022 15:02:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1667315050; 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=+tpwhTNaAc5SvbhVT5y4VAkKY7BNuh4alltDTQBdUA0=; b=jUfLbzU0AmyD/aLMQhrBqcVsxrukQ36og019FQ/dUfBqDxeZja9syKB7Kqa70LhtbSJHEj unIhrAe7f7ml5+Dye0AYiO5dXoDRfScX8U6K+GwLnto2yb4ocu+3hLT1BCTa6AKw0ZH0mX nP2W9m6y+bu2HmI2eSBmCggKcAgVdQ4= X-MC-Unique: YmYMtWCsMxuTV0OFyEAdsA-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 08/11] conf: domain: Remove pointless XML node name validation in virSysinfoChassisParseXML Date: Tue, 1 Nov 2022 16:02:22 +0100 Message-Id: <7f7e233d2873b363dce7cc5ca7131bb31f29d5c6.1667314911.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 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: 1667315052500100003 Content-Type: text/plain; charset="utf-8" The only caller passes 'node' argument originating from an XPath lookup for the 'chassis' element, so there's no point in checking it once more. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/conf/domain_conf.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index e10b4d72f8..6379cfda7c 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -12327,12 +12327,6 @@ virSysinfoChassisParseXML(xmlNodePtr node, ctxt->node =3D node; - if (!xmlStrEqual(node->name, BAD_CAST "chassis")) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("XML does not contain expected 'chassis' element"= )); - return -1; - } - def->manufacturer =3D virXPathString("string(entry[@name=3D'manufactur= er'])", ctxt); def->version =3D virXPathString("string(entry[@name=3D'version'])", ct= xt); def->serial =3D virXPathString("string(entry[@name=3D'serial'])", ctxt= ); --=20 2.37.3 From nobody Sat Apr 27 18:55:48 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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.129.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=1667315065; cv=none; d=zohomail.com; s=zohoarc; b=UrP3SlO0kOvvlczdHv5XzGiOE4/TRwi2fBEJ0FGnZh5Nlc2KoVP52EElHDeyANAnSA2U/WNMS9YhThUUfzIPSzn57zOGQfkVb+6sA1R3HNyC5zRJ/ClUzAtfXbSusUKEQVyPy1N3ZMfmgsOQTZWL+DM4avPaAt/ZBTvoxojzh5k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1667315065; 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=UTaH5Nx/ZIbXqG+TN037UKzzvzTTW5UDwfX5WkwvU1w=; b=UdZVK9kADmbm+ijLfakt5oDuPPLa7/iIYURXO0LHeA20C6TcXG3MXM8sCULy/JQIjGyLPNHG5rr8CZKX3GHFoNwe9y8UcZb3gSjJ6iA0GhB6nXKlHjqGzg0ZC0ev1caWDO2vVYy9MXAkPbxQtL7TbY7JlAO6n356u9l28T2qSBM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.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.129.124]) by mx.zohomail.com with SMTPS id 166731506536279.23259269627533; Tue, 1 Nov 2022 08:04:25 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-335-4Km9cjDwO_S7Cu5qgZ9y2Q-1; Tue, 01 Nov 2022 11:03:58 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3899928037D4; Tue, 1 Nov 2022 15:03:01 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2231240C83EC; Tue, 1 Nov 2022 15:03:01 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 1313E19465B3; Tue, 1 Nov 2022 15:03:01 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 287451946594 for ; Tue, 1 Nov 2022 15:03:00 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 1C2162166BB3; Tue, 1 Nov 2022 15:03:00 +0000 (UTC) Received: from speedmetal.redhat.com (ovpn-208-3.brq.redhat.com [10.40.208.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8089B2166B2D for ; Tue, 1 Nov 2022 15:02:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1667315063; 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=UTaH5Nx/ZIbXqG+TN037UKzzvzTTW5UDwfX5WkwvU1w=; b=EegJvK3MOjikP9ZYqkRW8DXwtxuhCdd1l3OB699RQEtCgHbWcPFopQ2xPI55RL9LMOKuKU kdlv11WVcbU4MMhQ4L/37+HbDcjnl/pUuH5VKiZSIAYAdF0g2oUxFvi7sklyK5rqatlcMB qojaGSM6j+57zUP2dosN2D/7g8JzqF8= X-MC-Unique: 4Km9cjDwO_S7Cu5qgZ9y2Q-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 09/11] conf: domain: Parse 'type' attribute via virXMLPropEnum in virSysinfoParseXML Date: Tue, 1 Nov 2022 16:02:23 +0100 Message-Id: <108adef1c89a3c74f27fc22ce7709be95e1ad4f4.1667314911.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 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: 1667315066584100001 Content-Type: text/plain; charset="utf-8" Rewrite the code to use the simple helper. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/conf/domain_conf.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 6379cfda7c..b9494500e2 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -12451,8 +12451,6 @@ virSysinfoParseXML(xmlNodePtr node, { VIR_XPATH_NODE_AUTORESTORE(ctxt) virSysinfoDef *def; - g_autofree char *typeStr =3D NULL; - int type; ctxt->node =3D node; @@ -12464,18 +12462,9 @@ virSysinfoParseXML(xmlNodePtr node, def =3D g_new0(virSysinfoDef, 1); - typeStr =3D virXMLPropString(node, "type"); - if (typeStr =3D=3D NULL) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("sysinfo must contain a type attribute")); - goto error; - } - if ((type =3D virSysinfoTypeFromString(typeStr)) < 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unknown sysinfo type '%s'"), typeStr); + if (virXMLPropEnum(node, "type", virSysinfoTypeFromString, + VIR_XML_PROP_REQUIRED, &def->type) < 0) goto error; - } - def->type =3D type; switch (def->type) { case VIR_SYSINFO_SMBIOS: --=20 2.37.3 From nobody Sat Apr 27 18:55:48 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=1667314993; cv=none; d=zohomail.com; s=zohoarc; b=KJAVKZ5iGUhy+ZsiKcKa7l5qF9IbQDcCxro1H8PY+wKKHbPQCm+tEQuts0o8J83JM1rvxqej/7oSDm9v2D3AlG94bzhrVJ+KQ+735rDZVB9FwIhpKJaXjPCtZUH8G5ckDWZXwcEVXQavnf+szSy6/c1crsd7uHCEGJJrsScrigE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1667314993; 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=m5JL/nU1kUs9gCxZlqdqBE2TNXq/+XjKWXXIgx0Hwak=; b=nEVWgzq6caaBgPtLHyv2twPTt3X+Q7UeIDKeb8nXVwL/JuEtsAnQ7gg7GbdIiu0K1kj1S+z3VPpd2NoyXlZ2aTE4fAGQNk0ceD1kwguUyTep4nPxyNuTLMZXCtPRGqCgIwyjQ+SXE5Lv4LBQZm/KLBgYGJLEEhqv0m6nGCMByOU= 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 1667314993774223.8248610549108; Tue, 1 Nov 2022 08:03:13 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-138-8h5B8pUyO0CwvHkFsAJ5JQ-1; Tue, 01 Nov 2022 11:03:08 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E6417101E153; Tue, 1 Nov 2022 15:03:03 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id CE0924B400F; Tue, 1 Nov 2022 15:03:03 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id BF42719465B3; Tue, 1 Nov 2022 15:03:03 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 812E41946594 for ; Tue, 1 Nov 2022 15:03:03 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 65EC82166B2D; Tue, 1 Nov 2022 15:03:03 +0000 (UTC) Received: from speedmetal.redhat.com (ovpn-208-3.brq.redhat.com [10.40.208.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id AF8C32166BB6 for ; Tue, 1 Nov 2022 15:03:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1667314991; 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=m5JL/nU1kUs9gCxZlqdqBE2TNXq/+XjKWXXIgx0Hwak=; b=SKwzDm7uduSUD76TbjR1iegjvAi6dnH2Yw/xPHrHqp9PoGmPnnkaSsTiXOKITDzj8CL92c FgzNgIct2Da708/Ee07mo3U8UYJc5zFmXA7ytT+e2pIInZ0q7xJ3z3WkOmAyvGN2dtO3BL qgqFwDWmAZUReZhmyoL9wY5HQfrCqNU= X-MC-Unique: 8h5B8pUyO0CwvHkFsAJ5JQ-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 10/11] conf: domain: Refactor cleanup in virSysinfoParseXML Date: Tue, 1 Nov 2022 16:02:24 +0100 Message-Id: <3e05e88ac14aa2592ae60fbc86db762b489a327a.1667314911.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 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: 1667314994129100001 Content-Type: text/plain; charset="utf-8" Use automatic pointer freeing to remove the 'error' label. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/conf/domain_conf.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index b9494500e2..71997e586a 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -12450,7 +12450,7 @@ virSysinfoParseXML(xmlNodePtr node, bool uuid_generated) { VIR_XPATH_NODE_AUTORESTORE(ctxt) - virSysinfoDef *def; + g_autoptr(virSysinfoDef) def =3D g_new0(virSysinfoDef, 1); ctxt->node =3D node; @@ -12460,32 +12460,26 @@ virSysinfoParseXML(xmlNodePtr node, return NULL; } - def =3D g_new0(virSysinfoDef, 1); - if (virXMLPropEnum(node, "type", virSysinfoTypeFromString, VIR_XML_PROP_REQUIRED, &def->type) < 0) - goto error; + return NULL; switch (def->type) { case VIR_SYSINFO_SMBIOS: if (virSysinfoParseSMBIOSDef(def, ctxt, domUUID, uuid_generated) <= 0) - goto error; + return NULL; break; case VIR_SYSINFO_FWCFG: if (virSysinfoParseFWCfgDef(def, node, ctxt) < 0) - goto error; + return NULL; break; case VIR_SYSINFO_LAST: break; } - return def; - - error: - virSysinfoDefFree(def); - return NULL; + return g_steal_pointer(&def); } unsigned int --=20 2.37.3 From nobody Sat Apr 27 18:55:48 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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.129.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=1667314995; cv=none; d=zohomail.com; s=zohoarc; b=V6ksXjo4q7CXIWxCx1FNfQ3K911CViP/h6oeRmYXUZnK1uqnQSQ9db/AzcbXB+/+FSoWwO5pUqBnGLsxQ7WwZRfXeYbC+KrO/xDd+CzvV2OMWBToMziutubKEvs9LvvHDfUTJUTdPeYUKLmNZ/CC8RbqbUVJrD8/wI3eQ/vJkpI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1667314995; 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=1dslvHjKcDJbXUA/QdFxHq+dCz6aF09SZldp66OSkLA=; b=PRJO0keOBeV1BnqMbgWhEVe5oaHf0xJVqckItoMXiP5r5MIKr78p85n1i/hWfUeXkJeo+iuY/+YKN9tsbeZXsvPMqcjQ+01gqn7JmD8aHR8nhkqsQAK2c4Bk/I4GC4az/g8TyI2DQnYMC8Ja7GeOADyXDAgc5B8rCiSjpYFy8+M= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.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.129.124]) by mx.zohomail.com with SMTPS id 1667314995399476.5584375125901; Tue, 1 Nov 2022 08:03:15 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-113-Q8WJ8teCN1STmXONzZVo6Q-1; Tue, 01 Nov 2022 11:03:11 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 802EF87B2A3; Tue, 1 Nov 2022 15:03:06 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6AB724EA5D; Tue, 1 Nov 2022 15:03:06 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 57F5819465B3; Tue, 1 Nov 2022 15:03:06 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 0D32919465B3 for ; Tue, 1 Nov 2022 15:03:05 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 01F9D2166BB3; Tue, 1 Nov 2022 15:03:05 +0000 (UTC) Received: from speedmetal.redhat.com (ovpn-208-3.brq.redhat.com [10.40.208.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0236D2166B2D for ; Tue, 1 Nov 2022 15:03:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1667314994; 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=1dslvHjKcDJbXUA/QdFxHq+dCz6aF09SZldp66OSkLA=; b=FxuzvH6mFN9ehXiDAz+eiYu3CJicj8/dQI2CA48OzEcLYSsNNW94qrlY8RUX7dOsMpCgvH mnq3fiCeHuEAi2+FFCS4CrhBKKibeW/zvCqtfY8SJgfFuzXISuban9dtX39N3uKan/04KY jGfnY1W/0oq9A4t9suA3OqVf+mMCRp0= X-MC-Unique: Q8WJ8teCN1STmXONzZVo6Q-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 11/11] conf: domain: Remove pointless XML node name validation in virSysinfoParseXML Date: Tue, 1 Nov 2022 16:02:25 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 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: 1667314996113100005 Content-Type: text/plain; charset="utf-8" The only caller passes 'node' argument originating from an XPath lookup for the 'sysinfo' element, so there's no point in checking it once more. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/conf/domain_conf.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 71997e586a..65f8ad20c9 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -12454,12 +12454,6 @@ virSysinfoParseXML(xmlNodePtr node, ctxt->node =3D node; - if (!virXMLNodeNameEqual(node, "sysinfo")) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("XML does not contain expected 'sysinfo' element"= )); - return NULL; - } - if (virXMLPropEnum(node, "type", virSysinfoTypeFromString, VIR_XML_PROP_REQUIRED, &def->type) < 0) return NULL; --=20 2.37.3