mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-28 11:21:44 +03:00
qemuDomainOpenFile: Take @cfg instead of driver
Again, we don't need full driver, just its config. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Pavel Hrdina <phrdina@redhat.com> Tested-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
e0dcdaefe2
commit
b5958b2863
@ -11511,7 +11511,7 @@ virQEMUFileOpenAs(uid_t fallback_uid,
|
||||
|
||||
/**
|
||||
* qemuDomainOpenFile:
|
||||
* @driver: driver object
|
||||
* @cfg: driver config object
|
||||
* @def: domain definition
|
||||
* @path: path to file to open
|
||||
* @oflags: flags for opening/creation of the file
|
||||
@ -11526,13 +11526,12 @@ virQEMUFileOpenAs(uid_t fallback_uid,
|
||||
* qemuDomainStorageFileInit and storage driver APIs if possible.
|
||||
**/
|
||||
int
|
||||
qemuDomainOpenFile(virQEMUDriver *driver,
|
||||
qemuDomainOpenFile(virQEMUDriverConfig *cfg,
|
||||
const virDomainDef *def,
|
||||
const char *path,
|
||||
int oflags,
|
||||
bool *needUnlink)
|
||||
{
|
||||
g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
|
||||
uid_t user = cfg->user;
|
||||
gid_t group = cfg->group;
|
||||
bool dynamicOwnership = cfg->dynamicOwnership;
|
||||
|
@ -1047,7 +1047,7 @@ int virQEMUFileOpenAs(uid_t fallback_uid,
|
||||
bool *needUnlink);
|
||||
|
||||
int
|
||||
qemuDomainOpenFile(virQEMUDriver *driver,
|
||||
qemuDomainOpenFile(virQEMUDriverConfig *cfg,
|
||||
const virDomainDef *def,
|
||||
const char *path,
|
||||
int oflags,
|
||||
|
@ -10808,7 +10808,7 @@ qemuDomainMemoryPeek(virDomainPtr dom,
|
||||
* reported) or -1 otherwise (errors are reported).
|
||||
*/
|
||||
static int
|
||||
qemuDomainStorageOpenStat(virQEMUDriver *driver,
|
||||
qemuDomainStorageOpenStat(virQEMUDriver *driver G_GNUC_UNUSED,
|
||||
virQEMUDriverConfig *cfg,
|
||||
virDomainObj *vm,
|
||||
virStorageSource *src,
|
||||
@ -10820,7 +10820,7 @@ qemuDomainStorageOpenStat(virQEMUDriver *driver,
|
||||
if (skipInaccessible && !virFileExists(src->path))
|
||||
return 0;
|
||||
|
||||
if ((*ret_fd = qemuDomainOpenFile(driver, vm->def, src->path, O_RDONLY,
|
||||
if ((*ret_fd = qemuDomainOpenFile(cfg, vm->def, src->path, O_RDONLY,
|
||||
NULL)) < 0)
|
||||
return -1;
|
||||
|
||||
|
@ -313,7 +313,7 @@ qemuSaveImageCreate(virQEMUDriver *driver,
|
||||
if (qemuDomainFileWrapperFDClose(vm, wrapperFd) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if ((fd = qemuDomainOpenFile(driver, vm->def, path, O_WRONLY, NULL)) < 0 ||
|
||||
if ((fd = qemuDomainOpenFile(cfg, vm->def, path, O_WRONLY, NULL)) < 0 ||
|
||||
virQEMUSaveDataFinish(data, &fd, path) < 0)
|
||||
goto cleanup;
|
||||
|
||||
@ -440,6 +440,7 @@ qemuSaveImageOpen(virQEMUDriver *driver,
|
||||
bool open_write,
|
||||
bool unlink_corrupt)
|
||||
{
|
||||
g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
|
||||
VIR_AUTOCLOSE fd = -1;
|
||||
int ret = -1;
|
||||
g_autoptr(virQEMUSaveData) data = NULL;
|
||||
@ -459,7 +460,7 @@ qemuSaveImageOpen(virQEMUDriver *driver,
|
||||
oflags |= directFlag;
|
||||
}
|
||||
|
||||
if ((fd = qemuDomainOpenFile(driver, NULL, path, oflags, NULL)) < 0)
|
||||
if ((fd = qemuDomainOpenFile(cfg, NULL, path, oflags, NULL)) < 0)
|
||||
return -1;
|
||||
|
||||
if (bypass_cache &&
|
||||
|
Loading…
Reference in New Issue
Block a user