[PATCH 2/4] qemuDomainOpenFile: Take virDomainDef instead of virDomainObj

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 src/qemu/qemu_domain.c    | 8 ++++----
 src/qemu/qemu_domain.h    | 2 +-
 src/qemu/qemu_driver.c    | 2 +-
 src/qemu/qemu_saveimage.c | 2 +-
 4 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 6f8c93ea0c..5a88e82856 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -11503,7 +11503,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
@@ -11518,7 +11518,7 @@ virQEMUFileOpenAs(uid_t fallback_uid,
  **/
 int
 qemuDomainOpenFile(virQEMUDriver *driver,
-                   virDomainObj *vm,
+                   const virDomainDef *def,
                    const char *path,
                    int oflags,
                    bool *needUnlink)
@@ -11530,8 +11530,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;
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index acf6ca5ab6..63f657fa49 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -1046,7 +1046,7 @@ int virQEMUFileOpenAs(uid_t fallback_uid,
 
 int
 qemuDomainOpenFile(virQEMUDriver *driver,
-                   virDomainObj *vm,
+                   const virDomainDef *def,
                    const char *path,
                    int oflags,
                    bool *needUnlink);
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index a7d76dd00f..d432c69dae 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -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;
 
diff --git a/src/qemu/qemu_saveimage.c b/src/qemu/qemu_saveimage.c
index b4af80f942..f93454c761 100644
--- a/src/qemu/qemu_saveimage.c
+++ b/src/qemu/qemu_saveimage.c
@@ -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;
 
-- 
2.31.1




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux