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

[libvirt PATCH v3 04/10] remote: split out function for parsing URI scheme



The remoteSplitURISCheme method will be needed by source files beyond
the remote driver client.

Signed-off-by: Daniel P. Berrangé <berrange redhat com>
---
 src/remote/remote_driver.c  | 25 -------------------------
 src/remote/remote_sockets.c | 28 ++++++++++++++++++++++++++++
 src/remote/remote_sockets.h |  6 ++++++
 3 files changed, 34 insertions(+), 25 deletions(-)

diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index b214632bdf..8952484b8e 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -165,31 +165,6 @@ static void make_nonnull_domain_snapshot(remote_nonnull_domain_snapshot *snapsho
 /*----------------------------------------------------------------------*/
 
 /* Helper functions for remoteOpen. */
-static int remoteSplitURIScheme(virURIPtr uri,
-                                char **driver,
-                                char **transport)
-{
-    char *p = strchr(uri->scheme, '+');
-
-    *driver = *transport = NULL;
-
-    if (p)
-        *driver = g_strndup(uri->scheme, p - uri->scheme);
-    else
-        *driver = g_strdup(uri->scheme);
-
-    if (p) {
-        *transport = g_strdup(p + 1);
-
-        p = *transport;
-        while (*p) {
-            *p = g_ascii_tolower(*p);
-            p++;
-        }
-    }
-
-    return 0;
-}
 
 
 static int
diff --git a/src/remote/remote_sockets.c b/src/remote/remote_sockets.c
index 0662cbad14..976124d0ed 100644
--- a/src/remote/remote_sockets.c
+++ b/src/remote/remote_sockets.c
@@ -37,3 +37,31 @@ VIR_ENUM_IMPL(remoteDriverMode,
               "auto",
               "legacy",
               "direct");
+
+
+int
+remoteSplitURIScheme(virURIPtr uri,
+                     char **driver,
+                     char **transport)
+{
+    char *p = strchr(uri->scheme, '+');
+
+    *driver = *transport = NULL;
+
+    if (p)
+        *driver = g_strndup(uri->scheme, p - uri->scheme);
+    else
+        *driver = g_strdup(uri->scheme);
+
+    if (p) {
+        *transport = g_strdup(p + 1);
+
+        p = *transport;
+        while (*p) {
+            *p = g_ascii_tolower(*p);
+            p++;
+        }
+    }
+
+    return 0;
+}
diff --git a/src/remote/remote_sockets.h b/src/remote/remote_sockets.h
index 1d4ae3f9c1..bef3cdada9 100644
--- a/src/remote/remote_sockets.h
+++ b/src/remote/remote_sockets.h
@@ -21,6 +21,7 @@
 #pragma once
 
 #include "virenum.h"
+#include "viruri.h"
 
 typedef enum {
     REMOTE_DRIVER_TRANSPORT_TLS,
@@ -48,3 +49,8 @@ typedef enum {
 } remoteDriverMode;
 
 VIR_ENUM_DECL(remoteDriverMode);
+
+int
+remoteSplitURIScheme(virURIPtr uri,
+                     char **driver,
+                     char **transport);
-- 
2.26.2


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