[PATCH v2 RESEND 01/17] util: Rename some functions of virresctrl

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

 



From: Bing Niu <bing.niu@xxxxxxxxx>

Some functions in virresctrl are for CAT only, while some of other
functions are for resource allocation, not just CAT. So change
their names to reflect the reality.

Signed-off-by: Bing Niu <bing.niu@xxxxxxxxx>
Reviewed-by: John Ferlan <jferlan@xxxxxxxxxx>
---
 src/conf/domain_conf.c   |  8 ++++----
 src/libvirt_private.syms |  4 ++--
 src/util/virresctrl.c    | 30 +++++++++++++++---------------
 src/util/virresctrl.h    | 26 +++++++++++++-------------
 4 files changed, 34 insertions(+), 34 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index eff8af2..abb6c5e 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -19013,7 +19013,7 @@ virDomainCachetuneDefParseCache(xmlXPathContextPtr ctxt,
                                   ULLONG_MAX, true) < 0)
         goto cleanup;
 
-    if (virResctrlAllocSetSize(alloc, level, type, cache, size) < 0)
+    if (virResctrlAllocSetCacheSize(alloc, level, type, cache, size) < 0)
         goto cleanup;
 
     ret = 0;
@@ -27002,9 +27002,9 @@ virDomainCachetuneDefFormat(virBufferPtr buf,
     int ret = -1;
 
     virBufferSetChildIndent(&childrenBuf, buf);
-    virResctrlAllocForeachSize(cachetune->alloc,
-                               virDomainCachetuneDefFormatHelper,
-                               &childrenBuf);
+    virResctrlAllocForeachCache(cachetune->alloc,
+                                virDomainCachetuneDefFormatHelper,
+                                &childrenBuf);
 
 
     if (virBufferCheckError(&childrenBuf) < 0)
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index fc386e1..bc489cb 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -2648,14 +2648,14 @@ virCacheTypeToString;
 virResctrlAllocAddPID;
 virResctrlAllocCreate;
 virResctrlAllocDeterminePath;
-virResctrlAllocForeachSize;
+virResctrlAllocForeachCache;
 virResctrlAllocFormat;
 virResctrlAllocGetID;
 virResctrlAllocGetUnused;
 virResctrlAllocNew;
 virResctrlAllocRemove;
+virResctrlAllocSetCacheSize;
 virResctrlAllocSetID;
-virResctrlAllocSetSize;
 virResctrlInfoGetCache;
 virResctrlInfoNew;
 
diff --git a/src/util/virresctrl.c b/src/util/virresctrl.c
index e492a63..6d69c8d 100644
--- a/src/util/virresctrl.c
+++ b/src/util/virresctrl.c
@@ -754,11 +754,11 @@ virResctrlAllocCheckCollision(virResctrlAllocPtr alloc,
 
 
 int
-virResctrlAllocSetSize(virResctrlAllocPtr alloc,
-                       unsigned int level,
-                       virCacheType type,
-                       unsigned int cache,
-                       unsigned long long size)
+virResctrlAllocSetCacheSize(virResctrlAllocPtr alloc,
+                            unsigned int level,
+                            virCacheType type,
+                            unsigned int cache,
+                            unsigned long long size)
 {
     if (virResctrlAllocCheckCollision(alloc, level, type, cache)) {
         virReportError(VIR_ERR_XML_ERROR,
@@ -773,9 +773,9 @@ virResctrlAllocSetSize(virResctrlAllocPtr alloc,
 
 
 int
-virResctrlAllocForeachSize(virResctrlAllocPtr alloc,
-                           virResctrlAllocForeachSizeCallback cb,
-                           void *opaque)
+virResctrlAllocForeachCache(virResctrlAllocPtr alloc,
+                            virResctrlAllocForeachCacheCallback cb,
+                            void *opaque)
 {
     int ret = 0;
     unsigned int level = 0;
@@ -939,9 +939,9 @@ virResctrlAllocParseProcessCache(virResctrlInfoPtr resctrl,
 
 
 static int
-virResctrlAllocParseProcessLine(virResctrlInfoPtr resctrl,
-                                virResctrlAllocPtr alloc,
-                                char *line)
+virResctrlAllocParseCacheLine(virResctrlInfoPtr resctrl,
+                              virResctrlAllocPtr alloc,
+                              char *line)
 {
     char **caches = NULL;
     char *tmp = NULL;
@@ -1009,7 +1009,7 @@ virResctrlAllocParse(virResctrlInfoPtr resctrl,
 
     lines = virStringSplitCount(schemata, "\n", 0, &nlines);
     for (i = 0; i < nlines; i++) {
-        if (virResctrlAllocParseProcessLine(resctrl, alloc, lines[i]) < 0)
+        if (virResctrlAllocParseCacheLine(resctrl, alloc, lines[i]) < 0)
             goto cleanup;
     }
 
@@ -1401,8 +1401,8 @@ virResctrlAllocCopyMasks(virResctrlAllocPtr dst,
  * transforming `sizes` into `masks`.
  */
 static int
-virResctrlAllocMasksAssign(virResctrlInfoPtr resctrl,
-                           virResctrlAllocPtr alloc)
+virResctrlAllocAssign(virResctrlInfoPtr resctrl,
+                      virResctrlAllocPtr alloc)
 {
     int ret = -1;
     unsigned int level = 0;
@@ -1526,7 +1526,7 @@ virResctrlAllocCreate(virResctrlInfoPtr resctrl,
     if (lockfd < 0)
         goto cleanup;
 
-    if (virResctrlAllocMasksAssign(resctrl, alloc) < 0)
+    if (virResctrlAllocAssign(resctrl, alloc) < 0)
         goto cleanup;
 
     alloc_str = virResctrlAllocFormat(alloc);
diff --git a/src/util/virresctrl.h b/src/util/virresctrl.h
index 9052a2b..d657c06 100644
--- a/src/util/virresctrl.h
+++ b/src/util/virresctrl.h
@@ -67,11 +67,11 @@ virResctrlInfoGetCache(virResctrlInfoPtr resctrl,
 typedef struct _virResctrlAlloc virResctrlAlloc;
 typedef virResctrlAlloc *virResctrlAllocPtr;
 
-typedef int virResctrlAllocForeachSizeCallback(unsigned int level,
-                                               virCacheType type,
-                                               unsigned int cache,
-                                               unsigned long long size,
-                                               void *opaque);
+typedef int virResctrlAllocForeachCacheCallback(unsigned int level,
+                                                virCacheType type,
+                                                unsigned int cache,
+                                                unsigned long long size,
+                                                void *opaque);
 
 virResctrlAllocPtr
 virResctrlAllocNew(void);
@@ -80,16 +80,16 @@ bool
 virResctrlAllocIsEmpty(virResctrlAllocPtr alloc);
 
 int
-virResctrlAllocSetSize(virResctrlAllocPtr alloc,
-                       unsigned int level,
-                       virCacheType type,
-                       unsigned int cache,
-                       unsigned long long size);
+virResctrlAllocSetCacheSize(virResctrlAllocPtr alloc,
+                            unsigned int level,
+                            virCacheType type,
+                            unsigned int cache,
+                            unsigned long long size);
 
 int
-virResctrlAllocForeachSize(virResctrlAllocPtr alloc,
-                           virResctrlAllocForeachSizeCallback cb,
-                           void *opaque);
+virResctrlAllocForeachCache(virResctrlAllocPtr alloc,
+                            virResctrlAllocForeachCacheCallback cb,
+                            void *opaque);
 
 int
 virResctrlAllocSetID(virResctrlAllocPtr alloc,
-- 
2.7.4

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