From nobody Mon Feb 9 17:22:50 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1649405464; cv=none; d=zohomail.com; s=zohoarc; b=HCxf0VfDEeEytQ0GhW2KeDFsJCoAEdySEYiYUb44tYciOISH5Cadw/3jw4H4bQ13bjr4qo+UzIQZALTKvZMtXo6dV+75tSWkRP1EeHZG0BKpBUiIHQGBR9xm5SzSBxd7iAxZa9o0qUoOUH5aI5I8X6csXuDXWnrKIeeAeZCi5uE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1649405464; 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=dTBiB3Xxtt6wzwAkQ9JjZ3bipI3FLfV3FEthhL5oSJw=; b=FofKYnirS40mBMsJm9u9ORJX8HF7KS1aCVYZq25DvP4iy8fWELmTRu7BuQ2bs06wfA1W1USAv5EvlAPG+5nP0xpzI4B2xUEhgAJYvnA29owTdgHXwLBDtDeWZLvLgyw02/1bnlnqS3buGwZ37XOItd8eJ6wssrIRJ1Khl6D9RdA= 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 1649405464112801.7599544550129; Fri, 8 Apr 2022 01:11:04 -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-658-iEGwvZb5MfijNrMwGXGaUw-1; Fri, 08 Apr 2022 04:10:57 -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 4CE108339A4; Fri, 8 Apr 2022 08:10:53 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 31604407C943; Fri, 8 Apr 2022 08:10: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 F26851940341; Fri, 8 Apr 2022 08:10:52 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 1BE8D1940340 for ; Fri, 8 Apr 2022 08:10:52 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 0DFB7401D25; Fri, 8 Apr 2022 08:10:52 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.180]) by smtp.corp.redhat.com (Postfix) with ESMTP id AA0DC54ACBC for ; Fri, 8 Apr 2022 08:10:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1649405463; 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=dTBiB3Xxtt6wzwAkQ9JjZ3bipI3FLfV3FEthhL5oSJw=; b=SbU9xEunKHQivpUgG0dM9cAEX3CUhTbNj/Plcnot2b9gI16Juk0jtHxdI40Douq0VM8WAY 3qmFnWjMPhkS4DST53xygSl1E2FA4GAYQ5pUTbhDD+hHreW2VRz0fp7bic//2lU6chNqP8 Bf18I8FBAHwzyrS5LYb56I0H2adUZtw= X-MC-Unique: iEGwvZb5MfijNrMwGXGaUw-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 08/17] virDomainDiskSourceNVMeParse: Switch to virXMLPropEnumDefault() Date: Fri, 8 Apr 2022 10:08:47 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.9 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 2.84 on 10.11.54.1 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) X-ZM-MESSAGEID: 1649405464549100003 Content-Type: text/plain; charset="utf-8"; x-default="true" The virDomainDiskSourceNVMeParse() function uses old style of parsing XML (virXMLPropString + str2enum conversion). Use virXMLPropEnumDefault() which encapsulates those steps. Signed-off-by: Michal Privoznik --- src/conf/domain_conf.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index bdf0ae06a8..e348748062 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -8369,7 +8369,6 @@ virDomainDiskSourceNVMeParse(xmlNodePtr node, { g_autoptr(virStorageSourceNVMeDef) nvme =3D NULL; g_autofree char *type =3D NULL; - g_autofree char *namespc =3D NULL; xmlNodePtr address; =20 nvme =3D g_new0(virStorageSourceNVMeDef, 1); @@ -8387,18 +8386,10 @@ virDomainDiskSourceNVMeParse(xmlNodePtr node, return -1; } =20 - if (!(namespc =3D virXMLPropString(node, "namespace"))) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("missing 'namespace' attribute to disk source")); + if (virXMLPropULongLong(node, "namespace", 10, + VIR_XML_PROP_REQUIRED, + &nvme->namespc) < 0) return -1; - } - - if (virStrToLong_ull(namespc, NULL, 10, &nvme->namespc) < 0) { - virReportError(VIR_ERR_XML_ERROR, - _("malformed namespace '%s'"), - namespc); - return -1; - } =20 if (virXMLPropTristateBool(node, "managed", VIR_XML_PROP_NONE, &nvme->managed) < 0) --=20 2.35.1