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

[Xen-tools] [PATCH] Add a size parameter to xs_read_watch



Hi,

The attached patch adds an (optional) unsigned int * parameter to xs_read_watch to make it consistent with xs_read_directory. I've been experimenting with automated binding generators for libxenstore and returning a char ** with an implicit size makes things quite hairy.

Another solution would be to return a struct pair.

Regards,

Anthony Liguori
# HG changeset patch
# User anthony@xxxxxxxxxxxxxxxxxxxxx
# Node ID 6c8322f067904443641fe2e3b83199ad48792a8e
# Parent  61aef426bc350aeca268329482ef11f7547a7b70
Add an additional parameter to xs_read_watch to make it consistent with other
places where we return char **.

Signed-off-by: Anthony Liguori <aliguori@xxxxxxxxxx>

diff -r 61aef426bc35 -r 6c8322f06790 tools/blktap/xenbus.c
--- a/tools/blktap/xenbus.c     Sun Sep 18 17:37:45 2005
+++ b/tools/blktap/xenbus.c     Sun Sep 18 19:23:46 2005
@@ -252,7 +252,7 @@
     struct xenbus_watch *w;
     int er;
 
-    res = xs_read_watch(h);
+    res = xs_read_watch(h, NULL);
     if (res == NULL) 
         return -EAGAIN; /* in O_NONBLOCK, read_watch returns 0... */
 
diff -r 61aef426bc35 -r 6c8322f06790 tools/console/daemon/io.c
--- a/tools/console/daemon/io.c Sun Sep 18 17:37:45 2005
+++ b/tools/console/daemon/io.c Sun Sep 18 19:23:46 2005
@@ -478,7 +478,7 @@
        int domid;
        struct domain *dom;
 
-       vec = xs_read_watch(xs);
+       vec = xs_read_watch(xs, NULL);
        if (!vec)
                return;
 
diff -r 61aef426bc35 -r 6c8322f06790 tools/python/xen/lowlevel/xs/xs.c
--- a/tools/python/xen/lowlevel/xs/xs.c Sun Sep 18 17:37:45 2005
+++ b/tools/python/xen/lowlevel/xs/xs.c Sun Sep 18 19:23:46 2005
@@ -477,7 +477,7 @@
     if (!PyArg_ParseTupleAndKeywords(args, kwds, arg_spec, kwd_spec))
         goto exit;
     Py_BEGIN_ALLOW_THREADS
-    xsval = xs_read_watch(xh);
+    xsval = xs_read_watch(xh, NULL);
     Py_END_ALLOW_THREADS
     if (!xsval) {
         PyErr_SetFromErrno(PyExc_RuntimeError);
diff -r 61aef426bc35 -r 6c8322f06790 tools/xenstore/xs.c
--- a/tools/xenstore/xs.c       Sun Sep 18 17:37:45 2005
+++ b/tools/xenstore/xs.c       Sun Sep 18 19:23:46 2005
@@ -464,7 +464,7 @@
  * Returns array of two pointers: path and token, or NULL.
  * Call free() after use.
  */
-char **xs_read_watch(struct xs_handle *h)
+char **xs_read_watch(struct xs_handle *h, unsigned int *num)
 {
        struct xsd_sockmsg msg;
        char **ret;
@@ -483,6 +483,9 @@
                return NULL;
        }
        ret[1] = ret[0] + strlen(ret[0]) + 1;
+
+       if (num) *num = 2;
+
        return ret;
 }
 
diff -r 61aef426bc35 -r 6c8322f06790 tools/xenstore/xs.h
--- a/tools/xenstore/xs.h       Sun Sep 18 17:37:45 2005
+++ b/tools/xenstore/xs.h       Sun Sep 18 19:23:46 2005
@@ -94,7 +94,7 @@
  * Returns array of two pointers: path and token, or NULL.
  * Call free() after use.
  */
-char **xs_read_watch(struct xs_handle *h);
+char **xs_read_watch(struct xs_handle *h, unsigned int *num);
 
 /* Acknowledge watch on node.  Watches must be acknowledged before
  * any other watches can be read.
diff -r 61aef426bc35 -r 6c8322f06790 tools/xenstore/xs_test.c
--- a/tools/xenstore/xs_test.c  Sun Sep 18 17:37:45 2005
+++ b/tools/xenstore/xs_test.c  Sun Sep 18 19:23:46 2005
@@ -551,7 +551,7 @@
                set_timeout();
        }
 
-       vec = xs_read_watch(handles[handle]);
+       vec = xs_read_watch(handles[handle], NULL);
        if (!vec) {
                failed(handle);
                return;
_______________________________________________
Xen-tools mailing list
Xen-tools@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-tools

 


Rackspace

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