xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
To: xen-devel@lists.xensource.com
Cc: david.vrabel@citrix.com, Ian.Campbell@citrix.com,
	Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
	Tim.Deegan@citrix.com
Subject: [PATCH v5 6/7] arm: compile libxl
Date: Thu, 23 Feb 2012 14:51:50 +0000	[thread overview]
Message-ID: <1330008712-17715-6-git-send-email-stefano.stabellini@eu.citrix.com> (raw)
In-Reply-To: <alpine.DEB.2.00.1202231445500.23091@kaball-desktop>

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.


Changes in v3:

- move libxl_cpuid_policy_list_gen_json to libxl_(no)cpuid.c.


Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
---
 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 06764f2..41b6ac4 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 be6ad96..4cbcd57 100644
--- a/tools/libxl/libxl_json.c
+++ b/tools/libxl/libxl_json.c
@@ -140,66 +140,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
-- 
1.7.2.5

  parent reply	other threads:[~2012-02-23 14:51 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-23 14:50 [PATCH v5 0/7] arm: compile tools Stefano Stabellini
2012-02-23 14:51 ` [PATCH v5 1/7] arm: add stub hvm/save.h Stefano Stabellini
2012-02-23 14:51 ` [PATCH v5 2/7] arm: compile libxc Stefano Stabellini
2012-02-23 14:51 ` [PATCH v5 3/7] arm: compile libxenguest Stefano Stabellini
2012-02-24  9:01   ` Ian Campbell
2012-02-23 14:51 ` [PATCH v5 4/7] arm: compile memshr Stefano Stabellini
2012-02-23 14:51 ` [PATCH v5 5/7] arm: compile xentrace Stefano Stabellini
2012-02-23 14:51 ` Stefano Stabellini [this message]
2012-02-23 14:51 ` [PATCH v5 7/7] libxl: Introduce libxl__arch_domain_create Stefano Stabellini
2012-02-24  9:25   ` Ian Campbell
2012-03-01 17:39 ` [PATCH v5 0/7] arm: compile tools Ian Jackson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1330008712-17715-6-git-send-email-stefano.stabellini@eu.citrix.com \
    --to=stefano.stabellini@eu.citrix.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=Tim.Deegan@citrix.com \
    --cc=david.vrabel@citrix.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).