WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] tools/python/pyxl: Updates to builtin-typ

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] tools/python/pyxl: Updates to builtin-type marshalling functions
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Mon, 17 Jan 2011 08:00:01 -0800
Delivery-date: Mon, 17 Jan 2011 08:17:10 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Gianni Tedesco <gianni.tedesco@xxxxxxxxxx>
# Date 1294772282 0
# Node ID ea6f92a479dae99857f8fdfd55833285042419f4
# Parent  aa3d665e3bb7fee04aa96a191a130ebb0e199cb5
tools/python/pyxl: Updates to builtin-type marshalling functions

Allow setting a string field to None as a way to zero it out.
Implement setting/getting libx_file_references as strings.
Produce relevant Exceptions marshallers which remain unimplemented.

Signed-off-by: Gianni Tedesco <gianni.tedesco@xxxxxxxxxx>
Committed-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
 tools/python/xen/lowlevel/xl/xl.c |   63 ++++++++++++++++++++++++--------------
 1 files changed, 40 insertions(+), 23 deletions(-)

diff -r aa3d665e3bb7 -r ea6f92a479da tools/python/xen/lowlevel/xl/xl.c
--- a/tools/python/xen/lowlevel/xl/xl.c Tue Jan 11 18:57:37 2011 +0000
+++ b/tools/python/xen/lowlevel/xl/xl.c Tue Jan 11 18:58:02 2011 +0000
@@ -76,7 +76,7 @@ int genwrap__string_set(PyObject *v, cha
 int genwrap__string_set(PyObject *v, char **str)
 {
     char *tmp;
-    if ( NULL == v ) {
+    if ( NULL == v || Py_None == v ) {
         free(*str);
         *str = NULL;
         return 0;
@@ -211,6 +211,7 @@ static PyObject *fixed_bytearray_get(con
 
 int attrib__libxl_cpuid_policy_list_set(PyObject *v, libxl_cpuid_policy_list 
*pptr)
 {
+    PyErr_SetString(PyExc_NotImplementedError, "Setting cpuid_policy_list");
     return -1;
 }
 
@@ -233,46 +234,57 @@ int attrib__libxl_cpuarray_set(PyObject 
 
 int attrib__libxl_domain_build_state_ptr_set(PyObject *v, 
libxl_domain_build_state **pptr)
 {
+    PyErr_SetString(PyExc_NotImplementedError, "Setting 
domain_build_state_ptr");
     return -1;
 }
 
 int attrib__libxl_file_reference_set(PyObject *v, libxl_file_reference *pptr)
 {
+    return genwrap__string_set(v, &pptr->path);
+}
+
+int attrib__libxl_hwcap_set(PyObject *v, libxl_hwcap *pptr)
+{
+    PyErr_SetString(PyExc_NotImplementedError, "Setting hwcap");
     return -1;
 }
 
-int attrib__libxl_hwcap_set(PyObject *v, libxl_hwcap *pptr)
-{
+int attrib__libxl_key_value_list_set(PyObject *v, libxl_key_value_list *pptr)
+{
+    if ( *pptr ) {
+        libxl_key_value_list_destroy(pptr);
+        *pptr = NULL;
+    }
+    if ( v == Py_None )
+        return 0;
     return -1;
 }
 
-int attrib__libxl_key_value_list_set(PyObject *v, libxl_key_value_list *pptr)
-{
+int attrib__libxl_mac_set(PyObject *v, libxl_mac *pptr)
+{
+    return fixed_bytearray_set(v, *pptr, 6);
+}
+
+int attrib__libxl_string_list_set(PyObject *v, libxl_string_list *pptr)
+{
+    PyErr_SetString(PyExc_NotImplementedError, "Setting string_list");
     return -1;
 }
 
-int attrib__libxl_mac_set(PyObject *v, libxl_mac *pptr)
-{
-    return fixed_bytearray_set(v, *pptr, 6);
-}
-
-int attrib__libxl_string_list_set(PyObject *v, libxl_string_list *pptr)
-{
+int attrib__libxl_uuid_set(PyObject *v, libxl_uuid *pptr)
+{
+    return fixed_bytearray_set(v, libxl_uuid_bytearray(pptr), 16);
+}
+
+int attrib__struct_in_addr_set(PyObject *v, struct in_addr *pptr)
+{
+    PyErr_SetString(PyExc_NotImplementedError, "Setting in_addr");
     return -1;
 }
 
-int attrib__libxl_uuid_set(PyObject *v, libxl_uuid *pptr)
-{
-    return fixed_bytearray_set(v, libxl_uuid_bytearray(pptr), 16);
-}
-
-int attrib__struct_in_addr_set(PyObject *v, struct in_addr *pptr)
-{
-    return -1;
-}
-
 PyObject *attrib__libxl_cpuid_policy_list_get(libxl_cpuid_policy_list *pptr)
 {
+    PyErr_SetString(PyExc_NotImplementedError, "Getting cpuid_policy_list");
     return NULL;
 }
 
@@ -314,21 +326,24 @@ PyObject *attrib__libxl_cpuarray_get(lib
 
 PyObject *attrib__libxl_domain_build_state_ptr_get(libxl_domain_build_state 
**pptr)
 {
+    PyErr_SetString(PyExc_NotImplementedError, "Getting 
domain_build_state_ptr");
     return NULL;
 }
 
 PyObject *attrib__libxl_file_reference_get(libxl_file_reference *pptr)
 {
-    return NULL;
+    return genwrap__string_get(&pptr->path);
 }
 
 PyObject *attrib__libxl_hwcap_get(libxl_hwcap *pptr)
 {
+    PyErr_SetString(PyExc_NotImplementedError, "Getting hwcap");
     return NULL;
 }
 
 PyObject *attrib__libxl_key_value_list_get(libxl_key_value_list *pptr)
 {
+    PyErr_SetString(PyExc_NotImplementedError, "Getting key_value_list");
     return NULL;
 }
 
@@ -339,6 +354,7 @@ PyObject *attrib__libxl_mac_get(libxl_ma
 
 PyObject *attrib__libxl_string_list_get(libxl_string_list *pptr)
 {
+    PyErr_SetString(PyExc_NotImplementedError, "Getting string_list");
     return NULL;
 }
 
@@ -349,6 +365,7 @@ PyObject *attrib__libxl_uuid_get(libxl_u
 
 PyObject *attrib__struct_in_addr_get(struct in_addr *pptr)
 {
+    PyErr_SetString(PyExc_NotImplementedError, "Getting in_addr");
     return NULL;
 }
 

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] tools/python/pyxl: Updates to builtin-type marshalling functions, Xen patchbot-unstable <=