From 2b76e3009c224c0d03a4d951e0686aad6f6dc577 Mon Sep 17 00:00:00 2001 Message-Id: <2b76e3009c224c0d03a4d951e0686aad6f6dc577@dist-git> From: Jiri Denemark Date: Tue, 26 May 2020 10:59:29 +0200 Subject: [PATCH] cpu_x86: Move and rename x86FormatSignatures MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Later in this series the function will work on a newly introduced virCPUx86Signatures structure. Let's move it to the place where all related functions will be added and rename the function as virCPUx86SignaturesFormat for easier review of the virCPUx86Signatures patch. Signed-off-by: Jiri Denemark Reviewed-by: Ján Tomko (cherry picked from commit 7e0d351fa69c468906533b2ac9b24212df13a370) https://bugzilla.redhat.com/show_bug.cgi?id=1840010 Conflicts: src/cpu/cpu_x86.c - v6.0.0-264-g0a125c7144 which removes the third argument from virBufferTrim was not backported Signed-off-by: Jiri Denemark Message-Id: Reviewed-by: Ján Tomko --- src/cpu/cpu_x86.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 65a99876a9..9248403eff 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -1125,6 +1125,23 @@ virCPUx86SignaturesMatch(virCPUx86ModelPtr model, } +static char * +virCPUx86SignaturesFormat(virCPUx86ModelPtr model) +{ + virBuffer buf = VIR_BUFFER_INITIALIZER; + size_t i; + + for (i = 0; i < model->nsignatures; i++) { + virBufferAsprintf(&buf, "%06lx,", + (unsigned long)model->signatures[i]); + } + + virBufferTrim(&buf, ",", -1); + + return virBufferContentAndReset(&buf); +} + + static void x86ModelFree(virCPUx86ModelPtr model) { @@ -1890,23 +1907,6 @@ virCPUx86Compare(virCPUDefPtr host, } -static char * -x86FormatSignatures(virCPUx86ModelPtr model) -{ - virBuffer buf = VIR_BUFFER_INITIALIZER; - size_t i; - - for (i = 0; i < model->nsignatures; i++) { - virBufferAsprintf(&buf, "%06lx,", - (unsigned long)model->signatures[i]); - } - - virBufferTrim(&buf, ",", -1); - - return virBufferContentAndReset(&buf); -} - - /* * Checks whether a candidate model is a better fit for the CPU data than the * current model. @@ -2134,7 +2134,7 @@ x86Decode(virCPUDefPtr cpu, if (vendor) cpu->vendor = g_strdup(vendor->name); - sigs = x86FormatSignatures(model); + sigs = virCPUx86SignaturesFormat(model); VIR_DEBUG("Using CPU model %s (signatures %s) for CPU with signature %06lx", model->name, NULLSTR(sigs), (unsigned long)signature); -- 2.26.2