]> xenbits.xensource.com Git - xenclient/toolstack.git/commitdiff
add Vkb module
authorVincent Hanquez <vincent.hanquez@eu.citrix.com>
Mon, 10 Aug 2009 13:48:31 +0000 (14:48 +0100)
committerVincent Hanquez <vincent.hanquez@eu.citrix.com>
Tue, 11 Aug 2009 12:45:29 +0000 (13:45 +0100)
xenops/device.ml
xenops/device.mli
xenops/device_common.ml
xenops/device_common.mli
xenops/hotplug.ml

index a70cd83b6e3c5c40f2ec92698367fb4cb8e07000..4daea8ac520be75daa0bd54037af7f98e512ac13 100644 (file)
@@ -1071,17 +1071,51 @@ let clean_shutdown ~xs (x: device) =
 
 end
 
+module Vkb = struct
+
+let add ~xc ~xs ~hvm ?(protocol=Protocol_Native) domid =
+       debug "Device.Vkb.add %d" domid;
+
+       let frontend = { domid = domid; kind = Vkb; devid = 0 } in
+       let backend = { domid = 0; kind = Vkb; devid = 0 } in
+       let device = { backend = backend; frontend = frontend } in
+
+       let back = [
+               "frontend-id", sprintf "%u" domid;
+               "online", "1";
+               "state", string_of_int (Xenbus.int_of Xenbus.Initialising);
+       ] in
+       let front = [
+               "backend-id", string_of_int 0;
+               "protocol", (string_of_protocol protocol);
+               "state", string_of_int (Xenbus.int_of Xenbus.Initialising);
+       ] in
+       Generic.add_device ~xs device back front;
+       ()
+
+let hard_shutdown ~xs (x: device) =
+       debug "Device.Vkb.hard_shutdown %s" (string_of_device x);
+       ()
+
+let clean_shutdown ~xs (x: device) =
+       debug "Device.Vkb.clean_shutdown %s" (string_of_device x);
+       ()
+
+end
+
 let hard_shutdown ~xs (x: device) = match x.backend.kind with
   | Vif -> Vif.hard_shutdown ~xs x
   | Vbd | Tap -> Vbd.hard_shutdown ~xs x
   | Pci -> PCI.hard_shutdown ~xs x
   | Vfb -> Vfb.hard_shutdown ~xs x
+  | Vkb -> Vkb.hard_shutdown ~xs x
 
 let clean_shutdown ~xs (x: device) = match x.backend.kind with
   | Vif -> Vif.clean_shutdown ~xs x
   | Vbd | Tap -> Vbd.clean_shutdown ~xs x
   | Pci -> PCI.clean_shutdown ~xs x
   | Vfb -> Vfb.clean_shutdown ~xs x
+  | Vkb -> Vkb.clean_shutdown ~xs x
 
 let can_surprise_remove ~xs (x: device) = Generic.can_surprise_remove ~xs x
 
index 4397689cdad6b89f5ad4d2c8367eff3dfdbe880c..55a308af44988dd0fef464d7fd6983a414e81a7f 100644 (file)
@@ -142,6 +142,11 @@ sig
        val add : xc:Xc.handle -> xs:Xs.xsh -> hvm:bool -> ?protocol:protocol -> Xc.domid -> unit
 end
 
+module Vkb :
+sig
+       val add : xc:Xc.handle -> xs:Xs.xsh -> hvm:bool -> ?protocol:protocol -> Xc.domid -> unit
+end
+
 module Dm :
 sig
        type disp_opt =
index 75bdfacb917041903a44ac1ffb558a3173ff08b8..339be0a5c1a43a4aa9688630389156ab30b7a4f4 100644 (file)
@@ -19,7 +19,7 @@ open Stringext
 open Hashtblext
 open Pervasiveext
 
-type kind = Vif | Vbd | Tap | Pci | Vfb
+type kind = Vif | Vbd | Tap | Pci | Vfb | Vkb
 
 type devid = int
 (** Represents one end of a device *)
@@ -46,9 +46,9 @@ open D
 open Printf
 
 let string_of_kind = function
-  | Vif -> "vif" | Vbd -> "vbd" | Tap -> "tap" | Pci -> "pci" | Vfb -> "vfb"
+  | Vif -> "vif" | Vbd -> "vbd" | Tap -> "tap" | Pci -> "pci" | Vfb -> "vfb" | Vkb -> "vkb"
 let kind_of_string = function
-  | "vif" -> Vif | "vbd" -> Vbd | "tap" -> Tap | "pci" -> Pci | "vfb" -> Vfb
+  | "vif" -> Vif | "vbd" -> Vbd | "tap" -> Tap | "pci" -> Pci | "vfb" -> Vfb | "vkb" -> Vkb
   | x -> raise (Unknown_device_type x)
 
 let string_of_endpoint (x: endpoint) =
@@ -100,9 +100,8 @@ let device_of_backend (backend: endpoint) (domu: Xc.domid) =
   let frontend = { domid = domu;
                   kind = (match backend.kind with
                           | Vbd | Tap -> Vbd
-                          | Vif -> Vif
-                          | Vfb -> Vfb
-                          | Pci -> Pci);
+                          | _ -> backend.kind
+                         );
                   devid = backend.devid } in
   { backend = backend; frontend = frontend }
 
index 1666e50478528e6cc4a5837dc6fb43f923af50ef..69d17a077dad6f545ed030ab42472ed053a61f34 100644 (file)
@@ -15,7 +15,7 @@
  * GNU Lesser General Public License for more details.
  *)
 
-type kind = Vif | Vbd | Tap | Pci | Vfb
+type kind = Vif | Vbd | Tap | Pci | Vfb | Vkb
 
 type devid = int
 
index af05bfc4c1037d79086971f06d7095f35765e8d5..4b2f97201f2f1f77aa002589e55f765c087051aa 100644 (file)
@@ -92,7 +92,7 @@ let device_is_online ~xs (x: device) =
   and backend_request () = try ignore(xs.Xs.read (backend_shutdown_request_path_of_device ~xs x)); true with Xb.Noent -> false in
 
   match x.backend.kind with
-  | Pci | Vfb -> assert false (* PCI/Vfb backend doesn't create online node *)
+  | Pci | Vfb | Vkb -> assert false (* PCI/Vfb backend doesn't create online node *)
   | Vif -> backend_hotplug ()
   | ( Vbd | Tap ) -> 
       if backend_request ()