package mirage-block-ramdisk

  1. Overview
  2. Docs
In-memory BLOCK device for MirageOS

Install

Dune Dependency

Authors

Maintainers

Sources

mirage-block-ramdisk-0.5.tbz
sha256=cc0e814fd54efe7a5b7a8c5eb1c04e2dece751b7d8dee2d95908a0768896e8af
sha512=2557896713c0d7a833d30b9847e2c545929df40cd04c534fed7a8d0ea25c2cd1075b8ae5ba56e47bdeac5a60a07a222a1780b32cc12ebcb2ce94fdffdcf0657c

Description

  • Can be dynamically resized
  • Supports querying sparseness information

Tags

org:mirage

Published: 11 Jun 2020

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

  1. lwt
  2. mirage-block >= "2.0.0"
  3. io-page
  4. cstruct < "6.1.0"
  5. dune
  6. ocaml >= "4.06.0"

Dev Dependencies (3)

  1. mirage-block-combinators with-test
  2. io-page-unix with-test
  3. alcotest with-test & < "1.4.0"

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.