qemu: Rename memory path functions

This way they make sense not only based on where they are located but
the name also relates to what they are actually doing.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Martin Kletzander 2024-09-23 11:05:49 +02:00
parent d599fc3d57
commit f035f24777
4 changed files with 19 additions and 17 deletions

View File

@ -3222,7 +3222,8 @@ qemuBuildMemoryBackendProps(virJSONValue **backendProps,
} else {
/* We can have both pagesize and mem source. If that's the case,
* prefer hugepages as those are more specific. */
if (qemuGetMemoryBackingPath(priv, mem->info.alias, &memPath) < 0)
if (qemuDomainGetMemoryBackingPath(priv, mem->info.alias,
&memPath) < 0)
return -1;
}
@ -7116,7 +7117,7 @@ qemuBuildMemPathStr(const virDomainDef *def,
return -1;
prealloc = true;
} else if (def->mem.source == VIR_DOMAIN_MEMORY_SOURCE_FILE) {
if (qemuGetMemoryBackingPath(priv, "ram", &mem_path) < 0)
if (qemuDomainGetMemoryBackingPath(priv, "ram", &mem_path) < 0)
return -1;
}

View File

@ -1736,9 +1736,9 @@ qemuDomainSecretPrepare(virQEMUDriver *driver,
static int
qemuGetMemoryBackingDomainPath(qemuDomainObjPrivate *priv,
const virDomainDef *def,
char **path)
qemuDomainGenerateMemoryBackingPath(qemuDomainObjPrivate *priv,
const virDomainDef *def,
char **path)
{
virQEMUDriver *driver = priv->driver;
g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
@ -1760,7 +1760,7 @@ qemuGetMemoryBackingDomainPath(qemuDomainObjPrivate *priv,
/**
* qemuGetMemoryBackingPath:
* qemuDomainGetMemoryBackingPath:
* @priv: domain private data
* @alias: memory object alias
* @memPath: constructed path
@ -1771,9 +1771,9 @@ qemuGetMemoryBackingDomainPath(qemuDomainObjPrivate *priv,
* -1 otherwise (with error reported).
*/
int
qemuGetMemoryBackingPath(qemuDomainObjPrivate *priv,
const char *alias,
char **memPath)
qemuDomainGetMemoryBackingPath(qemuDomainObjPrivate *priv,
const char *alias,
char **memPath)
{
if (!alias) {
/* This should never happen (TM) */
@ -1804,8 +1804,8 @@ qemuDomainSetPrivatePathsOld(virQEMUDriver *driver,
cfg->channelTargetDir, vm->def->name);
if (!priv->memoryBackingDir &&
qemuGetMemoryBackingDomainPath(priv, vm->def,
&priv->memoryBackingDir) < 0)
qemuDomainGenerateMemoryBackingPath(priv, vm->def,
&priv->memoryBackingDir) < 0)
return -1;
return 0;
@ -1831,8 +1831,8 @@ qemuDomainSetPrivatePaths(virQEMUDriver *driver,
cfg->channelTargetDir, domname);
if (!priv->memoryBackingDir &&
qemuGetMemoryBackingDomainPath(priv, vm->def,
&priv->memoryBackingDir) < 0)
qemuDomainGenerateMemoryBackingPath(priv, vm->def,
&priv->memoryBackingDir) < 0)
return -1;
return 0;

View File

@ -939,9 +939,9 @@ void qemuDomainCleanupStorageSourceFD(virStorageSource *src);
void qemuDomainStartupCleanup(virDomainObj *vm);
int qemuGetMemoryBackingPath(qemuDomainObjPrivate *priv,
const char *alias,
char **memPath);
int qemuDomainGetMemoryBackingPath(qemuDomainObjPrivate *priv,
const char *alias,
char **memPath);
int qemuDomainSecretPrepare(virQEMUDriver *driver,
virDomainObj *vm)

View File

@ -4110,7 +4110,8 @@ qemuProcessDestroyMemoryBackingPath(virDomainObj *vm,
{
g_autofree char *path = NULL;
if (qemuGetMemoryBackingPath(QEMU_DOMAIN_PRIVATE(vm), mem->info.alias, &path) < 0)
if (qemuDomainGetMemoryBackingPath(QEMU_DOMAIN_PRIVATE(vm),
mem->info.alias, &path) < 0)
return -1;
if (unlink(path) < 0 &&