source: trunk/packages/xen-3.1/xen-3.1/extras/mini-os/include/xenbus.h @ 34

Last change on this file since 34 was 34, checked in by hartmans, 18 years ago

Add xen and xen-common

File size: 2.2 KB
Line 
1#ifndef XENBUS_H__
2#define XENBUS_H__
3
4typedef unsigned long xenbus_transaction_t;
5#define XBT_NIL ((xenbus_transaction_t)0)
6
7/* Initialize the XenBus system. */
8void init_xenbus(void);
9
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. */
13char *xenbus_read(xenbus_transaction_t xbt, const char *path, char **value);
14
15char *xenbus_watch_path(xenbus_transaction_t xbt, const char *path);
16void wait_for_watch(void);
17char* xenbus_wait_for_value(const char*,const char*);
18
19/* Associates a value with a path.  Returns a malloc'd error string on
20   failure. */
21char *xenbus_write(xenbus_transaction_t xbt, const char *path, const char *value);
22
23/* Removes the value associated with a path.  Returns a malloc'd error
24   string on failure. */
25char *xenbus_rm(xenbus_transaction_t xbt, const char *path);
26
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. */
31char *xenbus_ls(xenbus_transaction_t xbt, const char *prefix, char ***contents);
32
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. */
36char *xenbus_get_perms(xenbus_transaction_t xbt, const char *path, char **value);
37
38/* Sets the permissions associated with a path.  Returns a malloc'd
39   error string on failure. */
40char *xenbus_set_perms(xenbus_transaction_t xbt, const char *path, domid_t dom, char perm);
41
42/* Start a xenbus transaction.  Returns the transaction in xbt on
43   success or a malloc'd error string otherwise. */
44char *xenbus_transaction_start(xenbus_transaction_t *xbt);
45
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. */
49char *xenbus_transaction_end(xenbus_transaction_t, int abort,
50                             int *retry);
51
52/* Read path and parse it as an integer.  Returns -1 on error. */
53int xenbus_read_integer(char *path);
54
55#endif /* XENBUS_H__ */
Note: See TracBrowser for help on using the repository browser.