]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: Make qemuTPMEmulatorCreateStorage() take a virDomainTPMDef*
authorAndrea Bolognani <abologna@redhat.com>
Fri, 4 Feb 2022 16:26:23 +0000 (17:26 +0100)
committerAndrea Bolognani <abologna@redhat.com>
Sat, 5 Feb 2022 13:36:11 +0000 (14:36 +0100)
This matches how qemuTPMEmulatorDeleteStorage() expects to be
called.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
src/qemu/qemu_tpm.c

index 127a2c80be2460d0ffc59719b925e7f6b39990a3..2196b5c567c7f9a7c772f167e4e340f63e312f26 100644 (file)
@@ -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)