From nobody Sun Feb 8 18:43:44 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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.129.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=1634037209; cv=none; d=zohomail.com; s=zohoarc; b=he9p0EwtGpsMNGbogUSkSw0smVATwGuOW2aIddvMwk4+Os7laRqG2iJ21Dc0E7E62fBv2TIZxp5kRprw62uFZYE5osF4NWfS2i8oxKxfRAhICoD9JCCdRWZT0IY49mM15H8QAWrssEwKugfieiGNuPH934YEBukQ6i9XeZaiXeo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1634037209; 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=rG+DOnQhYCk30d1P5p5oK7xCHXWWNIv3fVKnhcjTeXU=; b=Jm/wqQtniMD1bk7hB3IyWIct3pg7afkK4a80GnJEtMCLY98ocdi9dvdpXeD5bjCFrtA7OPB2gF0kZ0TbBVkKBiihRYV/86rZtWtJbBGvhgrgp4pHkfIwLp4s/P5N6MAgJoKneFP0ScUyVJJmNs6EoVpuxycvbm0d8gQ3xv9X79A= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.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.129.124]) by mx.zohomail.com with SMTPS id 16340372097561005.4401044671919; Tue, 12 Oct 2021 04:13:29 -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-15-8zBsfAJ-Ovm16OjjehgZFA-1; Tue, 12 Oct 2021 07:13:25 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3F166100C63B; Tue, 12 Oct 2021 11:13:20 +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 1ED7210016F4; Tue, 12 Oct 2021 11:13:20 +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 E17BB1806D02; Tue, 12 Oct 2021 11:13:19 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 19CBDJj2008617 for ; Tue, 12 Oct 2021 07:13:19 -0400 Received: by smtp.corp.redhat.com (Postfix) id 59CE9ADD1; Tue, 12 Oct 2021 11:13:19 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.15]) by smtp.corp.redhat.com (Postfix) with ESMTP id BECDD5E268 for ; Tue, 12 Oct 2021 11:13:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634037208; 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=rG+DOnQhYCk30d1P5p5oK7xCHXWWNIv3fVKnhcjTeXU=; b=WYJXTBg04DpsPBy6S+mheB1H9H2M54UhRygq5BJPUmfj0ueaB+qTkvedUOAF1SAUOi3PlC lfFndIZmx1EcIILSIyekCScDrm/2tB+qm7xebBLNpXgmIcKXh2F0b76vGBFsHNQpbnxe// an7uaqWNb2cWkjdKnx6l4/7KpqEq1Q0= X-MC-Unique: 8zBsfAJ-Ovm16OjjehgZFA-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 09/14] qemuBuildTPMProxyCommandLine: Generate via JSON Date: Tue, 12 Oct 2021 13:12:15 +0200 Message-Id: <1a308df6e2c64f73ac94ec48ec9328f8bf269f8a.1634037045.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 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.22 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: 1634037210215100001 Content-Type: text/plain; charset="utf-8" All properties are strings according to QEMU. Signed-off-by: Peter Krempa --- src/qemu/qemu_command.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index bf15a4801a..86affcdf6f 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -9980,19 +9980,20 @@ qemuBuildTPMCommandLine(virCommand *cmd, static int qemuBuildTPMProxyCommandLine(virCommand *cmd, - virDomainTPMDef *tpm) + virDomainTPMDef *tpm, + virQEMUCaps *qemuCaps) { - g_auto(virBuffer) buf =3D VIR_BUFFER_INITIALIZER; - const char *filePath =3D NULL; + g_autoptr(virJSONValue) props =3D NULL; - filePath =3D tpm->data.passthrough.source.data.file.path; + if (virJSONValueObjectCreate(&props, + "s:driver", virDomainTPMModelTypeToString= (tpm->model), + "s:id", tpm->info.alias, + "s:host-path", tpm->data.passthrough.sour= ce.data.file.path, + NULL) < 0) + return -1; - virCommandAddArg(cmd, "-device"); - virBufferAsprintf(&buf, "%s,id=3D%s,host-path=3D", - virDomainTPMModelTypeToString(tpm->model), - tpm->info.alias); - virQEMUBuildBufferEscapeComma(&buf, filePath); - virCommandAddArgBuffer(cmd, &buf); + if (qemuBuildDeviceCommandlineFromJSON(cmd, props, qemuCaps) < 0) + return -1; return 0; } @@ -10007,7 +10008,7 @@ qemuBuildTPMsCommandLine(virCommand *cmd, for (i =3D 0; i < def->ntpms; i++) { if (def->tpms[i]->model =3D=3D VIR_DOMAIN_TPM_MODEL_SPAPR_PROXY) { - if (qemuBuildTPMProxyCommandLine(cmd, def->tpms[i]) < 0) + if (qemuBuildTPMProxyCommandLine(cmd, def->tpms[i], qemuCaps) = < 0) return -1; } else if (qemuBuildTPMCommandLine(cmd, def, def->tpms[i], qemuCaps) < 0) { --=20 2.31.1