[PATCH 3/9] qemu: Move functions around

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

 



Make sure related functions, eg. all qemuDomainIs*(), are
close together instead of being sprinkled throughout both
the header and implementation file, and also that all
qemuDomainMachine*() functions are declared first since
we're going to make a bunch of them static later on.

Signed-off-by: Andrea Bolognani <abologna@xxxxxxxxxx>
---
 src/qemu/qemu_domain.c | 148 ++++++++++++++++++++---------------------
 src/qemu/qemu_domain.h |  24 +++----
 2 files changed, 86 insertions(+), 86 deletions(-)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 073f5cc86c..bae49e97a4 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -9870,13 +9870,6 @@ qemuFindAgentConfig(virDomainDefPtr def)
 }
 
 
-bool
-qemuDomainIsQ35(const virDomainDef *def)
-{
-    return qemuDomainMachineIsQ35(def->os.machine);
-}
-
-
 bool
 qemuDomainMachineIsQ35(const char *machine)
 {
@@ -9885,13 +9878,6 @@ qemuDomainMachineIsQ35(const char *machine)
 }
 
 
-bool
-qemuDomainIsI440FX(const virDomainDef *def)
-{
-    return qemuDomainMachineIsI440FX(def->os.machine);
-}
-
-
 bool
 qemuDomainMachineIsI440FX(const char *machine)
 {
@@ -9904,14 +9890,23 @@ qemuDomainMachineIsI440FX(const char *machine)
 
 
 bool
-qemuDomainHasPCIRoot(const virDomainDef *def)
+qemuDomainMachineIsS390CCW(const char *machine)
 {
-    int root = virDomainControllerFind(def, VIR_DOMAIN_CONTROLLER_TYPE_PCI, 0);
+    return STRPREFIX(machine, "s390-ccw");
+}
 
-    if (root < 0)
+
+bool
+qemuDomainMachineIsARMVirt(const char *machine,
+                           const virArch arch)
+{
+    if (arch != VIR_ARCH_ARMV6L &&
+        arch != VIR_ARCH_ARMV7L &&
+        arch != VIR_ARCH_AARCH64)
         return false;
 
-    if (def->controllers[root]->model != VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT)
+    if (STRNEQ(machine, "virt") &&
+        !STRPREFIX(machine, "virt-"))
         return false;
 
     return true;
@@ -9919,14 +9914,29 @@ qemuDomainHasPCIRoot(const virDomainDef *def)
 
 
 bool
-qemuDomainHasPCIeRoot(const virDomainDef *def)
+qemuDomainMachineIsRISCVVirt(const char *machine,
+                             const virArch arch)
 {
-    int root = virDomainControllerFind(def, VIR_DOMAIN_CONTROLLER_TYPE_PCI, 0);
+    if (!ARCH_IS_RISCV(arch))
+        return false;
 
-    if (root < 0)
+    if (STRNEQ(machine, "virt") &&
+        !STRPREFIX(machine, "virt-"))
         return false;
 
-    if (def->controllers[root]->model != VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT)
+    return true;
+}
+
+
+bool
+qemuDomainMachineIsPSeries(const char *machine,
+                           const virArch arch)
+{
+    if (!ARCH_IS_PPC64(arch))
+        return false;
+
+    if (STRNEQ(machine, "pseries") &&
+        !STRPREFIX(machine, "pseries-"))
         return false;
 
     return true;
@@ -9934,9 +9944,12 @@ qemuDomainHasPCIeRoot(const virDomainDef *def)
 
 
 bool
-qemuDomainNeedsFDC(const virDomainDef *def)
+qemuDomainMachineHasBuiltinIDE(const char *machine)
 {
-    return qemuDomainMachineNeedsFDC(def->os.machine);
+    return qemuDomainMachineIsI440FX(machine) ||
+        STREQ(machine, "malta") ||
+        STREQ(machine, "sun4u") ||
+        STREQ(machine, "g3beige");
 }
 
 
@@ -9959,40 +9972,30 @@ qemuDomainMachineNeedsFDC(const char *machine)
 
 
 bool
-qemuDomainIsS390CCW(const virDomainDef *def)
+qemuDomainIsQ35(const virDomainDef *def)
 {
-    return qemuDomainMachineIsS390CCW(def->os.machine);
+    return qemuDomainMachineIsQ35(def->os.machine);
 }
 
 
 bool
-qemuDomainMachineIsS390CCW(const char *machine)
+qemuDomainIsI440FX(const virDomainDef *def)
 {
-    return STRPREFIX(machine, "s390-ccw");
+    return qemuDomainMachineIsI440FX(def->os.machine);
 }
 
 
 bool
-qemuDomainIsARMVirt(const virDomainDef *def)
+qemuDomainIsS390CCW(const virDomainDef *def)
 {
-    return qemuDomainMachineIsARMVirt(def->os.machine, def->os.arch);
+    return qemuDomainMachineIsS390CCW(def->os.machine);
 }
 
 
 bool
-qemuDomainMachineIsARMVirt(const char *machine,
-                           const virArch arch)
+qemuDomainIsARMVirt(const virDomainDef *def)
 {
-    if (arch != VIR_ARCH_ARMV6L &&
-        arch != VIR_ARCH_ARMV7L &&
-        arch != VIR_ARCH_AARCH64)
-        return false;
-
-    if (STRNEQ(machine, "virt") &&
-        !STRPREFIX(machine, "virt-"))
-        return false;
-
-    return true;
+    return qemuDomainMachineIsARMVirt(def->os.machine, def->os.arch);
 }
 
 
@@ -10004,14 +10007,21 @@ qemuDomainIsRISCVVirt(const virDomainDef *def)
 
 
 bool
-qemuDomainMachineIsRISCVVirt(const char *machine,
-                             const virArch arch)
+qemuDomainIsPSeries(const virDomainDef *def)
 {
-    if (!ARCH_IS_RISCV(arch))
+    return qemuDomainMachineIsPSeries(def->os.machine, def->os.arch);
+}
+
+
+bool
+qemuDomainHasPCIRoot(const virDomainDef *def)
+{
+    int root = virDomainControllerFind(def, VIR_DOMAIN_CONTROLLER_TYPE_PCI, 0);
+
+    if (root < 0)
         return false;
 
-    if (STRNEQ(machine, "virt") &&
-        !STRPREFIX(machine, "virt-"))
+    if (def->controllers[root]->model != VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT)
         return false;
 
     return true;
@@ -10019,24 +10029,31 @@ qemuDomainMachineIsRISCVVirt(const char *machine,
 
 
 bool
-qemuDomainIsPSeries(const virDomainDef *def)
+qemuDomainHasPCIeRoot(const virDomainDef *def)
 {
-    return qemuDomainMachineIsPSeries(def->os.machine, def->os.arch);
+    int root = virDomainControllerFind(def, VIR_DOMAIN_CONTROLLER_TYPE_PCI, 0);
+
+    if (root < 0)
+        return false;
+
+    if (def->controllers[root]->model != VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT)
+        return false;
+
+    return true;
 }
 
 
 bool
-qemuDomainMachineIsPSeries(const char *machine,
-                           const virArch arch)
+qemuDomainHasBuiltinIDE(const virDomainDef *def)
 {
-    if (!ARCH_IS_PPC64(arch))
-        return false;
+    return qemuDomainMachineHasBuiltinIDE(def->os.machine);
+}
 
-    if (STRNEQ(machine, "pseries") &&
-        !STRPREFIX(machine, "pseries-"))
-        return false;
 
-    return true;
+bool
+qemuDomainNeedsFDC(const virDomainDef *def)
+{
+    return qemuDomainMachineNeedsFDC(def->os.machine);
 }
 
 
@@ -10234,23 +10251,6 @@ qemuDomainDefValidateMemoryHotplug(const virDomainDef *def,
 }
 
 
-bool
-qemuDomainHasBuiltinIDE(const virDomainDef *def)
-{
-    return qemuDomainMachineHasBuiltinIDE(def->os.machine);
-}
-
-
-bool
-qemuDomainMachineHasBuiltinIDE(const char *machine)
-{
-    return qemuDomainMachineIsI440FX(machine) ||
-        STREQ(machine, "malta") ||
-        STREQ(machine, "sun4u") ||
-        STREQ(machine, "g3beige");
-}
-
-
 /**
  * qemuDomainUpdateCurrentMemorySize:
  *
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index fe474170dc..0bd4408f12 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -828,20 +828,8 @@ void qemuDomainMemoryDeviceAlignSize(virDomainDefPtr def,
 
 virDomainChrDefPtr qemuFindAgentConfig(virDomainDefPtr def);
 
-bool qemuDomainIsQ35(const virDomainDef *def);
-bool qemuDomainIsI440FX(const virDomainDef *def);
-bool qemuDomainHasPCIRoot(const virDomainDef *def);
-bool qemuDomainHasPCIeRoot(const virDomainDef *def);
-bool qemuDomainNeedsFDC(const virDomainDef *def);
-bool qemuDomainIsS390CCW(const virDomainDef *def);
-bool qemuDomainIsARMVirt(const virDomainDef *def);
-bool qemuDomainIsRISCVVirt(const virDomainDef *def);
-bool qemuDomainIsPSeries(const virDomainDef *def);
-bool qemuDomainHasBuiltinIDE(const virDomainDef *def);
-
 bool qemuDomainMachineIsQ35(const char *machine);
 bool qemuDomainMachineIsI440FX(const char *machine);
-bool qemuDomainMachineNeedsFDC(const char *machine);
 bool qemuDomainMachineIsS390CCW(const char *machine);
 bool qemuDomainMachineIsARMVirt(const char *machine,
                                 const virArch arch);
@@ -850,6 +838,18 @@ bool qemuDomainMachineIsRISCVVirt(const char *machine,
 bool qemuDomainMachineIsPSeries(const char *machine,
                                 const virArch arch);
 bool qemuDomainMachineHasBuiltinIDE(const char *machine);
+bool qemuDomainMachineNeedsFDC(const char *machine);
+
+bool qemuDomainIsQ35(const virDomainDef *def);
+bool qemuDomainIsI440FX(const virDomainDef *def);
+bool qemuDomainIsS390CCW(const virDomainDef *def);
+bool qemuDomainIsARMVirt(const virDomainDef *def);
+bool qemuDomainIsRISCVVirt(const virDomainDef *def);
+bool qemuDomainIsPSeries(const virDomainDef *def);
+bool qemuDomainHasPCIRoot(const virDomainDef *def);
+bool qemuDomainHasPCIeRoot(const virDomainDef *def);
+bool qemuDomainHasBuiltinIDE(const virDomainDef *def);
+bool qemuDomainNeedsFDC(const virDomainDef *def);
 
 int qemuDomainUpdateCurrentMemorySize(virQEMUDriverPtr driver,
                                       virDomainObjPtr vm);
-- 
2.20.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[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