mirage/mirage-block-ramdisk

Name: mirage-block-ramdisk

Owner: MirageOS

Description: A simple in-memory BLOCK device

Created: 2015-11-03 12:06:51.0

Updated: 2016-11-28 19:01:59.0

Pushed: 2017-11-25 03:31:17.0

Homepage: null

Size: 33

Language: OCaml

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

mirage-block-ramdisk

A simple in-memory BLOCK device.

Please see the API documentation.

Features
Example usage

In a top-level like utop:

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

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

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

t page = Io_page.(to_cstruct (get 1));;
page : Ramdisk.page_aligned_buffer =
struct.buffer = <abstr>; off = 0; len = 4096}

t result_or_error = Ramdisk.read t 0L [ page ];;
result_or_error : [ `Error of Ramdisk.error | `Ok of unit ] = `Ok ()

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.