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

Re: [Xen-devel] [PATCH v7 4/8] arm: compile libxl



On Tue, 2012-05-29 at 14:41 +0100, Stefano Stabellini wrote:
> libxl_cpuid_destroy has been renamed to libxl_cpuid_dispose; also cpuid
> functions are only available on x86, so ifdef the new cpuid related
> function in libxl_json.c.

This was out of date. I replaced with:
        libxl_cpuid_destroy has been renamed to libxl_cpuid_dispose; also cpuid
        functions are only available on x86, so move them to
        libxl_cpuid.c.

> 
> 
> Changes in v3:
> 
> - move libxl_cpuid_policy_list_gen_json to libxl_(no)cpuid.c.
> 
> 
> Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
> Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
> Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
> ---
>  tools/libxl/Makefile        |    1 +
>  tools/libxl/libxl_cpuid.c   |   60 
> +++++++++++++++++++++++++++++++++++++++++++
>  tools/libxl/libxl_json.c    |   60 
> -------------------------------------------
>  tools/libxl/libxl_nocpuid.c |    8 +++++-
>  4 files changed, 68 insertions(+), 61 deletions(-)
> 
> diff --git a/tools/libxl/Makefile b/tools/libxl/Makefile
> index 5d9227e..f9cc9fd 100644
> --- a/tools/libxl/Makefile
> +++ b/tools/libxl/Makefile
> @@ -36,6 +36,7 @@ LIBXL_OBJS-y += libxl_noblktap2.o
>  endif
>  LIBXL_OBJS-$(CONFIG_X86) += libxl_cpuid.o
>  LIBXL_OBJS-$(CONFIG_IA64) += libxl_nocpuid.o
> +LIBXL_OBJS-$(CONFIG_ARM) += libxl_nocpuid.o
>  
>  ifeq ($(CONFIG_NetBSD),y)
>  LIBXL_OBJS-y += libxl_netbsd.o
> diff --git a/tools/libxl/libxl_cpuid.c b/tools/libxl/libxl_cpuid.c
> index dcdb9d02..ff7531f 100644
> --- a/tools/libxl/libxl_cpuid.c
> +++ b/tools/libxl/libxl_cpuid.c
> @@ -333,6 +333,66 @@ void libxl_cpuid_set(libxl_ctx *ctx, uint32_t domid,
>                       (const char**)(cpuid[i].policy), cpuid_res);
>  }
>  
> +yajl_gen_status libxl_cpuid_policy_list_gen_json(yajl_gen hand,
> +                                libxl_cpuid_policy_list *pcpuid)
> +{
> +    libxl_cpuid_policy_list cpuid = *pcpuid;
> +    yajl_gen_status s;
> +    const char *input_names[2] = { "leaf", "subleaf" };
> +    const char *policy_names[4] = { "eax", "ebx", "ecx", "edx" };
> +    int i, j;
> +
> +    /*
> +     * Aiming for:
> +     * [
> +     *     { 'leaf':    'val-eax',
> +     *       'subleaf': 'val-ecx',
> +     *       'eax':     'filter',
> +     *       'ebx':     'filter',
> +     *       'ecx':     'filter',
> +     *       'edx':     'filter' },
> +     *     { 'leaf':    'val-eax', ..., 'eax': 'filter', ... },
> +     *     ... etc ...
> +     * ]
> +     */
> +
> +    s = yajl_gen_array_open(hand);
> +    if (s != yajl_gen_status_ok) goto out;
> +
> +    if (cpuid == NULL) goto empty;
> +
> +    for (i = 0; cpuid[i].input[0] != XEN_CPUID_INPUT_UNUSED; i++) {
> +        s = yajl_gen_map_open(hand);
> +        if (s != yajl_gen_status_ok) goto out;
> +
> +        for (j = 0; j < 2; j++) {
> +            if (cpuid[i].input[j] != XEN_CPUID_INPUT_UNUSED) {
> +                s = libxl__yajl_gen_asciiz(hand, input_names[j]);
> +                if (s != yajl_gen_status_ok) goto out;
> +                s = yajl_gen_integer(hand, cpuid[i].input[j]);
> +                if (s != yajl_gen_status_ok) goto out;
> +            }
> +        }
> +
> +        for (j = 0; j < 4; j++) {
> +            if (cpuid[i].policy[j] != NULL) {
> +                s = libxl__yajl_gen_asciiz(hand, policy_names[j]);
> +                if (s != yajl_gen_status_ok) goto out;
> +                s = yajl_gen_string(hand,
> +                               (const unsigned char *)cpuid[i].policy[j], 
> 32);
> +                if (s != yajl_gen_status_ok) goto out;
> +            }
> +        }
> +        s = yajl_gen_map_close(hand);
> +        if (s != yajl_gen_status_ok) goto out;
> +    }
> +
> +empty:
> +    s = yajl_gen_array_close(hand);
> +out:
> +    return s;
> +}
> +
>  /*
>   * Local variables:
>   * mode: C
> diff --git a/tools/libxl/libxl_json.c b/tools/libxl/libxl_json.c
> index 7c068d3..f430d4a 100644
> --- a/tools/libxl/libxl_json.c
> +++ b/tools/libxl/libxl_json.c
> @@ -146,66 +146,6 @@ out:
>      return s;
>  }
>  
> -yajl_gen_status libxl_cpuid_policy_list_gen_json(yajl_gen hand,
> -                                libxl_cpuid_policy_list *pcpuid)
> -{
> -    libxl_cpuid_policy_list cpuid = *pcpuid;
> -    yajl_gen_status s;
> -    const char *input_names[2] = { "leaf", "subleaf" };
> -    const char *policy_names[4] = { "eax", "ebx", "ecx", "edx" };
> -    int i, j;
> -
> -    /*
> -     * Aiming for:
> -     * [
> -     *     { 'leaf':    'val-eax',
> -     *       'subleaf': 'val-ecx',
> -     *       'eax':     'filter',
> -     *       'ebx':     'filter',
> -     *       'ecx':     'filter',
> -     *       'edx':     'filter' },
> -     *     { 'leaf':    'val-eax', ..., 'eax': 'filter', ... },
> -     *     ... etc ...
> -     * ]
> -     */
> -
> -    s = yajl_gen_array_open(hand);
> -    if (s != yajl_gen_status_ok) goto out;
> -
> -    if (cpuid == NULL) goto empty;
> -
> -    for (i = 0; cpuid[i].input[0] != XEN_CPUID_INPUT_UNUSED; i++) {
> -        s = yajl_gen_map_open(hand);
> -        if (s != yajl_gen_status_ok) goto out;
> -
> -        for (j = 0; j < 2; j++) {
> -            if (cpuid[i].input[j] != XEN_CPUID_INPUT_UNUSED) {
> -                s = libxl__yajl_gen_asciiz(hand, input_names[j]);
> -                if (s != yajl_gen_status_ok) goto out;
> -                s = yajl_gen_integer(hand, cpuid[i].input[j]);
> -                if (s != yajl_gen_status_ok) goto out;
> -            }
> -        }
> -
> -        for (j = 0; j < 4; j++) {
> -            if (cpuid[i].policy[j] != NULL) {
> -                s = libxl__yajl_gen_asciiz(hand, policy_names[j]);
> -                if (s != yajl_gen_status_ok) goto out;
> -                s = yajl_gen_string(hand,
> -                               (const unsigned char *)cpuid[i].policy[j], 
> 32);
> -                if (s != yajl_gen_status_ok) goto out;
> -            }
> -        }
> -        s = yajl_gen_map_close(hand);
> -        if (s != yajl_gen_status_ok) goto out;
> -    }
> -
> -empty:
> -    s = yajl_gen_array_close(hand);
> -out:
> -    return s;
> -}
> -
>  yajl_gen_status libxl_string_list_gen_json(yajl_gen hand, libxl_string_list 
> *pl)
>  {
>      libxl_string_list l = *pl;
> diff --git a/tools/libxl/libxl_nocpuid.c b/tools/libxl/libxl_nocpuid.c
> index 9e52f8d..5f7cb6a 100644
> --- a/tools/libxl/libxl_nocpuid.c
> +++ b/tools/libxl/libxl_nocpuid.c
> @@ -14,7 +14,7 @@
>  
>  #include "libxl_internal.h"
>  
> -void libxl_cpuid_destroy(libxl_cpuid_policy_list *p_cpuid_list)
> +void libxl_cpuid_dispose(libxl_cpuid_policy_list *p_cpuid_list)
>  {
>  }
>  
> @@ -38,6 +38,12 @@ void libxl_cpuid_set(libxl_ctx *ctx, uint32_t domid,
>  {
>  }
>  
> +yajl_gen_status libxl_cpuid_policy_list_gen_json(yajl_gen hand,
> +                                libxl_cpuid_policy_list *pcpuid)
> +{
> +    return 0;
> +}
> +
>  /*
>   * Local variables:
>   * mode: C



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.