Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions
xenbus_client.c File Reference
#include <linux/slab.h>
#include <linux/types.h>
#include <linux/spinlock.h>
#include <linux/vmalloc.h>
#include <linux/export.h>
#include <asm/xen/hypervisor.h>
#include <asm/xen/page.h>
#include <xen/interface/xen.h>
#include <xen/interface/event_channel.h>
#include <xen/balloon.h>
#include <xen/events.h>
#include <xen/grant_table.h>
#include <xen/xenbus.h>
#include <xen/xen.h>
#include "xenbus_probe.h"

Go to the source code of this file.

Data Structures

struct  xenbus_map_node
 
struct  xenbus_ring_ops
 

Macros

#define PRINTF_BUFFER_SIZE   4096
 

Functions

const charxenbus_strstate (enum xenbus_state state)
 
 EXPORT_SYMBOL_GPL (xenbus_strstate)
 
int xenbus_watch_path (struct xenbus_device *dev, const char *path, struct xenbus_watch *watch, void(*callback)(struct xenbus_watch *, const char **, unsigned int))
 
 EXPORT_SYMBOL_GPL (xenbus_watch_path)
 
int xenbus_watch_pathfmt (struct xenbus_device *dev, struct xenbus_watch *watch, void(*callback)(struct xenbus_watch *, const char **, unsigned int), const char *pathfmt,...)
 
 EXPORT_SYMBOL_GPL (xenbus_watch_pathfmt)
 
int xenbus_switch_state (struct xenbus_device *dev, enum xenbus_state state)
 
 EXPORT_SYMBOL_GPL (xenbus_switch_state)
 
int xenbus_frontend_closed (struct xenbus_device *dev)
 
 EXPORT_SYMBOL_GPL (xenbus_frontend_closed)
 
void xenbus_dev_error (struct xenbus_device *dev, int err, const char *fmt,...)
 
 EXPORT_SYMBOL_GPL (xenbus_dev_error)
 
void xenbus_dev_fatal (struct xenbus_device *dev, int err, const char *fmt,...)
 
 EXPORT_SYMBOL_GPL (xenbus_dev_fatal)
 
int xenbus_grant_ring (struct xenbus_device *dev, unsigned long ring_mfn)
 
 EXPORT_SYMBOL_GPL (xenbus_grant_ring)
 
int xenbus_alloc_evtchn (struct xenbus_device *dev, int *port)
 
 EXPORT_SYMBOL_GPL (xenbus_alloc_evtchn)
 
int xenbus_bind_evtchn (struct xenbus_device *dev, int remote_port, int *port)
 
 EXPORT_SYMBOL_GPL (xenbus_bind_evtchn)
 
int xenbus_free_evtchn (struct xenbus_device *dev, int port)
 
 EXPORT_SYMBOL_GPL (xenbus_free_evtchn)
 
int xenbus_map_ring_valloc (struct xenbus_device *dev, int gnt_ref, void **vaddr)
 
 EXPORT_SYMBOL_GPL (xenbus_map_ring_valloc)
 
int xenbus_map_ring (struct xenbus_device *dev, int gnt_ref, grant_handle_t *handle, void *vaddr)
 
 EXPORT_SYMBOL_GPL (xenbus_map_ring)
 
int xenbus_unmap_ring_vfree (struct xenbus_device *dev, void *vaddr)
 
 EXPORT_SYMBOL_GPL (xenbus_unmap_ring_vfree)
 
int xenbus_unmap_ring (struct xenbus_device *dev, grant_handle_t handle, void *vaddr)
 
 EXPORT_SYMBOL_GPL (xenbus_unmap_ring)
 
enum xenbus_state xenbus_read_driver_state (const char *path)
 
 EXPORT_SYMBOL_GPL (xenbus_read_driver_state)
 
void __init xenbus_ring_ops_init (void)
 

Macro Definition Documentation

#define PRINTF_BUFFER_SIZE   4096

Function Documentation

EXPORT_SYMBOL_GPL ( xenbus_strstate  )
EXPORT_SYMBOL_GPL ( xenbus_watch_path  )
EXPORT_SYMBOL_GPL ( xenbus_watch_pathfmt  )
EXPORT_SYMBOL_GPL ( xenbus_switch_state  )
EXPORT_SYMBOL_GPL ( xenbus_frontend_closed  )
EXPORT_SYMBOL_GPL ( xenbus_dev_error  )
EXPORT_SYMBOL_GPL ( xenbus_dev_fatal  )
EXPORT_SYMBOL_GPL ( xenbus_grant_ring  )
EXPORT_SYMBOL_GPL ( xenbus_alloc_evtchn  )
EXPORT_SYMBOL_GPL ( xenbus_bind_evtchn  )
EXPORT_SYMBOL_GPL ( xenbus_free_evtchn  )
EXPORT_SYMBOL_GPL ( xenbus_map_ring_valloc  )
EXPORT_SYMBOL_GPL ( xenbus_map_ring  )
EXPORT_SYMBOL_GPL ( xenbus_unmap_ring_vfree  )
EXPORT_SYMBOL_GPL ( xenbus_unmap_ring  )
EXPORT_SYMBOL_GPL ( xenbus_read_driver_state  )
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.

void xenbus_dev_error ( struct xenbus_device dev,
int  err,
const char fmt,
  ... 
)

xenbus_dev_error : xenbus device : error to report : error message format

Report the given negative errno into the store, along with the given formatted message.

Definition at line 306 of file xenbus_client.c.

void xenbus_dev_fatal ( struct xenbus_device dev,
int  err,
const char fmt,
  ... 
)

xenbus_dev_fatal : xenbus device : error to report : error message format

Equivalent to xenbus_dev_error(dev, err, fmt, args), followed by xenbus_switch_state(dev, XenbusStateClosing) to schedule an orderly closedown of this driver and its peer.

Definition at line 327 of file xenbus_client.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.

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.

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.

void __init xenbus_ring_ops_init ( void  )

Definition at line 742 of file xenbus_client.c.

const char* xenbus_strstate ( enum xenbus_state  state)

Definition at line 69 of file xenbus_client.c.

int xenbus_switch_state ( struct xenbus_device dev,
enum xenbus_state  state 
)

xenbus_switch_state : xenbus device : new state

Advertise in the store a change of the given driver to the given new_state. 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 232 of file xenbus_client.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.

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_watch_pathfmt ( struct xenbus_device dev,
struct xenbus_watch watch,
void(*)(struct xenbus_watch *, const char **, unsigned int callback,
const char pathfmt,
  ... 
)

xenbus_watch_pathfmt - register a watch on a sprintf-formatted path : xenbus device : watch to register : callback to register : format of path to watch

Register a watch on the given , 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 watched path (/) will be saved as ->node, and becomes the caller's to kfree(). On error, watch->node will be NULL, so the caller has nothing to free, the device will switch to XenbusStateClosing, and the error will be saved in the store.

Definition at line 138 of file xenbus_client.c.