qemu: Change parameters of qemuGetMemoryBackingDomainPath()

This way it does not use driver, since it will be later reworked and the
following patches cleaner, hopefully.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Martin Kletzander 2024-09-18 09:29:43 +02:00
parent edcf14be9c
commit c9a35eb255
6 changed files with 16 additions and 16 deletions

View File

@ -3222,7 +3222,7 @@ 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->driver, def, mem->info.alias, &memPath) < 0)
if (qemuGetMemoryBackingPath(priv, def, mem->info.alias, &memPath) < 0)
return -1;
}
@ -7116,7 +7116,7 @@ qemuBuildMemPathStr(const virDomainDef *def,
return -1;
prealloc = true;
} else if (def->mem.source == VIR_DOMAIN_MEMORY_SOURCE_FILE) {
if (qemuGetMemoryBackingPath(priv->driver, def, "ram", &mem_path) < 0)
if (qemuGetMemoryBackingPath(priv, def, "ram", &mem_path) < 0)
return -1;
}

View File

@ -1736,10 +1736,11 @@ qemuDomainSecretPrepare(virQEMUDriver *driver,
int
qemuGetMemoryBackingDomainPath(virQEMUDriver *driver,
qemuGetMemoryBackingDomainPath(qemuDomainObjPrivate *priv,
const virDomainDef *def,
char **path)
{
virQEMUDriver *driver = priv->driver;
g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
const char *root = driver->embeddedRoot;
g_autofree char *shortName = NULL;
@ -1760,7 +1761,7 @@ qemuGetMemoryBackingDomainPath(virQEMUDriver *driver,
/**
* qemuGetMemoryBackingPath:
* @driver: the qemu driver
* @priv: domain private data
* @def: domain definition
* @alias: memory object alias
* @memPath: constructed path
@ -1771,7 +1772,7 @@ qemuGetMemoryBackingDomainPath(virQEMUDriver *driver,
* -1 otherwise (with error reported).
*/
int
qemuGetMemoryBackingPath(virQEMUDriver *driver,
qemuGetMemoryBackingPath(qemuDomainObjPrivate *priv,
const virDomainDef *def,
const char *alias,
char **memPath)
@ -1785,7 +1786,7 @@ qemuGetMemoryBackingPath(virQEMUDriver *driver,
return -1;
}
if (qemuGetMemoryBackingDomainPath(driver, def, &domainPath) < 0)
if (qemuGetMemoryBackingDomainPath(priv, def, &domainPath) < 0)
return -1;
*memPath = g_strdup_printf("%s/%s", domainPath, alias);

View File

@ -936,11 +936,12 @@ void qemuDomainCleanupStorageSourceFD(virStorageSource *src);
void qemuDomainStartupCleanup(virDomainObj *vm);
int qemuGetMemoryBackingDomainPath(virQEMUDriver *driver,
int qemuGetMemoryBackingDomainPath(qemuDomainObjPrivate *priv,
const virDomainDef *def,
char **path);
int qemuGetMemoryBackingPath(virQEMUDriver *driver,
int qemuGetMemoryBackingPath(qemuDomainObjPrivate *priv,
const virDomainDef *def,
const char *alias,
char **memPath);

View File

@ -2404,7 +2404,7 @@ qemuDomainAttachMemory(virQEMUDriver *driver,
qemuDomainObjExitMonitor(vm);
if (objAdded && mem)
ignore_value(qemuProcessDestroyMemoryBackingPath(driver, vm, mem));
ignore_value(qemuProcessDestroyMemoryBackingPath(vm, mem));
virErrorRestore(&orig_err);
if (!mem)
@ -4761,7 +4761,7 @@ qemuDomainRemoveMemoryDevice(virQEMUDriver *driver,
if (qemuDomainNamespaceTeardownMemory(vm, mem) < 0)
VIR_WARN("Unable to remove memory device from /dev");
if (qemuProcessDestroyMemoryBackingPath(driver, vm, mem) < 0)
if (qemuProcessDestroyMemoryBackingPath(vm, mem) < 0)
VIR_WARN("Unable to destroy memory backing path");
qemuDomainReleaseMemoryDeviceSlot(vm, mem);

View File

@ -4095,7 +4095,7 @@ qemuProcessBuildDestroyMemoryPaths(virQEMUDriver *driver,
if (!build || shouldBuildMB) {
g_autofree char *path = NULL;
if (qemuGetMemoryBackingDomainPath(driver, vm->def, &path) < 0)
if (qemuGetMemoryBackingDomainPath(QEMU_DOMAIN_PRIVATE(vm), vm->def, &path) < 0)
return -1;
if (qemuProcessBuildDestroyMemoryPathsImpl(driver, vm,
@ -4108,13 +4108,12 @@ qemuProcessBuildDestroyMemoryPaths(virQEMUDriver *driver,
int
qemuProcessDestroyMemoryBackingPath(virQEMUDriver *driver,
virDomainObj *vm,
qemuProcessDestroyMemoryBackingPath(virDomainObj *vm,
virDomainMemoryDef *mem)
{
g_autofree char *path = NULL;
if (qemuGetMemoryBackingPath(driver, vm->def, mem->info.alias, &path) < 0)
if (qemuGetMemoryBackingPath(QEMU_DOMAIN_PRIVATE(vm), vm->def, mem->info.alias, &path) < 0)
return -1;
if (unlink(path) < 0 &&

View File

@ -43,8 +43,7 @@ int qemuProcessBuildDestroyMemoryPaths(virQEMUDriver *driver,
virDomainMemoryDef *mem,
bool build);
int qemuProcessDestroyMemoryBackingPath(virQEMUDriver *driver,
virDomainObj *vm,
int qemuProcessDestroyMemoryBackingPath(virDomainObj *vm,
virDomainMemoryDef *mem);
void qemuProcessReconnectAll(virQEMUDriver *driver);