/**
* 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
**/
int
qemuDomainOpenFile(virQEMUDriver *driver,
- virDomainObj *vm,
+ const virDomainDef *def,
const char *path,
int oflags,
bool *needUnlink)
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;
int
qemuDomainOpenFile(virQEMUDriver *driver,
- virDomainObj *vm,
+ const virDomainDef *def,
const char *path,
int oflags,
bool *needUnlink);
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;
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;