MirageOS filesystem passthrough driver for Unix
Module FS_unix
include V1.FS with type +'a io = 'a Lwt.t and type page_aligned_buffer = Cstruct.t
type block_device_error

The type for errors from the block layer

type error = [
| `Not_a_directory of string(*

Cannot create a directory entry in a file

| `Is_a_directory of string(*

Cannot read or write the contents of a directory

| `Directory_not_empty of string(*

Cannot remove a non-empty directory

| `No_directory_entry of string * string(*

Cannot find a directory entry

| `File_already_exists of string(*

Cannot create a file with a duplicate name

| `No_space(*

No space left on the block device

| `Format_not_recognised of string(*

The block device appears to not be formatted

| `Unknown_error of string
| `Block_device of block_device_error

The type for filesystem errors.

include V1.DEVICE with type error := error with type +'a io = 'a Lwt.t
type +'a io = 'a Lwt.t

The type for potentially blocking I/O operation

type t

The type representing the internal state of the device

type id

This type is no longer used and will be removed once other * modules stop using it in their type signatures.

val disconnect : t -> unit io

Disconnect from the device. While this might take some time to complete, it can never result in an error.

type page_aligned_buffer = Cstruct.t

The type for memory buffers.

val read : t -> string -> int -> int -> [ `Ok of page_aligned_buffer list | `Error of error ] io

read t key offset length reads up to length bytes from the value associated with key. If less data is returned than requested, this indicates the end of the value.

val size : t -> string -> [ `Error of error | `Ok of int64 ] io

Get the value size.

type stat = {
filename : string;(*

Filename within the enclosing directory

read_only : bool;(*

True means the contents are read-only

directory : bool;(*

True means the entity is a directory; false means a file

size : int64;(*

Size of the entity in bytes


The type for Per-file/directory statistics.

val format : t -> int64 -> [ `Ok of unit | `Error of error ] io

format t size erases the contents of t and creates an empty filesystem of size size bytes.

val create : t -> string -> [ `Ok of unit | `Error of error ] io

create t path creates an empty file at path. If path contains directories that do not yet exist, create will attempt to create them.

val mkdir : t -> string -> [ `Ok of unit | `Error of error ] io

mkdir t path creates an empty directory at path. If path contains intermediate directories that do not yet exist, mkdir will create them. If a directory already exists at path, mkdir returns `Ok () and takes no action.

val destroy : t -> string -> [ `Ok of unit | `Error of error ] io

destroy t path removes a path (which may be a file or an empty directory) on filesystem t.

val stat : t -> string -> [ `Ok of stat | `Error of error ] io

stat t path returns information about file or directory at path.

val listdir : t -> string -> [ `Ok of string list | `Error of error ] io

listdir t path returns the names of files and subdirectories within the directory path.

val write : t -> string -> int -> page_aligned_buffer -> [ `Ok of unit | `Error of error ] io

write t path offset data writes data at offset in file path on filesystem t.

If path contains directories that do not exist, write will attempt to create them. If path already exists, write will overwrite existing information starting at off.

val string_of_error : error -> string

Pretty print errors.

val connect : string -> [ `Ok of t | `Error of error ] io