Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions | Variables
xenbus.h File Reference
#include <linux/device.h>
#include <linux/notifier.h>
#include <linux/mutex.h>
#include <linux/export.h>
#include <linux/completion.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <xen/interface/xen.h>
#include <xen/interface/grant_table.h>
#include <xen/interface/io/xenbus.h>
#include <xen/interface/io/xs_wire.h>

Go to the source code of this file.

Data Structures

struct  xenbus_watch
 
struct  xenbus_device
 
struct  xenbus_device_id
 
struct  xenbus_driver
 
struct  xenbus_transaction
 

Macros

#define DEFINE_XENBUS_DRIVER(var, drvname, methods...)
 
#define XBT_NIL   ((struct xenbus_transaction) { 0 })
 
#define XENBUS_IS_ERR_READ(str)
 
#define XENBUS_EXIST_ERR(err)   ((err) == -ENOENT || (err) == -ERANGE)
 

Functions

int __must_check xenbus_register_frontend (struct xenbus_driver *)
 
int __must_check xenbus_register_backend (struct xenbus_driver *)
 
void xenbus_unregister_driver (struct xenbus_driver *drv)
 
char ** xenbus_directory (struct xenbus_transaction t, const char *dir, const char *node, unsigned int *num)
 
voidxenbus_read (struct xenbus_transaction t, const char *dir, const char *node, unsigned int *len)
 
int xenbus_write (struct xenbus_transaction t, const char *dir, const char *node, const char *string)
 
int xenbus_mkdir (struct xenbus_transaction t, const char *dir, const char *node)
 
int xenbus_exists (struct xenbus_transaction t, const char *dir, const char *node)
 
int xenbus_rm (struct xenbus_transaction t, const char *dir, const char *node)
 
int xenbus_transaction_start (struct xenbus_transaction *t)
 
int xenbus_transaction_end (struct xenbus_transaction t, int abort)
 
 __scanf (4, 5) int xenbus_scanf(struct xenbus_transaction t
 
const char const char const char __printf (4, 5) int xenbus_printf(struct xenbus_transaction t
 
const char const char const
char const char const char
const char int 
xenbus_gather (struct xenbus_transaction t, const char *dir,...)
 
int register_xenstore_notifier (struct notifier_block *nb)
 
void unregister_xenstore_notifier (struct notifier_block *nb)
 
int register_xenbus_watch (struct xenbus_watch *watch)
 
void unregister_xenbus_watch (struct xenbus_watch *watch)
 
void xs_suspend (void)
 
void xs_resume (void)
 
void xs_suspend_cancel (void)
 
voidxenbus_dev_request_and_reply (struct xsd_sockmsg *msg)
 
void xenbus_suspend (void)
 
void xenbus_resume (void)
 
void xenbus_probe (struct work_struct *)
 
void xenbus_suspend_cancel (void)
 
int xenbus_watch_path (struct xenbus_device *dev, const char *path, struct xenbus_watch *watch, void(*callback)(struct xenbus_watch *, const char **, unsigned int))
 
int xenbus_grant_ring (struct xenbus_device *dev, unsigned long ring_mfn)
 
int xenbus_map_ring_valloc (struct xenbus_device *dev, int gnt_ref, void **vaddr)
 
int xenbus_map_ring (struct xenbus_device *dev, int gnt_ref, grant_handle_t *handle, void *vaddr)
 
int xenbus_unmap_ring_vfree (struct xenbus_device *dev, void *vaddr)
 
int xenbus_unmap_ring (struct xenbus_device *dev, grant_handle_t handle, void *vaddr)
 
int xenbus_alloc_evtchn (struct xenbus_device *dev, int *port)
 
int xenbus_bind_evtchn (struct xenbus_device *dev, int remote_port, int *port)
 
int xenbus_free_evtchn (struct xenbus_device *dev, int port)
 
enum xenbus_state xenbus_read_driver_state (const char *path)
 
 __printf (3, 4) void xenbus_dev_error(struct xenbus_device *dev
 
int const char int const char
const char
xenbus_strstate (enum xenbus_state state)
 
int xenbus_dev_is_online (struct xenbus_device *dev)
 
int xenbus_frontend_closed (struct xenbus_device *dev)
 

Variables

const chardir
 
const char const charnode
 
const char const char const charfmt
 
int xenstored_ready
 
struct xenbus_watchwatch
 
struct xenbus_watch void(* callback )(struct xenbus_watch *, const char **, unsigned int)
 
struct xenbus_watch void(*)
const char 
pathfmt )
 
struct xenbus_watch void(*)
const char in 
xenbus_switch_state )(struct xenbus_device *dev, enum xenbus_state new_state)
 
int err
 

Macro Definition Documentation

#define DEFINE_XENBUS_DRIVER (   var,
  drvname,
  methods... 
)
Value:
struct xenbus_driver var ## _driver = { \
.driver.name = drvname + 0 ?: var ## _ids->devicetype, \
.driver.owner = THIS_MODULE, \
.ids = var ## _ids, ## methods \
}

Definition at line 102 of file xenbus.h.

#define XBT_NIL   ((struct xenbus_transaction) { 0 })

Definition at line 125 of file xenbus.h.

#define XENBUS_EXIST_ERR (   err)    ((err) == -ENOENT || (err) == -ERANGE)

Definition at line 185 of file xenbus.h.

#define XENBUS_IS_ERR_READ (   str)
Value:
({ \
if (!IS_ERR(str) && strlen(str) == 0) { \
kfree(str); \
str = ERR_PTR(-ERANGE); \
} \
IS_ERR(str); \
})

Definition at line 177 of file xenbus.h.

Function Documentation

const char const char const char __printf ( ,
 
)
__printf ( ,
 
)
__scanf ( ,
 
)
int register_xenbus_watch ( struct xenbus_watch watch)

Definition at line 663 of file xenbus_xs.c.

int register_xenstore_notifier ( struct notifier_block nb)

Definition at line 641 of file xenbus_probe.c.

void unregister_xenbus_watch ( struct xenbus_watch watch)

Definition at line 692 of file xenbus_xs.c.

void unregister_xenstore_notifier ( struct notifier_block nb)

Definition at line 654 of file xenbus_probe.c.

int xenbus_alloc_evtchn ( struct xenbus_device dev,
int port 
)

Allocate an event channel for the given xenbus_device, assigning the newly created local port to *port. Return 0 on success, or -errno on error. On error, the device will switch to XenbusStateClosing, and the error will be saved in the store.

Definition at line 381 of file xenbus_client.c.

int xenbus_bind_evtchn ( struct xenbus_device dev,
int  remote_port,
int port 
)

Bind to an existing interdomain event channel in another domain. Returns 0 on success and stores the local port in *port. On error, returns -errno, switches the device to XenbusStateClosing, and saves the error in XenStore.

Definition at line 406 of file xenbus_client.c.

int xenbus_dev_is_online ( struct xenbus_device dev)

Definition at line 223 of file xenbus_probe_backend.c.

void* xenbus_dev_request_and_reply ( struct xsd_sockmsg msg)

Definition at line 198 of file xenbus_xs.c.

char** xenbus_directory ( struct xenbus_transaction  t,
const char dir,
const char node,
unsigned int num 
)

Definition at line 354 of file xenbus_xs.c.

int xenbus_exists ( struct xenbus_transaction  t,
const char dir,
const char node 
)

Definition at line 374 of file xenbus_xs.c.

int xenbus_free_evtchn ( struct xenbus_device dev,
int  port 
)

Free an existing event channel. Returns 0 on success or -errno on error.

Definition at line 431 of file xenbus_client.c.

int xenbus_frontend_closed ( struct xenbus_device dev)

Definition at line 239 of file xenbus_client.c.

Definition at line 555 of file xenbus_xs.c.

int xenbus_grant_ring ( struct xenbus_device dev,
unsigned long  ring_mfn 
)

xenbus_grant_ring : xenbus device : mfn of ring to grant

Grant access to the given to the peer of the given device. Return 0 on success, or -errno on error. On error, the device will switch to XenbusStateClosing, and the error will be saved in the store.

Definition at line 365 of file xenbus_client.c.

int xenbus_map_ring ( struct xenbus_device dev,
int  gnt_ref,
grant_handle_t handle,
void vaddr 
)

xenbus_map_ring : xenbus device : grant reference : pointer to grant handle to be filled : address to be mapped to

Map a page of memory into this domain from another domain's grant table. xenbus_map_ring does not allocate the virtual address space (you must do this yourself!). It only maps in the page to the specified address. Returns 0 on success, and GNTST_* (see xen/include/interface/grant_table.h) or -ENOMEM on error. If an error is returned, device will switch to XenbusStateClosing and the error message will be saved in XenStore.

Definition at line 566 of file xenbus_client.c.

int xenbus_map_ring_valloc ( struct xenbus_device dev,
int  gnt_ref,
void **  vaddr 
)

xenbus_map_ring_valloc : xenbus device : grant reference : pointer to address to be filled out by mapping

Based on Rusty Russell's skeleton driver's map_page. Map a page of memory into this domain from another domain's grant table. xenbus_map_ring_valloc allocates a page of virtual address space, maps the page to that address, and sets vaddr to that address. Returns 0 on success, and GNTST_ (see xen/include/interface/grant_table.h) or -ENOMEM on error. If an error is returned, device will switch to XenbusStateClosing and the error message will be saved in XenStore.

Definition at line 461 of file xenbus_client.c.

int xenbus_mkdir ( struct xenbus_transaction  t,
const char dir,
const char node 
)

Definition at line 434 of file xenbus_xs.c.

void xenbus_probe ( struct work_struct )

Definition at line 660 of file xenbus_probe.c.

void* xenbus_read ( struct xenbus_transaction  t,
const char dir,
const char node,
unsigned int len 
)

Definition at line 392 of file xenbus_xs.c.

enum xenbus_state xenbus_read_driver_state ( const char path)

xenbus_read_driver_state : path for driver

Return the state of the driver rooted at the given store path, or XenbusStateUnknown if no state can be read.

Definition at line 721 of file xenbus_client.c.

int __must_check xenbus_register_backend ( struct xenbus_driver )

Definition at line 235 of file xenbus_probe_backend.c.

int __must_check xenbus_register_frontend ( struct xenbus_driver )

Definition at line 277 of file xenbus_probe_frontend.c.

void xenbus_resume ( void  )
int xenbus_rm ( struct xenbus_transaction  t,
const char dir,
const char node 
)

Definition at line 451 of file xenbus_xs.c.

int const char int const char const char* xenbus_strstate ( enum xenbus_state  state)

Definition at line 69 of file xenbus_client.c.

void xenbus_suspend ( void  )
void xenbus_suspend_cancel ( void  )
int xenbus_transaction_end ( struct xenbus_transaction  t,
int  abort 
)

Definition at line 490 of file xenbus_xs.c.

int xenbus_transaction_start ( struct xenbus_transaction t)

Definition at line 469 of file xenbus_xs.c.

int xenbus_unmap_ring ( struct xenbus_device dev,
grant_handle_t  handle,
void vaddr 
)

xenbus_unmap_ring : xenbus device : grant handle : addr to unmap

Unmap a page of memory in this domain that was imported from another domain. Returns 0 on success and returns GNTST_* on error (see xen/include/interface/grant_table.h).

Definition at line 694 of file xenbus_client.c.

int xenbus_unmap_ring_vfree ( struct xenbus_device dev,
void vaddr 
)

xenbus_unmap_ring_vfree : xenbus device : addr to unmap

Based on Rusty Russell's skeleton driver's unmap_page. Unmap a page of memory in this domain that was imported from another domain. Use xenbus_unmap_ring_vfree if you mapped in your memory with xenbus_map_ring_valloc (it will free the virtual address space). Returns 0 on success and returns GNTST_* on error (see xen/include/interface/grant_table.h).

Definition at line 600 of file xenbus_client.c.

void xenbus_unregister_driver ( struct xenbus_driver drv)

Definition at line 303 of file xenbus_probe.c.

int xenbus_watch_path ( struct xenbus_device dev,
const char path,
struct xenbus_watch watch,
void(*)(struct xenbus_watch *, const char **, unsigned int callback 
)

xenbus_watch_path - register a watch : xenbus device : path to watch : watch to register : callback to register

Register a on the given path, using the given xenbus_watch structure for storage, and the given function as the callback. Return 0 on success, or -errno on error. On success, the given will be saved as ->node, and remains the caller's to free. On error, ->node will be NULL, the device will switch to XenbusStateClosing, and the error will be saved in the store.

Definition at line 100 of file xenbus_client.c.

int xenbus_write ( struct xenbus_transaction  t,
const char dir,
const char node,
const char string 
)

Definition at line 411 of file xenbus_xs.c.

void xs_resume ( void  )

Definition at line 744 of file xenbus_xs.c.

void xs_suspend ( void  )

Definition at line 736 of file xenbus_xs.c.

void xs_suspend_cancel ( void  )

Definition at line 764 of file xenbus_xs.c.

Variable Documentation

Definition at line 193 of file xenbus.h.

Definition at line 144 of file xenbus.h.

Definition at line 215 of file xenbus.h.

Definition at line 144 of file xenbus.h.

Definition at line 144 of file xenbus.h.

Definition at line 195 of file xenbus.h.

Definition at line 192 of file xenbus.h.

Definition at line 197 of file xenbus.h.

int xenstored_ready

Definition at line 638 of file xenbus_probe.c.