99cbc7
From 9bb6096b3d4cff38af3515c3b45a6a227b407cd4 Mon Sep 17 00:00:00 2001
99cbc7
Message-Id: <9bb6096b3d4cff38af3515c3b45a6a227b407cd4@dist-git>
99cbc7
From: Bing Niu <bing.niu@intel.com>
99cbc7
Date: Mon, 15 Apr 2019 17:32:44 +0200
99cbc7
Subject: [PATCH] util: Rename some functions of virresctrl
99cbc7
MIME-Version: 1.0
99cbc7
Content-Type: text/plain; charset=UTF-8
99cbc7
Content-Transfer-Encoding: 8bit
99cbc7
99cbc7
Some functions in virresctrl are for CAT only, while some of other
99cbc7
functions are for resource allocation, not just CAT. So change
99cbc7
their names to reflect the reality.
99cbc7
99cbc7
Signed-off-by: Bing Niu <bing.niu@intel.com>
99cbc7
Reviewed-by: John Ferlan <jferlan@redhat.com>
99cbc7
(cherry picked from commit f7c7f8ea656facd44152e224bfcf5dc04a023cf1)
99cbc7
99cbc7
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1468650
99cbc7
99cbc7
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
99cbc7
Message-Id: <a67fa07cb0ebe995a4486d18259feb34c5a3ed41.1555342313.git.phrdina@redhat.com>
99cbc7
Reviewed-by: Ján Tomko <jtomko@redhat.com>
99cbc7
---
99cbc7
 src/conf/domain_conf.c   |  8 ++++----
99cbc7
 src/libvirt_private.syms |  4 ++--
99cbc7
 src/util/virresctrl.c    | 30 +++++++++++++++---------------
99cbc7
 src/util/virresctrl.h    | 26 +++++++++++++-------------
99cbc7
 4 files changed, 34 insertions(+), 34 deletions(-)
99cbc7
99cbc7
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
99cbc7
index 1096499831..e04edd97dc 100644
99cbc7
--- a/src/conf/domain_conf.c
99cbc7
+++ b/src/conf/domain_conf.c
99cbc7
@@ -19108,7 +19108,7 @@ virDomainCachetuneDefParseCache(xmlXPathContextPtr ctxt,
99cbc7
                                   ULLONG_MAX, true) < 0)
99cbc7
         goto cleanup;
99cbc7
 
99cbc7
-    if (virResctrlAllocSetSize(alloc, level, type, cache, size) < 0)
99cbc7
+    if (virResctrlAllocSetCacheSize(alloc, level, type, cache, size) < 0)
99cbc7
         goto cleanup;
99cbc7
 
99cbc7
     ret = 0;
99cbc7
@@ -27061,9 +27061,9 @@ virDomainCachetuneDefFormat(virBufferPtr buf,
99cbc7
     int ret = -1;
99cbc7
 
99cbc7
     virBufferSetChildIndent(&childrenBuf, buf);
99cbc7
-    virResctrlAllocForeachSize(cachetune->alloc,
99cbc7
-                               virDomainCachetuneDefFormatHelper,
99cbc7
-                               &childrenBuf);
99cbc7
+    virResctrlAllocForeachCache(cachetune->alloc,
99cbc7
+                                virDomainCachetuneDefFormatHelper,
99cbc7
+                                &childrenBuf);
99cbc7
 
99cbc7
 
99cbc7
     if (virBufferCheckError(&childrenBuf) < 0)
99cbc7
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
99cbc7
index 3000d6ee0a..a3b30bf675 100644
99cbc7
--- a/src/libvirt_private.syms
99cbc7
+++ b/src/libvirt_private.syms
99cbc7
@@ -2657,14 +2657,14 @@ virCacheTypeToString;
99cbc7
 virResctrlAllocAddPID;
99cbc7
 virResctrlAllocCreate;
99cbc7
 virResctrlAllocDeterminePath;
99cbc7
-virResctrlAllocForeachSize;
99cbc7
+virResctrlAllocForeachCache;
99cbc7
 virResctrlAllocFormat;
99cbc7
 virResctrlAllocGetID;
99cbc7
 virResctrlAllocGetUnused;
99cbc7
 virResctrlAllocNew;
99cbc7
 virResctrlAllocRemove;
99cbc7
+virResctrlAllocSetCacheSize;
99cbc7
 virResctrlAllocSetID;
99cbc7
-virResctrlAllocSetSize;
99cbc7
 virResctrlInfoGetCache;
99cbc7
 virResctrlInfoNew;
99cbc7
 
99cbc7
diff --git a/src/util/virresctrl.c b/src/util/virresctrl.c
99cbc7
index e492a63b80..6d69c8d4e2 100644
99cbc7
--- a/src/util/virresctrl.c
99cbc7
+++ b/src/util/virresctrl.c
99cbc7
@@ -754,11 +754,11 @@ virResctrlAllocCheckCollision(virResctrlAllocPtr alloc,
99cbc7
 
99cbc7
 
99cbc7
 int
99cbc7
-virResctrlAllocSetSize(virResctrlAllocPtr alloc,
99cbc7
-                       unsigned int level,
99cbc7
-                       virCacheType type,
99cbc7
-                       unsigned int cache,
99cbc7
-                       unsigned long long size)
99cbc7
+virResctrlAllocSetCacheSize(virResctrlAllocPtr alloc,
99cbc7
+                            unsigned int level,
99cbc7
+                            virCacheType type,
99cbc7
+                            unsigned int cache,
99cbc7
+                            unsigned long long size)
99cbc7
 {
99cbc7
     if (virResctrlAllocCheckCollision(alloc, level, type, cache)) {
99cbc7
         virReportError(VIR_ERR_XML_ERROR,
99cbc7
@@ -773,9 +773,9 @@ virResctrlAllocSetSize(virResctrlAllocPtr alloc,
99cbc7
 
99cbc7
 
99cbc7
 int
99cbc7
-virResctrlAllocForeachSize(virResctrlAllocPtr alloc,
99cbc7
-                           virResctrlAllocForeachSizeCallback cb,
99cbc7
-                           void *opaque)
99cbc7
+virResctrlAllocForeachCache(virResctrlAllocPtr alloc,
99cbc7
+                            virResctrlAllocForeachCacheCallback cb,
99cbc7
+                            void *opaque)
99cbc7
 {
99cbc7
     int ret = 0;
99cbc7
     unsigned int level = 0;
99cbc7
@@ -939,9 +939,9 @@ virResctrlAllocParseProcessCache(virResctrlInfoPtr resctrl,
99cbc7
 
99cbc7
 
99cbc7
 static int
99cbc7
-virResctrlAllocParseProcessLine(virResctrlInfoPtr resctrl,
99cbc7
-                                virResctrlAllocPtr alloc,
99cbc7
-                                char *line)
99cbc7
+virResctrlAllocParseCacheLine(virResctrlInfoPtr resctrl,
99cbc7
+                              virResctrlAllocPtr alloc,
99cbc7
+                              char *line)
99cbc7
 {
99cbc7
     char **caches = NULL;
99cbc7
     char *tmp = NULL;
99cbc7
@@ -1009,7 +1009,7 @@ virResctrlAllocParse(virResctrlInfoPtr resctrl,
99cbc7
 
99cbc7
     lines = virStringSplitCount(schemata, "\n", 0, &nlines);
99cbc7
     for (i = 0; i < nlines; i++) {
99cbc7
-        if (virResctrlAllocParseProcessLine(resctrl, alloc, lines[i]) < 0)
99cbc7
+        if (virResctrlAllocParseCacheLine(resctrl, alloc, lines[i]) < 0)
99cbc7
             goto cleanup;
99cbc7
     }
99cbc7
 
99cbc7
@@ -1401,8 +1401,8 @@ virResctrlAllocCopyMasks(virResctrlAllocPtr dst,
99cbc7
  * transforming `sizes` into `masks`.
99cbc7
  */
99cbc7
 static int
99cbc7
-virResctrlAllocMasksAssign(virResctrlInfoPtr resctrl,
99cbc7
-                           virResctrlAllocPtr alloc)
99cbc7
+virResctrlAllocAssign(virResctrlInfoPtr resctrl,
99cbc7
+                      virResctrlAllocPtr alloc)
99cbc7
 {
99cbc7
     int ret = -1;
99cbc7
     unsigned int level = 0;
99cbc7
@@ -1526,7 +1526,7 @@ virResctrlAllocCreate(virResctrlInfoPtr resctrl,
99cbc7
     if (lockfd < 0)
99cbc7
         goto cleanup;
99cbc7
 
99cbc7
-    if (virResctrlAllocMasksAssign(resctrl, alloc) < 0)
99cbc7
+    if (virResctrlAllocAssign(resctrl, alloc) < 0)
99cbc7
         goto cleanup;
99cbc7
 
99cbc7
     alloc_str = virResctrlAllocFormat(alloc);
99cbc7
diff --git a/src/util/virresctrl.h b/src/util/virresctrl.h
99cbc7
index 9052a2b19a..d657c06008 100644
99cbc7
--- a/src/util/virresctrl.h
99cbc7
+++ b/src/util/virresctrl.h
99cbc7
@@ -67,11 +67,11 @@ virResctrlInfoGetCache(virResctrlInfoPtr resctrl,
99cbc7
 typedef struct _virResctrlAlloc virResctrlAlloc;
99cbc7
 typedef virResctrlAlloc *virResctrlAllocPtr;
99cbc7
 
99cbc7
-typedef int virResctrlAllocForeachSizeCallback(unsigned int level,
99cbc7
-                                               virCacheType type,
99cbc7
-                                               unsigned int cache,
99cbc7
-                                               unsigned long long size,
99cbc7
-                                               void *opaque);
99cbc7
+typedef int virResctrlAllocForeachCacheCallback(unsigned int level,
99cbc7
+                                                virCacheType type,
99cbc7
+                                                unsigned int cache,
99cbc7
+                                                unsigned long long size,
99cbc7
+                                                void *opaque);
99cbc7
 
99cbc7
 virResctrlAllocPtr
99cbc7
 virResctrlAllocNew(void);
99cbc7
@@ -80,16 +80,16 @@ bool
99cbc7
 virResctrlAllocIsEmpty(virResctrlAllocPtr alloc);
99cbc7
 
99cbc7
 int
99cbc7
-virResctrlAllocSetSize(virResctrlAllocPtr alloc,
99cbc7
-                       unsigned int level,
99cbc7
-                       virCacheType type,
99cbc7
-                       unsigned int cache,
99cbc7
-                       unsigned long long size);
99cbc7
+virResctrlAllocSetCacheSize(virResctrlAllocPtr alloc,
99cbc7
+                            unsigned int level,
99cbc7
+                            virCacheType type,
99cbc7
+                            unsigned int cache,
99cbc7
+                            unsigned long long size);
99cbc7
 
99cbc7
 int
99cbc7
-virResctrlAllocForeachSize(virResctrlAllocPtr alloc,
99cbc7
-                           virResctrlAllocForeachSizeCallback cb,
99cbc7
-                           void *opaque);
99cbc7
+virResctrlAllocForeachCache(virResctrlAllocPtr alloc,
99cbc7
+                            virResctrlAllocForeachCacheCallback cb,
99cbc7
+                            void *opaque);
99cbc7
 
99cbc7
 int
99cbc7
 virResctrlAllocSetID(virResctrlAllocPtr alloc,
99cbc7
-- 
99cbc7
2.21.0
99cbc7