[PATCH] conf: De-duplicate scheduling policy enums

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

 



Since adding the support for scheduler policy settings in commit
8680ea97, there are two enums with the same information.  That was
caused by rewriting the patch since first draft.

Find out thanks to clang, but there was no impact whatsoever.

Signed-off-by: Martin Kletzander <mkletzan@xxxxxxxxxx>
---
 src/conf/domain_conf.c   | 20 +++++++-------------
 src/conf/domain_conf.h   | 14 ++------------
 src/libvirt_private.syms |  2 --
 src/qemu/qemu_process.c  |  2 +-
 4 files changed, 10 insertions(+), 28 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 9b7ae3f..95175ea 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -772,13 +772,6 @@ VIR_ENUM_IMPL(virDomainLoader,
               "rom",
               "pflash")

-VIR_ENUM_IMPL(virDomainThreadSched, VIR_DOMAIN_THREAD_SCHED_LAST,
-              "other", /* default */
-              "batch",
-              "idle",
-              "fifo",
-              "rr")
-
 /* Internal mapping: subset of block job types that can be present in
  * <mirror> XML (remaining types are not two-phase). */
 VIR_ENUM_DECL(virDomainBlockJob)
@@ -12867,7 +12860,7 @@ virDomainThreadSchedParse(xmlNodePtr node,
                           virDomainThreadSchedParamPtr sp)
 {
     char *tmp = NULL;
-    int sched = 0;
+    int pol = 0;

     tmp = virXMLPropString(node, name);
     if (!tmp) {
@@ -12892,16 +12885,17 @@ virDomainThreadSchedParse(xmlNodePtr node,

     tmp = virXMLPropString(node, "scheduler");
     if (tmp) {
-        if ((sched = virDomainThreadSchedTypeFromString(tmp)) <= 0) {
+        if ((pol = virProcessSchedPolicyTypeFromString(tmp)) <= 0) {
             virReportError(VIR_ERR_INTERNAL_ERROR,
                            _("Invalid scheduler attribute: '%s'"),
                            tmp);
             goto error;
         }
-        sp->scheduler = sched;
+        sp->policy = pol;

         VIR_FREE(tmp);
-        if (sp->scheduler >= VIR_DOMAIN_THREAD_SCHED_FIFO) {
+        if (sp->policy == VIR_PROC_POLICY_FIFO ||
+            sp->policy == VIR_PROC_POLICY_RR) {
             tmp = virXMLPropString(node, "priority");
             if (!tmp) {
                 virReportError(VIR_ERR_XML_ERROR, "%s",
@@ -19888,7 +19882,7 @@ virDomainDefFormatInternal(virDomainDefPtr def,
         if (!(ids = virBitmapFormat(sp->ids)))
             goto error;
         virBufferAsprintf(buf, "<vcpusched vcpus='%s' scheduler='%s'",
-                          ids, virDomainThreadSchedTypeToString(sp->scheduler));
+                          ids, virProcessSchedPolicyTypeToString(sp->policy));
         VIR_FREE(ids);

         if (sp->priority)
@@ -19903,7 +19897,7 @@ virDomainDefFormatInternal(virDomainDefPtr def,
         if (!(ids = virBitmapFormat(sp->ids)))
             goto error;
         virBufferAsprintf(buf, "<iothreadsched iothreads='%s' scheduler='%s'",
-                          ids, virDomainThreadSchedTypeToString(sp->scheduler));
+                          ids, virProcessSchedPolicyTypeToString(sp->policy));
         VIR_FREE(ids);

         if (sp->priority)
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 02ddd93..aafeadd 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -50,6 +50,7 @@
 # include "virbitmap.h"
 # include "virstoragefile.h"
 # include "virseclabel.h"
+# include "virprocess.h"

 /* forward declarations of all device types, required by
  * virDomainDeviceDef
@@ -1813,21 +1814,11 @@ typedef enum {
     VIR_DOMAIN_CPU_PLACEMENT_MODE_LAST
 } virDomainCpuPlacementMode;

-typedef enum {
-    VIR_DOMAIN_THREAD_SCHED_OTHER = 0,
-    VIR_DOMAIN_THREAD_SCHED_BATCH,
-    VIR_DOMAIN_THREAD_SCHED_IDLE,
-    VIR_DOMAIN_THREAD_SCHED_FIFO,
-    VIR_DOMAIN_THREAD_SCHED_RR,
-
-    VIR_DOMAIN_THREAD_SCHED_LAST
-} virDomainThreadSched;
-
 typedef struct _virDomainThreadSchedParam virDomainThreadSchedParam;
 typedef virDomainThreadSchedParam *virDomainThreadSchedParamPtr;
 struct _virDomainThreadSchedParam {
     virBitmapPtr ids;
-    virDomainThreadSched scheduler;
+    virProcessSchedPolicy policy;
     int priority;
 };

@@ -2881,7 +2872,6 @@ VIR_ENUM_DECL(virDomainRNGModel)
 VIR_ENUM_DECL(virDomainRNGBackend)
 VIR_ENUM_DECL(virDomainTPMModel)
 VIR_ENUM_DECL(virDomainTPMBackend)
-VIR_ENUM_DECL(virDomainThreadSched)
 /* from libvirt.h */
 VIR_ENUM_DECL(virDomainState)
 VIR_ENUM_DECL(virDomainNostateReason)
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index ba05cc6..ead1b45 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -415,8 +415,6 @@ virDomainStateTypeFromString;
 virDomainStateTypeToString;
 virDomainTaintTypeFromString;
 virDomainTaintTypeToString;
-virDomainThreadSchedTypeFromString;
-virDomainThreadSchedTypeToString;
 virDomainTimerModeTypeFromString;
 virDomainTimerModeTypeToString;
 virDomainTimerNameTypeFromString;
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index bd63fd7..faf9907 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -2614,7 +2614,7 @@ qemuProcessSetSchedParams(int id,
     if (!s)
         return 0;

-    return virProcessSetScheduler(pid, s->scheduler, s->priority);
+    return virProcessSetScheduler(pid, s->policy, s->priority);
 }

 static int
-- 
2.3.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]