[PATCH shared-cd v1 3/9] Add --spice-share-cd command line option

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

 



From: Alexander Nezhinsky <anezhins@xxxxxxxxxx>

Signed-off-by: Alexander Nezhinsky <anezhins@xxxxxxxxxx>
---
 src/spice-option.c | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/src/spice-option.c b/src/spice-option.c
index 8c4e707..6237bc9 100644
--- a/src/spice-option.c
+++ b/src/spice-option.c
@@ -39,6 +39,7 @@ static gint cache_size = 0;
 static gint glz_window_size = 0;
 static gchar *secure_channels = NULL;
 static gchar *shared_dir = NULL;
+static gchar **cd_share_files = NULL;
 static SpiceImageCompression preferred_compression = SPICE_IMAGE_COMPRESSION_INVALID;
 
 G_GNUC_NORETURN
@@ -183,6 +184,8 @@ GOptionGroup* spice_get_option_group(void)
           N_("Filter selecting USB devices to be auto-redirected when plugged in"), N_("<filter-string>") },
         { "spice-usbredir-redirect-on-connect", '\0', 0, G_OPTION_ARG_STRING, &usbredir_redirect_on_connect,
           N_("Filter selecting USB devices to redirect on connect"), N_("<filter-string>") },
+        { "spice-share-cd", '\0', 0, G_OPTION_ARG_STRING_ARRAY, &cd_share_files,
+          N_("Name of ISO file or CD/DVD device to share"), N_("<filename> (repeat allowed)") },
         { "spice-cache-size", '\0', 0, G_OPTION_ARG_INT, &cache_size,
           N_("Image cache size (deprecated)"), N_("<bytes>") },
         { "spice-glz-window-size", '\0', 0, G_OPTION_ARG_INT, &glz_window_size,
@@ -288,6 +291,31 @@ void spice_set_session_option(SpiceSession *session)
                          usbredir_redirect_on_connect, NULL);
         }
     }
+    if (cd_share_files) {
+        SpiceUsbDeviceManager *m =
+                get_usb_device_manager_for_option(session, "--spice-share-cd");
+        if (m) {
+            gchar **name = cd_share_files;
+            GError *err = NULL;
+            gboolean rc;
+
+            while (name && *name) {
+                rc = spice_usb_device_manager_create_shared_cd_device(m, *name, &err);
+                if (!rc) {
+                    if (err == NULL) {
+                        g_warning("Failed to create shared CD device %s", *name);
+                    } else {
+                        g_warning("Failed to create shared CD device %s: %s",
+                                  *name, err->message);
+                        g_clear_error(&err);
+                    }
+                }
+                name++;
+            }
+        }
+        g_strfreev(cd_share_files);
+        cd_share_files = NULL;
+    }
     if (disable_usbredir)
         g_object_set(session, "enable-usbredir", FALSE, NULL);
     if (disable_audio)
-- 
2.20.1

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux Virtualization]     [Linux Virtualization]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]