[PATCH 1/8] qemu: Move domain-related functions to qemu_domain

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

 



Signed-off-by: Martin Kletzander <mkletzan@xxxxxxxxxx>
---
 src/qemu/qemu_conf.c   | 58 ------------------------------------------
 src/qemu/qemu_conf.h   |  8 ------
 src/qemu/qemu_domain.c | 58 ++++++++++++++++++++++++++++++++++++++++++
 src/qemu/qemu_domain.h |  8 ++++++
 4 files changed, 66 insertions(+), 66 deletions(-)

diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index b36bede6c3c6..0d90a8739202 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -1603,64 +1603,6 @@ qemuGetDomainHupageMemPath(virQEMUDriver *driver,
 }
 
 
-int
-qemuGetMemoryBackingDomainPath(virQEMUDriver *driver,
-                               const virDomainDef *def,
-                               char **path)
-{
-    g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
-    const char *root = driver->embeddedRoot;
-    g_autofree char *shortName = NULL;
-
-    if (!(shortName = virDomainDefGetShortName(def)))
-        return -1;
-
-    if (root && !STRPREFIX(cfg->memoryBackingDir, root)) {
-        g_autofree char * hash = virDomainDriverGenerateRootHash("qemu", root);
-        *path = g_strdup_printf("%s/%s-%s", cfg->memoryBackingDir, hash, shortName);
-    } else {
-        *path = g_strdup_printf("%s/%s", cfg->memoryBackingDir, shortName);
-    }
-
-    return 0;
-}
-
-
-/**
- * qemuGetMemoryBackingPath:
- * @driver: the qemu driver
- * @def: domain definition
- * @alias: memory object alias
- * @memPath: constructed path
- *
- * Constructs path to memory backing dir and stores it at @memPath.
- *
- * Returns: 0 on success,
- *          -1 otherwise (with error reported).
- */
-int
-qemuGetMemoryBackingPath(virQEMUDriver *driver,
-                         const virDomainDef *def,
-                         const char *alias,
-                         char **memPath)
-{
-    g_autofree char *domainPath = NULL;
-
-    if (!alias) {
-        /* This should never happen (TM) */
-        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                       _("memory device alias is not assigned"));
-        return -1;
-    }
-
-    if (qemuGetMemoryBackingDomainPath(driver, def, &domainPath) < 0)
-        return -1;
-
-    *memPath = g_strdup_printf("%s/%s", domainPath, alias);
-    return 0;
-}
-
-
 int
 qemuHugepageMakeBasedir(virQEMUDriver *driver,
                         virHugeTLBFS *hugepage)
diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h
index aa1e1a626c1a..c98b6137c1fd 100644
--- a/src/qemu/qemu_conf.h
+++ b/src/qemu/qemu_conf.h
@@ -368,14 +368,6 @@ int qemuGetDomainHupageMemPath(virQEMUDriver *driver,
                                unsigned long long pagesize,
                                char **memPath);
 
-int qemuGetMemoryBackingDomainPath(virQEMUDriver *driver,
-                                   const virDomainDef *def,
-                                   char **path);
-int qemuGetMemoryBackingPath(virQEMUDriver *driver,
-                             const virDomainDef *def,
-                             const char *alias,
-                             char **memPath);
-
 int qemuHugepageMakeBasedir(virQEMUDriver *driver,
                             virHugeTLBFS *hugepage);
 
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index ed305d9427f5..550ab5046f00 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -13143,3 +13143,61 @@ qemuDomainStorageUpdatePhysical(virQEMUDriverConfig *cfg,
 
     return ret;
 }
+
+
+int
+qemuGetMemoryBackingDomainPath(virQEMUDriver *driver,
+                               const virDomainDef *def,
+                               char **path)
+{
+    g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
+    const char *root = driver->embeddedRoot;
+    g_autofree char *shortName = NULL;
+
+    if (!(shortName = virDomainDefGetShortName(def)))
+        return -1;
+
+    if (root && !STRPREFIX(cfg->memoryBackingDir, root)) {
+        g_autofree char * hash = virDomainDriverGenerateRootHash("qemu", root);
+        *path = g_strdup_printf("%s/%s-%s", cfg->memoryBackingDir, hash, shortName);
+    } else {
+        *path = g_strdup_printf("%s/%s", cfg->memoryBackingDir, shortName);
+    }
+
+    return 0;
+}
+
+
+/**
+ * qemuGetMemoryBackingPath:
+ * @driver: the qemu driver
+ * @def: domain definition
+ * @alias: memory object alias
+ * @memPath: constructed path
+ *
+ * Constructs path to memory backing dir and stores it at @memPath.
+ *
+ * Returns: 0 on success,
+ *          -1 otherwise (with error reported).
+ */
+int
+qemuGetMemoryBackingPath(virQEMUDriver *driver,
+                         const virDomainDef *def,
+                         const char *alias,
+                         char **memPath)
+{
+    g_autofree char *domainPath = NULL;
+
+    if (!alias) {
+        /* This should never happen (TM) */
+        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                       _("memory device alias is not assigned"));
+        return -1;
+    }
+
+    if (qemuGetMemoryBackingDomainPath(driver, def, &domainPath) < 0)
+        return -1;
+
+    *memPath = g_strdup_printf("%s/%s", domainPath, alias);
+    return 0;
+}
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index d799f6c08676..e06ee60f4cd9 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -1168,3 +1168,11 @@ int
 qemuDomainStorageUpdatePhysical(virQEMUDriverConfig *cfg,
                                 virDomainObj *vm,
                                 virStorageSource *src);
+
+int qemuGetMemoryBackingDomainPath(virQEMUDriver *driver,
+                                   const virDomainDef *def,
+                                   char **path);
+int qemuGetMemoryBackingPath(virQEMUDriver *driver,
+                             const virDomainDef *def,
+                             const char *alias,
+                             char **memPath);
-- 
2.46.0




[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