package mirage-block-ramdisk

  1. Overview
  2. Docs
In-memory block device ("Ramdisk") for Mirage

Install

Dune Dependency

Authors

Maintainers

Sources

v0.3.tar.gz
sha256=d3131b4860f6f7d93cffaf58ae9a182ca68b21958c285cc0710d9d4d6e1e52aa
md5=ab0127760d2e3a2103cd2b3d5089b5e5

Description

This is an implementation of the Mirage V1_LWT.BLOCK signature backed by an in-heap Map. This library supports

  • read/write
  • dynamic resize (i.e. device truncation and extension)
  • sparseness querying

Tags

org:mirage

Published: 23 Feb 2017

README

mirage-block-ramdisk

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 ()

Dependencies (9)

  1. lwt
  2. mirage-block-lwt >= "1.0.0"
  3. io-page < "2.0.0"
  4. cstruct
  5. base-bytes
  6. topkg build
  7. ocamlbuild build
  8. ocamlfind build
  9. ocaml >= "4.03.0"

Dev Dependencies (1)

  1. alcotest with-test

Used by (4)

  1. mirage-block < "1.0.0"
  2. qcow != "0.10.0"
  3. qcow-format
  4. qcow-tool

Conflicts

None

OCaml

Innovation. Community. Security.