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

[Xen-changelog] [xen master] libxl: introduce libxl_cpuid_policy_list_length



commit 92f962f4a72f297a0e21bf1acbea4a685a487fc7
Author:     Wei Liu <wei.liu2@xxxxxxxxxx>
AuthorDate: Mon Jun 9 13:43:26 2014 +0100
Commit:     Ian Campbell <ian.campbell@xxxxxxxxxx>
CommitDate: Tue Jun 10 14:27:35 2014 +0100

    libxl: introduce libxl_cpuid_policy_list_length
    
    Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx>
    Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---
 tools/libxl/libxl.h       |    1 +
 tools/libxl/libxl_cpuid.c |   13 +++++++++++++
 2 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h
index e2259b2..17b8a7b 100644
--- a/tools/libxl/libxl.h
+++ b/tools/libxl/libxl.h
@@ -529,6 +529,7 @@ void libxl_bitmap_dispose(libxl_bitmap *map);
 typedef struct libxl__cpuid_policy libxl_cpuid_policy;
 typedef libxl_cpuid_policy * libxl_cpuid_policy_list;
 void libxl_cpuid_dispose(libxl_cpuid_policy_list *cpuid_list);
+int libxl_cpuid_policy_list_length(libxl_cpuid_policy_list *l);
 
 #define LIBXL_PCI_FUNC_ALL (~0U)
 
diff --git a/tools/libxl/libxl_cpuid.c b/tools/libxl/libxl_cpuid.c
index d9007b2..1f2bcd5 100644
--- a/tools/libxl/libxl_cpuid.c
+++ b/tools/libxl/libxl_cpuid.c
@@ -455,6 +455,19 @@ int libxl_cpuid_policy_list_parse_json(libxl__gc *gc,
     return 0;
 }
 
+int libxl_cpuid_policy_list_length(libxl_cpuid_policy_list *pl)
+{
+    int i = 0;
+    libxl_cpuid_policy_list l = *pl;
+
+    if (l) {
+        while (l[i].input[0] != XEN_CPUID_INPUT_UNUSED)
+            i++;
+    }
+
+    return i;
+}
+
 /*
  * Local variables:
  * mode: C
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

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