1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
#ifndef XENBUS_H__
#define XENBUS_H__
typedef unsigned long xenbus_transaction_t;
#define XBT_NIL ((xenbus_transaction_t)0)
/* Initialize the XenBus system. */
void init_xenbus(void);
/* Read the value associated with a path. Returns a malloc'd error
string on failure and sets *value to NULL. On success, *value is
set to a malloc'd copy of the value. */
char *xenbus_read(xenbus_transaction_t xbt, const char *path, char **value);
/* Associates a value with a path. Returns a malloc'd error string on
failure. */
char *xenbus_write(xenbus_transaction_t xbt, const char *path, const char *value);
/* Removes the value associated with a path. Returns a malloc'd error
string on failure. */
char *xenbus_rm(xenbus_transaction_t xbt, const char *path);
/* List the contents of a directory. Returns a malloc'd error string
on failure and sets *contents to NULL. On success, *contents is
set to a malloc'd array of pointers to malloc'd strings. The array
is NULL terminated. May block. */
char *xenbus_ls(xenbus_transaction_t xbt, const char *prefix, char ***contents);
/* Reads permissions associated with a path. Returns a malloc'd error
string on failure and sets *value to NULL. On success, *value is
set to a malloc'd copy of the value. */
char *xenbus_get_perms(xenbus_transaction_t xbt, const char *path, char **value);
/* Sets the permissions associated with a path. Returns a malloc'd
error string on failure. */
char *xenbus_set_perms(xenbus_transaction_t xbt, const char *path, domid_t dom, char perm);
/* Start a xenbus transaction. Returns the transaction in xbt on
success or a malloc'd error string otherwise. */
char *xenbus_transaction_start(xenbus_transaction_t *xbt);
/* End a xenbus transaction. Returns a malloc'd error string if it
fails. abort says whether the transaction should be aborted.
Returns 1 in *retry iff the transaction should be retried. */
char *xenbus_transaction_end(xenbus_transaction_t, int abort,
int *retry);
/* Read path and parse it as an integer. Returns -1 on error. */
int xenbus_read_integer(char *path);
#endif /* XENBUS_H__ */
|