[PATCH 02/14] cpu: Rename and document cpuModelIsAllowed

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

 



The new name is virCPUModelIsAllowed.

Signed-off-by: Jiri Denemark <jdenemar@xxxxxxxxxx>
---
 src/cpu/cpu.c       | 21 +++++++++++++++++----
 src/cpu/cpu.h       |  6 +++---
 src/cpu/cpu_ppc64.c |  2 +-
 src/cpu/cpu_x86.c   |  2 +-
 4 files changed, 22 insertions(+), 9 deletions(-)

diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c
index 0332d50..e8bcce8 100644
--- a/src/cpu/cpu.c
+++ b/src/cpu/cpu.c
@@ -813,10 +813,22 @@ cpuDataParse(const char *xmlStr)
     return data;
 }
 
+
+/** virCPUModelIsAllowed:
+ *
+ * @model: CPU model to be checked
+ * @models: list of supported CPU models
+ * @nmodels: number of models in @models
+ *
+ * Checks whether @model can be found in the list of supported @models.
+ * If @models is empty, all models are supported.
+ *
+ * Returns true if @model is supported, false otherwise.
+ */
 bool
-cpuModelIsAllowed(const char *model,
-                  const char **models,
-                  unsigned int nmodels)
+virCPUModelIsAllowed(const char *model,
+                     const char **models,
+                     unsigned int nmodels)
 {
     size_t i;
 
@@ -830,6 +842,7 @@ cpuModelIsAllowed(const char *model,
     return false;
 }
 
+
 /**
  * virCPUGetModels:
  *
@@ -898,7 +911,7 @@ virCPUTranslate(virArch arch,
         cpu->mode == VIR_CPU_MODE_HOST_PASSTHROUGH)
         return 0;
 
-    if (cpuModelIsAllowed(cpu->model, (const char **) models, nmodels))
+    if (virCPUModelIsAllowed(cpu->model, (const char **) models, nmodels))
         return 0;
 
     if (cpu->fallback != VIR_CPU_FALLBACK_ALLOW) {
diff --git a/src/cpu/cpu.h b/src/cpu/cpu.h
index 82912a4..86cb96b 100644
--- a/src/cpu/cpu.h
+++ b/src/cpu/cpu.h
@@ -214,9 +214,9 @@ virCPUDataCheckFeature(const virCPUData *data,
 
 
 bool
-cpuModelIsAllowed(const char *model,
-                  const char **models,
-                  unsigned int nmodels)
+virCPUModelIsAllowed(const char *model,
+                     const char **models,
+                     unsigned int nmodels)
     ATTRIBUTE_NONNULL(1);
 
 int
diff --git a/src/cpu/cpu_ppc64.c b/src/cpu/cpu_ppc64.c
index bfe50a3..bdb026b 100644
--- a/src/cpu/cpu_ppc64.c
+++ b/src/cpu/cpu_ppc64.c
@@ -691,7 +691,7 @@ ppc64DriverDecode(virCPUDefPtr cpu,
         goto cleanup;
     }
 
-    if (!cpuModelIsAllowed(model->name, models, nmodels)) {
+    if (!virCPUModelIsAllowed(model->name, models, nmodels)) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                        _("CPU model %s is not supported by hypervisor"),
                        model->name);
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
index 34c3e5b..5dfe549 100644
--- a/src/cpu/cpu_x86.c
+++ b/src/cpu/cpu_x86.c
@@ -1833,7 +1833,7 @@ x86Decode(virCPUDefPtr cpu,
      */
     for (i = map->nmodels - 1; i >= 0; i--) {
         candidate = map->models[i];
-        if (!cpuModelIsAllowed(candidate->name, models, nmodels)) {
+        if (!virCPUModelIsAllowed(candidate->name, models, nmodels)) {
             if (preferred && STREQ(candidate->name, preferred)) {
                 if (cpu->fallback != VIR_CPU_FALLBACK_ALLOW) {
                     virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-- 
2.10.2

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