[libvirt PATCH v2 05/12] util: don't export virTPMEmulatorInit method

Daniel P. Berrangé berrange at redhat.com
Wed Nov 24 15:44:09 UTC 2021


Every other exportd API from virtpm.h will internally call
virTPMEmulatorInit, so there is no reason for this initializer
to be exported on its own.

Signed-off-by: Daniel P. Berrangé <berrange at redhat.com>
---
 src/libvirt_private.syms | 1 -
 src/qemu/qemu_tpm.c      | 6 ------
 src/util/virtpm.c        | 4 +++-
 src/util/virtpm.h        | 1 -
 4 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index b98cb0f66d..6b179a61b9 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -3447,7 +3447,6 @@ virTimeStringThenRaw;
 
 # util/virtpm.h
 virTPMCreateCancelPath;
-virTPMEmulatorInit;
 virTPMGetSwtpm;
 virTPMGetSwtpmIoctl;
 virTPMGetSwtpmSetup;
diff --git a/src/qemu/qemu_tpm.c b/src/qemu/qemu_tpm.c
index 62f54f56ab..1b923fd68e 100644
--- a/src/qemu/qemu_tpm.c
+++ b/src/qemu/qemu_tpm.c
@@ -295,9 +295,6 @@ qemuTPMEmulatorPrepareHost(virDomainTPMDef *tpm,
                            uid_t qemu_user,
                            const char *shortName)
 {
-    if (virTPMEmulatorInit() < 0)
-        return -1;
-
     /* create log dir ... allow 'tss' user to cd into it */
     if (g_mkdir_with_parents(logDir, 0711) < 0)
         return -1;
@@ -804,9 +801,6 @@ qemuTPMEmulatorStop(const char *swtpmStateDir,
     if (!swtpm_ioctl)
         return;
 
-    if (virTPMEmulatorInit() < 0)
-        return;
-
     if (!(pathname = qemuTPMCreateEmulatorSocket(swtpmStateDir, shortName)))
         return;
 
diff --git a/src/util/virtpm.c b/src/util/virtpm.c
index 2539ea9275..3ea3b668e2 100644
--- a/src/util/virtpm.c
+++ b/src/util/virtpm.c
@@ -132,6 +132,8 @@ static virTPMBinaryInfo swtpmBinaries[VIR_TPM_BINARY_LAST] = {
     },
 };
 
+static int virTPMEmulatorInit(void);
+
 static char *
 virTPMBinaryGetPath(virTPMBinary binary)
 {
@@ -264,7 +266,7 @@ virTPMGetCaps(virTPMBinaryCapsParse capsParse,
  * Initialize the Emulator functions by searching for necessary
  * executables that we will use to start and setup the swtpm
  */
-int
+static int
 virTPMEmulatorInit(void)
 {
     int ret = -1;
diff --git a/src/util/virtpm.h b/src/util/virtpm.h
index defea6c106..4c16332f9b 100644
--- a/src/util/virtpm.h
+++ b/src/util/virtpm.h
@@ -25,7 +25,6 @@ char *virTPMCreateCancelPath(const char *devpath) G_GNUC_NO_INLINE;
 char *virTPMGetSwtpm(void);
 char *virTPMGetSwtpmSetup(void);
 char *virTPMGetSwtpmIoctl(void);
-int virTPMEmulatorInit(void);
 
 bool virTPMSwtpmCapsGet(unsigned int cap);
 bool virTPMSwtpmSetupCapsGet(unsigned int cap);
-- 
2.33.1




More information about the libvir-list mailing list