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.4.tbz
sha256=5ba75345c584ecc52b2da95bf50e87da15aad2cded67d2809fe621becb51fc20
sha512=edefaec72ba38d9af26423af5aa3104b5553df4fed458a8baf0084d807de3540a302a3c9534abda3f40277e62d9008187e7600d6493a77e95e51d349b38f3aaa
Dependencies
Reverse Dependencies