From nobody Mon Feb 9 06:27:05 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=1639053166; cv=none; d=zohomail.com; s=zohoarc; b=oGezheibV3dlSfesr64S9YZ7Q0WuZkplHmcbYGwfUwPNRQ8D7dZfiAUeKll7vF5DV2jkGVVbMbJOWKEZCp/3QCjc69erJqtb++jMP8PwyFWE5l8fNAGmbC4ISj7etPGe25TpwmCU8ZowaruTSV6hce5z6OQazKW6UHIDlOTvv7c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639053166; 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=c67X9Iavk/eQcmqGnPy63GvAXIYVQ1YKV8p5+ttyQL0=; b=OEwMlwzkw5ZytavWMg+NDLG4OYcHlQ3vOkuyOJh8nxzRV/MfH2J+Yg1M1U0/MvlFIj404KjAElQ1WTW+dCo48O0O+W9IUexB4YHlStxsu6LGDvU5hQy0e14HnsQjOBYzXFPBImTMNdJ0COLAfCYVggiemOIUwAo2vMusBo7GpHo= 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 1639053166922382.5008320395675; Thu, 9 Dec 2021 04:32:46 -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-154-jmXCb3YEOfu5jbv7Mc7gqQ-1; Thu, 09 Dec 2021 07:32:42 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 56BF3801AFC; Thu, 9 Dec 2021 12:32:38 +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 373E3781FE; Thu, 9 Dec 2021 12:32:38 +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 04F4B4A705; Thu, 9 Dec 2021 12:32:38 +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 1B9CVNdX017924 for ; Thu, 9 Dec 2021 07:31:23 -0500 Received: by smtp.corp.redhat.com (Postfix) id 13B1760C25; Thu, 9 Dec 2021 12:31:23 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 64B22694C0 for ; Thu, 9 Dec 2021 12:31:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639053165; 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=c67X9Iavk/eQcmqGnPy63GvAXIYVQ1YKV8p5+ttyQL0=; b=YNSX13kBjwsdOVQWNHLShD4mOTKHYbmD4bjCvbaY2SY2xjMt9820qzxLRo/bufPFigGXEp s2rI7ftGBRfCjSKK6kq0X//Sbsvh7H1wJ0nMSVtvDxzZuUjc0dNBHTfoooxdiyiIquFrk7 6OUGZMbhVHSAegGNhk3wSkpFIpwLALk= X-MC-Unique: jmXCb3YEOfu5jbv7Mc7gqQ-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 20/24] qemu: Use qemuBuildChrChardevCommand for vhost-user disk backend Date: Thu, 9 Dec 2021 13:30:55 +0100 Message-Id: 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.13 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: 1639053169093100001 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. For virtiofs we don't have a centrally stored chardev source so we allocate one inline for temporary use. Signed-off-by: Peter Krempa --- src/qemu/qemu_block.c | 1 - src/qemu/qemu_block.h | 1 - src/qemu/qemu_command.c | 18 ++++-------------- 3 files changed, 4 insertions(+), 16 deletions(-) diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index f6a7f2b750..87dca40179 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -1655,7 +1655,6 @@ qemuBlockStorageSourceAttachDataFree(qemuBlockStorage= SourceAttachData *data) g_free(data->driveCmd); g_free(data->driveAlias); g_free(data->chardevAlias); - g_free(data->chardevCmd); g_free(data); } diff --git a/src/qemu/qemu_block.h b/src/qemu/qemu_block.h index 54601a48a9..184a549d5c 100644 --- a/src/qemu/qemu_block.h +++ b/src/qemu/qemu_block.h @@ -99,7 +99,6 @@ struct qemuBlockStorageSourceAttachData { virDomainChrSourceDef *chardevDef; char *chardevAlias; - char *chardevCmd; bool chardevAdded; virJSONValue *authsecretProps; diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 0fb7b83d3f..0bfe76c29c 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -2591,8 +2591,10 @@ qemuBuildBlockStorageSourceAttachDataCommandline(vir= Command *cmd, if (data->driveCmd) virCommandAddArgList(cmd, "-drive", data->driveCmd, NULL); - if (data->chardevCmd) - virCommandAddArgList(cmd, "-chardev", data->chardevCmd, NULL); + if (data->chardevDef) { + if (qemuBuildChardevCommand(cmd, data->chardevDef, data->chardevAl= ias, qemuCaps) < 0) + return -1; + } if (data->storageProps) { if (!(tmp =3D virJSONValueToString(data->storageProps, false))) @@ -10959,24 +10961,12 @@ static qemuBlockStorageSourceAttachData * qemuBuildStorageSourceAttachPrepareChardev(virDomainDiskDef *disk) { g_autoptr(qemuBlockStorageSourceAttachData) data =3D NULL; - g_auto(virBuffer) chardev =3D VIR_BUFFER_INITIALIZER; data =3D g_new0(qemuBlockStorageSourceAttachData, 1); data->chardevDef =3D disk->src->vhostuser; data->chardevAlias =3D qemuDomainGetVhostUserChrAlias(disk->info.alias= ); - virBufferAddLit(&chardev, "socket"); - virBufferAsprintf(&chardev, ",id=3D%s", data->chardevAlias); - virBufferAddLit(&chardev, ",path=3D"); - virQEMUBuildBufferEscapeComma(&chardev, disk->src->vhostuser->data.nix= .path); - - qemuBuildChrChardevReconnectStr(&chardev, - &disk->src->vhostuser->data.nix.reconn= ect); - - if (!(data->chardevCmd =3D virBufferContentAndReset(&chardev))) - return NULL; - return g_steal_pointer(&data); } --=20 2.31.1