From 8af506b89f1897bda84a7728fb9bae7ff127ea65 Mon Sep 17 00:00:00 2001 From: Daniel Veillard Date: Mon, 7 Nov 2005 17:16:18 +0000 Subject: [PATCH] * TODO: updated * include/libxen.h src/libxen.c src/libxen_sym.version: extended entry points to a first minimal set. * src/internal.h: TODO macro Daniel --- ChangeLog | 7 +++ TODO | 6 ++- include/libxen.h | 17 ++++++- src/internal.h | 14 ++++++ src/libxen.c | 106 ++++++++++++++++++++++++++++++++++++++++- src/libxen_sym.version | 4 ++ 6 files changed, 150 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index bab0c03eae..53cbf47193 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Mon Nov 7 18:14:50 CET 2005 Daniel Veillard + + * TODO: updated + * include/libxen.h src/libxen.c src/libxen_sym.version: extended + entry points to a first minimal set. + * src/internal.h: TODO macro + Wed Nov 2 16:35:54 CET 2005 Daniel Veillard * TODO libxen.pc.in libxen.spec.in include/Makefile.am Makefile.am diff --git a/TODO b/TODO index 4329446449..7902d5624d 100644 --- a/TODO +++ b/TODO @@ -1 +1,5 @@ -- everything at this point +- nearly everything at this point + +Done: +- make dist and make rpm targets +- set a no public by default policy for libxen symbols diff --git a/include/libxen.h b/include/libxen.h index 1f74d75ab2..3832d23fd3 100644 --- a/include/libxen.h +++ b/include/libxen.h @@ -47,7 +47,6 @@ typedef struct _xenDomain xenDomain; */ typedef xenDomain *xenDomainPtr; - /** * xenDomainFlags: * @@ -72,7 +71,23 @@ xenDomainPtr xenCreateLinuxDomain (xenConnectPtr conn, const char *kernel_path, const char *initrd_path, const char *cmdline, + unsigned long memory, unsigned int flags); + +int xenDestroyDomain (xenDomainPtr domain); + +/* + * Domain suspend/resume + */ +int xenSuspendDomain (xenDomainPtr domain); +int xenResumeDomain (xenDomainPtr domain); + +/* + * Dynamic control of domains + */ +int xenSetMaxMemory (xenDomainPtr domain, + unsigned long memory); + #ifdef __cplusplus } #endif diff --git a/src/internal.h b/src/internal.h index ca13e360cc..e79fe47b14 100644 --- a/src/internal.h +++ b/src/internal.h @@ -9,6 +9,11 @@ extern "C" { #endif +/** + * ATTRIBUTE_UNUSED: + * + * Macro to flag conciously unused parameters to functions + */ #ifdef __GNUC__ #ifdef HAVE_ANSIDECL_H #include @@ -20,6 +25,15 @@ extern "C" { #define ATTRIBUTE_UNUSED #endif +/** + * TODO: + * + * macro to flag unimplemented blocks + */ +#define TODO \ + fprintf(stderr, "Unimplemented block at %s:%d\n", \ + __FILE__, __LINE__); + #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/src/libxen.c b/src/libxen.c index 941fbbde02..7aba219e9e 100644 --- a/src/libxen.c +++ b/src/libxen.c @@ -12,7 +12,6 @@ #include "libxen.h" #include - #include "internal.h" /* @@ -74,5 +73,108 @@ xenCloseConnect(xenConnectPtr conn) { * xenGetVersion: * @conn: pointer to the hypervisor connection * - * Get the version level of the Hypervisor running + * Get the version level of the Hypervisor running. + * + * Returns -1 in case of error or major * 10,000 + minor * 100 + rev otherwise */ +unsigned long +xenGetVersion(xenConnectPtr conn) { + if (conn == NULL) + return(-1); +} + +/** + * xenCreateLinuxDomain: + * @conn: pointer to the hypervisor connection + * @kernel_path: the file path to the kernel image + * @initrd_path: an optional file path to an initrd + * @cmdline: optional command line parameters for the kernel + * @memory: the memory size in kilobytes + * @flags: an optional set of xenDomainFlags + * + * Launch a new Linux guest domain + * + * Returns a new domain object or NULL in case of failure + */ +xenDomainPtr +xenCreateLinuxDomain(xenConnectPtr conn, const char *kernel_path, + const char *initrd_path, const char *cmdline, + unsigned long memory, unsigned int flags) { + if ((conn == NULL) || (kernel_path == NULL) || (memory < 4096)) + return(NULL); + TODO + return(NULL); +} + +/** + * xenDestroyDomain: + * @domain: a domain object + * + * Destroy the domain object. The running instance is shutdown if not down + * already and all resources used by it are given back to the hypervisor. + * + * Returns 0 in case of success and -1 in case of failure. + */ +int +xenDestroyDomain(xenDomainPtr domain) { + if (domain == NULL) + return(-1); + TODO + return(-1); +} + +/** + * xenSuspendDomain: + * @domain: a domain object + * + * Suspends an active domain, the process is frozen without further access + * to CPU resources and I/O but the memory used by the domain at the + * hypervisor level will stay allocated. Use xenResumeDomain() to reactivate + * the domain. + * + * Returns 0 in case of success and -1 in case of failure. + */ +int +xenSuspendDomain(xenDomainPtr domain) { + if (domain == NULL) + return(-1); + TODO + return(-1); +} + +/** + * xenResumeDomain: + * @domain: a domain object + * + * Resume an suspended domain, the process is restarted from the state where + * it was frozen by calling xenSuspendDomain(). + * + * Returns 0 in case of success and -1 in case of failure. + */ +int +xenResumeDomain(xenDomainPtr domain) { + if (domain == NULL) + return(-1); + TODO + return(-1); +} + +/** + * xenSetMaxMemory: + * @domain: a domain object or NULL + * @memory: the memory size in kilobytes + * + * Dynamically change the maximum amount of physical memory allocated to a + * domain. If domain is NULL, then this change the amount of memory reserved + * to Domain0 i.e. the domain where the application runs. + * + * Returns 0 in case of success and -1 in case of failure. + */ +int +xenSetMaxMemory(xenDomainPtr domain, unsigned long memory) { + if ((domain == NULL) || (memory < 4096)) + return(-1); + TODO + return(-1); +} + diff --git a/src/libxen_sym.version b/src/libxen_sym.version index 24536aeefd..0ac937ac5b 100644 --- a/src/libxen_sym.version +++ b/src/libxen_sym.version @@ -4,5 +4,9 @@ xenCloseConnect; xenGetVersion; xenCreateLinuxDomain; + xenDestroyDomain; + xenSuspendDomain; + xenResumeDomain; + xenSetMaxMemory; local: *; };