FreeBSD xen subsystem code
|
Datastructures and function declarations for usedby device drivers operating on the XenBus. More...
#include <sys/queue.h>
#include <sys/bus.h>
#include <sys/eventhandler.h>
#include <sys/malloc.h>
#include <sys/sbuf.h>
#include <machine/stdarg.h>
#include <xen/xen-os.h>
#include <contrib/xen/grant_table.h>
#include <contrib/xen/io/xenbus.h>
#include <contrib/xen/io/xs_wire.h>
#include <xen/xenstore/xenstorevar.h>
#include "xenbus_if.h"
Go to the source code of this file.
Macros | |
#define | XENBUS_ACCESSOR(var, ivar, type) __BUS_ACCESSOR(xenbus, var, XENBUS, ivar, type) |
Enumerations | |
enum | { XENBUS_IVAR_NODE , XENBUS_IVAR_TYPE , XENBUS_IVAR_STATE , XENBUS_IVAR_OTHEREND_ID , XENBUS_IVAR_OTHEREND_PATH } |
Functions | |
MALLOC_DECLARE (M_XENBUS) | |
XenbusState | xenbus_read_driver_state (const char *path) |
static XenbusState | xenbus_get_otherend_state (device_t dev) |
int | xenbus_grant_ring (device_t dev, unsigned long ring_mfn, grant_ref_t *refp) |
void | xenbus_dev_error (device_t dev, int err, const char *fmt,...) __attribute__((format(printf |
void void | xenbus_dev_verror (device_t dev, int err, const char *fmt, va_list ap) __attribute__((format(printf |
void void void | xenbus_dev_fatal (device_t dev, int err, const char *fmt,...) __attribute__((format(printf |
void void void void | xenbus_dev_vfatal (device_t dev, int err, const char *fmt, va_list) __attribute__((format(printf |
void void void void const char * | xenbus_strstate (enum xenbus_state state) |
int | xenbus_dev_is_online (device_t dev) |
void | xenbus_localend_changed (device_t dev, const char *path) |
Datastructures and function declarations for usedby device drivers operating on the XenBus.
Definition in file xenbusvar.h.
#define XENBUS_ACCESSOR | ( | var, | |
ivar, | |||
type | |||
) | __BUS_ACCESSOR(xenbus, var, XENBUS, ivar, type) |
Simplified accessors for xenbus devices:
xenbus_get_node xenbus_get_type xenbus_get_state xenbus_get_otherend_id xenbus_get_otherend_path
Definition at line 93 of file xenbusvar.h.
anonymous enum |
Definition at line 57 of file xenbusvar.h.
void xenbus_dev_error | ( | device_t | dev, |
int | err, | ||
const char * | fmt, | ||
... | |||
) |
Record the given errno, along with the given, printf-style, formatted message in dev's device specific error node in the XenStore.
dev | The device which encountered the error. |
err | The errno value corresponding to the error. |
fmt | Printf format string followed by a variable number of printf arguments. |
void void void xenbus_dev_fatal | ( | device_t | dev, |
int | err, | ||
const char * | fmt, | ||
... | |||
) |
Equivalent to xenbus_dev_error(), followed by xenbus_set_state(dev, XenbusStateClosing).
dev | The device which encountered the error. |
err | The errno value corresponding to the error. |
fmt | Printf format string followed by a variable number of printf arguments. |
Referenced by xenbus_grant_ring(), and xenbusb_write_ivar().
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 198 of file xenbus.c.
Referenced by xenbusb_back_localend_changed(), and xenbusb_back_otherend_changed().
void void xenbus_dev_verror | ( | device_t | dev, |
int | err, | ||
const char * | fmt, | ||
va_list | ap | ||
) |
va_list version of xenbus_dev_error().
dev | The device which encountered the error. |
err | The errno value corresponding to the error. |
fmt | Printf format string. |
ap | Va_list of printf arguments. |
void void void void xenbus_dev_vfatal | ( | device_t | dev, |
int | err, | ||
const char * | fmt, | ||
va_list | |||
) |
va_list version of xenbus_dev_fatal().
dev | The device which encountered the error. |
err | The errno value corresponding to the error. |
fmt | Printf format string. |
ap | Va_list of printf arguments. |
|
inlinestatic |
Return the state of the "other end" (peer) of a XenBus device.
dev | The XenBus device whose peer to query. |
Definition at line 121 of file xenbusvar.h.
References xenbus_read_driver_state().
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 170 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 185 of file xenbus.c.
Referenced by xenbus_get_otherend_state(), xenbusb_add_device(), xenbusb_localend_changed(), and xenbusb_otherend_watch_cb().
void void void void const char * xenbus_strstate | ( | enum xenbus_state | state | ) |
Convert a member of the xenbus_state enum into an ASCII string.
/param state The XenBus state to lookup.
/return A string representing state or, for unrecognized states, the string "Unknown".
Referenced by xenbusb_device_sysctl_handler().