[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 3/6] libxl: dont pass array size to libxl__xs_kvs_of_flexarray()
Instead of passing the array size as an argument when calling libxl__xs_kvs_of_flexarray() let the function get the size from the array instead. Signed-off-by: Juergen Gross <jgross@xxxxxxxx> --- tools/libxl/libxl.c | 22 +++++++++++----------- tools/libxl/libxl_internal.h | 2 +- tools/libxl/libxl_nic.c | 6 ++---- tools/libxl/libxl_pci.c | 7 +++---- tools/libxl/libxl_usb.c | 6 +++--- tools/libxl/libxl_vtpm.c | 6 ++---- tools/libxl/libxl_xshelp.c | 4 ++-- 7 files changed, 24 insertions(+), 29 deletions(-) diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c index 577ed35..b7b8b08 100644 --- a/tools/libxl/libxl.c +++ b/tools/libxl/libxl.c @@ -2315,8 +2315,8 @@ static void device_disk_add(libxl__egc *egc, uint32_t domid, } libxl__device_generic_add(gc, t, device, - libxl__xs_kvs_of_flexarray(gc, back, back->count), - libxl__xs_kvs_of_flexarray(gc, front, front->count), + libxl__xs_kvs_of_flexarray(gc, back), + libxl__xs_kvs_of_flexarray(gc, front), NULL); rc = libxl__xs_transaction_commit(gc, &t); @@ -2735,7 +2735,7 @@ int libxl_cdrom_insert(libxl_ctx *ctx, uint32_t domid, libxl_device_disk *disk, goto out; } - char **kvs = libxl__xs_kvs_of_flexarray(gc, empty, empty->count); + char **kvs = libxl__xs_kvs_of_flexarray(gc, empty); rc = libxl__xs_writev(gc, t, be_path, kvs); if (rc) goto out; @@ -2777,7 +2777,7 @@ int libxl_cdrom_insert(libxl_ctx *ctx, uint32_t domid, libxl_device_disk *disk, rc = libxl__set_domain_configuration(gc, domid, &d_config); if (rc) goto out; - char **kvs = libxl__xs_kvs_of_flexarray(gc, insert, insert->count); + char **kvs = libxl__xs_kvs_of_flexarray(gc, insert); rc = libxl__xs_writev(gc, t, be_path, kvs); if (rc) goto out; @@ -3147,9 +3147,9 @@ int libxl__device_console_add(libxl__gc *gc, uint32_t domid, flexarray_append(front, LIBXL_XENCONSOLE_PROTOCOL); } libxl__device_generic_add(gc, XBT_NULL, device, - libxl__xs_kvs_of_flexarray(gc, back, back->count), - libxl__xs_kvs_of_flexarray(gc, front, front->count), - libxl__xs_kvs_of_flexarray(gc, ro_front, ro_front->count)); + libxl__xs_kvs_of_flexarray(gc, back), + libxl__xs_kvs_of_flexarray(gc, front), + libxl__xs_kvs_of_flexarray(gc, ro_front)); rc = 0; out: return rc; @@ -3476,8 +3476,8 @@ int libxl__device_vkb_add(libxl__gc *gc, uint32_t domid, flexarray_append(front, GCSPRINTF("%d", XenbusStateInitialising)); libxl__device_generic_add(gc, XBT_NULL, &device, - libxl__xs_kvs_of_flexarray(gc, back, back->count), - libxl__xs_kvs_of_flexarray(gc, front, front->count), + libxl__xs_kvs_of_flexarray(gc, back), + libxl__xs_kvs_of_flexarray(gc, front), NULL); rc = 0; out: @@ -3589,8 +3589,8 @@ int libxl__device_vfb_add(libxl__gc *gc, uint32_t domid, libxl_device_vfb *vfb) flexarray_append_pair(front, "state", GCSPRINTF("%d", XenbusStateInitialising)); libxl__device_generic_add(gc, XBT_NULL, &device, - libxl__xs_kvs_of_flexarray(gc, back, back->count), - libxl__xs_kvs_of_flexarray(gc, front, front->count), + libxl__xs_kvs_of_flexarray(gc, back), + libxl__xs_kvs_of_flexarray(gc, front), NULL); rc = 0; out: diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h index ecbfdad..ec4fc23 100644 --- a/tools/libxl/libxl_internal.h +++ b/tools/libxl/libxl_internal.h @@ -676,7 +676,7 @@ _hidden int libxl__remove_directory(libxl__gc *gc, const char *path); _hidden int libxl__remove_file_or_directory(libxl__gc *gc, const char *path); -_hidden char **libxl__xs_kvs_of_flexarray(libxl__gc *gc, flexarray_t *array, int length); +_hidden char **libxl__xs_kvs_of_flexarray(libxl__gc *gc, flexarray_t *array); /* treats kvs as pairs of keys and values and writes each to dir. */ _hidden int libxl__xs_writev(libxl__gc *gc, xs_transaction_t t, diff --git a/tools/libxl/libxl_nic.c b/tools/libxl/libxl_nic.c index d1caa90..220a028 100644 --- a/tools/libxl/libxl_nic.c +++ b/tools/libxl/libxl_nic.c @@ -266,10 +266,8 @@ static void libxl__device_nic_add(libxl__egc *egc, uint32_t domid, } libxl__device_generic_add(gc, t, device, - libxl__xs_kvs_of_flexarray(gc, back, - back->count), - libxl__xs_kvs_of_flexarray(gc, front, - front->count), + libxl__xs_kvs_of_flexarray(gc, back), + libxl__xs_kvs_of_flexarray(gc, front), NULL); rc = libxl__xs_transaction_commit(gc, &t); diff --git a/tools/libxl/libxl_pci.c b/tools/libxl/libxl_pci.c index 22398a4..6f8f49c 100644 --- a/tools/libxl/libxl_pci.c +++ b/tools/libxl/libxl_pci.c @@ -104,8 +104,8 @@ int libxl__create_pci_backend(libxl__gc *gc, uint32_t domid, flexarray_append_pair(front, "state", GCSPRINTF("%d", XenbusStateInitialising)); return libxl__device_generic_add(gc, XBT_NULL, &device, - libxl__xs_kvs_of_flexarray(gc, back, back->count), - libxl__xs_kvs_of_flexarray(gc, front, front->count), + libxl__xs_kvs_of_flexarray(gc, back), + libxl__xs_kvs_of_flexarray(gc, front), NULL); } @@ -172,8 +172,7 @@ static int libxl__device_pci_add_xenstore(libxl__gc *gc, uint32_t domid, libxl_d rc = libxl__set_domain_configuration(gc, domid, &d_config); if (rc) goto out; - libxl__xs_writev(gc, t, be_path, - libxl__xs_kvs_of_flexarray(gc, back, back->count)); + libxl__xs_writev(gc, t, be_path, libxl__xs_kvs_of_flexarray(gc, back)); rc = libxl__xs_transaction_commit(gc, &t); if (!rc) break; diff --git a/tools/libxl/libxl_usb.c b/tools/libxl/libxl_usb.c index 75f7b8b..6b30e0f 100644 --- a/tools/libxl/libxl_usb.c +++ b/tools/libxl/libxl_usb.c @@ -177,9 +177,9 @@ static int libxl__device_usbctrl_add_xenstore(libxl__gc *gc, uint32_t domid, } libxl__device_generic_add(gc, t, device, - libxl__xs_kvs_of_flexarray(gc, back, back->count), - libxl__xs_kvs_of_flexarray(gc, front, front->count), - NULL); + libxl__xs_kvs_of_flexarray(gc, back), + libxl__xs_kvs_of_flexarray(gc, front), + NULL); rc = libxl__xs_transaction_commit(gc, &t); if (!rc) break; diff --git a/tools/libxl/libxl_vtpm.c b/tools/libxl/libxl_vtpm.c index 29a0817..8588569 100644 --- a/tools/libxl/libxl_vtpm.c +++ b/tools/libxl/libxl_vtpm.c @@ -141,10 +141,8 @@ static void libxl__device_vtpm_add(libxl__egc *egc, uint32_t domid, } libxl__device_generic_add(gc, t, device, - libxl__xs_kvs_of_flexarray(gc, back, - back->count), - libxl__xs_kvs_of_flexarray(gc, front, - front->count), + libxl__xs_kvs_of_flexarray(gc, back), + libxl__xs_kvs_of_flexarray(gc, front), NULL); rc = libxl__xs_transaction_commit(gc, &t); diff --git a/tools/libxl/libxl_xshelp.c b/tools/libxl/libxl_xshelp.c index e1412a6..4982b52 100644 --- a/tools/libxl/libxl_xshelp.c +++ b/tools/libxl/libxl_xshelp.c @@ -17,10 +17,10 @@ #include "libxl_internal.h" -char **libxl__xs_kvs_of_flexarray(libxl__gc *gc, flexarray_t *array, int length) +char **libxl__xs_kvs_of_flexarray(libxl__gc *gc, flexarray_t *array) { char **kvs; - int i; + int i, length = array->count; if (!length) return NULL; -- 2.6.6 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |