VIR_LOG_INIT("qemu.tpm");
-/*
- * qemuTPMCreateEmulatorStoragePath
- *
+/**
+ * qemuTPMEmulatorStorageBuildPath:
* @swtpmStorageDir: directory for swtpm persistent state
- * @uuid: The UUID of the VM for which to create the storage
+ * @uuidstr: UUID of the VM
* @tpmversion: version of the TPM
*
- * Create the swtpm's storage path
+ * Generate the swtpm's storage path.
*/
static char *
-qemuTPMCreateEmulatorStoragePath(const char *swtpmStorageDir,
- const char *uuidstr,
- virDomainTPMVersion tpmversion)
+qemuTPMEmulatorStorageBuildPath(const char *swtpmStorageDir,
+ const char *uuidstr,
+ virDomainTPMVersion tpmversion)
{
char *path = NULL;
const char *dir = "";
/**
- * qemuTPMCreateEmulatorLogPath:
- * @logDir: directory where swtpm writes its logs into
+ * qemuTPMEmulatorLogBuildPath:
+ * @logDir: directory for swtpm log files
* @vmname: name of the VM
*
- * Create the swtpm's log path.
+ * Generate the swtpm's log path.
*/
static char*
-qemuTPMCreateEmulatorLogPath(const char *logDir,
- const char *vmname)
+qemuTPMEmulatorLogBuildPath(const char *logDir,
+ const char *vmname)
{
return g_strdup_printf("%s/%s-swtpm.log", logDir, vmname);
}
}
-/*
- * qemuTPMCreateEmulatorSocket:
- *
- * @swtpmStateDir: the directory where to create the socket in
+/**
+ * qemuTPMEmulatorSocketBuildPath:
+ * @swtpmStateDir: directory for swtpm runtime state
* @shortName: short and unique name of the domain
*
- * Create the Unix socket path from the given parameters
+ * Generate the swtpm's Unix socket path.
*/
static char *
-qemuTPMCreateEmulatorSocket(const char *swtpmStateDir,
- const char *shortName)
+qemuTPMEmulatorSocketBuildPath(const char *swtpmStateDir,
+ const char *shortName)
{
return g_strdup_printf("%s/%s-swtpm.sock", swtpmStateDir, shortName);
}
if (!tpm->data.emulator.storagepath &&
!(tpm->data.emulator.storagepath =
- qemuTPMCreateEmulatorStoragePath(swtpmStorageDir, uuidstr,
- tpm->version)))
+ qemuTPMEmulatorStorageBuildPath(swtpmStorageDir, uuidstr,
+ tpm->version)))
return -1;
if (!tpm->data.emulator.logfile) {
- tpm->data.emulator.logfile = qemuTPMCreateEmulatorLogPath(logDir,
- vmname);
+ tpm->data.emulator.logfile = qemuTPMEmulatorLogBuildPath(logDir,
+ vmname);
}
return 0;
}
-/*
- * qemuTPMCreatePidFilename
+/**
+ * qemuTPMEmulatorPidFileBuildPath:
+ * @swtpmStateDir: directory for swtpm runtime state
+ * @shortName: short and unique name of the domain
+ *
+ * Generate the swtpm's pidfile path.
*/
static char *
-qemuTPMEmulatorCreatePidFilename(const char *swtpmStateDir,
- const char *shortName)
+qemuTPMEmulatorPidFileBuildPath(const char *swtpmStateDir,
+ const char *shortName)
{
g_autofree char *devicename = NULL;
const char *shortName,
pid_t *pid)
{
- g_autofree char *pidfile = qemuTPMEmulatorCreatePidFilename(swtpmStateDir,
- shortName);
-
+ g_autofree char *pidfile = qemuTPMEmulatorPidFileBuildPath(swtpmStateDir,
+ shortName);
if (!pidfile)
return -1;
/* create the socket filename */
if (!tpm->data.emulator.source->data.nix.path &&
!(tpm->data.emulator.source->data.nix.path =
- qemuTPMCreateEmulatorSocket(swtpmStateDir, shortName)))
+ qemuTPMEmulatorSocketBuildPath(swtpmStateDir, shortName)))
return -1;
tpm->data.emulator.source->type = VIR_DOMAIN_CHR_TYPE_UNIX;
if (!swtpm_ioctl)
return;
- if (!(pathname = qemuTPMCreateEmulatorSocket(swtpmStateDir, shortName)))
+ if (!(pathname = qemuTPMEmulatorSocketBuildPath(swtpmStateDir, shortName)))
return;
if (!virFileExists(pathname))
if (qemuExtDeviceLogCommand(driver, vm, cmd, "TPM Emulator") < 0)
return -1;
- if (!(pidfile = qemuTPMEmulatorCreatePidFilename(cfg->swtpmStateDir, shortName)))
+ if (!(pidfile = qemuTPMEmulatorPidFileBuildPath(cfg->swtpmStateDir, shortName)))
return -1;
virCommandDaemonize(cmd);