1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-28 11:21:44 +03:00

qemuDomainOpenFile: Take virDomainDef instead of virDomainObj

The function doesn't really need domain object, but domain
definition from which it takes seclabels.

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:
Michal Privoznik 2021-08-06 10:31:22 +02:00
parent 34ce7e7e96
commit e0dcdaefe2
4 changed files with 7 additions and 7 deletions

View File

@ -11512,7 +11512,7 @@ virQEMUFileOpenAs(uid_t fallback_uid,
/**
* qemuDomainOpenFile:
* @driver: driver object
* @vm: domain object
* @def: domain definition
* @path: path to file to open
* @oflags: flags for opening/creation of the file
* @needUnlink: set to true if file was created by this function
@ -11527,7 +11527,7 @@ virQEMUFileOpenAs(uid_t fallback_uid,
**/
int
qemuDomainOpenFile(virQEMUDriver *driver,
virDomainObj *vm,
const virDomainDef *def,
const char *path,
int oflags,
bool *needUnlink)
@ -11539,8 +11539,8 @@ qemuDomainOpenFile(virQEMUDriver *driver,
virSecurityLabelDef *seclabel;
/* TODO: Take imagelabel into account? */
if (vm &&
(seclabel = virDomainDefGetSecurityLabelDef(vm->def, "dac")) != NULL &&
if (def &&
(seclabel = virDomainDefGetSecurityLabelDef(def, "dac")) != NULL &&
seclabel->label != NULL &&
(virParseOwnershipIds(seclabel->label, &user, &group) < 0))
return -EINVAL;

View File

@ -1048,7 +1048,7 @@ int virQEMUFileOpenAs(uid_t fallback_uid,
int
qemuDomainOpenFile(virQEMUDriver *driver,
virDomainObj *vm,
const virDomainDef *def,
const char *path,
int oflags,
bool *needUnlink);

View File

@ -10820,7 +10820,7 @@ qemuDomainStorageOpenStat(virQEMUDriver *driver,
if (skipInaccessible && !virFileExists(src->path))
return 0;
if ((*ret_fd = qemuDomainOpenFile(driver, vm, src->path, O_RDONLY,
if ((*ret_fd = qemuDomainOpenFile(driver, vm->def, src->path, O_RDONLY,
NULL)) < 0)
return -1;

View File

@ -313,7 +313,7 @@ qemuSaveImageCreate(virQEMUDriver *driver,
if (qemuDomainFileWrapperFDClose(vm, wrapperFd) < 0)
goto cleanup;
if ((fd = qemuDomainOpenFile(driver, vm, path, O_WRONLY, NULL)) < 0 ||
if ((fd = qemuDomainOpenFile(driver, vm->def, path, O_WRONLY, NULL)) < 0 ||
virQEMUSaveDataFinish(data, &fd, path) < 0)
goto cleanup;