* include/libvir.h.in include/libvir.h src/internal.h src/libvir.c

src/xend_internal.c src/xend_internal.h: starting to plug the
  xend code in, replacing structures mostly, but not finished.
Daniel
This commit is contained in:
Daniel Veillard 2006-01-13 16:41:01 +00:00
parent fe64a1d852
commit c568ebea25
8 changed files with 240 additions and 208 deletions

View File

@ -1,3 +1,9 @@
Fri Jan 13 17:39:24 CET 2006 Daniel Veillard <veillard@redhat.com>
* include/libvir.h.in include/libvir.h src/internal.h src/libvir.c
src/xend_internal.c src/xend_internal.h: starting to plug the
xend code in, replacing structures mostly, but not finished.
Thu Jan 12 16:36:21 CET 2006 Daniel Veillard <veillard@redhat.com> Thu Jan 12 16:36:21 CET 2006 Daniel Veillard <veillard@redhat.com>
* src/Makefile.am src/xend_internal.c src/xend_internal.h: * src/Makefile.am src/xend_internal.c src/xend_internal.h:

View File

@ -7,7 +7,7 @@ H1 {font-family: Verdana,Arial,Helvetica}
H2 {font-family: Verdana,Arial,Helvetica} H2 {font-family: Verdana,Arial,Helvetica}
H3 {font-family: Verdana,Arial,Helvetica} H3 {font-family: Verdana,Arial,Helvetica}
A:link, A:visited, A:active { text-decoration: underline } A:link, A:visited, A:active { text-decoration: underline }
</style><title>libvir architecture</title></head><body bgcolor="#8b7765" text="#000000" link="#a06060" vlink="#000000"><table border="0" width="100%" cellpadding="5" cellspacing="0" align="center"><tr><td width="120"><a href="http://www.redhat.com/"><img src="redhat.gif" alt="Red Hat Logo" /></a></td><td><table border="0" width="90%" cellpadding="2" cellspacing="0" align="center" bgcolor="#000000"><tr><td><table width="100%" border="0" cellspacing="1" cellpadding="3" bgcolor="#fffacd"><tr><td align="center"><h1>Libvir the virtualization API</h1><h2>libvir architecture</h2></td></tr></table></td></tr></table></td></tr></table><table border="0" cellpadding="4" cellspacing="0" width="100%" align="center"><tr><td bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="2" width="100%"><tr><td valign="top" width="200" bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000"><tr><td><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>Main Menu</b></center></td></tr><tr><td bgcolor="#fffacd"><form action="search.php" enctype="application/x-www-form-urlencoded" method="get"><input name="query" type="text" size="20" value="" /><input name="submit" type="submit" value="Search ..." /></form><ul><li><a href="index.html">Home</a></li><li><a href="news.html">Releases</a></li><li><a href="intro.html">Introduction</a></li><li><a href="architecture.html">libvir architecture</a></li><li><a href="downloads.html">Downloads</a></li><li><a href="FAQ.html">FAQ</a></li><li><a href="bugs.html">Reporting bugs and getting help</a></li><li><a style="font-weight:bold" href="html/index.html">API Menu</a></li><li><a href="ChangeLog.html">Recent Changes</a></li></ul></td></tr></table><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>Related links</b></center></td></tr><tr><td bgcolor="#fffacd"><ul><li><a href="https://www.redhat.com/archives/libvir-list/">Mail archive</a></li><li><a href="http://www.cl.cam.ac.uk/Research/SRG/netos/xen/index.html">Xen project</a></li></ul></td></tr></table></td></tr></table><a href="http://xmlsoft.org/"><img src="Libxml2-Logo-90x34.gif" alt="Made with Libxml2 Logo" /></a></td><td valign="top" bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="1" width="100%"><tr><td><table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000"><tr><td><table border="0" cellpadding="3" cellspacing="1" width="100%"><tr><td bgcolor="#fffacd"><p>In a Xen environment, program using libvir have to execute in "Domain 0", </style><title>libvir architecture</title></head><body bgcolor="#8b7765" text="#000000" link="#a06060" vlink="#000000"><table border="0" width="100%" cellpadding="5" cellspacing="0" align="center"><tr><td width="120"><a href="http://www.redhat.com/"><img src="redhat.gif" alt="Red Hat Logo" /></a></td><td><table border="0" width="90%" cellpadding="2" cellspacing="0" align="center" bgcolor="#000000"><tr><td><table width="100%" border="0" cellspacing="1" cellpadding="3" bgcolor="#fffacd"><tr><td align="center"><h1>Libvir the virtualization API</h1><h2>libvir architecture</h2></td></tr></table></td></tr></table></td></tr></table><table border="0" cellpadding="4" cellspacing="0" width="100%" align="center"><tr><td bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="2" width="100%"><tr><td valign="top" width="200" bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000"><tr><td><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>Main Menu</b></center></td></tr><tr><td bgcolor="#fffacd"><form action="search.php" enctype="application/x-www-form-urlencoded" method="get"><input name="query" type="text" size="20" value="" /><input name="submit" type="submit" value="Search ..." /></form><ul><li><a href="index.html">Home</a></li><li><a href="news.html">Releases</a></li><li><a href="intro.html">Introduction</a></li><li><a href="architecture.html">libvir architecture</a></li><li><a href="downloads.html">Downloads</a></li><li><a href="FAQ.html">FAQ</a></li><li><a href="bugs.html">Reporting bugs and getting help</a></li><li><a style="font-weight:bold" href="html/index.html">API Menu</a></li><li><a href="ChangeLog.html">Recent Changes</a></li></ul></td></tr></table><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>Related links</b></center></td></tr><tr><td bgcolor="#fffacd"><ul><li><a href="https://www.redhat.com/archives/libvir-list/">Mail archive</a></li><li><a href="http://www.cl.cam.ac.uk/Research/SRG/netos/xen/index.html">Xen project</a></li></ul></td></tr></table></td></tr></table><a href="http://xmlsoft.org/"><img src="Libxml2-Logo-90x34.gif" alt="Made with Libxml2 Logo" /></a></td><td valign="top" bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="1" width="100%"><tr><td><table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000"><tr><td><table border="0" cellpadding="3" cellspacing="1" width="100%"><tr><td bgcolor="#fffacd"><p>In a Xen environment, programs using libvir have to execute in "Domain 0",
which is the primary Linux OS loaded on the machine. That OS kernel provides which is the primary Linux OS loaded on the machine. That OS kernel provides
most if not all of the actual drivers used by the set of domains. It also most if not all of the actual drivers used by the set of domains. It also
runs the Xen Store, a database of informations shared by the hypervisor, the runs the Xen Store, a database of informations shared by the hypervisor, the

View File

@ -63,6 +63,30 @@ typedef enum {
VIR_DOMAIN_SHUTOFF = 5 /* the domain is shut off */ VIR_DOMAIN_SHUTOFF = 5 /* the domain is shut off */
} virDomainState; } virDomainState;
/**
* virDomainRestart:
*
* Flags that determine the action to take on a shutdown or crash of a domain
*/
typedef enum {
VIR_DOMAIN_DESTROY = 1, /* destroy the domain */
VIR_DOMAIN_RESTART = 2, /* restart the domain */
VIR_DOMAIN_PRESERVE= 3, /* keep as is, need manual destroy, for debug */
VIR_DOMAIN_RENAME_RESTART= 4/* restart under an new unique name */
} virDomainRestart;
/**
* virDeviceMode:
*
* Flags that determine permission to expose a device to the guest
*/
typedef enum {
VIR_DEVICE_DEFAULT = 0, /* Default mode */
VIR_DEVICE_RO = 1, /* Access read-only */
VIR_DEVICE_RW = 2, /* Access read-write */
VIR_DEVICE_RW_FORCE= 3 /* Forced read-write even if already used */
} virDeviceMode;
/** /**
* virDomainInfoPtr: * virDomainInfoPtr:
* *
@ -99,6 +123,30 @@ struct _virDomainInfo {
typedef virDomainInfo *virDomainInfoPtr; typedef virDomainInfo *virDomainInfoPtr;
/**
* virDomainKernel:
*
* a virDomainImage is the set of kernel related informations associated
* to a domain
*/
typedef struct _virDomainKernel virDomainKernel;
struct _virDomainKernel {
const char *kernel; /* filename pointing to the kernel image */
const char *ramdisk; /* an optional init ramdisk */
const char *root; /* an optional root block device */
const char *extra; /* optional kernel command line parameters */
};
/**
* virDomainKernelPtr:
*
* a virDomainKernelPtr is a pointer to a virDomainKernel structure.
*/
typedef virDomainKernel *virDomainKernelPtr;
/** /**
* virDomainCreateFlags: * virDomainCreateFlags:
* *

View File

@ -63,6 +63,30 @@ typedef enum {
VIR_DOMAIN_SHUTOFF = 5 /* the domain is shut off */ VIR_DOMAIN_SHUTOFF = 5 /* the domain is shut off */
} virDomainState; } virDomainState;
/**
* virDomainRestart:
*
* Flags that determine the action to take on a shutdown or crash of a domain
*/
typedef enum {
VIR_DOMAIN_DESTROY = 1, /* destroy the domain */
VIR_DOMAIN_RESTART = 2, /* restart the domain */
VIR_DOMAIN_PRESERVE= 3, /* keep as is, need manual destroy, for debug */
VIR_DOMAIN_RENAME_RESTART= 4/* restart under an new unique name */
} virDomainRestart;
/**
* virDeviceMode:
*
* Flags that determine permission to expose a device to the guest
*/
typedef enum {
VIR_DEVICE_DEFAULT = 0, /* Default mode */
VIR_DEVICE_RO = 1, /* Access read-only */
VIR_DEVICE_RW = 2, /* Access read-write */
VIR_DEVICE_RW_FORCE= 3 /* Forced read-write even if already used */
} virDeviceMode;
/** /**
* virDomainInfoPtr: * virDomainInfoPtr:
* *
@ -92,12 +116,28 @@ struct _virDomainInfo {
}; };
/** /**
* virDomainInfoPtr: * virDomainKernel:
* *
* a virDomainInfoPtr is a pointer to a virDomainInfo structure. * a virDomainImage is the set of kernel related informations associated
* to a domain
*/ */
typedef virDomainInfo *virDomainInfoPtr; typedef struct _virDomainKernel virDomainKernel;
struct _virDomainKernel {
const char *kernel; /* filename pointing to the kernel image */
const char *ramdisk; /* an optional init ramdisk */
const char *root; /* an optional root block device */
const char *extra; /* optional kernel command line parameters */
};
/**
* virDomainKernelPtr:
*
* a virDomainKernelPtr is a pointer to a virDomainKernel structure.
*/
typedef virDomainKernel *virDomainKernelPtr;
/** /**
* virDomainCreateFlags: * virDomainCreateFlags:

View File

@ -5,6 +5,12 @@
#ifndef __VIR_INTERNAL_H__ #ifndef __VIR_INTERNAL_H__
#define __VIR_INTERNAL_H__ #define __VIR_INTERNAL_H__
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include "hash.h" #include "hash.h"
#include "libvir.h" #include "libvir.h"
@ -71,6 +77,14 @@ struct _virConnect {
unsigned int magic; /* specific value to check */ unsigned int magic; /* specific value to check */
int handle; /* internal handle used for hypercall */ int handle; /* internal handle used for hypercall */
struct xs_handle *xshandle; /* handle to talk to the xenstore */ struct xs_handle *xshandle; /* handle to talk to the xenstore */
/* connection to xend */
int type; /* PF_UNIX or PF_INET */
int len; /* lenght of addr */
struct sockaddr *addr; /* type of address used */
struct sockaddr_un addr_un; /* the unix address */
struct sockaddr_in addr_in; /* the inet address */
virHashTablePtr domains; /* hash table for known domains */ virHashTablePtr domains; /* hash table for known domains */
int flags; /* a set of connection flags */ int flags; /* a set of connection flags */
}; };

View File

@ -11,6 +11,7 @@
#include "libvir.h" #include "libvir.h"
#include "xen_internal.h" #include "xen_internal.h"
#include "xend_internal.h"
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -101,6 +102,8 @@ virConnectOpen(const char *name) {
ret->magic = VIR_CONNECT_MAGIC; ret->magic = VIR_CONNECT_MAGIC;
ret->handle = handle; ret->handle = handle;
ret->xshandle = xshandle; ret->xshandle = xshandle;
if (xend_setup(ret) < 0)
goto failed;
ret->domains = virHashCreate(20); ret->domains = virHashCreate(20);
ret->flags = 0; ret->flags = 0;
if (ret->domains == NULL) if (ret->domains == NULL)
@ -145,6 +148,8 @@ virConnectOpenReadOnly(const char *name) {
ret->magic = VIR_CONNECT_MAGIC; ret->magic = VIR_CONNECT_MAGIC;
ret->handle = -1; ret->handle = -1;
ret->xshandle = xshandle; ret->xshandle = xshandle;
if (xend_setup(ret) < 0)
goto failed;
ret->domains = virHashCreate(20); ret->domains = virHashCreate(20);
ret->flags = VIR_CONNECT_RO; ret->flags = VIR_CONNECT_RO;
if (ret->domains == NULL) if (ret->domains == NULL)
@ -209,6 +214,7 @@ virDomainFreeName(virDomainPtr domain, const char *name ATTRIBUTE_UNUSED) {
*/ */
int int
virConnectClose(virConnectPtr conn) { virConnectClose(virConnectPtr conn) {
xend_cleanup(conn);
if (!VIR_IS_CONNECT(conn)) if (!VIR_IS_CONNECT(conn))
return(-1); return(-1);
virHashFree(conn->domains, (virHashDeallocator) virDomainFreeName); virHashFree(conn->domains, (virHashDeallocator) virDomainFreeName);

View File

@ -27,6 +27,8 @@
#include <arpa/inet.h> #include <arpa/inet.h>
#include <netdb.h> #include <netdb.h>
#include "libvir.h"
#include "internal.h"
#include "sexpr.h" #include "sexpr.h"
#include "xend_internal.h" #include "xend_internal.h"
@ -72,7 +74,7 @@ struct xend {
* Returns the socket file descriptor or -1 in case of error * Returns the socket file descriptor or -1 in case of error
*/ */
static int static int
do_connect(struct xend *xend) do_connect(virConnectPtr xend)
{ {
int s; int s;
int serrno; int serrno;
@ -285,7 +287,7 @@ xend_req(int fd, char *content, size_t n_content)
* Returns the HTTP return code or -1 in case or error. * Returns the HTTP return code or -1 in case or error.
*/ */
static int static int
xend_get(struct xend *xend, const char *path, xend_get(virConnectPtr xend, const char *path,
char *content, size_t n_content) char *content, size_t n_content)
{ {
int ret; int ret;
@ -323,7 +325,7 @@ xend_get(struct xend *xend, const char *path,
* Returns the HTTP return code or -1 in case or error. * Returns the HTTP return code or -1 in case or error.
*/ */
static int static int
xend_post(struct xend *xend, const char *path, const char *ops, xend_post(virConnectPtr xend, const char *path, const char *ops,
char *content, size_t n_content) char *content, size_t n_content)
{ {
char buffer[100]; char buffer[100];
@ -396,7 +398,7 @@ http2unix(int ret)
* Returns 0 in case of success, -1 in case of failure. * Returns 0 in case of success, -1 in case of failure.
*/ */
static int static int
xend_op_ext2(struct xend *xend, const char *path, char *error, xend_op_ext2(virConnectPtr xend, const char *path, char *error,
size_t n_error, const char *key, va_list ap) size_t n_error, const char *key, va_list ap)
{ {
char ops[1024]; char ops[1024];
@ -431,7 +433,7 @@ xend_op_ext2(struct xend *xend, const char *path, char *error,
* Returns 0 in case of success, -1 in case of failure. * Returns 0 in case of success, -1 in case of failure.
*/ */
static int static int
xend_node_op(struct xend *xend, const char *path, const char *key, ...) xend_node_op(virConnectPtr xend, const char *path, const char *key, ...)
{ {
va_list ap; va_list ap;
int ret; int ret;
@ -460,7 +462,7 @@ xend_node_op(struct xend *xend, const char *path, const char *key, ...)
* Returns 0 in case of success, -1 in case of failure. * Returns 0 in case of success, -1 in case of failure.
*/ */
static int static int
xend_op_ext(struct xend *xend, const char *name, char *error, xend_op_ext(virConnectPtr xend, const char *name, char *error,
size_t n_error, const char *key, ...) size_t n_error, const char *key, ...)
{ {
char buffer[1024]; char buffer[1024];
@ -489,7 +491,7 @@ xend_op_ext(struct xend *xend, const char *name, char *error,
* Returns a parsed S-Expression in case of success, NULL in case of failure * Returns a parsed S-Expression in case of success, NULL in case of failure
*/ */
static struct sexpr * static struct sexpr *
sexpr_get(struct xend *xend, const char *fmt, ...) sexpr_get(virConnectPtr xend, const char *fmt, ...)
{ {
char buffer[4096]; char buffer[4096];
char path[1024]; char path[1024];
@ -672,20 +674,20 @@ sexpr_u64(struct sexpr *sexpr, const char *name)
* *
* Returns the value found or 0 if not found (but may not be an error) * Returns the value found or 0 if not found (but may not be an error)
*/ */
static enum xend_domain_restart static virDomainRestart
sexpr_poweroff(struct sexpr *sexpr, const char *name) sexpr_poweroff(struct sexpr *sexpr, const char *name)
{ {
const char *value = sexpr_node(sexpr, name); const char *value = sexpr_node(sexpr, name);
if (value) { if (value) {
if (strcmp(value, "poweroff") == 0) { if (strcmp(value, "poweroff") == 0) {
return XEND_DESTROY; return VIR_DOMAIN_DESTROY;
} else if (strcmp(value, "restart") == 0) { } else if (strcmp(value, "restart") == 0) {
return XEND_RESTART; return VIR_DOMAIN_RESTART;
} else if (strcmp(value, "preserve") == 0) { } else if (strcmp(value, "preserve") == 0) {
return XEND_PRESERVE; return VIR_DOMAIN_PRESERVE;
} else if (strcmp(value, "rename-restart") == 0) { } else if (strcmp(value, "rename-restart") == 0) {
return XEND_RENAME_RESTART; return VIR_DOMAIN_RENAME_RESTART;
} }
} }
return XEND_DEFAULT; return XEND_DEFAULT;
@ -722,22 +724,22 @@ sexpr_strcpy(char **ptr, struct sexpr *node, const char *path)
* *
* Returns the value found or 0 if not found (but may not be an error) * Returns the value found or 0 if not found (but may not be an error)
*/ */
static enum xend_device_vbd_mode static virDeviceMode
sexpr_mode(struct sexpr *node, const char *path) sexpr_mode(struct sexpr *node, const char *path)
{ {
const char *mode = sexpr_node(node, path); const char *mode = sexpr_node(node, path);
enum xend_device_vbd_mode ret; virDeviceMode ret;
if (!mode) { if (!mode) {
ret = XEND_DEFAULT; ret = VIR_DEVICE_DEFAULT;
} else if (strcmp(mode, "r") == 0) { } else if (strcmp(mode, "r") == 0) {
ret = XEND_READ_ONLY; ret = VIR_DEVICE_RO;
} else if (strcmp(mode, "w") == 0) { } else if (strcmp(mode, "w") == 0) {
ret = XEND_READ_WRITE; ret = VIR_DEVICE_RW;
} else if (strcmp(mode, "w!") == 0) { } else if (strcmp(mode, "w!") == 0) {
ret = XEND_READ_WRITE_FORCE; ret = VIR_DEVICE_RW_FORCE;
} else { } else {
ret = XEND_DEFAULT; ret = VIR_DEVICE_DEFAULT;
} }
return ret; return ret;
@ -947,22 +949,22 @@ xend_device_vif_to_sexpr(const struct xend_device_vif *vif)
/* PUBLIC FUNCTIONS */ /* PUBLIC FUNCTIONS */
/** /**
* xend_new_unix: * xend_setup_unix:
* @conn: an existing virtual connection block
* @path: the path for the Xen Daemon socket * @path: the path for the Xen Daemon socket
* *
* Creates a localhost Xen Daemon connection * Creates a localhost Xen Daemon connection
* Note: this doesn't try to check if the connection actually works * Note: this doesn't try to check if the connection actually works
* *
* Returns the new pointer or NULL in case of error. * Returns 0 in case of success, -1 in case of error.
*/ */
struct xend * int
xend_new_unix(const char *path) xend_setup_unix(virConnectPtr xend, const char *path)
{ {
struct xend *xend = malloc(sizeof(*xend));
struct sockaddr_un *addr; struct sockaddr_un *addr;
if (!xend) if ((xend == NULL) || (path == NULL))
return NULL; return(-1);
addr = &xend->addr_un; addr = &xend->addr_un;
addr->sun_family = AF_UNIX; addr->sun_family = AF_UNIX;
@ -976,34 +978,34 @@ xend_new_unix(const char *path)
xend->addr = (struct sockaddr *) addr; xend->addr = (struct sockaddr *) addr;
xend->type = PF_UNIX; xend->type = PF_UNIX;
return xend; return(0);
} }
/** /**
* xend_new_unix: * xend_setup_tcp:
* @conn: an existing virtual connection block
* @host: the host name for the Xen Daemon * @host: the host name for the Xen Daemon
* @port: the port * @port: the port
* *
* Creates a possibly remote Xen Daemon connection * Creates a possibly remote Xen Daemon connection
* Note: this doesn't try to check if the connection actually works * Note: this doesn't try to check if the connection actually works
* *
* Returns the new pointer or NULL in case of error. * Returns 0 in case of success, -1 in case of error.
*/ */
struct xend * int
xend_new_tcp(const char *host, int port) xend_setup_tcp(virConnectPtr xend, const char *host, int port)
{ {
struct xend *xend = malloc(sizeof(*xend));
struct in_addr ip; struct in_addr ip;
struct hostent *pent; struct hostent *pent;
if (!xend) if ((xend == NULL) || (host == NULL) || (port <= 0))
return NULL; return(-1);
pent = gethostbyname(host); pent = gethostbyname(host);
if (pent == NULL) { if (pent == NULL) {
if (inet_aton(host, &ip) == 0) { if (inet_aton(host, &ip) == 0) {
errno = ESRCH; errno = ESRCH;
return NULL; return(-1);
} }
} else { } else {
memcpy(&ip, pent->h_addr_list[0], sizeof(ip)); memcpy(&ip, pent->h_addr_list[0], sizeof(ip));
@ -1017,32 +1019,32 @@ xend_new_tcp(const char *host, int port)
xend->addr_in.sin_port = htons(port); xend->addr_in.sin_port = htons(port);
memcpy(&xend->addr_in.sin_addr, &ip, sizeof(ip)); memcpy(&xend->addr_in.sin_addr, &ip, sizeof(ip));
return xend; return(0);
} }
/** /**
* xend_new: * xend_setup:
* @conn: an existing virtual connection block
* *
* Creates a localhost Xen Daemon connection * Creates a localhost Xen Daemon connection
* Note: this doesn't try to check if the connection actually works * Note: this doesn't try to check if the connection actually works
* *
* Returns the new pointer or NULL in case of error. * Returns 0 in case of success, -1 in case of error.
*/ */
struct xend * int
xend_new(void) xend_setup(virConnectPtr conn)
{ {
return xend_new_unix("/var/lib/xend/xend-socket"); return(xend_setup_unix(conn, "/var/lib/xend/xend-socket"));
} }
/** /**
* xend_delete: * xend_cleanup:
* *
* Free a Xen Daemon connection * Cleanup a xend connection
*/ */
void void
xend_delete(struct xend *xend) xend_cleanup(virConnectPtr xend ATTRIBUTE_UNUSED)
{ {
free(xend);
} }
/** /**
@ -1056,7 +1058,7 @@ xend_delete(struct xend *xend)
* Returns 0 in case of success, -1 (with errno) in case of error. * Returns 0 in case of success, -1 (with errno) in case of error.
*/ */
int int
xend_wait_for_devices(struct xend *xend, const char *name) xend_wait_for_devices(virConnectPtr xend, const char *name)
{ {
return xend_op(xend, name, "op", "wait_for_devices", NULL); return xend_op(xend, name, "op", "wait_for_devices", NULL);
} }
@ -1072,7 +1074,7 @@ xend_wait_for_devices(struct xend *xend, const char *name)
* Returns 0 in case of success, -1 (with errno) in case of error. * Returns 0 in case of success, -1 (with errno) in case of error.
*/ */
int int
xend_pause(struct xend *xend, const char *name) xend_pause(virConnectPtr xend, const char *name)
{ {
return xend_op(xend, name, "op", "pause", NULL); return xend_op(xend, name, "op", "pause", NULL);
} }
@ -1087,7 +1089,7 @@ xend_pause(struct xend *xend, const char *name)
* Returns 0 in case of success, -1 (with errno) in case of error. * Returns 0 in case of success, -1 (with errno) in case of error.
*/ */
int int
xend_unpause(struct xend *xend, const char *name) xend_unpause(virConnectPtr xend, const char *name)
{ {
return xend_op(xend, name, "op", "unpause", NULL); return xend_op(xend, name, "op", "unpause", NULL);
} }
@ -1103,7 +1105,7 @@ xend_unpause(struct xend *xend, const char *name)
* Returns 0 in case of success, -1 (with errno) in case of error. * Returns 0 in case of success, -1 (with errno) in case of error.
*/ */
int int
xend_rename(struct xend *xend, const char *old, const char *new) xend_rename(virConnectPtr xend, const char *old, const char *new)
{ {
if ((xend == NULL) || (old == NULL) || (new == NULL)) if ((xend == NULL) || (old == NULL) || (new == NULL))
return(-1); return(-1);
@ -1120,7 +1122,7 @@ xend_rename(struct xend *xend, const char *old, const char *new)
* Returns 0 in case of success, -1 (with errno) in case of error. * Returns 0 in case of success, -1 (with errno) in case of error.
*/ */
int int
xend_reboot(struct xend *xend, const char *name) xend_reboot(virConnectPtr xend, const char *name)
{ {
if ((xend == NULL) || (name == NULL)) if ((xend == NULL) || (name == NULL))
return(-1); return(-1);
@ -1138,7 +1140,7 @@ xend_reboot(struct xend *xend, const char *name)
* Returns 0 in case of success, -1 (with errno) in case of error. * Returns 0 in case of success, -1 (with errno) in case of error.
*/ */
int int
xend_shutdown(struct xend *xend, const char *name) xend_shutdown(virConnectPtr xend, const char *name)
{ {
if ((xend == NULL) || (name == NULL)) if ((xend == NULL) || (name == NULL))
return(-1); return(-1);
@ -1157,7 +1159,7 @@ xend_shutdown(struct xend *xend, const char *name)
* Returns 0 in case of success, -1 (with errno) in case of error. * Returns 0 in case of success, -1 (with errno) in case of error.
*/ */
int int
xend_sysrq(struct xend *xend, const char *name, const char *key) xend_sysrq(virConnectPtr xend, const char *name, const char *key)
{ {
if ((xend == NULL) || (name == NULL) || (key == NULL)) if ((xend == NULL) || (name == NULL) || (key == NULL))
return(-1); return(-1);
@ -1176,7 +1178,7 @@ xend_sysrq(struct xend *xend, const char *name, const char *key)
* Returns 0 in case of success, -1 (with errno) in case of error. * Returns 0 in case of success, -1 (with errno) in case of error.
*/ */
int int
xend_destroy(struct xend *xend, const char *name) xend_destroy(virConnectPtr xend, const char *name)
{ {
if ((xend == NULL) || (name == NULL)) if ((xend == NULL) || (name == NULL))
return(-1); return(-1);
@ -1198,7 +1200,7 @@ xend_destroy(struct xend *xend, const char *name)
* Returns 0 in case of success, -1 (with errno) in case of error. * Returns 0 in case of success, -1 (with errno) in case of error.
*/ */
int int
xend_save(struct xend *xend, const char *name, const char *filename) xend_save(virConnectPtr xend, const char *name, const char *filename)
{ {
if ((xend == NULL) || (filename == NULL)) if ((xend == NULL) || (filename == NULL))
return(-1); return(-1);
@ -1217,7 +1219,7 @@ xend_save(struct xend *xend, const char *name, const char *filename)
* Returns 0 in case of success, -1 (with errno) in case of error. * Returns 0 in case of success, -1 (with errno) in case of error.
*/ */
int int
xend_restore(struct xend *xend, const char *filename) xend_restore(virConnectPtr xend, const char *filename)
{ {
if ((xend == NULL) || (filename == NULL)) if ((xend == NULL) || (filename == NULL))
return(-1); return(-1);
@ -1234,7 +1236,7 @@ xend_restore(struct xend *xend, const char *filename)
* Returns a list of names or NULL in case of error. * Returns a list of names or NULL in case of error.
*/ */
char ** char **
xend_get_domains(struct xend *xend) xend_get_domains(virConnectPtr xend)
{ {
size_t extra = 0; size_t extra = 0;
struct sexpr *root = NULL; struct sexpr *root = NULL;
@ -1374,7 +1376,7 @@ xend_domain_to_sexpr(const struct xend_domain *domain)
*/ */
int int
xend_create(struct xend *xend, const struct xend_domain *dom) xend_create(virConnectPtr xend, const struct xend_domain *dom)
{ {
int ret, serrno; int ret, serrno;
struct sexpr *sexpr; struct sexpr *sexpr;
@ -1409,7 +1411,7 @@ xend_create(struct xend *xend, const struct xend_domain *dom)
* Returns 0 for success; -1 (with errno) on error * Returns 0 for success; -1 (with errno) on error
*/ */
int int
xend_set_max_memory(struct xend *xend, const char *name, uint64_t value) xend_set_max_memory(virConnectPtr xend, const char *name, uint64_t value)
{ {
char buf[1024]; char buf[1024];
@ -1435,7 +1437,7 @@ xend_set_max_memory(struct xend *xend, const char *name, uint64_t value)
* Returns 0 for success; -1 (with errno) on error * Returns 0 for success; -1 (with errno) on error
*/ */
int int
xend_set_memory(struct xend *xend, const char *name, uint64_t value) xend_set_memory(virConnectPtr xend, const char *name, uint64_t value)
{ {
char buf[1024]; char buf[1024];
@ -1458,7 +1460,7 @@ xend_set_memory(struct xend *xend, const char *name, uint64_t value)
* Returns 0 on success; -1 (with errno) on error * Returns 0 on success; -1 (with errno) on error
*/ */
int int
xend_vbd_create(struct xend *xend, xend_vbd_create(virConnectPtr xend,
const char *name, const struct xend_device_vbd *vbd) const char *name, const struct xend_device_vbd *vbd)
{ {
char buffer[4096]; char buffer[4096];
@ -1492,7 +1494,7 @@ xend_vbd_create(struct xend *xend,
* Returns 0 on success; -1 (with errno) on error * Returns 0 on success; -1 (with errno) on error
*/ */
int int
xend_vbd_destroy(struct xend *xend, xend_vbd_destroy(virConnectPtr xend,
const char *name, const struct xend_device_vbd *vbd) const char *name, const struct xend_device_vbd *vbd)
{ {
return xend_op(xend, name, "op", "device_destroy", "type", "vbd", return xend_op(xend, name, "op", "device_destroy", "type", "vbd",
@ -1513,7 +1515,7 @@ xend_vbd_destroy(struct xend *xend,
* Returns 0 on success; -1 (with errno) on error * Returns 0 on success; -1 (with errno) on error
*/ */
int int
xend_vif_create(struct xend *xend, xend_vif_create(virConnectPtr xend,
const char *name, const struct xend_device_vif *vif) const char *name, const struct xend_device_vif *vif)
{ {
char buffer[4096]; char buffer[4096];
@ -1534,8 +1536,8 @@ xend_vif_create(struct xend *xend,
} }
static int static int
get_vif_handle(struct xend *xend, get_vif_handle(virConnectPtr xend,
const char *name, const char *name ATTRIBUTE_UNUSED,
const struct xend_device_vif *vif, const struct xend_device_vif *vif,
char *buffer, size_t n_buffer) char *buffer, size_t n_buffer)
{ {
@ -1586,7 +1588,7 @@ get_vif_handle(struct xend *xend,
* Returns 0 on success; -1 (with errno) on error * Returns 0 on success; -1 (with errno) on error
*/ */
int int
xend_vif_destroy(struct xend *xend, xend_vif_destroy(virConnectPtr xend,
const char *name, const struct xend_device_vif *vif) const char *name, const struct xend_device_vif *vif)
{ {
char handle[1024]; char handle[1024];
@ -1785,7 +1787,7 @@ error:
* Returns domain info on success; NULL (with errno) on error * Returns domain info on success; NULL (with errno) on error
*/ */
struct xend_domain * struct xend_domain *
xend_get_domain(struct xend *xend, const char *domname) xend_get_domain(virConnectPtr xend, const char *domname)
{ {
struct sexpr *root; struct sexpr *root;
struct xend_domain *dom = NULL; struct xend_domain *dom = NULL;
@ -1811,7 +1813,7 @@ xend_get_domain(struct xend *xend, const char *domname)
* Returns node info on success; NULL (with errno) on error * Returns node info on success; NULL (with errno) on error
*/ */
struct xend_node * struct xend_node *
xend_get_node(struct xend *xend) xend_get_node(virConnectPtr xend)
{ {
struct sexpr *root; struct sexpr *root;
struct xend_node *node = NULL; struct xend_node *node = NULL;
@ -1896,7 +1898,7 @@ xend_get_node(struct xend *xend)
* Returns 0 on success; -1 (with errno) on error * Returns 0 on success; -1 (with errno) on error
*/ */
int int
xend_node_shutdown(struct xend *xend) xend_node_shutdown(virConnectPtr xend)
{ {
return xend_node_op(xend, "/xend/node/", "op", "shutdown", NULL); return xend_node_op(xend, "/xend/node/", "op", "shutdown", NULL);
} }
@ -1910,7 +1912,7 @@ xend_node_shutdown(struct xend *xend)
* Returns 0 on success; -1 (with errno) on error * Returns 0 on success; -1 (with errno) on error
*/ */
int int
xend_node_restart(struct xend *xend) xend_node_restart(virConnectPtr xend)
{ {
return xend_node_op(xend, "/xend/node/", "op", "restart", NULL); return xend_node_op(xend, "/xend/node/", "op", "restart", NULL);
} }
@ -1927,7 +1929,7 @@ xend_node_restart(struct xend *xend)
* Returns 0 on success; -1 (with errno) on error * Returns 0 on success; -1 (with errno) on error
*/ */
int int
xend_dmesg(struct xend *xend, char *buffer, size_t n_buffer) xend_dmesg(virConnectPtr xend, char *buffer, size_t n_buffer)
{ {
return http2unix(xend_get(xend, "/xend/node/dmesg", buffer, n_buffer)); return http2unix(xend_get(xend, "/xend/node/dmesg", buffer, n_buffer));
} }
@ -1942,7 +1944,7 @@ xend_dmesg(struct xend *xend, char *buffer, size_t n_buffer)
* Returns 0 on success; -1 (with errno) on error * Returns 0 on success; -1 (with errno) on error
*/ */
int int
xend_dmesg_clear(struct xend *xend) xend_dmesg_clear(virConnectPtr xend)
{ {
return xend_node_op(xend, "/xend/node/dmesg", "op", "clear", NULL); return xend_node_op(xend, "/xend/node/dmesg", "op", "clear", NULL);
} }
@ -1959,7 +1961,7 @@ xend_dmesg_clear(struct xend *xend)
* Returns 0 on success; -1 (with errno) on error * Returns 0 on success; -1 (with errno) on error
*/ */
int int
xend_log(struct xend *xend, char *buffer, size_t n_buffer) xend_log(virConnectPtr xend, char *buffer, size_t n_buffer)
{ {
return http2unix(xend_get(xend, "/xend/node/log", buffer, n_buffer)); return http2unix(xend_get(xend, "/xend/node/log", buffer, n_buffer));
} }

View File

@ -17,6 +17,8 @@
#include <stdint.h> #include <stdint.h>
#include <stdbool.h> #include <stdbool.h>
#include "libvir.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
@ -26,60 +28,6 @@ extern "C" {
*/ */
#define XEND_DEFAULT 0 #define XEND_DEFAULT 0
/**
Flags that determine the permission to expose a device to the guest as.
*/
enum xend_device_vbd_mode
{
/**
Expose the device as read only.
*/
XEND_READ_ONLY = 1,
/**
Expose the device as read/write with an in-use check.
If Xend thinks the device is already in use, it will generate an
error. It uses heuristics so it will not always catch every
instance of this and will sometimes generate false positives.
*/
XEND_READ_WRITE,
/**
Expose the device as read/only without an in-use check.
*/
XEND_READ_WRITE_FORCE,
};
/**
Flags that determine the action to take on a shutdown or crash.
*/
enum xend_domain_restart
{
/**
Destroy the domain.
*/
XEND_DESTROY = 1,
/**
Restart the domain.
*/
XEND_RESTART,
/**
Take no action. The domain will have to be manually destroyed by
the user. Useful for debugging.
*/
XEND_PRESERVE,
/**
Rename the domain to something unique and then create a new instance
of the domain. Useful for debugging crashes while avoiding
down time.
*/
XEND_RENAME_RESTART,
};
/** /**
Xend context. Xend context.
@ -87,40 +35,6 @@ enum xend_domain_restart
*/ */
struct xend; struct xend;
/**
This structure the image information for a guest.
*/
struct xend_image
{
/**
A filename pointing to a paravirtual Xen kernel.
Required.
*/
const char *kernel;
/**
A filename pointing to an initrd.
Optional
*/
const char *ramdisk;
/**
The root block device.
Optional
*/
const char *root;
/**
The kernel command line.
Optional.
*/
const char *extra;
};
/** /**
This structure represents a virtual block device. This structure represents a virtual block device.
*/ */
@ -153,7 +67,7 @@ struct xend_device_vbd
Required. Required.
*/ */
enum xend_device_vbd_mode mode; virDeviceMode mode;
}; };
/** /**
@ -345,21 +259,21 @@ struct xend_domain
Optional. Optional.
*/ */
enum xend_domain_restart on_poweroff; virDomainRestart on_poweroff;
/** /**
The action to perform when the domain reboots. The action to perform when the domain reboots.
Optional. Optional.
*/ */
enum xend_domain_restart on_reboot; virDomainRestart on_reboot;
/** /**
The action to perform when the domain crashes. The action to perform when the domain crashes.
Optional. Optional.
*/ */
enum xend_domain_restart on_crash; virDomainRestart on_crash;
/** /**
The number of VCPUs to assign to the domain. The number of VCPUs to assign to the domain.
@ -370,7 +284,7 @@ struct xend_domain
/* FIXME cpus */ /* FIXME cpus */
struct xend_image image; virDomainKernel image;
/** /**
The number of VBDs pointed to be vbds. The number of VBDs pointed to be vbds.
@ -533,53 +447,55 @@ struct xend_node
}; };
/** /**
* \brief Allocate a new Xend instance * \brief Setup the connection to the local Xend instance
* \return A new xend instance * \return 0 in case of success, -1 in case of error
* *
* This method creates a new Xend instance preferrably trying * This method creates a new Xend instance preferrably trying
* to connect with the domain socket but if necessary using * to connect with the domain socket but if necessary using
* TCP (only on localhost though). * TCP (only on localhost though).
* *
* This function may not fail if Xend is not running. * This function may not fail if Xend is not running.
*
* Make sure to call xend_cleanup().
*/ */
struct xend *xend_new(void); int xend_setup(virConnectPtr conn);
/** /**
* \brief Creates a new xend instance via TCP * \brief Setup the connection to a xend instance via TCP
* \param host The host name to connect to * \param host The host name to connect to
* \param port The port number to connect to * \param port The port number to connect to
* \return A new xend instance * \return 0 in case of success, -1 in case of error
* *
* This method creates a new Xend instance via TCP. * This method creates a new Xend instance via TCP.
* *
* This function may not fail if Xend is not running. * This function may not fail if Xend is not running.
* *
* Make sure to call xen_delete(). * Make sure to call xend_cleanup().
*/ */
struct xend *xend_new_tcp(const char *host, int port); int xend_setup_tcp(virConnectPtr xend, const char *host, int port);
/** /**
* \brief Creates a new xend instance via a Unix domain socket * \brief Setup the connection to xend instance via a Unix domain socket
* \param path The path to the domain socket * \param path The path to the domain socket
* \return A new xend instance * \return 0 in case of success, -1 in case of error
* *
* This method creates a new xend instance via a Unix domain socket. * This method creates a new xend instance via a Unix domain socket.
* *
* This function may not fail if Xend is not running. * This function may not fail if Xend is not running.
* *
* Make sure to call xen_delete(). * Make sure to call xend_cleanup().
*/ */
struct xend *xend_new_unix(const char *path); int xend_setup_unix(virConnectPtr xend, const char *path);
/** /**
* \brief Delete a previously allocated Xend instance * \brief Delete a previously allocated Xend instance
* \param xend The xend instance * \param xend The xend instance
* *
* This method should be called when a xend instance * This method should be called when a connection to xend instance
* allocated with xend_new[_{tcp, unix}] is no longer needed * initialized with xend_setup[_{tcp, unix}] is no longer needed
* to free the associated resources. * to free the associated resources.
*/ */
void xend_delete(struct xend *xend); void xend_cleanup(virConnectPtr xend);
/** /**
* \brief Blocks until a domain's devices are initialized * \brief Blocks until a domain's devices are initialized
@ -593,7 +509,7 @@ void xend_delete(struct xend *xend);
* invalid filename, the error won't occur until after this function * invalid filename, the error won't occur until after this function
* returns. * returns.
*/ */
int xend_wait_for_devices(struct xend *xend, const char *name); int xend_wait_for_devices(virConnectPtr xend, const char *name);
/** /**
* \brief Pause a domain * \brief Pause a domain
@ -604,7 +520,7 @@ int xend_wait_for_devices(struct xend *xend, const char *name);
* This method will make sure that Xen does not schedule the domain * This method will make sure that Xen does not schedule the domain
* anymore until after xend_unpause() has been called. * anymore until after xend_unpause() has been called.
*/ */
int xend_pause(struct xend *xend, const char *name); int xend_pause(virConnectPtr xend, const char *name);
/** /**
* \brief Unpause a domain * \brief Unpause a domain
@ -615,7 +531,7 @@ int xend_pause(struct xend *xend, const char *name);
* This method will allow a paused domain (the result of xen_pause()) * This method will allow a paused domain (the result of xen_pause())
* to be scheduled in the future. * to be scheduled in the future.
*/ */
int xend_unpause(struct xend *xend, const char *name); int xend_unpause(virConnectPtr xend, const char *name);
/** /**
* \brief Unpause a domain * \brief Unpause a domain
@ -626,7 +542,7 @@ int xend_unpause(struct xend *xend, const char *name);
* *
* This method allows a domain to have its name changed after creation. * This method allows a domain to have its name changed after creation.
*/ */
int xend_rename(struct xend *xend, const char *oldname, const char *name); int xend_rename(virConnectPtr xend, const char *oldname, const char *name);
/** /**
* \brief Sends a SYSRQ to a domain * \brief Sends a SYSRQ to a domain
@ -637,7 +553,7 @@ int xend_rename(struct xend *xend, const char *oldname, const char *name);
* *
* This method simulates the pressing of a SYSRQ sequence. * This method simulates the pressing of a SYSRQ sequence.
*/ */
int xend_sysrq(struct xend *xend, const char *name, const char *key); int xend_sysrq(virConnectPtr xend, const char *name, const char *key);
/** /**
* \brief Request a domain to reboot * \brief Request a domain to reboot
@ -649,7 +565,7 @@ int xend_sysrq(struct xend *xend, const char *name, const char *key);
* a request and the domain may ignore it. It will return immediately * a request and the domain may ignore it. It will return immediately
* after queuing the request. * after queuing the request.
*/ */
int xend_reboot(struct xend *xend, const char *name); int xend_reboot(virConnectPtr xend, const char *name);
/** /**
* \brief Request a domain to shutdown * \brief Request a domain to shutdown
@ -661,7 +577,7 @@ int xend_reboot(struct xend *xend, const char *name);
* a request and the domain may ignore it. It will return immediately * a request and the domain may ignore it. It will return immediately
* after queuing the request. * after queuing the request.
*/ */
int xend_shutdown(struct xend *xend, const char *name); int xend_shutdown(virConnectPtr xend, const char *name);
/** /**
* \brief Destroy a domain * \brief Destroy a domain
@ -675,7 +591,7 @@ int xend_shutdown(struct xend *xend, const char *name);
* dying and will go away completely once all of the resources have been * dying and will go away completely once all of the resources have been
* unmapped (usually from the backend devices). * unmapped (usually from the backend devices).
*/ */
int xend_destroy(struct xend *xend, const char *name); int xend_destroy(virConnectPtr xend, const char *name);
/** /**
* \brief Save a domain to the disk * \brief Save a domain to the disk
@ -688,7 +604,7 @@ int xend_destroy(struct xend *xend, const char *name);
* a file on disk. Use xend_restore() to restore a domain after * a file on disk. Use xend_restore() to restore a domain after
* saving. * saving.
*/ */
int xend_save(struct xend *xend, const char *name, const char *filename); int xend_save(virConnectPtr xend, const char *name, const char *filename);
/** /**
* \brief Restore a domain from the disk * \brief Restore a domain from the disk
@ -698,7 +614,7 @@ int xend_save(struct xend *xend, const char *name, const char *filename);
* *
* This method will restore a domain saved to disk by xend_save(). * This method will restore a domain saved to disk by xend_save().
*/ */
int xend_restore(struct xend *xend, const char *filename); int xend_restore(virConnectPtr xend, const char *filename);
/** /**
* \brief Obtain a list of currently running domains * \brief Obtain a list of currently running domains
@ -708,7 +624,7 @@ int xend_restore(struct xend *xend, const char *filename);
* This method will return an array of names of currently running * This method will return an array of names of currently running
* domains. The memory should be released will a call to free(). * domains. The memory should be released will a call to free().
*/ */
char **xend_get_domains(struct xend *xend); char **xend_get_domains(virConnectPtr xend);
/** /**
* \brief Create a new domain * \brief Create a new domain
@ -720,7 +636,7 @@ char **xend_get_domains(struct xend *xend);
* domain will be paused after creation and must be unpaused with * domain will be paused after creation and must be unpaused with
* xend_unpause() to begin execution. * xend_unpause() to begin execution.
*/ */
int xend_create(struct xend *xend, const struct xend_domain *info); int xend_create(virConnectPtr xend, const struct xend_domain *info);
/** /**
* \brief Set the maximum memory for a domain * \brief Set the maximum memory for a domain
@ -734,7 +650,7 @@ int xend_create(struct xend *xend, const struct xend_domain *info);
* on its own (although under normal circumstances, memory allocation for a * on its own (although under normal circumstances, memory allocation for a
* domain is only done through xend_set_memory()). * domain is only done through xend_set_memory()).
*/ */
int xend_set_max_memory(struct xend *xend, const char *name, uint64_t value); int xend_set_max_memory(virConnectPtr xend, const char *name, uint64_t value);
/** /**
* \brief Set the memory allocation for a domain * \brief Set the memory allocation for a domain
@ -752,7 +668,7 @@ int xend_set_max_memory(struct xend *xend, const char *name, uint64_t value);
* There is no safe guard for allocations that are too small so be careful * There is no safe guard for allocations that are too small so be careful
* when using this function to reduce a domain's memory usage. * when using this function to reduce a domain's memory usage.
*/ */
int xend_set_memory(struct xend *xend, const char *name, uint64_t value); int xend_set_memory(virConnectPtr xend, const char *name, uint64_t value);
/** /**
* \brief Create a virtual block device * \brief Create a virtual block device
@ -766,7 +682,7 @@ int xend_set_memory(struct xend *xend, const char *name, uint64_t value);
* rather, one should use xend_wait_for_devices() to block until the device * rather, one should use xend_wait_for_devices() to block until the device
* has been successfully attached. * has been successfully attached.
*/ */
int xend_vbd_create(struct xend *xend, int xend_vbd_create(virConnectPtr xend,
const char *name, const char *name,
const struct xend_device_vbd *vbd); const struct xend_device_vbd *vbd);
@ -782,7 +698,7 @@ int xend_vbd_create(struct xend *xend,
* should use xend_wait_for_devices() to block until the device has been * should use xend_wait_for_devices() to block until the device has been
* successfully detached. * successfully detached.
*/ */
int xend_vbd_destroy(struct xend *xend, int xend_vbd_destroy(virConnectPtr xend,
const char *name, const char *name,
const struct xend_device_vbd *vbd); const struct xend_device_vbd *vbd);
@ -798,7 +714,7 @@ int xend_vbd_destroy(struct xend *xend,
* rather, one should use xend_wait_for_devices() to network until the device * rather, one should use xend_wait_for_devices() to network until the device
* has been successfully attached. * has been successfully attached.
*/ */
int xend_vif_create(struct xend *xend, int xend_vif_create(virConnectPtr xend,
const char *name, const char *name,
const struct xend_device_vif *vif); const struct xend_device_vif *vif);
@ -814,7 +730,7 @@ int xend_vif_create(struct xend *xend,
* rather, one should use xend_wait_for_devices() to network until the device * rather, one should use xend_wait_for_devices() to network until the device
* has been successfully detached. * has been successfully detached.
*/ */
int xend_vif_destroy(struct xend *xend, int xend_vif_destroy(virConnectPtr xend,
const char *name, const char *name,
const struct xend_device_vif *vif); const struct xend_device_vif *vif);
@ -828,7 +744,7 @@ int xend_vif_destroy(struct xend *xend,
* it in the form of a struct xend_domain. This should be * it in the form of a struct xend_domain. This should be
* free()'d when no longer needed. * free()'d when no longer needed.
*/ */
struct xend_domain *xend_get_domain(struct xend *xend, struct xend_domain *xend_get_domain(virConnectPtr xend,
const char *name); const char *name);
/** /**
@ -839,7 +755,7 @@ struct xend_domain *xend_get_domain(struct xend *xend,
* This method returns information about the physical host * This method returns information about the physical host
* machine running Xen. * machine running Xen.
*/ */
struct xend_node *xend_get_node(struct xend *xend); struct xend_node *xend_get_node(virConnectPtr xend);
/** /**
* \brief Shutdown physical host machine * \brief Shutdown physical host machine
@ -848,7 +764,7 @@ struct xend_node *xend_get_node(struct xend *xend);
* *
* This method shuts down the physical machine running Xen. * This method shuts down the physical machine running Xen.
*/ */
int xend_node_shutdown(struct xend *xend); int xend_node_shutdown(virConnectPtr xend);
/** /**
* \brief Restarts physical host machine * \brief Restarts physical host machine
@ -857,7 +773,7 @@ int xend_node_shutdown(struct xend *xend);
* *
* This method restarts the physical machine running Xen. * This method restarts the physical machine running Xen.
*/ */
int xend_node_restart(struct xend *xend); int xend_node_restart(virConnectPtr xend);
/** /**
* \brief Return hypervisor debugging messages * \brief Return hypervisor debugging messages
@ -869,7 +785,7 @@ int xend_node_restart(struct xend *xend);
* This function will place the debugging messages from the * This function will place the debugging messages from the
* hypervisor into a buffer with a null terminator. * hypervisor into a buffer with a null terminator.
*/ */
int xend_dmesg(struct xend *xend, int xend_dmesg(virConnectPtr xend,
char *buffer, char *buffer,
size_t n_buffer); size_t n_buffer);
@ -881,7 +797,7 @@ int xend_dmesg(struct xend *xend,
* This function will clear the debugging message ring queue * This function will clear the debugging message ring queue
* in the hypervisor. * in the hypervisor.
*/ */
int xend_dmesg_clear(struct xend *xend); int xend_dmesg_clear(virConnectPtr xend);
/** /**
* \brief Obtain the Xend log messages * \brief Obtain the Xend log messages
@ -893,7 +809,7 @@ int xend_dmesg_clear(struct xend *xend);
* This function will place the Xend debugging messages into * This function will place the Xend debugging messages into
* a buffer with a null terminator. * a buffer with a null terminator.
*/ */
int xend_log(struct xend *xend, int xend_log(virConnectPtr xend,
char *buffer, char *buffer,
size_t n_buffer); size_t n_buffer);