FreeBSD xen subsystem code
|
Client-facing interface for the Xenbus driver. More...
#include <sys/cdefs.h>
#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/types.h>
#include <sys/malloc.h>
#include <sys/libkern.h>
#include <sys/sbuf.h>
#include <xen/xen-os.h>
#include <xen/hypervisor.h>
#include <xen/evtchn.h>
#include <xen/gnttab.h>
#include <xen/xenbus/xenbusvar.h>
#include <machine/stdarg.h>
Go to the source code of this file.
Macros | |
#define | DPRINTK(fmt, args...) ((void)0) |
#define | PRINTF_BUFFER_SIZE 4096 |
Functions | |
__FBSDID ("$FreeBSD: head/sys/xen/xenbus/xenbus.c 255040 2013-08-29 19:52:18Z gibbs $") | |
MALLOC_DEFINE (M_XENBUS, "xenbus", "XenBus Support") | |
static char * | error_path (device_t dev) |
Construct the error path corresponding to the given XenBus device. More... | |
const char * | xenbus_strstate (XenbusState state) |
int | xenbus_watch_path (device_t dev, char *path, struct xs_watch *watch, xs_watch_cb_t *callback, uintptr_t callback_data) |
int | xenbus_watch_path2 (device_t dev, const char *path, const char *path2, struct xs_watch *watch, xs_watch_cb_t *callback, uintptr_t callback_data) |
void | xenbus_dev_verror (device_t dev, int err, const char *fmt, va_list ap) |
void | xenbus_dev_error (device_t dev, int err, const char *fmt,...) |
void | xenbus_dev_vfatal (device_t dev, int err, const char *fmt, va_list ap) |
void | xenbus_dev_fatal (device_t dev, int err, const char *fmt,...) |
int | xenbus_grant_ring (device_t dev, unsigned long ring_mfn, grant_ref_t *refp) |
XenbusState | xenbus_read_driver_state (const char *path) |
int | xenbus_dev_is_online (device_t dev) |
void | xenbus_localend_changed (device_t dev, const char *path) |
Client-facing interface for the Xenbus driver.
In other words, the interface between the Xenbus and the device-specific code, be it the frontend or the backend of that driver.
Definition in file xenbus.c.
|
static |
Construct the error path corresponding to the given XenBus device.
dev | The XenBus device for which we are constructing an error path. |
It is the caller's responsibility to free any returned error path node using the M_XENBUS malloc type.
int xenbus_dev_is_online | ( | device_t | dev | ) |
Return the value of a XenBus device's "online" node within the XenStore.
dev | The XenBus device to query. |
Definition at line 240 of file xenbus.c.
Referenced by xenbusb_back_localend_changed(), and xenbusb_back_otherend_changed().
int xenbus_grant_ring | ( | device_t | dev, |
unsigned long | ring_mfn, | ||
grant_ref_t * | refp | ||
) |
Grant access to the given ring_mfn to the peer of the given device.
dev | The device granting access to the ring page. |
ring_mfn | The guest machine page number of the page to grant peer access rights. |
refp[out] | The grant reference for the page. |
A successful call to xenbus_grant_ring should be paired with a call to gnttab_end_foreign_access() when foregn access to this page is no longer requried.
Definition at line 212 of file xenbus.c.
References xenbus_dev_fatal().
void xenbus_localend_changed | ( | device_t | dev, |
const char * | path | ||
) |
Default callback invoked when a change to the local XenStore sub-tree for a device is modified.
dev | The XenBus device whose tree was modified. |
path | The tree relative sub-path to the modified node. The empty string indicates the root of the tree was destroyed. |
XenbusState xenbus_read_driver_state | ( | const char * | path | ) |
Return the state of a XenBus device.
path | The root XenStore path for the device. |
Definition at line 227 of file xenbus.c.
Referenced by xenbus_get_otherend_state(), xenbusb_add_device(), xenbusb_localend_changed(), and xenbusb_otherend_watch_cb().
int xenbus_watch_path | ( | device_t | dev, |
char * | path, | ||
struct xs_watch * | watch, | ||
xs_watch_cb_t * | callback, | ||
uintptr_t | cb_data | ||
) |
Initialize and register a watch on the given path (client suplied storage).
dev | The XenBus device requesting the watch service. |
path | The XenStore path of the object to be watched. The storage for this string must be stable for the lifetime of the watch. |
watch | The watch object to use for this request. This object must be stable for the lifetime of the watch. |
callback | The function to call when XenStore objects at or below path are modified. |
cb_data | Client data that can be retrieved from the watch object during the callback. |
Definition at line 106 of file xenbus.c.
References xenbus_dev_fatal().
Referenced by xenbus_watch_path2().
int xenbus_watch_path2 | ( | device_t | dev, |
const char * | path, | ||
const char * | path2, | ||
struct xs_watch * | watch, | ||
xs_watch_cb_t * | callback, | ||
uintptr_t | cb_data | ||
) |
Initialize and register a watch at path/path2 in the XenStore.
dev | The XenBus device requesting the watch service. |
path | The base XenStore path of the object to be watched. |
path2 | The tail XenStore path of the object to be watched. |
watch | The watch object to use for this request. This object must be stable for the lifetime of the watch. |
callback | The function to call when XenStore objects at or below path are modified. |
cb_data | Client data that can be retrieved from the watch object during the callback. |
Similar to xenbus_watch_path, however the storage for the path to the watched object is allocated from the heap and filled with "path '/' path2". Should a call to this function succeed, it is the callers responsibility to free watch->node using the M_XENBUS malloc type.
Definition at line 127 of file xenbus.c.
References xenbus_watch_path().