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