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
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 *)
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) =
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 }
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 ()