[PATCH 3/4] qemuDomainOpenFile: Take @cfg instead of driver

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

 



Again, we don't need full driver, just its config.

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

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 5a88e82856..2aa346744d 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -11502,7 +11502,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
@@ -11517,13 +11517,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;
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index 63f657fa49..d470dc3822 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -1045,7 +1045,7 @@ int virQEMUFileOpenAs(uid_t fallback_uid,
                       bool *needUnlink);
 
 int
-qemuDomainOpenFile(virQEMUDriver *driver,
+qemuDomainOpenFile(virQEMUDriverConfig *cfg,
                    const virDomainDef *def,
                    const char *path,
                    int oflags,
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index d432c69dae..ed3af5a619 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -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;
 
diff --git a/src/qemu/qemu_saveimage.c b/src/qemu/qemu_saveimage.c
index f93454c761..e14e2987f1 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->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 &&
-- 
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