ia64/xen-unstable

view extras/mini-os/include/xenbus.h @ 16520:a583f3a7eafc

Revert 16498:d2bef6551c1263e457aef75ce403ba53652a803f.
author Keir Fraser <keir.fraser@citrix.com>
date Tue Dec 04 22:54:58 2007 +0000 (2007-12-04)
parents f40079acf646
children 76d88d1da324
line source
1 #ifndef XENBUS_H__
2 #define XENBUS_H__
4 typedef unsigned long xenbus_transaction_t;
5 #define XBT_NIL ((xenbus_transaction_t)0)
7 /* Initialize the XenBus system. */
8 void init_xenbus(void);
10 /* Read the value associated with a path. Returns a malloc'd error
11 string on failure and sets *value to NULL. On success, *value is
12 set to a malloc'd copy of the value. */
13 char *xenbus_read(xenbus_transaction_t xbt, const char *path, char **value);
15 char *xenbus_watch_path(xenbus_transaction_t xbt, const char *path);
16 void wait_for_watch(void);
17 char* xenbus_wait_for_value(const char*,const char*);
19 /* Associates a value with a path. Returns a malloc'd error string on
20 failure. */
21 char *xenbus_write(xenbus_transaction_t xbt, const char *path, const char *value);
23 /* Removes the value associated with a path. Returns a malloc'd error
24 string on failure. */
25 char *xenbus_rm(xenbus_transaction_t xbt, const char *path);
27 /* List the contents of a directory. Returns a malloc'd error string
28 on failure and sets *contents to NULL. On success, *contents is
29 set to a malloc'd array of pointers to malloc'd strings. The array
30 is NULL terminated. May block. */
31 char *xenbus_ls(xenbus_transaction_t xbt, const char *prefix, char ***contents);
33 /* Reads permissions associated with a path. Returns a malloc'd error
34 string on failure and sets *value to NULL. On success, *value is
35 set to a malloc'd copy of the value. */
36 char *xenbus_get_perms(xenbus_transaction_t xbt, const char *path, char **value);
38 /* Sets the permissions associated with a path. Returns a malloc'd
39 error string on failure. */
40 char *xenbus_set_perms(xenbus_transaction_t xbt, const char *path, domid_t dom, char perm);
42 /* Start a xenbus transaction. Returns the transaction in xbt on
43 success or a malloc'd error string otherwise. */
44 char *xenbus_transaction_start(xenbus_transaction_t *xbt);
46 /* End a xenbus transaction. Returns a malloc'd error string if it
47 fails. abort says whether the transaction should be aborted.
48 Returns 1 in *retry iff the transaction should be retried. */
49 char *xenbus_transaction_end(xenbus_transaction_t, int abort,
50 int *retry);
52 /* Read path and parse it as an integer. Returns -1 on error. */
53 int xenbus_read_integer(char *path);
55 #endif /* XENBUS_H__ */