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

Re: [Xen-devel] [PATCH 04 of 11] libxl: expand the libxl_{cpu, node}map API a bit



On 31/05/12 13:11, Dario Faggioli wrote:
By adding copying and *_is_full/*_is_empty facilities.

Signed-off-by: Dario Faggioli<dario.faggioli@xxxxxxxxxx>

diff --git a/tools/libxl/libxl_utils.c b/tools/libxl/libxl_utils.c
--- a/tools/libxl/libxl_utils.c
+++ b/tools/libxl/libxl_utils.c
@@ -505,6 +505,35 @@ static int libxl_map_alloc(libxl_ctx *ct
      return 0;
  }

+static void libxl_map_copy(struct libxl_map *dptr,
+                           const struct libxl_map *sptr)
+{
+    int sz;
+
+    sz = dptr->size = sptr->size;
+    memcpy(dptr->map, sptr->map, sz * sizeof(*dptr->map));
+}
+
+int libxl_map_is_full(struct libxl_map *map)
+{
+    int i;
+
+    for (i = 0; i<  map->size; i++)
+        if (map->map[i] != (uint8_t)-1)
+            return -1;
+    return 0;
+}
Why are you returning -1 and 0 for false and true, rather than 0 and 1? None of the other libxl "_is_" functions (e.g., libxl_is_stubom()) do that.

 -George

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

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