diff options
Diffstat (limited to 'tools/xenstore/xs.h')
-rw-r--r-- | tools/xenstore/xs.h | 41 |
1 files changed, 20 insertions, 21 deletions
diff --git a/tools/xenstore/xs.h b/tools/xenstore/xs.h index ff9481c3a6..b778cedd65 100644 --- a/tools/xenstore/xs.h +++ b/tools/xenstore/xs.h @@ -1,5 +1,3 @@ -#ifndef _XS_H -#define _XS_H /* Xen Store Daemon providing simple tree-like database. Copyright (C) 2005 Rusty Russell IBM Corporation @@ -19,11 +17,15 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* On failure, these routines set errno. */ +#ifndef _XS_H +#define _XS_H + #include "xs_lib.h" struct xs_handle; +/* On failure, these routines set errno. */ + /* Connect to the xs daemon. * Returns a handle or NULL. */ @@ -52,8 +54,8 @@ void *xs_read(struct xs_handle *h, const char *path, unsigned int *len); /* Write the value of a single file. * Returns false on failure. createflags can be 0, O_CREAT, or O_CREAT|O_EXCL. */ -bool xs_write(struct xs_handle *h, const char *path, const void *data, unsigned int len, - int createflags); +bool xs_write(struct xs_handle *h, const char *path, const void *data, + unsigned int len, int createflags); /* Create a new directory. * Returns false on failure. @@ -69,42 +71,42 @@ bool xs_rm(struct xs_handle *h, const char *path); * Returns malloced array, or NULL: call free() after use. */ struct xs_permissions *xs_get_permissions(struct xs_handle *h, - const char *path, - unsigned int *num); + const char *path, unsigned int *num); /* Set permissions of node (must be owner). * Returns false on failure. */ -bool xs_set_permissions(struct xs_handle *h, - const char *path, - struct xs_permissions *perms, - unsigned int num_perms); +bool xs_set_permissions(struct xs_handle *h, const char *path, + struct xs_permissions *perms, unsigned int num_perms); /* Watch a node for changes (poll on fd to detect, or call read_watch()). * When the node (or any child) changes, fd will become readable. + * Token is returned when watch is read, to allow matching. * Priority indicates order if multiple watchers: higher is first. * Returns false on failure. */ -bool xs_watch(struct xs_handle *h, const char *path, unsigned int priority); +bool xs_watch(struct xs_handle *h, const char *path, const char *token, + unsigned int priority); /* Return the FD to poll on to see if a watch has fired. */ int xs_fileno(struct xs_handle *h); /* Find out what node change was on (will block if nothing pending). - * Returns malloced path, or NULL: call free() after use. + * 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); /* Acknowledge watch on node. Watches must be acknowledged before * any other watches can be read. * Returns false on failure. */ -bool xs_acknowledge_watch(struct xs_handle *h); +bool xs_acknowledge_watch(struct xs_handle *h, const char *token); /* Remove a watch on a node. * Returns false on failure (no watch on that node). */ -bool xs_unwatch(struct xs_handle *h, const char *path); +bool xs_unwatch(struct xs_handle *h, const char *path, const char *token); /* Start a transaction: changes by others will not be seen during this * transaction, and changes will not be visible to others until end. @@ -125,11 +127,8 @@ bool xs_transaction_end(struct xs_handle *h, bool abort); * This tells the store daemon about a shared memory page, event channel * and store path associated with a domain: the domain uses these to communicate. */ -bool xs_introduce_domain(struct xs_handle *h, - domid_t domid, - unsigned long mfn, - unsigned int eventchn, - const char *path); +bool xs_introduce_domain(struct xs_handle *h, domid_t domid, unsigned long mfn, + unsigned int eventchn, const char *path); /* Release a domain. * Tells the store domain to release the memory page to the domain. |