From f23bf5b4627ebb2fe8c1abd0d5be9a1cf9da9933 Mon Sep 17 00:00:00 2001 From: Lucas Pluvinage Date: Tue, 4 Jun 2019 14:18:26 +0200 Subject: [PATCH 1/4] reflect mirage-xen api change --- lib/blkback.ml | 4 +++- lib/blkfront.ml | 4 +++- lib/blkproto.ml | 8 +++++--- lib/blkproto.mli | 2 +- lib/dune | 2 +- 5 files changed, 13 insertions(+), 7 deletions(-) diff --git a/lib/blkback.ml b/lib/blkback.ml index 5a5085d..7bff30f 100644 --- a/lib/blkback.ml +++ b/lib/blkback.ml @@ -43,6 +43,8 @@ end open Lwt open Blkproto + +module OS = Os_xen module Gntref = OS.Xen.Gntref type ops = { @@ -305,7 +307,7 @@ let init xe domid ring_info ops = on_cancel th (fun () -> let counter = ref 0 in Ring.Rpc.Back.ack_requests ring (fun _ -> incr counter); - if !counter <> 0 then Log.err (fun f-> f "FATAL: before unmapping, there were %d outstanding requests on the ring. Events lost?" !(counter)); + if !counter <> 0 then Log.err (fun f-> f "FATAL: before unmapping, there were %d outstanding requests on the ring. Events lOSt?" !(counter)); let () = OS.Xen.Import.Local_mapping.unmap_exn mapping in () ); th, stats diff --git a/lib/blkfront.ml b/lib/blkfront.ml index 3141d64..e514e16 100644 --- a/lib/blkfront.ml +++ b/lib/blkfront.ml @@ -19,7 +19,9 @@ open Lwt open Printf open Mirage_block open Blkproto -open OS +open Os_xen + +module OS = Os_xen let src = Logs.Src.create "blkfront" ~doc:"Mirage Xen blkfront" diff --git a/lib/blkproto.ml b/lib/blkproto.ml index 055afd4..7dd5c89 100644 --- a/lib/blkproto.ml +++ b/lib/blkproto.ml @@ -15,6 +15,8 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. *) +module OS = Os_xen + let ( >>= ) x f = match x with | Error _ as y -> y | Ok x -> f x @@ -277,9 +279,9 @@ module Req = struct val get_hdr_indirect_op: Cstruct.t -> int val set_hdr_indirect_op: Cstruct.t -> int -> unit end - module type PROTOCOL_IMPLEMENTATION = sig - val total_size : int - val segments_per_indirect_page : int + module type PROTOCOL_IMPLEMENTATION = sig + val total_size : int + val segments_per_indirect_page : int val write_segments : seg array -> Cstruct.t -> unit val write_request : t -> Cstruct.t -> int64 val read_request : Cstruct.t -> t diff --git a/lib/blkproto.mli b/lib/blkproto.mli index bd823e2..e2a6fdf 100644 --- a/lib/blkproto.mli +++ b/lib/blkproto.mli @@ -57,7 +57,7 @@ end module Req : sig type seg = { - gref : OS.Xen.Gntref.t; + gref : Os_xen.Xen.Gntref.t; first_sector : int; last_sector : int; } diff --git a/lib/dune b/lib/dune index 2ecc702..f20113c 100644 --- a/lib/dune +++ b/lib/dune @@ -2,7 +2,7 @@ (name mirage_block_xen) (public_name mirage-block-xen) (modules Blkproto Device_number) - (libraries cstruct io-page mirage-xen) + (libraries cstruct io-page mirage-xen.internals) (wrapped false) (preprocess (pps ppx_cstruct))) From 92f58ff5f2b44f098099ba38d7a6328e56af5cac Mon Sep 17 00:00:00 2001 From: Anil Madhavapeddy Date: Mon, 17 Jun 2019 21:14:30 +0100 Subject: [PATCH 2/4] move modules into seperate directories this allows merlin file generation to be accurate since it does not support mixing ppx/non-ppx in same dir --- CHANGES.md | 3 +++ lib/{ => back}/blkback.ml | 0 lib/{ => back}/block_request.ml | 0 lib/back/dune | 8 ++++++++ lib/{ => core}/blkproto.ml | 0 lib/{ => core}/blkproto.mli | 0 lib/{ => core}/device_number.ml | 0 lib/{ => core}/device_number.mli | 0 lib/core/dune | 8 ++++++++ lib/dune | 26 -------------------------- lib/{ => front}/blkfront.ml | 0 lib/{ => front}/blkfront.mli | 0 lib/{ => front}/block.ml | 0 lib/front/dune | 8 ++++++++ 14 files changed, 27 insertions(+), 26 deletions(-) rename lib/{ => back}/blkback.ml (100%) rename lib/{ => back}/block_request.ml (100%) create mode 100644 lib/back/dune rename lib/{ => core}/blkproto.ml (100%) rename lib/{ => core}/blkproto.mli (100%) rename lib/{ => core}/device_number.ml (100%) rename lib/{ => core}/device_number.mli (100%) create mode 100644 lib/core/dune delete mode 100644 lib/dune rename lib/{ => front}/blkfront.ml (100%) rename lib/{ => front}/blkfront.mli (100%) rename lib/{ => front}/block.ml (100%) create mode 100644 lib/front/dune diff --git a/CHANGES.md b/CHANGES.md index 8b9233d..cbba62b 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,6 @@ +## 1.6.2 +* generate exact Merlin files by rearranging build (@avsm) + ## 1.6.1 (2019-04-02): * use new grant API from mirage-xen (@yomimono, @talex5) * several code cleanups and removals (@yomimono, @emillon) diff --git a/lib/blkback.ml b/lib/back/blkback.ml similarity index 100% rename from lib/blkback.ml rename to lib/back/blkback.ml diff --git a/lib/block_request.ml b/lib/back/block_request.ml similarity index 100% rename from lib/block_request.ml rename to lib/back/block_request.ml diff --git a/lib/back/dune b/lib/back/dune new file mode 100644 index 0000000..cb269c9 --- /dev/null +++ b/lib/back/dune @@ -0,0 +1,8 @@ +(library + (name mirage_block_xen_back) + (public_name mirage-block-xen.back) + (modules Blkback Block_request) + (libraries logs lwt cstruct io-page shared-memory-ring + shared-memory-ring-lwt mirage-block-xen xen-evtchn xenstore + xenstore.client mirage-block-lwt rresult mirage-xen) + (wrapped false)) diff --git a/lib/blkproto.ml b/lib/core/blkproto.ml similarity index 100% rename from lib/blkproto.ml rename to lib/core/blkproto.ml diff --git a/lib/blkproto.mli b/lib/core/blkproto.mli similarity index 100% rename from lib/blkproto.mli rename to lib/core/blkproto.mli diff --git a/lib/device_number.ml b/lib/core/device_number.ml similarity index 100% rename from lib/device_number.ml rename to lib/core/device_number.ml diff --git a/lib/device_number.mli b/lib/core/device_number.mli similarity index 100% rename from lib/device_number.mli rename to lib/core/device_number.mli diff --git a/lib/core/dune b/lib/core/dune new file mode 100644 index 0000000..a88ac48 --- /dev/null +++ b/lib/core/dune @@ -0,0 +1,8 @@ +(library + (name mirage_block_xen) + (public_name mirage-block-xen) + (modules Blkproto Device_number) + (libraries cstruct io-page mirage-xen.internals) + (wrapped false) + (preprocess + (pps ppx_cstruct))) diff --git a/lib/dune b/lib/dune deleted file mode 100644 index f20113c..0000000 --- a/lib/dune +++ /dev/null @@ -1,26 +0,0 @@ -(library - (name mirage_block_xen) - (public_name mirage-block-xen) - (modules Blkproto Device_number) - (libraries cstruct io-page mirage-xen.internals) - (wrapped false) - (preprocess - (pps ppx_cstruct))) - -(library - (name mirage_block_xen_front) - (public_name mirage-block-xen.front) - (modules Blkfront Block) - (libraries logs stringext lwt cstruct mirage-block-lwt io-page - io-page-xen shared-memory-ring shared-memory-ring-lwt mirage-block-xen - xen-evtchn mirage-xen) - (wrapped false)) - -(library - (name mirage_block_xen_back) - (public_name mirage-block-xen.back) - (modules Blkback Block_request) - (libraries logs lwt cstruct io-page shared-memory-ring - shared-memory-ring-lwt mirage-block-xen xen-evtchn xenstore - xenstore.client mirage-block-lwt rresult mirage-xen) - (wrapped false)) diff --git a/lib/blkfront.ml b/lib/front/blkfront.ml similarity index 100% rename from lib/blkfront.ml rename to lib/front/blkfront.ml diff --git a/lib/blkfront.mli b/lib/front/blkfront.mli similarity index 100% rename from lib/blkfront.mli rename to lib/front/blkfront.mli diff --git a/lib/block.ml b/lib/front/block.ml similarity index 100% rename from lib/block.ml rename to lib/front/block.ml diff --git a/lib/front/dune b/lib/front/dune new file mode 100644 index 0000000..5aa0641 --- /dev/null +++ b/lib/front/dune @@ -0,0 +1,8 @@ +(library + (name mirage_block_xen_front) + (public_name mirage-block-xen.front) + (modules Blkfront Block) + (libraries logs stringext lwt cstruct mirage-block-lwt io-page + io-page-xen shared-memory-ring shared-memory-ring-lwt mirage-block-xen + xen-evtchn mirage-xen) + (wrapped false)) From 01c3dba5b89c8401cdf47113d600263118df4d36 Mon Sep 17 00:00:00 2001 From: Anil Madhavapeddy Date: Mon, 17 Jun 2019 21:17:52 +0100 Subject: [PATCH 3/4] suppress the cstruct 5 deprecation warning for the moment --- lib/back/dune | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/back/dune b/lib/back/dune index cb269c9..18d1830 100644 --- a/lib/back/dune +++ b/lib/back/dune @@ -2,6 +2,7 @@ (name mirage_block_xen_back) (public_name mirage-block-xen.back) (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 xenstore.client mirage-block-lwt rresult mirage-xen) From 712363b985c000788e1059e287028403daff76a4 Mon Sep 17 00:00:00 2001 From: Anil Madhavapeddy Date: Mon, 17 Jun 2019 21:18:39 +0100 Subject: [PATCH 4/4] add pin-depends to opam file --- mirage-block-xen.opam | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mirage-block-xen.opam b/mirage-block-xen.opam index 490c489..98491f3 100644 --- a/mirage-block-xen.opam +++ b/mirage-block-xen.opam @@ -43,3 +43,8 @@ library which enables high-throughput, low-latency data transfers over shared memory on both x86 and ARM architectures, using the standard Xen RPC and event channel semantics. """ + +pin-depends: [ + ["mirage-xen.dev" "git+https://github.com/mirage/mirage-xen"] +] +