mirage-block-ramdisk

In-memory BLOCK device for MirageOS
README

A simple in-memory BLOCK device.

Please see the API documentation.

Features

  • Can be dynamically resized

  • Supports querying sparseness information

Example usage

In a top-level like utop:

# #require "io-page.unix";;
# #require "mirage-block";;
# #require "mirage-block-ramdisk";;
# #require "lwt.syntax";;

# lwt t_or_error = Ramdisk.create ~name:"hello" ~size_sectors:1024L ~sector_size:512;;
val t_or_error : [ `Error of Ramdisk.error | `Ok of Ramdisk.t ] = `Ok <abstr>

# let t = Mirage_block.Error.ok_exn t_or_error;;
val t : Ramdisk.t = <abstr>

# let page = Io_page.(to_cstruct (get 1));;
val page : Ramdisk.page_aligned_buffer =
  {Cstruct.buffer = <abstr>; off = 0; len = 4096}

# lwt result_or_error = Ramdisk.read t 0L [ page ];;
val result_or_error : [ `Error of Ramdisk.error | `Ok of unit ] = `Ok ()
Install
Maintainers
Sources
mirage-block-ramdisk-0.5.tbz
sha256=cc0e814fd54efe7a5b7a8c5eb1c04e2dece751b7d8dee2d95908a0768896e8af
sha512=2557896713c0d7a833d30b9847e2c545929df40cd04c534fed7a8d0ea25c2cd1075b8ae5ba56e47bdeac5a60a07a222a1780b32cc12ebcb2ce94fdffdcf0657c
Dependencies
mirage-block
>= "2.0.0"
io-page-unix
with-test
cstruct
< "6.1.0"
alcotest
with-test & < "1.4.0"
ocaml
>= "4.06.0"
Reverse Dependencies