From nobody Sun Feb 8 18:44:09 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.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 63.128.21.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=1616070545; cv=none; d=zohomail.com; s=zohoarc; b=TWzq49pPNGNlBAqdZVAqpiUqPFnh9yW9pmv+cgQjtbmNvDOH5Ewe3EPXQ2PIUTCRuxxkxO0aQc2pFQNIc09EjgXi15oKPSYt4aurYhZ53RbuWP0MIdst2KM30xSdRnhhzvyEdxNpQFwpBcFTbw3G+ZCFJUaO7a17ZjFOf3Ul+Nc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1616070545; 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=+geVVw8ccWVAxfqZjn2ybp93yH3rXvhxqdgK4iAjhew=; b=cFNUeLjbB2m/p7O767NzQeVm/9c91y7hGUJO6aA4x4eZCD0eJ3cgovhQ2ZjklTQ2tkWBuJgCkJ3TVaUjNIW7Uxx8pyqk7AEFghbGVQcZ84aDmxS1k8a5ZCYyxsKrTxx5QMGWCXFlNQ36EEoKeay3KYt1MozhbOonjN9CooWk+Nk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.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 [63.128.21.124]) by mx.zohomail.com with SMTPS id 1616070545255992.924995095461; Thu, 18 Mar 2021 05:29:05 -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-372-AFFumS62Pym6lX9dhxGKsA-1; Thu, 18 Mar 2021 08:29:01 -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 7E4DA5B365; Thu, 18 Mar 2021 12:28:56 +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 0DAB519C45; Thu, 18 Mar 2021 12:28:56 +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 B5E6E4A702; Thu, 18 Mar 2021 12:28:55 +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 12ICQvsA024692 for ; Thu, 18 Mar 2021 08:26:57 -0400 Received: by smtp.corp.redhat.com (Postfix) id EBA8D5C239; Thu, 18 Mar 2021 12:26:57 +0000 (UTC) Received: from antique-work.lan (unknown [10.40.192.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6B2AE5C1D1 for ; Thu, 18 Mar 2021 12:26:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1616070543; 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=+geVVw8ccWVAxfqZjn2ybp93yH3rXvhxqdgK4iAjhew=; b=iv/aIIc1bgWVy5wKPiP9RXtguu38SYCk7gL95Tjvpwfri7yBqc5aqMU3E8pDosLYPWtqt1 Xj5gQI3nnidlHGW/dDBkWfChz+YP/kAqDzzSbA7sbAJUZkSsHTPk3AlpsOb4/1GNCHg412 zc5UHj35efhUvzEOc7Yx34brT3ExtuU= X-MC-Unique: AFFumS62Pym6lX9dhxGKsA-1 From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH 4/9] conf: introduce virDomainDefParseBootFirmwareOptions Date: Thu, 18 Mar 2021 13:26:41 +0100 Message-Id: <68f688f4266a9490bdbdac69e83f7d6647ee6689.1616070296.git.phrdina@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com 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" Extract the code to it's own function. Signed-off-by: Pavel Hrdina --- src/conf/domain_conf.c | 39 +++++++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 4876fe61bb..03985b6687 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -19595,6 +19595,31 @@ virDomainDefParseBootKernelOptions(virDomainDefPtr= def, } =20 =20 +static int +virDomainDefParseBootFirmwareOptions(virDomainDefPtr def, + xmlXPathContextPtr ctxt) +{ + g_autofree char *firmware =3D virXPathString("string(./os/@firmware)",= ctxt); + int fw =3D 0; + + if (!firmware) + return 0; + + fw =3D virDomainOsDefFirmwareTypeFromString(firmware); + + if (fw <=3D 0) { + virReportError(VIR_ERR_XML_ERROR, + _("unknown firmware value %s"), + firmware); + return -1; + } + + def->os.firmware =3D fw; + + return 0; +} + + static int virDomainDefParseBootOptions(virDomainDefPtr def, xmlXPathContextPtr ctxt) @@ -19621,23 +19646,13 @@ virDomainDefParseBootOptions(virDomainDefPtr def, def->os.type =3D=3D VIR_DOMAIN_OSTYPE_XENPVH || def->os.type =3D=3D VIR_DOMAIN_OSTYPE_HVM || def->os.type =3D=3D VIR_DOMAIN_OSTYPE_UML) { - g_autofree char *firmware =3D NULL; xmlNodePtr loader_node; =20 virDomainDefParseBootKernelOptions(def, ctxt); =20 - if (def->os.type =3D=3D VIR_DOMAIN_OSTYPE_HVM && - (firmware =3D virXPathString("string(./os/@firmware)", ctxt)))= { - int fw =3D virDomainOsDefFirmwareTypeFromString(firmware); - - if (fw <=3D 0) { - virReportError(VIR_ERR_XML_ERROR, - _("unknown firmware value %s"), - firmware); + if (def->os.type =3D=3D VIR_DOMAIN_OSTYPE_HVM) { + if (virDomainDefParseBootFirmwareOptions(def, ctxt) < 0) return -1; - } - - def->os.firmware =3D fw; } =20 if ((loader_node =3D virXPathNode("./os/loader[1]", ctxt))) { --=20 2.30.2