]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
* configure.in: checking xenstore library, error out on missing libs
authorDaniel Veillard <veillard@redhat.com>
Wed, 23 Nov 2005 07:47:13 +0000 (07:47 +0000)
committerDaniel Veillard <veillard@redhat.com>
Wed, 23 Nov 2005 07:47:13 +0000 (07:47 +0000)
* include/libxen.h src/libxen.c src/libxen_sym.version: adding new
  entry points
Daniel

ChangeLog
configure.in
include/libxen.h
src/libxen.c
src/libxen_sym.version

index cf243547da65bed0ed3e8e1e17ef0c92c346ce84..a9c61f5c40607436a097a9a15f97185c6f64af06 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Tue Nov 22 17:09:11 CET 2005 Daniel Veillard <veillard@redhat.com>
+
+       * configure.in: checking xenstore library, error out on missing libs
+       * include/libxen.h src/libxen.c src/libxen_sym.version: adding new
+         entry points
+
 Thu Nov 10 17:11:03 CET 2005 Daniel Veillard <veillard@redhat.com>
 
        * src/makefile.am src/libxen.c src/xensh.c: add a small tool sensh,
index 4975649bfb22e20102fc0cc0ae9e23c6ea56c2ea..11e9c96611c7ded117f14ad74b630debaf7498a7 100644 (file)
@@ -48,6 +48,7 @@ test "x$U" != "x" && AC_MSG_ERROR(Compiler not ANSI compliant)
 AM_PROG_LIBTOOL
 
 dnl search for the low level Xen library
-AC_SEARCH_LIBS(xc_domain_create, [xenctrl])
+AC_SEARCH_LIBS(xc_domain_create, [xenctrl], [], [AC_MSG_ERROR([Xen control library not found])])
+AC_SEARCH_LIBS(xs_read, [xenstore], [], [AC_MSG_ERROR([Xen store library not found])])
 
 AC_OUTPUT(Makefile src/Makefile include/Makefile libxen.pc libxen.spec)
index 3832d23fd3655f6f995346b2f415dca04f6ea1f8..79514c6828e530eae51ed91709fc30844d6f2afd 100644 (file)
@@ -73,7 +73,8 @@ xenDomainPtr          xenCreateLinuxDomain    (xenConnectPtr conn,
                                                 const char *cmdline,
                                                 unsigned long memory,
                                                 unsigned int flags);
-
+xenDomainPtr           xenLookupDomain         (xenConnectPtr conn,
+                                                const char *name);
 int                    xenDestroyDomain        (xenDomainPtr domain);
 
 /*
@@ -85,6 +86,8 @@ int                   xenResumeDomain         (xenDomainPtr domain);
 /*
  * Dynamic control of domains
  */
+const char *           xenGetName              (xenDomainPtr domain);
+unsigned long          xenGetMaxMemory         (xenDomainPtr domain);
 int                    xenSetMaxMemory         (xenDomainPtr domain,
                                                 unsigned long memory);
 
index ff107ca351a15524c522f841557abc9477551cd7..7566b454a56075cccf05c98baa3f9df870590492 100644 (file)
@@ -31,6 +31,7 @@
 struct _xenConnect {
     unsigned int magic;                /* specific value to check */
     int                 handle;        /* internal handle used for hypercall */
+    int                 xshandle;      /* handle to talk to the xenstore */
 };
 
 /**
@@ -38,28 +39,37 @@ struct _xenConnect {
  * @name: optional argument currently unused, pass NULL
  *
  * This function should be called first to get a connection to the 
- * Hypervisor
+ * Hypervisor and xen store
  *
  * Returns a pointer to the hypervisor connection or NULL in case of error
  */
 xenConnectPtr
 xenOpenConnect(const char *name) {
     xenConnectPtr ret;
-    int handle;
+    int handle = -1;
+    int xshandle = -1;
 
     handle = xc_interface_open();
-    if (handle == -1) {
-        return(NULL);
-    }
+    if (handle == -1)
+        goto failed;
+    xshandle = xs_daemon_open();
+    if (xshandle < 0)
+        goto failed;
+
     ret = (xenConnectPtr) malloc(sizeof(xenConnect));
-    if (ret == NULL) {
-        xc_interface_close(handle);
-        return(NULL);
-    }
+    if (ret == NULL)
+        goto failed;
     ret->magic = XEN_CONNECT_MAGIC;
     ret->handle = handle;
+    ret->xshandle = xshandle;
 
     return(ret);
+failed:
+    if (handle >= 0)
+        xc_interface_close(handle);
+    if (xshandle >= 0)
+        xs_daemon_close(xshandle);
+    return(NULL);
 }
 
 /**
@@ -79,6 +89,8 @@ xenCloseConnect(xenConnectPtr conn) {
         return(-1);
 
     conn->magic = -1;
+    xs_daemon_close(conn->xshandle);
+    conn->xshandle = -1;
     xc_interface_close(conn->handle);
     conn->handle = -1;
     free(conn);
@@ -122,6 +134,23 @@ xenCreateLinuxDomain(xenConnectPtr conn, const char *kernel_path,
     return(NULL);
 }
 
+/**
+ * xenLookupDomain:
+ * @conn: pointer to the hypervisor connection
+ * @name: name for the domain
+ *
+ * Try to lookup a domain on the given hypervisor
+ *
+ * Returns a new domain object or NULL in case of failure
+ */
+xenDomainPtr
+xenLookupDomain(xenConnectPtr conn, const char *name) {
+    if ((conn == NULL) || (name == NULL))
+        return(NULL);
+    TODO
+    return(NULL);
+}
+
 /**
  * xenDestroyDomain:
  * @domain: a domain object
@@ -175,6 +204,41 @@ xenResumeDomain(xenDomainPtr domain) {
     return(-1);
 }
 
+/**
+ * xenGetName:
+ * @domain: a domain object
+ *
+ * Get the public name for that domain
+ *
+ * Returns a pointer to the name or NULL, the string need not be deallocated
+ * its lifetime will be the same as the domain object.
+ */
+const char *
+xenGetName(xenDomainPtr domain) {
+    if (domain == NULL)
+        return(NULL);
+    TODO
+    return(NULL);
+}
+
+/**
+ * xenGetMaxMemory:
+ * @domain: a domain object or NULL
+ * 
+ * Retrieve the maximum amount of physical memory allocated to a
+ * domain. If domain is NULL, then this get the amount of memory reserved
+ * to Domain0 i.e. the domain where the application runs.
+ *
+ * Returns the memory size in kilobytes or 0 in case of error.
+ */
+unsigned long
+xenGetMaxMemory(xenDomainPtr domain) {
+    if (domain == NULL)
+        return(0);
+    TODO
+    return(0);
+}
+
 /**
  * xenSetMaxMemory:
  * @domain: a domain object or NULL
index 0ac937ac5bbf6d2fb8fdb62d631618512d3a731f..fa49bf78d98d9bde20486b5d56f87c40b9bc9ff9 100644 (file)
@@ -4,9 +4,12 @@
        xenCloseConnect;
        xenGetVersion;
        xenCreateLinuxDomain;
+       xenLookupDomain;
        xenDestroyDomain;
        xenSuspendDomain;
        xenResumeDomain;
+       xenGetName;
+       xenGetMaxMemory;
        xenSetMaxMemory;
     local: *;
 };