[PATCH] xen: Remove unused function

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

 



Signed-off-by: Cole Robinson <crobinso@xxxxxxxxxx>
---
 src/xen/xend_internal.c |  223 -----------------------------------------------
 src/xen/xend_internal.h |    6 --
 2 files changed, 0 insertions(+), 229 deletions(-)

diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c
index a203a8d..a99cc7b 100644
--- a/src/xen/xend_internal.c
+++ b/src/xen/xend_internal.c
@@ -1204,229 +1204,6 @@ no_memory:
     return -1;
 }
 
-
-int
-xend_parse_sexp_desc_char(virBufferPtr buf,
-                          const char *devtype,
-                          int portNum,
-                          const char *value,
-                          const char *tty)
-{
-    const char *type;
-    int telnet = 0;
-    char *bindPort = NULL;
-    char *bindHost = NULL;
-    char *connectPort = NULL;
-    char *connectHost = NULL;
-    char *path = NULL;
-    int ret = -1;
-
-    if (value[0] == '/') {
-        type = "dev";
-    } else if (STRPREFIX(value, "null")) {
-        type = "null";
-        value = NULL;
-    } else if (STRPREFIX(value, "vc")) {
-        type = "vc";
-        value = NULL;
-    } else if (STRPREFIX(value, "pty")) {
-        type = "pty";
-        value = NULL;
-    } else if (STRPREFIX(value, "stdio")) {
-        type = "stdio";
-        value = NULL;
-    } else if (STRPREFIX(value, "file:")) {
-        type = "file";
-        value += sizeof("file:")-1;
-    } else if (STRPREFIX(value, "pipe:")) {
-        type = "pipe";
-        value += sizeof("pipe:")-1;
-    } else if (STRPREFIX(value, "tcp:")) {
-        type = "tcp";
-        value += sizeof("tcp:")-1;
-    } else if (STRPREFIX(value, "telnet:")) {
-        type = "tcp";
-        value += sizeof("telnet:")-1;
-        telnet = 1;
-    } else if (STRPREFIX(value, "udp:")) {
-        type = "udp";
-        value += sizeof("udp:")-1;
-    } else if (STRPREFIX(value, "unix:")) {
-        type = "unix";
-        value += sizeof("unix:")-1;
-    } else {
-        virXendError(VIR_ERR_INTERNAL_ERROR,
-                     "%s", _("Unknown char device type"));
-        return -1;
-    }
-
-    /* Compat with legacy  <console tty='/dev/pts/5'/> syntax */
-    if (STREQ(devtype, "console") &&
-        STREQ(type, "pty") &&
-        tty != NULL) {
-        virBufferVSprintf(buf, "    <%s type='%s' tty='%s'>\n",
-                          devtype, type, tty);
-    } else {
-        virBufferVSprintf(buf, "    <%s type='%s'>\n",
-                          devtype, type);
-    }
-
-    if (STREQ(type, "null") ||
-        STREQ(type, "vc") ||
-        STREQ(type, "stdio")) {
-        /* no source needed */
-    } else if (STREQ(type, "pty")) {
-        if (tty)
-            virBufferVSprintf(buf, "      <source path='%s'/>\n",
-                              tty);
-    } else if (STREQ(type, "file") ||
-               STREQ(type, "pipe")) {
-        virBufferVSprintf(buf, "      <source path='%s'/>\n",
-                          value);
-    } else if (STREQ(type, "tcp")) {
-        sa_assert (value);
-        const char *offset = strchr(value, ':');
-        const char *offset2;
-        const char *mode, *protocol;
-
-        if (offset == NULL) {
-            virXendError(VIR_ERR_INTERNAL_ERROR,
-                         "%s", _("malformed char device string"));
-            goto error;
-        }
-
-        if (offset != value &&
-            (bindHost = strndup(value, offset - value)) == NULL)
-            goto no_memory;
-
-        offset2 = strchr(offset, ',');
-        if (offset2 == NULL)
-            bindPort = strdup(offset+1);
-        else
-            bindPort = strndup(offset+1, offset2-(offset+1));
-        if (bindPort == NULL)
-            goto no_memory;
-
-        if (offset2 && strstr(offset2, ",listen"))
-            mode = "bind";
-        else
-            mode = "connect";
-        protocol = telnet ? "telnet":"raw";
-
-        if (bindHost) {
-            virBufferVSprintf(buf,
-                              "      <source mode='%s' host='%s' service='%s'/>\n",
-                              mode, bindHost, bindPort);
-        } else {
-            virBufferVSprintf(buf,
-                              "      <source mode='%s' service='%s'/>\n",
-                              mode, bindPort);
-        }
-        virBufferVSprintf(buf,
-                          "      <protocol type='%s'/>\n",
-                          protocol);
-    } else if (STREQ(type, "udp")) {
-        sa_assert (value);
-        const char *offset = strchr(value, ':');
-        const char *offset2, *offset3;
-
-        if (offset == NULL) {
-            virXendError(VIR_ERR_INTERNAL_ERROR,
-                         "%s", _("malformed char device string"));
-            goto error;
-        }
-
-        if (offset != value &&
-            (connectHost = strndup(value, offset - value)) == NULL)
-            goto no_memory;
-
-        offset2 = strchr(offset, '@');
-        if (offset2 != NULL) {
-            if ((connectPort = strndup(offset + 1, offset2-(offset+1))) == NULL)
-                goto no_memory;
-
-            offset3 = strchr(offset2, ':');
-            if (offset3 == NULL) {
-                virXendError(VIR_ERR_INTERNAL_ERROR,
-                             "%s", _("malformed char device string"));
-                goto error;
-            }
-
-            if (offset3 > (offset2 + 1) &&
-                (bindHost = strndup(offset2 + 1, offset3 - (offset2+1))) == NULL)
-                goto no_memory;
-
-            if ((bindPort = strdup(offset3 + 1)) == NULL)
-                goto no_memory;
-        } else {
-            if ((connectPort = strdup(offset + 1)) == NULL)
-                goto no_memory;
-        }
-
-        if (connectHost) {
-            virBufferVSprintf(buf,
-                              "      <source mode='connect' host='%s' service='%s'/>\n",
-                              connectHost, connectPort);
-        } else {
-            virBufferVSprintf(buf,
-                              "      <source mode='connect' service='%s'/>\n",
-                              connectPort);
-        }
-        if (bindPort) {
-            if (bindHost) {
-                virBufferVSprintf(buf,
-                                  "      <source mode='bind' host='%s' service='%s'/>\n",
-                                  bindHost, bindPort);
-            } else {
-                virBufferVSprintf(buf,
-                                  "      <source mode='bind' service='%s'/>\n",
-                                  bindPort);
-            }
-        }
-
-    } else if (STREQ(type, "unix")) {
-        sa_assert (value);
-        const char *offset = strchr(value, ',');
-        int dolisten = 0;
-        if (offset)
-            path = strndup(value, (offset - value));
-        else
-            path = strdup(value);
-        if (path == NULL)
-            goto no_memory;
-
-        if (offset != NULL &&
-            strstr(offset, ",listen") != NULL)
-            dolisten = 1;
-
-        virBufferVSprintf(buf, "      <source mode='%s' path='%s'/>\n",
-                          dolisten ? "bind" : "connect", path);
-    }
-
-    virBufferVSprintf(buf, "      <target port='%d'/>\n",
-                      portNum);
-
-    virBufferVSprintf(buf, "    </%s>\n",
-                      devtype);
-
-    ret = 0;
-
-    if (ret == -1) {
-no_memory:
-        virReportOOMError();
-    }
-
-error:
-
-    VIR_FREE(path);
-    VIR_FREE(bindHost);
-    VIR_FREE(bindPort);
-    VIR_FREE(connectHost);
-    VIR_FREE(connectPort);
-
-    return ret;
-}
-
 virDomainChrDefPtr
 xenDaemonParseSxprChar(const char *value,
                        const char *tty)
diff --git a/src/xen/xend_internal.h b/src/xen/xend_internal.h
index 25a5421..c757716 100644
--- a/src/xen/xend_internal.h
+++ b/src/xen/xend_internal.h
@@ -96,12 +96,6 @@ xenDaemonDomainFetch(virConnectPtr xend,
                      const char *name,
                      const char *cpus);
 
-int xend_parse_sexp_desc_char(virBufferPtr buf,
-                              const char *devtype,
-                              int portNum,
-                              const char *value,
-                              const char *tty);
-
 virDomainDefPtr
 xenDaemonParseSxprString(virConnectPtr conn,
                          const char *sexpr,
-- 
1.6.6.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]