mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06: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:
parent
34ce7e7e96
commit
e0dcdaefe2
@ -11512,7 +11512,7 @@ virQEMUFileOpenAs(uid_t fallback_uid,
|
|||||||
/**
|
/**
|
||||||
* qemuDomainOpenFile:
|
* qemuDomainOpenFile:
|
||||||
* @driver: driver object
|
* @driver: driver object
|
||||||
* @vm: domain object
|
* @def: domain definition
|
||||||
* @path: path to file to open
|
* @path: path to file to open
|
||||||
* @oflags: flags for opening/creation of the file
|
* @oflags: flags for opening/creation of the file
|
||||||
* @needUnlink: set to true if file was created by this function
|
* @needUnlink: set to true if file was created by this function
|
||||||
@ -11527,7 +11527,7 @@ virQEMUFileOpenAs(uid_t fallback_uid,
|
|||||||
**/
|
**/
|
||||||
int
|
int
|
||||||
qemuDomainOpenFile(virQEMUDriver *driver,
|
qemuDomainOpenFile(virQEMUDriver *driver,
|
||||||
virDomainObj *vm,
|
const virDomainDef *def,
|
||||||
const char *path,
|
const char *path,
|
||||||
int oflags,
|
int oflags,
|
||||||
bool *needUnlink)
|
bool *needUnlink)
|
||||||
@ -11539,8 +11539,8 @@ qemuDomainOpenFile(virQEMUDriver *driver,
|
|||||||
virSecurityLabelDef *seclabel;
|
virSecurityLabelDef *seclabel;
|
||||||
|
|
||||||
/* TODO: Take imagelabel into account? */
|
/* TODO: Take imagelabel into account? */
|
||||||
if (vm &&
|
if (def &&
|
||||||
(seclabel = virDomainDefGetSecurityLabelDef(vm->def, "dac")) != NULL &&
|
(seclabel = virDomainDefGetSecurityLabelDef(def, "dac")) != NULL &&
|
||||||
seclabel->label != NULL &&
|
seclabel->label != NULL &&
|
||||||
(virParseOwnershipIds(seclabel->label, &user, &group) < 0))
|
(virParseOwnershipIds(seclabel->label, &user, &group) < 0))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
@ -1048,7 +1048,7 @@ int virQEMUFileOpenAs(uid_t fallback_uid,
|
|||||||
|
|
||||||
int
|
int
|
||||||
qemuDomainOpenFile(virQEMUDriver *driver,
|
qemuDomainOpenFile(virQEMUDriver *driver,
|
||||||
virDomainObj *vm,
|
const virDomainDef *def,
|
||||||
const char *path,
|
const char *path,
|
||||||
int oflags,
|
int oflags,
|
||||||
bool *needUnlink);
|
bool *needUnlink);
|
||||||
|
@ -10820,7 +10820,7 @@ qemuDomainStorageOpenStat(virQEMUDriver *driver,
|
|||||||
if (skipInaccessible && !virFileExists(src->path))
|
if (skipInaccessible && !virFileExists(src->path))
|
||||||
return 0;
|
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)
|
NULL)) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
@ -313,7 +313,7 @@ qemuSaveImageCreate(virQEMUDriver *driver,
|
|||||||
if (qemuDomainFileWrapperFDClose(vm, wrapperFd) < 0)
|
if (qemuDomainFileWrapperFDClose(vm, wrapperFd) < 0)
|
||||||
goto cleanup;
|
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)
|
virQEMUSaveDataFinish(data, &fd, path) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user