[libvirt PATCH 06/14] qemu: Make qemuTPMEmulatorCreateStorage() take a virDomainTPMDef*

Andrea Bolognani abologna at redhat.com
Fri Feb 4 18:51:09 UTC 2022


This matches how qemuTPMEmulatorDeleteStorage() expects to be
called.

Signed-off-by: Andrea Bolognani <abologna at redhat.com>
---
 src/qemu/qemu_tpm.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/qemu/qemu_tpm.c b/src/qemu/qemu_tpm.c
index 127a2c80be..2196b5c567 100644
--- a/src/qemu/qemu_tpm.c
+++ b/src/qemu/qemu_tpm.c
@@ -101,7 +101,7 @@ qemuTPMCreateEmulatorLogPath(const char *logDir,
 
 /**
  * qemuTPMEmulatorCreateStorage:
- * @storagepath: directory for swtpm's persistent state
+ * @tpm: TPM definition for an emulator type
  * @created: a pointer to a bool that will be set to true if the
  *           storage was created because it did not exist yet
  * @swtpm_user: The uid that needs to be able to access the directory
@@ -112,11 +112,12 @@ qemuTPMCreateEmulatorLogPath(const char *logDir,
  * Adapt ownership of the directory and all swtpm's state files there.
  */
 static int
-qemuTPMEmulatorCreateStorage(const char *storagepath,
+qemuTPMEmulatorCreateStorage(virDomainTPMDef *tpm,
                              bool *created,
                              uid_t swtpm_user,
                              gid_t swtpm_group)
 {
+    const char *storagepath = tpm->data.emulator.storagepath;
     g_autofree char *swtpmStorageDir = g_path_get_dirname(storagepath);
 
     /* allow others to cd into this dir */
@@ -672,8 +673,7 @@ qemuTPMEmulatorBuildCommand(virDomainTPMDef *tpm,
     if (!swtpm)
         return NULL;
 
-    if (qemuTPMEmulatorCreateStorage(tpm->data.emulator.storagepath,
-                                     &created, swtpm_user, swtpm_group) < 0)
+    if (qemuTPMEmulatorCreateStorage(tpm, &created, swtpm_user, swtpm_group) < 0)
         return NULL;
 
     if (tpm->data.emulator.hassecretuuid)
-- 
2.34.1




More information about the libvir-list mailing list