xl: code motion and flexarray append
PATCH 1/1 xl: code motion and flexarray append
This is version 3 of 'split dm functions' to separate file and 'flexarray append'. Changes since v2 is that patches are re-ordered and code is rebased. There is also a fix for a bug in the flexarray append conversion.
The libxl domain create code is re-based on top of these and currently in testing. I will re-submit that when I am done with the testing and confident of correctness.
Gianni
PATCH 1/1 xl: Move device model functions in to a separate file
tools/libxl/Makefile | 2 +- tools/libxl/libxl.c | 810 +----------------------------------------- tools/libxl/libxl_dm.c | 833 +++++++++++++++++++++++++++++++++++++++++++ tools/libxl/libxl_internal.h | 2 + 4 files changed, 838 insertions(+), 809 deletions(-)
# HG changeset patch
# User Gianni Tedesco <[email protected]> # Date 1294416306 0
# Node ID 2bde4e48657ec8087778a5924bf2d07f02666c39 # Parent 82c205df44062aaa6f3ad2d22b5273e18ec3151e
xl: Move device model functions in to a separate file
No functional changes.
tools/libxl/Makefile +1 -1
@@ -29,7 +29,7 @@ endif LIBXL_OBJS-$(CONFIG_X86) += libxl_cpuid.o LIBXL_OBJS-$(CONFIG_IA64) += libxl_nocpuid.o -LIBXL_OBJS = flexarray.o libxl.o libxl_pci.o libxl_dom.o libxl_exec.o libxl_xshelp.o libxl_device.o libxl_internal.o libxl_utils.o $(LIBXL_OBJS-y) +LIBXL_OBJS = flexarray.o libxl.o libxl_dm.o libxl_pci.o libxl_dom.o libxl_exec.o libxl_xshelp.o libxl_device.o libxl_internal.o libxl_utils.o $(LIBXL_OBJS-y) LIBXL_OBJS += _libxl_types.o AUTOINCS= libxlu_cfg_y.h libxlu_cfg_l.h
tools/libxl/libxl.c +2 -808
834 lines not on this page · raw message
tools/libxl/libxl_dm.c new file +833 -0
833 lines not on this page · raw message
tools/libxl/libxl_internal.h +2 -0
@@ -204,6 +204,8 @@ _hidden int libxl__spawn_spawn(libxl_ctxlibxl_device_model_starting *starting, const char *what, void (*intermediate_hook)(void *for_spawn, pid_t innerchild)); +_hidden int libxl__destroy_device_model(libxl_ctx *ctx, uint32_t domid); +/* Logs errors. A copy of "what" is taken. Return values: * < 0 error, for_spawn need not be detached * +1 caller is the parent, must call detach on *for_spawn eventually
Re: [PATCH 1 of 2] xl: Move device model functions in to a separate file
Gianni Tedesco writes ("[PATCH 1 of 2] xl: Move device model functions in to a separate file"):
Quoted 1 line
xl: Move device model functions in to a separate file
Does not apply to current staging tip, I'm afraid ...
Ian.
PATCH 1/1 xl: Implement flexarray_append() and flexarray_vappend()
In reply to Gianni Tedescotools/libxl/flexarray.c | 24 +++ tools/libxl/flexarray.h | 3 + tools/libxl/libxl.c | 370 ++++++++++++++++++++++------------------------- tools/libxl/libxl_dm.c | 183 ++++++++++------------- tools/libxl/libxl_pci.c | 73 +++----- 5 files changed, 305 insertions(+), 348 deletions(-)
# HG changeset patch
# User Gianni Tedesco <[email protected]> # Date 1294416341 0
# Node ID 61dbad8d84446b3969309dda1cf24c7c464a6b24 # Parent 2bde4e48657ec8087778a5924bf2d07f02666c39
xl: Implement flexarray_append() and flexarray_vappend()
Makes a lot of code simpler and nicer and saves a fair amount of screen real-estate
tools/libxl/flexarray.c +24 -0
@@ -14,6 +14,7 @@*/ #include "libxl_internal.h" +#include <stdarg.h> flexarray_t *flexarray_make (int size,int autogrow) {
@@ -21,6 +22,7 @@ flexarray_t *flexarray_make(int size, inif (array) { array->size = size; array->autogrow = autogrow; + array->count =0 ; array->data =calloc (size,sizeof (void *)); }return array;
@@ -56,10 +58,32 @@ int flexarray_set(flexarray_t *array, unif (flexarray_grow (array, newsize - array->size))return 2 ; } +if ( index +1 > array->count ) + array->count = index +1 ; array->data[index] = ptr;return 0 ; } +int flexarray_append (flexarray_t *array,void *ptr) +{ +return flexarray_set (array, array->count, ptr); +} + +int flexarray_vappend (flexarray_t *array, ...) +{ +va_list va; +void *ptr; +int ret; + +va_start (va, array); + for(ret = 0; (ptr = va_arg(va, void *)); ret++) { +if (flexarray_append (array, ptr) ) +break ; + } +va_end (va); +return ret; +} +int flexarray_get (flexarray_t *array,int index,void **ptr) {if (index >= array->size)
tools/libxl/flexarray.h +3 -0
@@ -19,6 +19,7 @@typedef struct flexarray {int size;int autogrow; +unsigned int count;void **data;/* array of pointer */ }flexarray_t ;
@@ -26,6 +27,8 @@ _hidden flexarray_t *flexarray_make(int _hidden void flexarray_free(flexarray_t *array); _hidden int flexarray_grow(flexarray_t *array, int extents); _hidden int flexarray_set(flexarray_t *array, unsigned int index, void *ptr); +_hidden int flexarray_append(flexarray_t *array, void *ptr); +_hidden int flexarray_vappend(flexarray_t *array, ...); _hidden int flexarray_get(flexarray_t *array, int index, void **ptr); _hidden void **flexarray_contents(flexarray_t *array);
tools/libxl/libxl.c +172 -198
512 lines not on this page · raw message
tools/libxl/libxl_dm.c +78 -105
363 lines not on this page · raw message
tools/libxl/libxl_pci.c +28 -45
109 lines not on this page · raw message
Gianni Tedesco writes ("[Xen-devel] [PATCH 0 of 2] xl: code motion and flexarray append"):
Quoted 2 lines
This is version 3 of 'split dm functions' to separate file and 'flexarray append'. Changes since v2 is that patches are re-ordered and code is rebased.
Thanks. As we discussed, I applied these changes a day or two ago, since while we are in feature freeze, the first versions of your series were posted before the freeze deadline at the end of December.
Ian.