From nobody Mon Feb 9 14:14:36 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 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=1579490699; cv=none; d=zohomail.com; s=zohoarc; b=U3vUCEH/8Dkbur43042AMGaG7Mg5L4P0/Rm6nXiz8Cnl5+tVChoV7gKA9DKfYcCnIqe0vpE+jg/+jDX9f24qnNoB+9ZvBqBM+6j1/lBVVbGO8xD6DYn6DHEskZolzixQmNbOhlht5pzZp8pdGkERO1MUnZkL8CgpUeWcJKycpZU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1579490699; 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=3TF/XizuB2qoU4dfbe/MBaIDVZt/jx7Gv0nmqqR6sj4=; b=CGRzb8cWMtoC0+IBs1cr1fP7Qv/xEQ1KFXP2iaNxkP+U7FzsUMbj4W0nw1kOdtHmA+7sb+/hoMfu4YtEKVwKlemHNnIfJGHSw2akCFf4rcRwbpWumlee95pNJAkRvohhgr/9IK8a7LdOHA4DESpwQVqNdSMQZZYhDcbpVn1AhV8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 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-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1579490699893213.48605698231484; Sun, 19 Jan 2020 19:24:59 -0800 (PST) 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-290-mGbzF0kBNCWVFhWJVud5Kw-1; Sun, 19 Jan 2020 22:24:56 -0500 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 80C548010D0; Mon, 20 Jan 2020 03:24: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 5A0E15C3FA; Mon, 20 Jan 2020 03:24: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 17A1C81973; Mon, 20 Jan 2020 03:24:51 +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 00K3OQlg002376 for ; Sun, 19 Jan 2020 22:24:26 -0500 Received: by smtp.corp.redhat.com (Postfix) id 5B8C85C299; Mon, 20 Jan 2020 03:24:26 +0000 (UTC) Received: from tilapia.redhat.com (ovpn-121-72.rdu2.redhat.com [10.10.121.72]) by smtp.corp.redhat.com (Postfix) with ESMTP id AFD475C1BB; Mon, 20 Jan 2020 03:24:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1579490698; 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=3TF/XizuB2qoU4dfbe/MBaIDVZt/jx7Gv0nmqqR6sj4=; b=LJ+7TCpz0nK55Xmcl7LLTktGIilMFnIt7h+O/cgJ6HbwZZNt8mr4RWlKZfZGEXKU2h74tC +P0Lk2+aiZMYyZ3pnv47qGqOakOhKD9GmmhfC0rc0wXTQmFtjF/lMHG++RxXg3bzQLEyOv XFubFlv5w0QoT7epSsFe5oQALwQ3gxc= From: Laine Stump To: libvir-list@redhat.com Subject: [libvirt PATCH 01/12] conf: refactor hostdev driver subelement format for simpler additions Date: Sun, 19 Jan 2020 22:24:08 -0500 Message-Id: <20200120032419.448310-2-laine@redhat.com> In-Reply-To: <20200120032419.448310-1-laine@redhat.com> References: <20200120032419.448310-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: Jens Freimann 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 X-MC-Unique: mGbzF0kBNCWVFhWJVud5Kw-1 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" This reorganizes with no functional change, to make it easier to see what is added in an upcoming patch. (Yes, the "backend !=3D DEFAULT" clause is duplicated in the nested if - the first is to check if *any* attributes of are present, the second is checking for this specific attribute; this will be useful when we add a second attribute). Signed-off-by: Laine Stump --- src/conf/domain_conf.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 2a8a04cacb..0208d330c3 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -25022,16 +25022,23 @@ virDomainHostdevDefFormatSubsys(virBufferPtr buf, =20 if (def->source.subsys.type =3D=3D VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI = && pcisrc->backend !=3D VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT) { - const char *backend =3D - virDomainHostdevSubsysPCIBackendTypeToString(pcisrc->backend); =20 - if (!backend) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected pci hostdev driver name type %d"), - pcisrc->backend); - return -1; + virBufferAddLit(buf, "backend !=3D VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT) { + const char *backend =3D + virDomainHostdevSubsysPCIBackendTypeToString(pcisrc->backe= nd); + + if (!backend) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected pci hostdev driver name type = %d"), + pcisrc->backend); + return -1; + } + virBufferAsprintf(buf, " name=3D'%s'", backend); } - virBufferAsprintf(buf, "\n", backend); + + virBufferAddLit(buf, "/>\n"); } =20 virBufferAddLit(buf, "