From nobody Sat Feb 7 06:27:26 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=1639053170; cv=none; d=zohomail.com; s=zohoarc; b=ioboQdYmIaklaRes4HLLvOSzxzSvgioU54zgPhQeJWEg6xw9KUf7XSbPm4LCKcwAjP8A0N3hAEe6f8gPT6MVljpgToGlqSj1hIYr4yIx6tOScqWo+BFoB+VL8INs+rKZrmDwrM+6DMQi1ABg71W0lOTfuAivKB5SzG1Ydq4Vp8Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639053170; 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=1t3K3SOJDM5t4PDEv/GkgJVTyIZsoig9IQ/OoOgSoHA=; b=dH+ehFASexHj9iAsKJn6DTPCvIsrVU32nlDVsUqcOgT40IvU14EmAOAs+8pTjU53uGWmQwjdB3O4CjTeQNlGdf5zv1TjJsFK9w3LaRRiMl6NFFqZxexwEDoACPnHjSKC+fxvhc1RlUOwcjMKlVwjkZzzlIg+NJYAY3Ju8thWcRg= 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 163905316991234.12330871467066; Thu, 9 Dec 2021 04:32:49 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-436-T1iuOp8SOvSvFwyk-EWFVQ-1; Thu, 09 Dec 2021 07:32:45 -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 111E481CCBC; Thu, 9 Dec 2021 12:32:41 +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 E6A101ABE5; Thu, 9 Dec 2021 12:32:40 +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 B6EA34A70A; Thu, 9 Dec 2021 12:32:40 +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 1B9CVO0F017940 for ; Thu, 9 Dec 2021 07:31:24 -0500 Received: by smtp.corp.redhat.com (Postfix) id 2ABFE4ABB5; Thu, 9 Dec 2021 12:31:24 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 844831B472 for ; Thu, 9 Dec 2021 12:31:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639053168; 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=1t3K3SOJDM5t4PDEv/GkgJVTyIZsoig9IQ/OoOgSoHA=; b=fUC+LfaHM2Qb1XX1NwlsUxZbQ9fO+1JK88bprXtkU0hqzVtONRz6bXmFjH4jCWoU8Yhwn7 vjQOcgnTqhkUmvQvelKzKwfUC142e5u9Z7eourrL4tgF+cXyDrhoEpMAYZhcISLlMnu02V AIYPi9+OY66bZ72LTbO+7RUzKchjU4w= X-MC-Unique: T1iuOp8SOvSvFwyk-EWFVQ-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 21/24] qemu: Use qemuBuildChrChardevCommand for virtiofs backend chardev Date: Thu, 9 Dec 2021 13:30:56 +0100 Message-Id: <5f652b7636b7f69610cf4a4c61b735514cc60ed8.1639052639.git.pkrempa@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.16 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: 1639053171606100001 Content-Type: text/plain; charset="utf-8" Now that the API for qemuBuildChrChardevCommand is sane enough, we can use it to centralize formatting of '-chardev' generally. The 'virDomainFSDef' doesn't use 'virDomainChrSourceDef' internally so we create it for this occasion manually. Signed-off-by: Peter Krempa --- src/qemu/qemu_command.c | 31 +++++++++---------------------- 1 file changed, 9 insertions(+), 22 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 0bfe76c29c..3a5796fed8 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -2741,22 +2741,6 @@ qemuBuildDisksCommandLine(virCommand *cmd, } -static char * -qemuBuildVHostUserFsChardevStr(const virDomainFSDef *fs, - const char *chardev_alias, - qemuDomainObjPrivate *priv) -{ - g_auto(virBuffer) buf =3D VIR_BUFFER_INITIALIZER; - g_autofree char *socket_path =3D qemuDomainGetVHostUserFSSocketPath(pr= iv, fs); - - virBufferAddLit(&buf, "socket"); - virBufferAsprintf(&buf, ",id=3D%s", chardev_alias); - virBufferAddLit(&buf, ",path=3D"); - virQEMUBuildBufferEscapeComma(&buf, socket_path); - return virBufferContentAndReset(&buf); -} - - virJSONValue * qemuBuildVHostUserFsDevProps(virDomainFSDef *fs, const virDomainDef *def, @@ -2790,15 +2774,18 @@ qemuBuildVHostUserFsCommandLine(virCommand *cmd, const virDomainDef *def, qemuDomainObjPrivate *priv) { - g_autofree char *chardev_alias =3D NULL; - g_autofree char *chrdevstr =3D NULL; + g_autofree char *chardev_alias =3D qemuDomainGetVhostUserChrAlias(fs->= info.alias); g_autoptr(virJSONValue) devprops =3D NULL; + g_autoptr(virDomainChrSourceDef) chrsrc =3D virDomainChrSourceDefNew(p= riv->driver->xmlopt); - chardev_alias =3D qemuDomainGetVhostUserChrAlias(fs->info.alias); - chrdevstr =3D qemuBuildVHostUserFsChardevStr(fs, chardev_alias, priv); + if (!chrsrc) + return -1; + + chrsrc->type =3D VIR_DOMAIN_CHR_TYPE_UNIX; + chrsrc->data.nix.path =3D qemuDomainGetVHostUserFSSocketPath(priv, fs); - virCommandAddArg(cmd, "-chardev"); - virCommandAddArg(cmd, chrdevstr); + if (qemuBuildChardevCommand(cmd, chrsrc, chardev_alias, priv->qemuCaps= ) < 0) + return -1; if (qemuCommandAddExtDevice(cmd, &fs->info, priv->qemuCaps) < 0) return -1; --=20 2.31.1