Skip to content

Commit

Permalink
Update to new Xen core platform stack
Browse files Browse the repository at this point in the history
Update mirage-block-xen to the interface changes in the new Xen core
platform stack.

Part of mirage/mirage#1159, depends on mirage/mirage-xen#23.
  • Loading branch information
mato committed Jul 24, 2020
1 parent 3d43d86 commit c6787e3
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 33 deletions.
12 changes: 6 additions & 6 deletions lib/back/blkback.ml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ type event
val program_start: event
(** represents an event which 'fired' when the program started *)

val after: Eventchn.t -> event -> event Lwt.t
val after: OS.Eventchn.t -> event -> event Lwt.t
(** [next channel event] blocks until the system receives an event
newer than [event] on channel [channel]. If an event is received
while we aren't looking then this will be remembered and the
Expand Down Expand Up @@ -61,8 +61,8 @@ type stats = {

type ('a, 'b) t = {
domid: int;
xe: Eventchn.handle;
evtchn: Eventchn.t;
xe: OS.Eventchn.handle;
evtchn: OS.Eventchn.t;
ring: ('a, 'b) Ring.Rpc.Back.t;
ops : ops;
parse_req : Cstruct.t -> Req.t;
Expand Down Expand Up @@ -271,7 +271,7 @@ let service_thread t stats =
maybe_unmap indirect_grants_mapping;
(* Make the responses visible to the frontend *)
let notify = Ring.Rpc.Back.push_responses_and_check_notify t.ring in
if notify then Eventchn.notify t.xe t.evtchn;
if notify then OS.Eventchn.notify t.xe t.evtchn;
return () in
let open Lwt.Infix in
A.after t.evtchn after
Expand All @@ -280,7 +280,7 @@ let service_thread t stats =
loop_forever A.program_start

let init xe domid ring_info ops =
let evtchn = Eventchn.bind_interdomain xe domid ring_info.RingInfo.event_channel in
let evtchn = OS.Eventchn.bind_interdomain xe domid ring_info.RingInfo.event_channel in
let parse_req, idx_size = match ring_info.RingInfo.protocol with
| Protocol.X86_64 -> Req.Proto_64.read_request, Req.Proto_64.total_size
| Protocol.X86_32 -> Req.Proto_32.read_request, Req.Proto_32.total_size
Expand Down Expand Up @@ -397,7 +397,7 @@ let run ?(max_indirect_segments=256) t name (domid,devid) =
let open Mirage_block in
make ()
>>= fun client ->
let xe = Eventchn.init () in
let xe = OS.Eventchn.init () in

mk_backend_path client name (domid,devid)
>>= fun backend_path ->
Expand Down
2 changes: 1 addition & 1 deletion lib/back/dune
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
(modules Blkback Block_request)
(flags :standard -w -3)
(libraries logs lwt cstruct io-page shared-memory-ring
shared-memory-ring-lwt mirage-block-xen xen-evtchn xenstore
shared-memory-ring-lwt mirage-block-xen xenstore
xenstore.client mirage-block rresult mirage-xen)
(wrapped false))
22 changes: 0 additions & 22 deletions lib/front/blkfront.ml
Original file line number Diff line number Diff line change
Expand Up @@ -299,24 +299,6 @@ let single_request_into op t start_sector ?(start_offset=0) ?(end_offset=7) page
| exn -> fail exn) in
retry ()

let resume t =
let vdev = sprintf "%d" t.vdev in
let open Lwt.Infix in
plug vdev
>>= fun transport ->
let old_t = t.t in
t.t <- transport;
Lwt_ring.Front.shutdown old_t.client;
return ()

let resume () =
let devs = Hashtbl.fold (fun _k v acc -> v::acc) devices [] in
let open Lwt.Infix in
Lwt_list.iter_p (fun v ->
v >>= fun v ->
resume v
) devs

let disconnect t =
let open Lwt.Infix in
let frontend_node = sprintf "device/vbd/%d/%s" t.vdev in
Expand Down Expand Up @@ -504,7 +486,3 @@ let write t start_sector pages =
>>= fun () ->
return (Ok ())
) (fun e -> return (Error (`Exn e)))

let _ =
Log.debug (fun f -> f "Blkfront: add resume hook");
Sched.add_resume_hook resume
4 changes: 2 additions & 2 deletions lib/front/dune
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
(public_name mirage-block-xen.front)
(modules Blkfront Block)
(libraries logs stringext lwt cstruct mirage-block io-page
io-page-xen shared-memory-ring shared-memory-ring-lwt mirage-block-xen
xen-evtchn mirage-xen)
shared-memory-ring shared-memory-ring-lwt mirage-block-xen
mirage-xen)
(wrapped false))
4 changes: 2 additions & 2 deletions mirage-block-xen.opam
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ depends: [
"shared-memory-ring-lwt"
"mirage-block" {>= "2.0.0"}
"ipaddr"
"io-page-xen" {>= "2.0.0"}
"mirage-xen" {>= "5.0.0"}
"io-page" {>= "2.0.0"}
"mirage-xen" {>= "6.0.0"}
"rresult"
]
build: [
Expand Down

0 comments on commit c6787e3

Please sign in to comment.