[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen master] libxl: dont pass array size to libxl__xs_kvs_of_flexarray()



commit aa3cbf0db6fc58f90c6c5da48c49e0a0ab659581
Author:     Juergen Gross <jgross@xxxxxxxx>
AuthorDate: Thu Sep 8 09:20:23 2016 +0200
Commit:     Wei Liu <wei.liu2@xxxxxxxxxx>
CommitDate: Mon Sep 12 10:17:10 2016 +0100

    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>
    Acked-by: Wei Liu <wei.liu2@xxxxxxxxxx>
---
 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 6a50e49..997d94c 100644
--- a/tools/libxl/libxl.c
+++ b/tools/libxl/libxl.c
@@ -2334,8 +2334,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);
@@ -2754,7 +2754,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;
@@ -2796,7 +2796,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;
@@ -3166,9 +3166,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;
@@ -3495,8 +3495,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:
@@ -3608,8 +3608,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 01aabad..05a9308 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;
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.