]> xenbits.xensource.com Git - libvirt.git/commitdiff
cpu: Rename and document cpuModelIsAllowed
authorJiri Denemark <jdenemar@redhat.com>
Fri, 4 Nov 2016 13:57:53 +0000 (14:57 +0100)
committerJiri Denemark <jdenemar@redhat.com>
Tue, 15 Nov 2016 14:49:15 +0000 (15:49 +0100)
The new name is virCPUModelIsAllowed.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
src/cpu/cpu.c
src/cpu/cpu.h
src/cpu/cpu_ppc64.c
src/cpu/cpu_x86.c

index 0332d509fce909026b9153a3ab1c61304a1432f7..e8bcce8d4670c259ab8aae00903abdf594aa41ac 100644 (file)
@@ -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) {
index 82912a41b80b46385803baeac3c970deced1e0f6..86cb96be9cc13a5d0a3c44da11e987e6f3a5b718 100644 (file)
@@ -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
index bfe50a339561eb3e7823d402fff779742166c79c..bdb026b2c28191f4d97d8b379569d429f77aadb5 100644 (file)
@@ -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);
index 34c3e5b00d0e4459d7ce043b7aab13a38b42d7d7..5dfe549ee4824253212d20e6ba35fa202c097d2c 100644 (file)
@@ -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,