From nobody Sun Feb 8 18:31:45 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1633504643; cv=none; d=zohomail.com; s=zohoarc; b=YY2rnCNYTgiHv8HErXgAKzd+E2AqIqDIyOHVi3s6SHs4vSLk73nlIzvbsJeMCS6gOp00lv6+vya+6fROPdKetTKuE1CqsV1g4K9T8hA4E00Z3hz6BfN0J55sxNTkJOtCm7xlsdwxXKfepbTHNYTdMP6RTxw3b606CV8KRXfpDuQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633504643; 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=ZomRCaJDVK5hoRcAQDaRwTrUL4L1XxpkBmOMPU7NbG0=; b=J7rYytEWeZ2PJaYwJYupyoWe3/z8IiDCCXy7qnsTWinYGlP5lGHfB4wG7UW7fJ/BkxzLgYoWajGrdAHaNceJwnLPu8K8E9x9AjFpI/EJuC2Qvo7vhP8WvIxIqeP2nKYP/HxNtNk9vx7Mpi+iWx7cuJoqJNrn1MkoDQrICj4IdZU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 163350464356472.78033149492319; Wed, 6 Oct 2021 00:17:23 -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-215-jU1JTDwoN2ObiGcNRI3Tbw-1; Wed, 06 Oct 2021 03:17:20 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1DB0D101F7A4; Wed, 6 Oct 2021 07:17:15 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EFFD860C13; Wed, 6 Oct 2021 07:17:14 +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 BBB951806D01; Wed, 6 Oct 2021 07:17:14 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1967FjoO007468 for ; Wed, 6 Oct 2021 03:15:45 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5A8A560936; Wed, 6 Oct 2021 07:15:45 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.43.2.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id D6A4560853 for ; Wed, 6 Oct 2021 07:15:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633504642; 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=ZomRCaJDVK5hoRcAQDaRwTrUL4L1XxpkBmOMPU7NbG0=; b=bbf0xvcUyUFX7D7ZY55WDL2hUUSEXxv3gBMgPN1LuJo6nB/Rq6mqop//w+x64xeIsMd++i 3HvyAXdemujqn3P5Y8Mtzube1d8XKybWLCqbSi27ZcWWyH8DQR+I+/EqFvhVXZftp2NJ5I t6zzya9bqjrldwz8w8TCEZWVxhnhUVc= X-MC-Unique: jU1JTDwoN2ObiGcNRI3Tbw-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 07/16] qemu: vhost-user-fs: separate building of device string Date: Wed, 6 Oct 2021 09:15:13 +0200 Message-Id: <0edbaa63b14d1404e6d100a9863d926b93ddb22b.1633504466.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 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.79 on 10.5.11.12 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1633504644143100001 Signed-off-by: J=C3=A1n Tomko Reviewed-by: Peter Krempa --- src/qemu/qemu_command.c | 55 ++++++++++++++++++++++++++--------------- 1 file changed, 35 insertions(+), 20 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 7e76e188c1..d0f961b8ea 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -2047,6 +2047,36 @@ qemuBuildVHostUserFsChardevStr(const virDomainFSDef = *fs, } =20 =20 +static char * +qemuBuildVHostUserFsDevStr(virDomainFSDef *fs, + const virDomainDef *def, + const char *chardev_alias, + qemuDomainObjPrivate *priv) +{ + g_auto(virBuffer) buf =3D VIR_BUFFER_INITIALIZER; + + if (qemuBuildVirtioDevStr(&buf, "vhost-user-fs", priv->qemuCaps, + VIR_DOMAIN_DEVICE_FS, fs) < 0) + return NULL; + + virBufferAsprintf(&buf, ",id=3D%s", fs->info.alias); + virBufferAsprintf(&buf, ",chardev=3D%s", chardev_alias); + if (fs->queue_size) + virBufferAsprintf(&buf, ",queue-size=3D%llu", fs->queue_size); + virBufferAddLit(&buf, ",tag=3D"); + virQEMUBuildBufferEscapeComma(&buf, fs->dst); + qemuBuildVirtioOptionsStr(&buf, fs->virtio); + + if (fs->info.bootIndex) + virBufferAsprintf(&buf, ",bootindex=3D%u", fs->info.bootIndex); + + if (qemuBuildDeviceAddressStr(&buf, def, &fs->info) < 0) + return NULL; + + return virBufferContentAndReset(&buf); +} + + static int qemuBuildVHostUserFsCommandLine(virCommand *cmd, virDomainFSDef *fs, @@ -2055,7 +2085,7 @@ qemuBuildVHostUserFsCommandLine(virCommand *cmd, { g_autofree char *chardev_alias =3D NULL; g_autofree char *chrdevstr =3D NULL; - g_auto(virBuffer) opt =3D VIR_BUFFER_INITIALIZER; + g_autofree char *devstr =3D NULL; =20 chardev_alias =3D qemuDomainGetVhostUserChrAlias(fs->info.alias); chrdevstr =3D qemuBuildVHostUserFsChardevStr(fs, chardev_alias); @@ -2063,27 +2093,12 @@ qemuBuildVHostUserFsCommandLine(virCommand *cmd, virCommandAddArg(cmd, "-chardev"); virCommandAddArg(cmd, chrdevstr); =20 + if (!(devstr =3D qemuBuildVHostUserFsDevStr(fs, def, chardev_alias, pr= iv))) + return -1; + virCommandAddArg(cmd, "-device"); + virCommandAddArg(cmd, devstr); =20 - if (qemuBuildVirtioDevStr(&opt, "vhost-user-fs", priv->qemuCaps, - VIR_DOMAIN_DEVICE_FS, fs) < 0) - return -1; - - virBufferAsprintf(&opt, ",id=3D%s", fs->info.alias); - virBufferAsprintf(&opt, ",chardev=3D%s", chardev_alias); - if (fs->queue_size) - virBufferAsprintf(&opt, ",queue-size=3D%llu", fs->queue_size); - virBufferAddLit(&opt, ",tag=3D"); - virQEMUBuildBufferEscapeComma(&opt, fs->dst); - qemuBuildVirtioOptionsStr(&opt, fs->virtio); - - if (fs->info.bootIndex) - virBufferAsprintf(&opt, ",bootindex=3D%u", fs->info.bootIndex); - - if (qemuBuildDeviceAddressStr(&opt, def, &fs->info) < 0) - return -1; - - virCommandAddArgBuffer(cmd, &opt); return 0; } =20 --=20 2.31.1