From nobody Mon Feb 9 19:25: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=1653311355; cv=none; d=zohomail.com; s=zohoarc; b=helLImHbI2IqnELBBdJcZQYGdQCqQwN8oObxAi1EL68w2Cs7pGhaVURd0VZtftprvbI4BtttIexwVgWbFlOkwND22YS1NkNJ0gaUFwDGT0k8+tWj24Bc8F4sdLw0WwdOAFK2oR5dMPkzgXHPeFZ/pRv/mAHO8x7HUcU0OyCxo90= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1653311355; 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=cnjV9kgJEPjDW/iFM/8o9YxrQCZgXAYq3Xys9ibrM9o=; b=GE9s8EBlYYKJaLSPppfCOnNoIiCYpw+R9DxfXZCHUW0RZSTKwvs4bQ/FB0vkLv4u2cJ1sm4TbCGmWcbh84gLf2Ik0naCGsEVcmss65xdmkqLpydlHw4VzSn5rZ3RNOP+KI+BMXCp4eK5o4xLE5s6uHEw24U8euC32R0r2Nu10vs= 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 1653311355348115.03291443952412; Mon, 23 May 2022 06:09: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-546-h-nMRAEsNJCpTSrvW3sRIQ-1; Mon, 23 May 2022 09:09:12 -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 531561044560; Mon, 23 May 2022 13:09:01 +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 3F6BC492C14; Mon, 23 May 2022 13:09: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 D07191947073; Mon, 23 May 2022 13:09:00 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 783EA1947071 for ; Mon, 23 May 2022 13:09:00 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 66D68400E115; Mon, 23 May 2022 13:09:00 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.180]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0E6CB40D1B98 for ; Mon, 23 May 2022 13:08:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1653311354; 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=cnjV9kgJEPjDW/iFM/8o9YxrQCZgXAYq3Xys9ibrM9o=; b=NXYq3PX50UrfIB2gCBaP9rPlmlzGYufix+lyWoTUIrsFwp6WZ0Aj9UMUr7YU2twoQPPRrl TjJVZEl1LjY2kquY2xJAsi4YhXN3MxfFGFYRC3XtjtkPDACyA/pVtoEKIOuhc8nkHGwde7 EQrlJDErjVH7PUiGk4FokdDw/9ZbyrY= X-MC-Unique: h-nMRAEsNJCpTSrvW3sRIQ-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: Mon, 23 May 2022 15:08:43 +0200 Message-Id: <1656e91dbd1752e80f370bc70f3aebc53cd95904.1653311261.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 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.85 on 10.11.54.10 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: 1653311356603100002 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 Reviewed-by: Boris Fiuczynski --- 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 561af84eed..bf9db38340 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -8405,7 +8405,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); @@ -8423,18 +8422,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