debuggers.hg
changeset 22777:ea6f92a479da
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@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
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@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
author | Gianni Tedesco <gianni.tedesco@citrix.com> |
---|---|
date | Tue Jan 11 18:58:02 2011 +0000 (2011-01-11) |
parents | aa3d665e3bb7 |
children | 548c29920f68 |
files | tools/python/xen/lowlevel/xl/xl.c |
line diff
1.1 --- a/tools/python/xen/lowlevel/xl/xl.c Tue Jan 11 18:57:37 2011 +0000 1.2 +++ b/tools/python/xen/lowlevel/xl/xl.c Tue Jan 11 18:58:02 2011 +0000 1.3 @@ -76,7 +76,7 @@ int genwrap__obj_init(PyObject *self, Py 1.4 int genwrap__string_set(PyObject *v, char **str) 1.5 { 1.6 char *tmp; 1.7 - if ( NULL == v ) { 1.8 + if ( NULL == v || Py_None == v ) { 1.9 free(*str); 1.10 *str = NULL; 1.11 return 0; 1.12 @@ -211,6 +211,7 @@ static PyObject *fixed_bytearray_get(con 1.13 1.14 int attrib__libxl_cpuid_policy_list_set(PyObject *v, libxl_cpuid_policy_list *pptr) 1.15 { 1.16 + PyErr_SetString(PyExc_NotImplementedError, "Setting cpuid_policy_list"); 1.17 return -1; 1.18 } 1.19 1.20 @@ -233,21 +234,29 @@ int attrib__libxl_cpuarray_set(PyObject 1.21 1.22 int attrib__libxl_domain_build_state_ptr_set(PyObject *v, libxl_domain_build_state **pptr) 1.23 { 1.24 + PyErr_SetString(PyExc_NotImplementedError, "Setting domain_build_state_ptr"); 1.25 return -1; 1.26 } 1.27 1.28 int attrib__libxl_file_reference_set(PyObject *v, libxl_file_reference *pptr) 1.29 { 1.30 - return -1; 1.31 + return genwrap__string_set(v, &pptr->path); 1.32 } 1.33 1.34 int attrib__libxl_hwcap_set(PyObject *v, libxl_hwcap *pptr) 1.35 { 1.36 + PyErr_SetString(PyExc_NotImplementedError, "Setting hwcap"); 1.37 return -1; 1.38 } 1.39 1.40 int attrib__libxl_key_value_list_set(PyObject *v, libxl_key_value_list *pptr) 1.41 { 1.42 + if ( *pptr ) { 1.43 + libxl_key_value_list_destroy(pptr); 1.44 + *pptr = NULL; 1.45 + } 1.46 + if ( v == Py_None ) 1.47 + return 0; 1.48 return -1; 1.49 } 1.50 1.51 @@ -258,6 +267,7 @@ int attrib__libxl_mac_set(PyObject *v, l 1.52 1.53 int attrib__libxl_string_list_set(PyObject *v, libxl_string_list *pptr) 1.54 { 1.55 + PyErr_SetString(PyExc_NotImplementedError, "Setting string_list"); 1.56 return -1; 1.57 } 1.58 1.59 @@ -268,11 +278,13 @@ int attrib__libxl_uuid_set(PyObject *v, 1.60 1.61 int attrib__struct_in_addr_set(PyObject *v, struct in_addr *pptr) 1.62 { 1.63 + PyErr_SetString(PyExc_NotImplementedError, "Setting in_addr"); 1.64 return -1; 1.65 } 1.66 1.67 PyObject *attrib__libxl_cpuid_policy_list_get(libxl_cpuid_policy_list *pptr) 1.68 { 1.69 + PyErr_SetString(PyExc_NotImplementedError, "Getting cpuid_policy_list"); 1.70 return NULL; 1.71 } 1.72 1.73 @@ -314,21 +326,24 @@ PyObject *attrib__libxl_cpuarray_get(lib 1.74 1.75 PyObject *attrib__libxl_domain_build_state_ptr_get(libxl_domain_build_state **pptr) 1.76 { 1.77 + PyErr_SetString(PyExc_NotImplementedError, "Getting domain_build_state_ptr"); 1.78 return NULL; 1.79 } 1.80 1.81 PyObject *attrib__libxl_file_reference_get(libxl_file_reference *pptr) 1.82 { 1.83 - return NULL; 1.84 + return genwrap__string_get(&pptr->path); 1.85 } 1.86 1.87 PyObject *attrib__libxl_hwcap_get(libxl_hwcap *pptr) 1.88 { 1.89 + PyErr_SetString(PyExc_NotImplementedError, "Getting hwcap"); 1.90 return NULL; 1.91 } 1.92 1.93 PyObject *attrib__libxl_key_value_list_get(libxl_key_value_list *pptr) 1.94 { 1.95 + PyErr_SetString(PyExc_NotImplementedError, "Getting key_value_list"); 1.96 return NULL; 1.97 } 1.98 1.99 @@ -339,6 +354,7 @@ PyObject *attrib__libxl_mac_get(libxl_ma 1.100 1.101 PyObject *attrib__libxl_string_list_get(libxl_string_list *pptr) 1.102 { 1.103 + PyErr_SetString(PyExc_NotImplementedError, "Getting string_list"); 1.104 return NULL; 1.105 } 1.106 1.107 @@ -349,6 +365,7 @@ PyObject *attrib__libxl_uuid_get(libxl_u 1.108 1.109 PyObject *attrib__struct_in_addr_get(struct in_addr *pptr) 1.110 { 1.111 + PyErr_SetString(PyExc_NotImplementedError, "Getting in_addr"); 1.112 return NULL; 1.113 } 1.114