xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Add xl python bindings for cpumap
@ 2010-11-22 12:24 Juergen Gross
  2010-11-23 19:35 ` Ian Jackson
  0 siblings, 1 reply; 2+ messages in thread
From: Juergen Gross @ 2010-11-22 12:24 UTC (permalink / raw)
  To: xen-devel

[-- Attachment #1: Type: text/plain, Size: 162 bytes --]

Signed-off-by: juergen.gross@ts.fujitsu.com


1 file changed, 21 insertions(+), 2 deletions(-)
tools/python/xen/lowlevel/xl/xl.c |   23 +++++++++++++++++++++--



[-- Attachment #2: xen-work.patch --]
[-- Type: text/x-patch, Size: 1390 bytes --]

# HG changeset patch
# User Juergen Gross <juergen.gross@ts.fujitsu.com>
# Date 1290428619 -3600
# Node ID eb50c4e522e19b5b1a0fcddb50319c31ea589df9
# Parent  117d82dcd6ba785a702e2d0cfdb93642d84da1b9
Add xl python bindings for cpumap

Signed-off-by: juergen.gross@ts.fujitsu.com

diff -r 117d82dcd6ba -r eb50c4e522e1 tools/python/xen/lowlevel/xl/xl.c
--- a/tools/python/xen/lowlevel/xl/xl.c	Fri Nov 19 18:55:18 2010 +0000
+++ b/tools/python/xen/lowlevel/xl/xl.c	Mon Nov 22 13:23:39 2010 +0100
@@ -214,7 +214,14 @@
 
 int attrib__libxl_cpumap_set(PyObject *v, libxl_cpumap *pptr)
 {
-    return -1;
+    int i;
+    long cpu;
+
+    for (i = 0; i < PyList_Size(v); i++) {
+        cpu = PyInt_AsLong(PyList_GetItem(v, i));
+        libxl_cpumap_set(pptr, cpu);
+    }
+    return 0;
 }
 
 int attrib__libxl_domain_build_state_ptr_set(PyObject *v, libxl_domain_build_state **pptr)
@@ -264,7 +271,19 @@
 
 PyObject *attrib__libxl_cpumap_get(libxl_cpumap *pptr)
 {
-    return NULL;
+    PyObject *cpulist = NULL;
+    int i;
+
+    cpulist = PyList_New(0);
+    libxl_for_each_cpu(i, *pptr) {
+        if ( libxl_cpumap_test(pptr, i) ) {
+            PyObject* pyint = PyInt_FromLong(i);
+
+            PyList_Append(cpulist, pyint);
+            Py_DECREF(pyint);
+        }
+    }
+    return cpulist;
 }
 
 PyObject *attrib__libxl_domain_build_state_ptr_get(libxl_domain_build_state **pptr)

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Add xl python bindings for cpumap
  2010-11-22 12:24 [PATCH] Add xl python bindings for cpumap Juergen Gross
@ 2010-11-23 19:35 ` Ian Jackson
  0 siblings, 0 replies; 2+ messages in thread
From: Ian Jackson @ 2010-11-23 19:35 UTC (permalink / raw)
  To: Juergen Gross; +Cc: xen-devel

Juergen Gross writes ("[Xen-devel] [PATCH] Add xl python bindings for cpumap"):
> Signed-off-by: juergen.gross@ts.fujitsu.com

Applied, thanks.

Ian.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-11-23 19:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-22 12:24 [PATCH] Add xl python bindings for cpumap Juergen Gross
2010-11-23 19:35 ` Ian Jackson

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).