From e2ad28bcf8a05359a8d773ff53cdb4c7f9637923 Mon Sep 17 00:00:00 2001 From: Vincent Hanquez Date: Thu, 30 Jul 2009 14:50:20 +0100 Subject: [PATCH] add vfb stuff in the core of xenops. --- xenops/device.ml | 26 ++++++++++++++++++++++++++ xenops/device_common.ml | 6 +++--- xenops/device_common.mli | 2 +- 3 files changed, 30 insertions(+), 4 deletions(-) diff --git a/xenops/device.ml b/xenops/device.ml index 11fef21..fbb2214 100644 --- a/xenops/device.ml +++ b/xenops/device.ml @@ -1039,15 +1039,41 @@ let hard_shutdown ~xs (x: device) = end +module Vfb = struct + +let add ~xc ~xs ~hvm domid = + debug "Device.Vfb.add %d" domid; + + let frontend = { domid = domid; kind = Vfb; devid = 0 } in + let backend = frontend in + let device = { backend = backend; frontend = frontend } in + + let back = [] in + let front = [] in + Generic.add_device ~xs device back front; + () + +let hard_shutdown ~xs (x: device) = + debug "Device.Vfb.hard_shutdown %s" (string_of_device x); + () + +let clean_shutdown ~xs (x: device) = + debug "Device.Vfb.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 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 let can_surprise_remove ~xs (x: device) = Generic.can_surprise_remove ~xs x diff --git a/xenops/device_common.ml b/xenops/device_common.ml index 7baa170..75bdfac 100644 --- a/xenops/device_common.ml +++ b/xenops/device_common.ml @@ -19,7 +19,7 @@ open Stringext open Hashtblext open Pervasiveext -type kind = Vif | Vbd | Tap | Pci +type kind = Vif | Vbd | Tap | Pci | Vfb 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" + | Vif -> "vif" | Vbd -> "vbd" | Tap -> "tap" | Pci -> "pci" | Vfb -> "vfb" let kind_of_string = function - | "vif" -> Vif | "vbd" -> Vbd | "tap" -> Tap | "pci" -> Pci + | "vif" -> Vif | "vbd" -> Vbd | "tap" -> Tap | "pci" -> Pci | "vfb" -> Vfb | x -> raise (Unknown_device_type x) let string_of_endpoint (x: endpoint) = diff --git a/xenops/device_common.mli b/xenops/device_common.mli index ffc438b..1666e50 100644 --- a/xenops/device_common.mli +++ b/xenops/device_common.mli @@ -15,7 +15,7 @@ * GNU Lesser General Public License for more details. *) -type kind = Vif | Vbd | Tap | Pci +type kind = Vif | Vbd | Tap | Pci | Vfb type devid = int -- 2.39.5