[libvirt] [PATCH 1/4] cpu: allow include files for CPU definition

John Ferlan jferlan at redhat.com
Mon Aug 13 22:26:58 UTC 2018



On 08/01/2018 01:02 PM, Daniel P. Berrangé wrote:
> Allow for syntax
> 
>     <include filename="fooo.xml"/>
> 
> to reference other files in the CPU database directory
> 
> Signed-off-by: Daniel P. Berrangé <berrange at redhat.com>
> ---
>  libvirt.spec.in       |  2 +-
>  mingw-libvirt.spec.in |  4 +--
>  src/Makefile.am       |  2 +-
>  src/cpu/cpu_map.c     | 84 +++++++++++++++++++++++++++++++++++++++++--
>  4 files changed, 86 insertions(+), 6 deletions(-)
> 

I'll assume you got the spec/makefile magic correct as it's not in my
wheelhouse!



> diff --git a/src/cpu/cpu_map.c b/src/cpu/cpu_map.c
> index d263eb8cdd..9e090919ed 100644
> --- a/src/cpu/cpu_map.c
> +++ b/src/cpu/cpu_map.c
> @@ -70,6 +70,83 @@ static int load(xmlXPathContextPtr ctxt,
>      return ret;
>  }
>  

[...]

> +
> +
> +static int loadIncludes(xmlXPathContextPtr ctxt,
> +                        cpuMapLoadCallback callback,
> +                        void *data)

static int
loadIncludes(...)

for consistency

> +{
> +    int ret = -1;

[...]

>  
>  int cpuMapLoad(const char *arch,
>                 cpuMapLoadCallback cb,
> @@ -88,7 +165,7 @@ int cpuMapLoad(const char *arch,
>                                          PKGDATADIR)))
>          return -1;
>  
> -    VIR_DEBUG("Loading CPU map from %s", mapfile);
> +    VIR_DEBUG("Loading '%s' CPU map from %s", arch, mapfile);

Considering the subsequent NULL check:

s/arch/NULLSTR(arch)/

or move the VIR_DEBUG after the check (IDC).

I'm not even sure why @mapfile filling is above the argument validation
checks, but that's a different issue and since more changes are about to
come, it's not that important ;-)...  As long there is either a NULLSTR
or moved message, that's fine.

Reviewed-by: John Ferlan <jferlan at redhat.com>

John

[...]




More information about the libvir-list mailing list