From dec2ce4345db0d13cff8c639c69afbf894ee593a Mon Sep 17 00:00:00 2001 Message-Id: From: Jiri Denemark Date: Fri, 21 Jun 2019 09:25:40 +0200 Subject: [PATCH] cpu_x86: Move *CheckFeature functions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit They are static and we will need to call them a little bit closer to the beginning of the file. Signed-off-by: Jiri Denemark Reviewed-by: Ján Tomko (cherry picked from commit e17d10386bd9abcfb37c7d8b151bbd1071a87fc4) https://bugzilla.redhat.com/show_bug.cgi?id=1697627 Signed-off-by: Jiri Denemark Message-Id: <41d2a36757ed83f70c9dc23e9b984e109e5a81ba.1561068591.git.jdenemar@redhat.com> Reviewed-by: Ján Tomko --- src/cpu/cpu_x86.c | 69 ++++++++++++++++++++++++----------------------- 1 file changed, 35 insertions(+), 34 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 49562944c1..fdc2974a0d 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -2706,6 +2706,41 @@ cpuidSet(uint32_t base, virCPUDataPtr data) } +static int +virCPUx86CheckFeature(const virCPUDef *cpu, + const char *name) +{ + int ret = -1; + virCPUx86MapPtr map; + virCPUx86ModelPtr model = NULL; + + if (!(map = virCPUx86GetMap())) + return -1; + + if (!(model = x86ModelFromCPU(cpu, map, -1))) + goto cleanup; + + ret = x86FeatureInData(name, &model->data, map); + + cleanup: + x86ModelFree(model); + return ret; +} + + +static int +virCPUx86DataCheckFeature(const virCPUData *data, + const char *name) +{ + virCPUx86MapPtr map; + + if (!(map = virCPUx86GetMap())) + return -1; + + return x86FeatureInData(name, &data->data.x86, map); +} + + static int virCPUx86GetHost(virCPUDefPtr cpu, virDomainCapsCPUModelsPtr models) @@ -3062,40 +3097,6 @@ virCPUx86UpdateLive(virCPUDefPtr cpu, } -static int -virCPUx86CheckFeature(const virCPUDef *cpu, - const char *name) -{ - int ret = -1; - virCPUx86MapPtr map; - virCPUx86ModelPtr model = NULL; - - if (!(map = virCPUx86GetMap())) - return -1; - - if (!(model = x86ModelFromCPU(cpu, map, -1))) - goto cleanup; - - ret = x86FeatureInData(name, &model->data, map); - - cleanup: - x86ModelFree(model); - return ret; -} - - -static int -virCPUx86DataCheckFeature(const virCPUData *data, - const char *name) -{ - virCPUx86MapPtr map; - - if (!(map = virCPUx86GetMap())) - return -1; - - return x86FeatureInData(name, &data->data.x86, map); -} - static int virCPUx86GetModels(char ***models) { -- 2.22.0