[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] PATCH: 8/14: Remove dead Xen code



This patch is a cleanup to prepare the way for the next set of
Xen related patches. It basically removes a bunch of no-op or
unused code.

 proxy_internal.c |   10 --
 xen_unified.c    |    3 
 xend_internal.c  |  242 +++++++++++--------------------------------------------
 xend_internal.h  |   91 --------------------
 xs_internal.c    |   10 --
 5 files changed, 52 insertions(+), 304 deletions(-)

Daniel

diff -r afea2b6ba5c5 src/proxy_internal.c
--- a/src/proxy_internal.c	Mon Jun 30 10:20:16 2008 +0100
+++ b/src/proxy_internal.c	Mon Jun 30 10:34:45 2008 +0100
@@ -87,16 +87,6 @@
     NULL, /* domainSetSchedulerParameters */
 };
 
-/**
- * xenProxyInit:
- *
- * Initialise the xen proxy driver.
- */
-int
-xenProxyInit (void)
-{
-    return 0;
-}
 
 /************************************************************************
  *									*
diff -r afea2b6ba5c5 src/xen_unified.c
--- a/src/xen_unified.c	Mon Jun 30 10:20:16 2008 +0100
+++ b/src/xen_unified.c	Mon Jun 30 10:34:45 2008 +0100
@@ -1367,9 +1367,6 @@
 {
     /* Ignore failures here. */
     (void) xenHypervisorInit ();
-    (void) xenProxyInit ();
-    (void) xenDaemonInit ();
-    (void) xenStoreInit ();
     (void) xenXMInit ();
 
     return virRegisterDriver (&xenUnifiedDriver);
diff -r afea2b6ba5c5 src/xend_internal.c
--- a/src/xend_internal.c	Mon Jun 30 10:20:16 2008 +0100
+++ b/src/xend_internal.c	Mon Jun 30 10:34:45 2008 +0100
@@ -54,23 +54,6 @@
 #define DEBUG0(msg) VIR_DEBUG(__FILE__, "%s", msg)
 
 #ifndef PROXY
-static int xenDaemonListDomains(virConnectPtr conn, int *ids, int maxids);
-static int xenDaemonNumOfDomains(virConnectPtr conn);
-static int xenDaemonListDefinedDomains(virConnectPtr conn, char **const names, int maxnames);
-static int xenDaemonNumOfDefinedDomains(virConnectPtr conn);
-static virDomainPtr xenDaemonCreateLinux(virConnectPtr conn,
-                                         const char *xmlDesc,
-                                         unsigned int flags);
-static char *xenDaemonDomainGetOSType(virDomainPtr domain);
-static int xenDaemonAttachDevice(virDomainPtr domain, const char *xml);
-static int xenDaemonDetachDevice(virDomainPtr domain, const char *xml);
-static int xenDaemonDomainCoreDump(virDomainPtr domain, const char *filename,
-                                   int flags);
-static char *xenDaemonGetSchedulerType(virDomainPtr domain, int *nparams);
-static int xenDaemonGetSchedulerParameters(virDomainPtr domain,
-                                 virSchedParameterPtr params, int *nparams);
-static int xenDaemonSetSchedulerParameters(virDomainPtr domain,
-                                 virSchedParameterPtr params, int nparams);
 
 /*
  * The number of Xen scheduler parameters
@@ -79,61 +62,6 @@
 #define XEN_SCHED_CRED_NPARAM   2
 
 #endif /* PROXY */
-
-#ifndef PROXY
-struct xenUnifiedDriver xenDaemonDriver = {
-    xenDaemonOpen, /* open */
-    xenDaemonClose, /* close */
-    xenDaemonGetVersion, /* version */
-    NULL, /* hostname */
-    NULL, /* URI */
-    xenDaemonNodeGetInfo, /* nodeGetInfo */
-    NULL, /* getCapabilities */
-    xenDaemonListDomains, /* listDomains */
-    xenDaemonNumOfDomains, /* numOfDomains */
-    xenDaemonCreateLinux, /* domainCreateLinux */
-    xenDaemonDomainSuspend, /* domainSuspend */
-    xenDaemonDomainResume, /* domainResume */
-    xenDaemonDomainShutdown, /* domainShutdown */
-    xenDaemonDomainReboot, /* domainReboot */
-    xenDaemonDomainDestroy, /* domainDestroy */
-    xenDaemonDomainGetOSType, /* domainGetOSType */
-    xenDaemonDomainGetMaxMemory, /* domainGetMaxMemory */
-    xenDaemonDomainSetMaxMemory, /* domainSetMaxMemory */
-    xenDaemonDomainSetMemory, /* domainMaxMemory */
-    xenDaemonDomainGetInfo, /* domainGetInfo */
-    xenDaemonDomainSave, /* domainSave */
-    xenDaemonDomainRestore, /* domainRestore */
-    xenDaemonDomainCoreDump, /* domainCoreDump */
-    xenDaemonDomainSetVcpus, /* domainSetVcpus */
-    xenDaemonDomainPinVcpu, /* domainPinVcpu */
-    xenDaemonDomainGetVcpus, /* domainGetVcpus */
-    NULL, /* domainGetMaxVcpus */
-    xenDaemonListDefinedDomains, /* listDefinedDomains */
-    xenDaemonNumOfDefinedDomains, /* numOfDefinedDomains */
-    xenDaemonDomainCreate, /* domainCreate */
-    xenDaemonDomainDefineXML, /* domainDefineXML */
-    xenDaemonDomainUndefine, /* domainUndefine */
-    xenDaemonAttachDevice, /* domainAttachDevice */
-    xenDaemonDetachDevice, /* domainDetachDevice */
-    xenDaemonDomainGetAutostart, /* domainGetAutostart */
-    xenDaemonDomainSetAutostart, /* domainSetAutostart */
-    xenDaemonGetSchedulerType, /* domainGetSchedulerType */
-    xenDaemonGetSchedulerParameters, /* domainGetSchedulerParameters */
-    xenDaemonSetSchedulerParameters, /* domainSetSchedulerParameters */
-};
-
-/**
- * xenDaemonInit:
- *
- * Initialise the xenDaemon driver.
- */
-int
-xenDaemonInit (void)
-{
-    return 0;
-}
-#endif /* !PROXY */
 
 /**
  * xend_connection_type:
@@ -213,16 +141,6 @@
     __virRaiseError(conn, NULL, NULL, VIR_FROM_XEND, error, VIR_ERR_ERROR,
                     errmsg, NULL, NULL, val, 0, errmsg, val);
 }
-
-
-#define foreach(iterator, start) \
-        for (_for_i = (start), *iterator = (start)->u.s.car; \
-             _for_i->kind == SEXPR_CONS; \
-             _for_i = _for_i->u.s.cdr, iterator = _for_i->u.s.car)
-
-#define foreach_node(iterator, start, path) \
-        foreach(iterator, start) \
-            if (sexpr_lookup(iterator, path))
 
 /**
  * do_connect:
@@ -608,7 +526,7 @@
 
 #ifndef PROXY
 /**
- * xend_op_ext2:
+ * xend_op_ext:
  * @xend: pointer to the Xen Daemon structure
  * @path: path for the object
  * @error: buffer for the error output
@@ -621,8 +539,8 @@
  * Returns 0 in case of success, -1 in case of failure.
  */
 static int
-xend_op_ext2(virConnectPtr xend, const char *path, char *error,
-             size_t n_error, const char *key, va_list ap)
+xend_op_ext(virConnectPtr xend, const char *path, char *error,
+            size_t n_error, const char *key, va_list ap)
 {
     const char *k = key, *v;
     virBuffer buf = VIR_BUFFER_INITIALIZER;
@@ -655,33 +573,7 @@
 
 
 /**
- * xend_node_op:
- * @xend: pointer to the Xen Daemon structure
- * @path: path for the object
- * @key: the key for the operation
- * @...: input values to pass to the operation
- *
- * internal routine to run a POST RPC operation to the Xen Daemon
- *
- * Returns 0 in case of success, -1 in case of failure.
- */
-static int
-xend_node_op(virConnectPtr xend, const char *path, const char *key, ...)
-{
-    va_list ap;
-    int ret;
-    char error[1024];
-
-    va_start(ap, key);
-    ret = xend_op_ext2(xend, path, error, sizeof(error), key, ap);
-    va_end(ap);
-
-    return ret;
-}
-
-
-/**
- * xend_op_ext:
+ * xend_op:
  * @xend: pointer to the Xen Daemon structure
  * @name: the domain name target of this operation
  * @error: buffer for the error output
@@ -706,7 +598,7 @@
     snprintf(buffer, sizeof(buffer), "/xend/domain/%s", name);
 
     va_start(ap, key);
-    ret = xend_op_ext2(xend, buffer, error, sizeof(error), key, ap);
+    ret = xend_op_ext(xend, buffer, error, sizeof(error), key, ap);
     va_end(ap);
 
     return ret;
@@ -1027,7 +919,7 @@
  *
  * Returns 0 in case of success, -1 in case of error.
  */
-int
+static int
 xenDaemonOpen_tcp(virConnectPtr conn, const char *host, int port)
 {
     struct in_addr ip;
@@ -1309,83 +1201,6 @@
     return (0);
 }
 
-/**
- * xend_node_shutdown:
- * @xend: A xend instance
- *
- * This method shuts down the physical machine running Xen.
- *
- * Returns 0 on success; -1 (with errno) on error
- */
-int
-xend_node_shutdown(virConnectPtr xend)
-{
-    return xend_node_op(xend, "/xend/node/", "op", "halt", NULL);
-}
-
-/**
- * xend_node_restart:
- * @xend: A xend instance
- *
- * This method restarts the physical machine running Xen.
- *
- * Returns 0 on success; -1 (with errno) on error
- */
-int
-xend_node_restart(virConnectPtr xend)
-{
-    return xend_node_op(xend, "/xend/node/", "op", "restart", NULL);
-}
-
-
-/**
- * xend_dmesg:
- * @xend: A xend instance
- * @buffer: A buffer to hold the messages
- * @n_buffer: Size of buffer (including null terminator)
- *
- * This function will place the debugging messages from the
- * hypervisor into a buffer with a null terminator.
- *
- * Returns 0 on success; -1 (with errno) on error
- */
-int
-xend_dmesg(virConnectPtr xend, char *buffer, size_t n_buffer)
-{
-    return http2unix(xend, xend_get(xend, "/xend/node/dmesg", buffer, n_buffer));
-}
-
-/**
- * xend_dmesg_clear:
- * @xend: A xend instance
- *
- * This function will clear the debugging message ring queue
- * in the hypervisor.
- *
- * Returns 0 on success; -1 (with errno) on error
- */
-int
-xend_dmesg_clear(virConnectPtr xend)
-{
-    return xend_node_op(xend, "/xend/node/dmesg", "op", "clear", NULL);
-}
-
-/**
- * xend_log:
- * @xend: A xend instance
- * @buffer: The buffer to hold the messages
- * @n_buffer: Size of buffer (including null terminator)
- *
- * This function will place the Xend debugging messages into
- * a buffer with a null terminator.
- *
- * Returns 0 on success; -1 (with errno) on error
- */
-int
-xend_log(virConnectPtr xend, char *buffer, size_t n_buffer)
-{
-    return http2unix(xend, xend_get(xend, "/xend/node/log", buffer, n_buffer));
-}
 #endif /* PROXY */
 
 /*****************************************************************
@@ -4213,7 +4028,8 @@
     return(ret);
 }
 
-int xenDaemonListDefinedDomains(virConnectPtr conn, char **const names, int maxnames) {
+static int
+xenDaemonListDefinedDomains(virConnectPtr conn, char **const names, int maxnames) {
     struct sexpr *root = NULL;
     int ret = -1;
     struct sexpr *_for_i, *node;
@@ -4631,5 +4447,47 @@
     return ret;
 }
 
+struct xenUnifiedDriver xenDaemonDriver = {
+    xenDaemonOpen,               /* open */
+    xenDaemonClose,              /* close */
+    xenDaemonGetVersion,         /* version */
+    NULL,                        /* hostname */
+    NULL,                        /* URI */
+    xenDaemonNodeGetInfo,        /* nodeGetInfo */
+    NULL,                        /* getCapabilities */
+    xenDaemonListDomains,        /* listDomains */
+    xenDaemonNumOfDomains,       /* numOfDomains */
+    xenDaemonCreateLinux,        /* domainCreateLinux */
+    xenDaemonDomainSuspend,      /* domainSuspend */
+    xenDaemonDomainResume,       /* domainResume */
+    xenDaemonDomainShutdown,     /* domainShutdown */
+    xenDaemonDomainReboot,       /* domainReboot */
+    xenDaemonDomainDestroy,      /* domainDestroy */
+    xenDaemonDomainGetOSType,    /* domainGetOSType */
+    xenDaemonDomainGetMaxMemory, /* domainGetMaxMemory */
+    xenDaemonDomainSetMaxMemory, /* domainSetMaxMemory */
+    xenDaemonDomainSetMemory,    /* domainMaxMemory */
+    xenDaemonDomainGetInfo,      /* domainGetInfo */
+    xenDaemonDomainSave,         /* domainSave */
+    xenDaemonDomainRestore,      /* domainRestore */
+    xenDaemonDomainCoreDump,     /* domainCoreDump */
+    xenDaemonDomainSetVcpus,     /* domainSetVcpus */
+    xenDaemonDomainPinVcpu,      /* domainPinVcpu */
+    xenDaemonDomainGetVcpus,     /* domainGetVcpus */
+    NULL,                        /* domainGetMaxVcpus */
+    xenDaemonListDefinedDomains, /* listDefinedDomains */
+    xenDaemonNumOfDefinedDomains,/* numOfDefinedDomains */
+    xenDaemonDomainCreate,       /* domainCreate */
+    xenDaemonDomainDefineXML,    /* domainDefineXML */
+    xenDaemonDomainUndefine,     /* domainUndefine */
+    xenDaemonAttachDevice,       /* domainAttachDevice */
+    xenDaemonDetachDevice,       /* domainDetachDevice */
+    xenDaemonDomainGetAutostart, /* domainGetAutostart */
+    xenDaemonDomainSetAutostart, /* domainSetAutostart */
+    xenDaemonGetSchedulerType,   /* domainGetSchedulerType */
+    xenDaemonGetSchedulerParameters, /* domainGetSchedulerParameters */
+    xenDaemonSetSchedulerParameters, /* domainSetSchedulerParameters */
+};
+
 #endif /* ! PROXY */
 #endif /* WITH_XEN */
diff -r afea2b6ba5c5 src/xend_internal.h
--- a/src/xend_internal.h	Mon Jun 30 10:20:16 2008 +0100
+++ b/src/xend_internal.h	Mon Jun 30 10:34:45 2008 +0100
@@ -26,33 +26,8 @@
 extern "C" {
 #endif
 
-/**
- * \brief Setup the connection to a xend instance via TCP
- * \param host The host name to connect to
- * \param port The port number to connect to
- * \return 0 in case of success, -1 in case of error
- *
- * This method creates a new Xend instance via TCP.
- *
- * This function may not fail if Xend is not running.
- *
- * Make sure to call xenDaemonClose().
- */
-int xenDaemonOpen_tcp(virConnectPtr xend, const char *host, int port);
-
-/**
- * \brief Setup the connection to xend instance via a Unix domain socket
- * \param path The path to the domain socket
- * \return 0 in case of success, -1 in case of error
- *
- * This method creates a new xend instance via a Unix domain socket.
- *
- * This function may not fail if Xend is not running.
- *
- * Make sure to call xenDaemonClose().
- */
-int xenDaemonOpen_unix(virConnectPtr xend, const char *path);
-
+int
+xenDaemonOpen_unix(virConnectPtr conn, const char *path);
 
 /**
  * \brief Blocks until a domain's devices are initialized
@@ -117,68 +92,6 @@
                                    const char *name,
                                    int flags,
                                    const char *cpus);
-
-/**
- * \brief Lookup information about the host machine
- * \param xend A xend instance
- * \return node info on success; NULL (with errno) on error
- *
- * This method returns information about the physical host
- * machine running Xen.
- */
-    struct xend_node *xend_get_node(virConnectPtr xend);
-
-/**
- * \brief Shutdown physical host machine
- * \param xend A xend instance
- * \return 0 on success; -1 (with errno) on error
- *
- * This method shuts down the physical machine running Xen.
- */
-    int xend_node_shutdown(virConnectPtr xend);
-
-/**
- * \brief Restarts physical host machine
- * \param xend A xend instance
- * \return 0 on success; -1 (with errno) on error
- *
- * This method restarts the physical machine running Xen.
- */
-    int xend_node_restart(virConnectPtr xend);
-
-/**
- * \brief Return hypervisor debugging messages
- * \param xend A xend instance
- * \param buffer A buffer to hold the messages
- * \param n_buffer Size of buffer (including null terminator)
- * \return 0 on success; -1 (with errno) on error
- *
- * This function will place the debugging messages from the
- * hypervisor into a buffer with a null terminator.
- */
-    int xend_dmesg(virConnectPtr xend, char *buffer, size_t n_buffer);
-
-/**
- * \brief Clear the hypervisor debugging messages
- * \param xend A xend instance
- * \return 0 on success; -1 (with errno) on error
- *
- * This function will clear the debugging message ring queue
- * in the hypervisor.
- */
-    int xend_dmesg_clear(virConnectPtr xend);
-
-/**
- * \brief Obtain the Xend log messages
- * \param xend A xend instance
- * \param buffer The buffer to hold the messages
- * \param n_buffer Size of buffer (including null terminator)
- * \return 0 on success; -1 (with errno) on error
- *
- * This function will place the Xend debugging messages into
- * a buffer with a null terminator.
- */
-    int xend_log(virConnectPtr xend, char *buffer, size_t n_buffer);
 
     int xend_parse_sexp_desc_char(virConnectPtr conn,
                                   virBufferPtr buf,
diff -r afea2b6ba5c5 src/xs_internal.c
--- a/src/xs_internal.c	Mon Jun 30 10:20:16 2008 +0100
+++ b/src/xs_internal.c	Mon Jun 30 10:34:45 2008 +0100
@@ -86,16 +86,6 @@
     NULL, /* domainSetSchedulerParameters */
 };
 
-/**
- * xenStoreInit:
- *
- * Initialisation.
- */
-int
-xenStoreInit ()
-{
-    return 0;
-}
 #endif /* ! PROXY */
 
 /**

-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]