]> xenbits.xen.org Git - xenclient/ioemu-pq.git/commitdiff
Allow the vms to write into /local/domain/0/dom0_driver/command
authorJean Guyader <jean.guyader@eu.citrix.com>
Fri, 4 Sep 2009 15:16:18 +0000 (16:16 +0100)
committerJean Guyader <jean.guyader@eu.citrix.com>
Fri, 4 Sep 2009 15:16:18 +0000 (16:16 +0100)
master/dom0-driver

index 2cb68951937071c35d197e9c43b884a6d8b65748..c30d3a56a380ea4311058f096c1c1fb041f44711 100644 (file)
@@ -24,10 +24,10 @@ index 14b42f3..97214c0 100644
  #endif
 diff --git a/dom0_driver.c b/dom0_driver.c
 new file mode 100644
-index 0000000..fdd24ab
+index 0000000..05f7cc4
 --- /dev/null
 +++ b/dom0_driver.c
-@@ -0,0 +1,697 @@
+@@ -0,0 +1,705 @@
 +/*
 + * QEMU dom0_driver
 + *
@@ -423,14 +423,10 @@ index 0000000..fdd24ab
 +    natif_domid = dom0_driver_xs_read_dom0("natif");
 +
 +    dom0_driver_read_xs_info(&mouse, DOM0_MOUSE);
-+    if (mouse.domid != natif_domid)
-+    {
-+      DEBUG("Natif should have the focus for that.\n");
-+      return;
-+    }
-+
 +    for (i = 0; i < NB_SLOTS; ++i)
 +    {
++        if (!strcmp("switch", str) && positions[i] == domid)
++            break;
 +      if (!strcmp("take", str) && positions[i] == domid)
 +          break;
 +      if (!strcmp("release", str) && positions[i] == natif_domid)
@@ -443,7 +439,18 @@ index 0000000..fdd24ab
 +      return;
 +    }
 +
-+    sprintf(buff, "keyboard %d", i);
++    if (!strcmp("switch", str))
++        sprintf(buff, "switch %d", i);
++    else
++    {
++        if (mouse.domid != natif_domid)
++        {
++            DEBUG("Natif should have the focus for that.\n");
++            return;
++        }
++        sprintf(buff, "keyboard %d", i);
++    }
++
 +    DEBUG("Write \"%s\" into xenstore\n", buff);
 +    xenstore_write_dom0_driver("command", buff);
 +    free(str);
@@ -475,13 +482,14 @@ index 0000000..fdd24ab
 +      xenstore_write_dom0_driver("natif", str);
 +      xenstore_dom_chmod(0, "dom0_driver/natif", "r0");
 +      xenstore_watch_dom0_driver("command", dom0_driver_command, NULL);
-+    }
++      xenstore_dom_chmod(0, "dom0_driver/command", "w0");
++    } 
 +    else
 +    {
-+      xenstore_dom_write(domid, "dom0_input/command", "");
-+      sprintf(str, "w%d", domid);
-+      xenstore_dom_chmod(domid, "dom0_input/command", str);
-+      xenstore_dom_watch(domid, "dom0_input/command", dom0_driver_dom_command, NULL);
++        xenstore_dom_write(domid, "dom0_input/command", "");
++        sprintf(str, "w%d", domid);
++        xenstore_dom_chmod(domid, "dom0_input/command", str);
++        xenstore_dom_watch(domid, "dom0_input/command", dom0_driver_dom_command, NULL);
 +    }
 +
 +    xenstore_watch_dom0_driver("mouse/state", dom0_driver_state_change, NULL);
@@ -1259,10 +1267,10 @@ index 0000000..59dfec8
 +    }
 +}
 diff --git a/qemu-xen.h b/qemu-xen.h
-index 0cc5dd8..2646ec7 100644
+index 7883718..afe8f22 100644
 --- a/qemu-xen.h
 +++ b/qemu-xen.h
-@@ -107,7 +107,13 @@ int xenstore_write(const char *path, const char *val);
+@@ -109,7 +109,13 @@ int xenstore_write(const char *path, const char *val);
  
  void xenstore_dm_finished_startup(void);
  
@@ -1278,7 +1286,7 @@ index 0cc5dd8..2646ec7 100644
    * not be trusted by qemu code.  For variables containing xenstore
    * paths, `danger' can mean that both the path refers to a
 diff --git a/vl.c b/vl.c
-index e519705..0ffe1ec 100644
+index 6d79072..adfa4f6 100644
 --- a/vl.c
 +++ b/vl.c
 @@ -234,6 +234,7 @@ CharDriverState *virtcon_hds[MAX_VIRTIO_CONSOLES];
@@ -1310,7 +1318,7 @@ index e519705..0ffe1ec 100644
  /***********************************************************/
  /* x86 ISA bus support */
  
-@@ -4277,6 +4292,7 @@ enum {
+@@ -4289,6 +4304,7 @@ enum {
      QEMU_OPTION_acpi,
      QEMU_OPTION_vcpus,
      QEMU_OPTION_vga_passthrough,
@@ -1318,7 +1326,7 @@ index e519705..0ffe1ec 100644
  
      /* Debug/Expert options: */
      QEMU_OPTION_serial,
-@@ -4451,6 +4467,7 @@ static const QEMUOption qemu_options[] = {
+@@ -4463,6 +4479,7 @@ static const QEMUOption qemu_options[] = {
      { "vncunused", 0, QEMU_OPTION_vncunused },
      { "vcpus", HAS_ARG, QEMU_OPTION_vcpus },
      { "vga-passthrough", 0, QEMU_OPTION_vga_passthrough },
@@ -1326,7 +1334,7 @@ index e519705..0ffe1ec 100644
  #if defined(CONFIG_XEN) && !defined(CONFIG_DM)
      { "xen-domid", HAS_ARG, QEMU_OPTION_xen_domid },
      { "xen-create", 0, QEMU_OPTION_xen_create },
-@@ -5287,6 +5304,9 @@ int main(int argc, char **argv, char **envp)
+@@ -5299,6 +5316,9 @@ int main(int argc, char **argv, char **envp)
              case QEMU_OPTION_vga_passthrough:
                  vga_passthrough = 1;
                  break;
@@ -1336,7 +1344,7 @@ index e519705..0ffe1ec 100644
              case QEMU_OPTION_direct_pci:
                 direct_pci = optarg;
                  break;
-@@ -6053,6 +6073,9 @@ int main(int argc, char **argv, char **envp)
+@@ -6067,6 +6087,9 @@ int main(int argc, char **argv, char **envp)
          close(fd);
      }
  
@@ -1345,9 +1353,9 @@ index e519705..0ffe1ec 100644
 +
      xenstore_dm_finished_startup();
  
-     main_loop();
+ #ifndef CONFIG_STUBDOM
 diff --git a/xen-hooks.mak b/xen-hooks.mak
-index d171928..15ba4d1 100644
+index 799f80d..c0212a2 100644
 --- a/xen-hooks.mak
 +++ b/xen-hooks.mak
 @@ -37,6 +37,8 @@ OBJS += helper2.o
@@ -1360,10 +1368,10 @@ index d171928..15ba4d1 100644
  CONFIG_AUDIO=1
  
 diff --git a/xenstore.c b/xenstore.c
-index 01afcf0..20ca8cf 100644
+index 3cd2ba6..17136a3 100644
 --- a/xenstore.c
 +++ b/xenstore.c
-@@ -1727,3 +1727,63 @@ void xenstore_dm_finished_startup(void)
+@@ -1741,3 +1741,63 @@ void xenstore_dm_finished_startup(void)
      free(buf);
      free(path);
  }