[PATCH v3 06/16] numatune: unify numatune struct and enum names

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

 



Since there was already public virDomainNumatune*, I changed the
private virNumaTune to match the same, so all the uses are unified and
public API is kept:

s/vir\(Domain\)\?Numa[tT]une/virDomainNumatune/g

then shrunk long lines, and mainly functions, that were created after
that:

sed -i 's/virDomainNumatuneMemPlacementMode/virDomainNumatunePlacement/g'

And to cope with the enum name, I haad to change the constants as
well:

s/VIR_NUMA_TUNE_MEM_PLACEMENT_MODE/VIR_DOMAIN_NUMATUNE_PLACEMENT/g

Last thing I did was at least a little shortening of already long
name:

s/virDomainNumatuneDef/virDomainNumatune/g

Signed-off-by: Martin Kletzander <mkletzan@xxxxxxxxxx>
---
 src/conf/domain_conf.c   | 20 ++++++++++----------
 src/conf/domain_conf.h   |  2 +-
 src/conf/numatune_conf.c |  4 ++--
 src/conf/numatune_conf.h | 20 ++++++++++----------
 src/libvirt_private.syms |  4 ++--
 src/lxc/lxc_cgroup.c     |  4 ++--
 src/lxc/lxc_controller.c |  2 +-
 src/lxc/lxc_native.c     |  2 +-
 src/qemu/qemu_cgroup.c   |  4 ++--
 src/qemu/qemu_driver.c   | 10 +++++-----
 src/qemu/qemu_process.c  |  2 +-
 src/util/virnuma.c       |  8 ++++----
 src/util/virnuma.h       |  2 +-
 13 files changed, 42 insertions(+), 42 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 315ea6a..f83050d 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -11773,7 +11773,7 @@ virDomainDefParseXML(xmlDocPtr xml,
                     int placement_mode = 0;
                     if (placement) {
                         if ((placement_mode =
-                             virNumaTuneMemPlacementModeTypeFromString(placement)) < 0) {
+                             virDomainNumatunePlacementTypeFromString(placement)) < 0) {
                             virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                                            _("Unsupported memory placement "
                                              "mode '%s'"), placement);
@@ -11783,18 +11783,18 @@ virDomainDefParseXML(xmlDocPtr xml,
                         VIR_FREE(placement);
                     } else if (def->numatune.memory.nodemask) {
                         /* Defaults to "static" if nodeset is specified. */
-                        placement_mode = VIR_NUMA_TUNE_MEM_PLACEMENT_MODE_STATIC;
+                        placement_mode = VIR_DOMAIN_NUMATUNE_PLACEMENT_STATIC;
                     } else {
                         /* Defaults to "placement" of <vcpu> if nodeset is
                          * not specified.
                          */
                         if (def->placement_mode == VIR_DOMAIN_CPU_PLACEMENT_MODE_STATIC)
-                            placement_mode = VIR_NUMA_TUNE_MEM_PLACEMENT_MODE_STATIC;
+                            placement_mode = VIR_DOMAIN_NUMATUNE_PLACEMENT_STATIC;
                         else
-                            placement_mode = VIR_NUMA_TUNE_MEM_PLACEMENT_MODE_AUTO;
+                            placement_mode = VIR_DOMAIN_NUMATUNE_PLACEMENT_AUTO;
                     }

-                    if (placement_mode == VIR_NUMA_TUNE_MEM_PLACEMENT_MODE_STATIC &&
+                    if (placement_mode == VIR_DOMAIN_NUMATUNE_PLACEMENT_STATIC &&
                         !def->numatune.memory.nodemask) {
                         virReportError(VIR_ERR_XML_ERROR, "%s",
                                        _("nodeset for NUMA memory tuning must be set "
@@ -11803,7 +11803,7 @@ virDomainDefParseXML(xmlDocPtr xml,
                     }

                     /* Ignore 'nodeset' if 'placement' is 'auto' finally */
-                    if (placement_mode == VIR_NUMA_TUNE_MEM_PLACEMENT_MODE_AUTO) {
+                    if (placement_mode == VIR_DOMAIN_NUMATUNE_PLACEMENT_AUTO) {
                         virBitmapFree(def->numatune.memory.nodemask);
                         def->numatune.memory.nodemask = NULL;
                     }
@@ -11811,7 +11811,7 @@ virDomainDefParseXML(xmlDocPtr xml,
                     /* Copy 'placement' of <numatune> to <vcpu> if its 'placement'
                      * is not specified and 'placement' of <numatune> is specified.
                      */
-                    if (placement_mode == VIR_NUMA_TUNE_MEM_PLACEMENT_MODE_AUTO &&
+                    if (placement_mode == VIR_DOMAIN_NUMATUNE_PLACEMENT_AUTO &&
                         !def->cpumask)
                         def->placement_mode = VIR_DOMAIN_CPU_PLACEMENT_MODE_AUTO;

@@ -11830,7 +11830,7 @@ virDomainDefParseXML(xmlDocPtr xml,
          * and 'placement' of <vcpu> is 'auto'.
          */
         if (def->placement_mode == VIR_DOMAIN_CPU_PLACEMENT_MODE_AUTO) {
-            def->numatune.memory.placement_mode = VIR_NUMA_TUNE_MEM_PLACEMENT_MODE_AUTO;
+            def->numatune.memory.placement_mode = VIR_DOMAIN_NUMATUNE_PLACEMENT_AUTO;
             def->numatune.memory.mode = VIR_DOMAIN_NUMATUNE_MEM_STRICT;
         }
     }
@@ -17452,13 +17452,13 @@ virDomainDefFormatInternal(virDomainDefPtr def,
         virBufferAsprintf(buf, "<memory mode='%s' ", mode);

         if (def->numatune.memory.placement_mode ==
-            VIR_NUMA_TUNE_MEM_PLACEMENT_MODE_STATIC) {
+            VIR_DOMAIN_NUMATUNE_PLACEMENT_STATIC) {
             if (!(nodemask = virBitmapFormat(def->numatune.memory.nodemask)))
                 goto error;
             virBufferAsprintf(buf, "nodeset='%s'/>\n", nodemask);
             VIR_FREE(nodemask);
         } else if (def->numatune.memory.placement_mode) {
-            placement = virNumaTuneMemPlacementModeTypeToString(def->numatune.memory.placement_mode);
+            placement = virDomainNumatunePlacementTypeToString(def->numatune.memory.placement_mode);
             virBufferAsprintf(buf, "placement='%s'/>\n", placement);
         }
         virBufferAdjustIndent(buf, -2);
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index fc7680c..b0ac6b4 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1891,7 +1891,7 @@ struct _virDomainDef {
         virDomainVcpuPinDefPtr emulatorpin;
     } cputune;

-    virNumaTuneDef numatune;
+    virDomainNumatune numatune;
     virDomainResourceDefPtr resource;
     virDomainIdMapDef idmap;

diff --git a/src/conf/numatune_conf.c b/src/conf/numatune_conf.c
index e9be040..14300f0 100644
--- a/src/conf/numatune_conf.c
+++ b/src/conf/numatune_conf.c
@@ -30,8 +30,8 @@ VIR_ENUM_IMPL(virDomainNumatuneMemMode,
               "preferred",
               "interleave");

-VIR_ENUM_IMPL(virNumaTuneMemPlacementMode,
-              VIR_NUMA_TUNE_MEM_PLACEMENT_MODE_LAST,
+VIR_ENUM_IMPL(virDomainNumatunePlacement,
+              VIR_DOMAIN_NUMATUNE_PLACEMENT_LAST,
               "default",
               "static",
               "auto");
diff --git a/src/conf/numatune_conf.h b/src/conf/numatune_conf.h
index 6bdfdc0..baac7bf 100644
--- a/src/conf/numatune_conf.h
+++ b/src/conf/numatune_conf.h
@@ -28,24 +28,24 @@
 # include "virbitmap.h"

 typedef enum {
-    VIR_NUMA_TUNE_MEM_PLACEMENT_MODE_DEFAULT = 0,
-    VIR_NUMA_TUNE_MEM_PLACEMENT_MODE_STATIC,
-    VIR_NUMA_TUNE_MEM_PLACEMENT_MODE_AUTO,
+    VIR_DOMAIN_NUMATUNE_PLACEMENT_DEFAULT = 0,
+    VIR_DOMAIN_NUMATUNE_PLACEMENT_STATIC,
+    VIR_DOMAIN_NUMATUNE_PLACEMENT_AUTO,

-    VIR_NUMA_TUNE_MEM_PLACEMENT_MODE_LAST
-} virDomainNumaTuneMemPlacementMode;
+    VIR_DOMAIN_NUMATUNE_PLACEMENT_LAST
+} virDomainNumatunePlacement;

-VIR_ENUM_DECL(virNumaTuneMemPlacementMode)
+VIR_ENUM_DECL(virDomainNumatunePlacement)

 VIR_ENUM_DECL(virDomainNumatuneMemMode)

-typedef struct _virNumaTuneDef virNumaTuneDef;
-typedef virNumaTuneDef *virNumaTuneDefPtr;
-struct _virNumaTuneDef {
+typedef struct _virDomainNumatune virDomainNumatune;
+typedef virDomainNumatune *virDomainNumatunePtr;
+struct _virDomainNumatune {
     struct {
         virBitmapPtr nodemask;
         int mode;           /* enum virDomainNumatuneMemMode */
-        int placement_mode; /* enum virNumaTuneMemPlacementMode */
+        int placement_mode; /* enum virDomainNumatunePlacement */
     } memory;               /* pinning for all the memory */

     /* Future NUMA tuning related stuff should go here. */
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 7e0f90b..cf8bb91 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -609,8 +609,8 @@ virNodeDeviceObjUnlock;
 # conf/numatune_conf.h
 virDomainNumatuneMemModeTypeFromString;
 virDomainNumatuneMemModeTypeToString;
-virNumaTuneMemPlacementModeTypeFromString;
-virNumaTuneMemPlacementModeTypeToString;
+virDomainNumatunePlacementTypeFromString;
+virDomainNumatunePlacementTypeToString;


 # conf/nwfilter_conf.h
diff --git a/src/lxc/lxc_cgroup.c b/src/lxc/lxc_cgroup.c
index 00ff807..b584e33 100644
--- a/src/lxc/lxc_cgroup.c
+++ b/src/lxc/lxc_cgroup.c
@@ -81,10 +81,10 @@ static int virLXCCgroupSetupCpusetTune(virDomainDefPtr def,

     if ((def->numatune.memory.nodemask ||
          (def->numatune.memory.placement_mode ==
-          VIR_NUMA_TUNE_MEM_PLACEMENT_MODE_AUTO)) &&
+          VIR_DOMAIN_NUMATUNE_PLACEMENT_AUTO)) &&
           def->numatune.memory.mode == VIR_DOMAIN_NUMATUNE_MEM_STRICT) {
         if (def->numatune.memory.placement_mode ==
-            VIR_NUMA_TUNE_MEM_PLACEMENT_MODE_AUTO)
+            VIR_DOMAIN_NUMATUNE_PLACEMENT_AUTO)
             mask = virBitmapFormat(nodemask);
         else
             mask = virBitmapFormat(def->numatune.memory.nodemask);
diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c
index 4aa7e02..03b1d31 100644
--- a/src/lxc/lxc_controller.c
+++ b/src/lxc/lxc_controller.c
@@ -656,7 +656,7 @@ static int virLXCControllerGetNumadAdvice(virLXCControllerPtr ctrl,
     if ((ctrl->def->placement_mode ==
          VIR_DOMAIN_CPU_PLACEMENT_MODE_AUTO) ||
         (ctrl->def->numatune.memory.placement_mode ==
-         VIR_NUMA_TUNE_MEM_PLACEMENT_MODE_AUTO)) {
+         VIR_DOMAIN_NUMATUNE_PLACEMENT_AUTO)) {
         nodeset = virNumaGetAutoPlacementAdvice(ctrl->def->vcpus,
                                                 ctrl->def->mem.cur_balloon);
         if (!nodeset)
diff --git a/src/lxc/lxc_native.c b/src/lxc/lxc_native.c
index f4c4556..30f7e55 100644
--- a/src/lxc/lxc_native.c
+++ b/src/lxc/lxc_native.c
@@ -720,7 +720,7 @@ lxcSetCpusetTune(virDomainDefPtr def, virConfPtr properties)

     if ((value = virConfGetValue(properties, "lxc.cgroup.cpuset.mems")) &&
             value->str) {
-        def->numatune.memory.placement_mode = VIR_NUMA_TUNE_MEM_PLACEMENT_MODE_STATIC;
+        def->numatune.memory.placement_mode = VIR_DOMAIN_NUMATUNE_PLACEMENT_STATIC;
         def->numatune.memory.mode = VIR_DOMAIN_NUMATUNE_MEM_STRICT;
         if (virBitmapParse(value->str, 0, &def->numatune.memory.nodemask,
                            VIR_DOMAIN_CPUMASK_LEN) < 0)
diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c
index 79f5f55..a24975b 100644
--- a/src/qemu/qemu_cgroup.c
+++ b/src/qemu/qemu_cgroup.c
@@ -603,11 +603,11 @@ qemuSetupCpusetCgroup(virDomainObjPtr vm,

     if ((vm->def->numatune.memory.nodemask ||
          (vm->def->numatune.memory.placement_mode ==
-          VIR_NUMA_TUNE_MEM_PLACEMENT_MODE_AUTO)) &&
+          VIR_DOMAIN_NUMATUNE_PLACEMENT_AUTO)) &&
         vm->def->numatune.memory.mode == VIR_DOMAIN_NUMATUNE_MEM_STRICT) {

         if (vm->def->numatune.memory.placement_mode ==
-            VIR_NUMA_TUNE_MEM_PLACEMENT_MODE_AUTO)
+            VIR_DOMAIN_NUMATUNE_PLACEMENT_AUTO)
             mem_mask = virBitmapFormat(nodemask);
         else
             mem_mask = virBitmapFormat(vm->def->numatune.memory.nodemask);
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 1652744..85c3684 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -8754,8 +8754,8 @@ qemuDomainSetNumaParameters(virDomainPtr dom,
         if (STREQ(param->field, VIR_DOMAIN_NUMA_MODE)) {
             int mode = param->value.i;

-            if (mode >= VIR_NUMA_TUNE_MEM_PLACEMENT_MODE_LAST ||
-                mode < VIR_NUMA_TUNE_MEM_PLACEMENT_MODE_DEFAULT)
+            if (mode >= VIR_DOMAIN_NUMATUNE_PLACEMENT_LAST ||
+                mode < VIR_DOMAIN_NUMATUNE_PLACEMENT_DEFAULT)
             {
                 virReportError(VIR_ERR_INVALID_ARG,
                                _("unsupported numa_mode: '%d'"), mode);
@@ -8791,7 +8791,7 @@ qemuDomainSetNumaParameters(virDomainPtr dom,
                 virBitmapFree(vm->def->numatune.memory.nodemask);

                 vm->def->numatune.memory.placement_mode =
-                    VIR_NUMA_TUNE_MEM_PLACEMENT_MODE_STATIC;
+                    VIR_DOMAIN_NUMATUNE_PLACEMENT_STATIC;
                 vm->def->numatune.memory.nodemask = virBitmapNewCopy(nodeset);
             }

@@ -8800,7 +8800,7 @@ qemuDomainSetNumaParameters(virDomainPtr dom,

                 persistentDef->numatune.memory.nodemask = nodeset;
                 persistentDef->numatune.memory.placement_mode =
-                    VIR_NUMA_TUNE_MEM_PLACEMENT_MODE_STATIC;
+                    VIR_DOMAIN_NUMATUNE_PLACEMENT_STATIC;
                 nodeset = NULL;
             }
             virBitmapFree(nodeset);
@@ -8810,7 +8810,7 @@ qemuDomainSetNumaParameters(virDomainPtr dom,
     if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
         if (!persistentDef->numatune.memory.placement_mode)
             persistentDef->numatune.memory.placement_mode =
-                VIR_NUMA_TUNE_MEM_PLACEMENT_MODE_AUTO;
+                VIR_DOMAIN_NUMATUNE_PLACEMENT_AUTO;
         if (virDomainSaveConfig(cfg->configDir, persistentDef) < 0)
             goto cleanup;
     }
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index ccc571b..d8bb679 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -3901,7 +3901,7 @@ int qemuProcessStart(virConnectPtr conn,
     if ((vm->def->placement_mode ==
          VIR_DOMAIN_CPU_PLACEMENT_MODE_AUTO) ||
         (vm->def->numatune.memory.placement_mode ==
-         VIR_NUMA_TUNE_MEM_PLACEMENT_MODE_AUTO)) {
+         VIR_DOMAIN_NUMATUNE_PLACEMENT_AUTO)) {
         nodeset = virNumaGetAutoPlacementAdvice(vm->def->vcpus,
                                                 vm->def->mem.max_balloon);
         if (!nodeset)
diff --git a/src/util/virnuma.c b/src/util/virnuma.c
index de3f86a..bc5180a 100644
--- a/src/util/virnuma.c
+++ b/src/util/virnuma.c
@@ -87,7 +87,7 @@ virNumaGetAutoPlacementAdvice(unsigned short vcpus ATTRIBUTE_UNUSED,

 #if WITH_NUMACTL
 int
-virNumaSetupMemoryPolicy(virNumaTuneDef numatune,
+virNumaSetupMemoryPolicy(virDomainNumatune numatune,
                          virBitmapPtr nodemask)
 {
     nodemask_t mask;
@@ -100,13 +100,13 @@ virNumaSetupMemoryPolicy(virNumaTuneDef numatune,
     virBitmapPtr tmp_nodemask = NULL;

     if (numatune.memory.placement_mode ==
-        VIR_NUMA_TUNE_MEM_PLACEMENT_MODE_STATIC) {
+        VIR_DOMAIN_NUMATUNE_PLACEMENT_STATIC) {
         if (!numatune.memory.nodemask)
             return 0;
         VIR_DEBUG("Set NUMA memory policy with specified nodeset");
         tmp_nodemask = numatune.memory.nodemask;
     } else if (numatune.memory.placement_mode ==
-               VIR_NUMA_TUNE_MEM_PLACEMENT_MODE_AUTO) {
+               VIR_DOMAIN_NUMATUNE_PLACEMENT_AUTO) {
         VIR_DEBUG("Set NUMA memory policy with advisory nodeset from numad");
         tmp_nodemask = nodemask;
     } else {
@@ -327,7 +327,7 @@ virNumaGetNodeCPUs(int node,

 #else
 int
-virNumaSetupMemoryPolicy(virNumaTuneDef numatune,
+virNumaSetupMemoryPolicy(virDomainNumatune numatune,
                          virBitmapPtr nodemask ATTRIBUTE_UNUSED)
 {
     if (numatune.memory.nodemask) {
diff --git a/src/util/virnuma.h b/src/util/virnuma.h
index 21e8125..d2ab6af 100644
--- a/src/util/virnuma.h
+++ b/src/util/virnuma.h
@@ -31,7 +31,7 @@
 char *virNumaGetAutoPlacementAdvice(unsigned short vcups,
                                     unsigned long long balloon);

-int virNumaSetupMemoryPolicy(virNumaTuneDef numatune,
+int virNumaSetupMemoryPolicy(virDomainNumatune numatune,
                              virBitmapPtr nodemask);

 bool virNumaIsAvailable(void);
-- 
2.0.0

--
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]