From nobody Sun Feb 8 22:18:39 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.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 63.128.21.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=1614619073; cv=none; d=zohomail.com; s=zohoarc; b=ayCmqqZod/8+rhmYAEshoDDRgOfaOaTlM6Bp1nJizN58bq4fqz2UaJwJIm4XHFu2pIVfXAlg6I21TbzxKoGcpBCyfp8IcLWFgpFrJ3xXbdjcrQ3a9TKyfYlmQ+fsVPMXACfnqjXNprjBt0BDsjjVIsp2QsmaCAv20n1j+2faUhg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614619073; 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=2l+ZmTWyCdEuJ5+KnsxGrNgJqpmrZZvpGqSdofV0mcU=; b=C9oAsy72uqOU8vTCPeqcAkJJsTEGjiePwEnsRcW/JG7tf5cgYQIbrT6JK2LZblnj0OgVPV4ODmqpP9RWQhSPRiZvI2GX2l/cxmddd9rMvi9AgOtb6w7gsTJEpsBQ0QhS1Y2jdsFwi2FJ73n6Q/F9c+GYDUI0mL6x4BTnqmZayv4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 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-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1614619073126236.11352863315005; Mon, 1 Mar 2021 09:17:53 -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-204-eXxDrWyZMmOvMmRMeK6Jog-1; Mon, 01 Mar 2021 12:17:49 -0500 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 54BA7801975; Mon, 1 Mar 2021 17:17:44 +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 4EDD560C04; Mon, 1 Mar 2021 17:17:43 +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 60FFC58074; Mon, 1 Mar 2021 17:17:42 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 121HHfA7004852 for ; Mon, 1 Mar 2021 12:17:41 -0500 Received: by smtp.corp.redhat.com (Postfix) id CADA610016DB; Mon, 1 Mar 2021 17:17:41 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.194.76]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4BC5810013C1 for ; Mon, 1 Mar 2021 17:17:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614619072; 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=2l+ZmTWyCdEuJ5+KnsxGrNgJqpmrZZvpGqSdofV0mcU=; b=X/O30khrMgc4DDIWrZBKVbiwDmh4+WN4EM7HfMZm7uYjKUmszsNQsioREssbuZ42xf3ALL f4nMI/GQIs+wWwLtIP/pyljtc/VX8msqY+3JPk2LViKkTEh61GHaadzmIsNXHIgo4O/MHa 695DTVHgm31Ld/Rk4HzmOsLxNXwlURI= X-MC-Unique: eXxDrWyZMmOvMmRMeK6Jog-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 1/4] qemu_tpm: Move logfile path generation into a separate function Date: Mon, 1 Mar 2021 18:17:32 +0100 Message-Id: <913fb769cf484d6a5997a4a07e6229966a6324b7.1614617800.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Strictly not needed, but the rest of paths is generated in separate functions. Helps with code readability. Signed-off-by: Michal Privoznik Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_tpm.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_tpm.c b/src/qemu/qemu_tpm.c index f94cad8230..71339b785a 100644 --- a/src/qemu/qemu_tpm.c +++ b/src/qemu/qemu_tpm.c @@ -82,6 +82,21 @@ qemuTPMCreateEmulatorStoragePath(const char *swtpmStorag= eDir, } =20 =20 +/** + * qemuTPMCreateEmulatorLogPath: + * @logDir: directory where swtpm writes its logs into + * @vmname: name of the VM + * + * Create the swtpm's log path. + */ +static char* +qemuTPMCreateEmulatorLogPath(const char *logDir, + const char *vmname) +{ + return g_strdup_printf("%s/%s-swtpm.log", logDir, vmname); +} + + /* * qemuTPMEmulatorInitStorage * @@ -286,7 +301,7 @@ qemuTPMEmulatorPrepareHost(virDomainTPMDefPtr tpm, =20 /* create logfile name ... */ if (!tpm->data.emulator.logfile) - tpm->data.emulator.logfile =3D g_strdup_printf("%s/%s-swtpm.log", = logDir, vmname); + tpm->data.emulator.logfile =3D qemuTPMCreateEmulatorLogPath(logDir= , vmname); =20 if (!virFileExists(tpm->data.emulator.logfile) && virFileTouch(tpm->data.emulator.logfile, 0644) < 0) { --=20 2.26.2