mirage-fs-unix

Passthrough filesystem for MirageOS on Unix
Legend:
Library
Module
Module type
Parameter
Class
Class type
Library mirage-fs-unix
Module FS_unix
type fs_error = [
| `Unix_error of Unix.error
| `Unix_errorno of int
| `Negative_bytes
]
type error = [
| Mirage_fs.error
| fs_error
]
type write_error = [
| Mirage_fs.write_error
| fs_error
| `Directory_not_empty
]
include Mirage_fs.S with type error := error and type write_error := write_error
type error#row

The type for errors.

val pp_error : error Fmt.t

pp_error is the pretty-printer for errors.

type write_error#row

The type for FS write errors.

val pp_write_error : write_error Fmt.t

pp_write_error is the pretty-printer for write errors.

type t

The type representing the internal state of the file system.

val disconnect : t -> unit Lwt.t

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

val read : t -> string -> int -> int -> ( Cstruct.t list, error ) result Lwt.t

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 -> ( int64, error ) result Lwt.t

Get the value size.

val create : t -> string -> ( unit, write_error ) result Lwt.t

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 -> ( unit, write_error ) result Lwt.t

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 -> ( unit, write_error ) result Lwt.t

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

val stat : t -> string -> ( Mirage_fs.stat, error ) result Lwt.t

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

val listdir : t -> string -> ( string list, error ) result Lwt.t

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

val write : t -> string -> int -> Cstruct.t -> ( unit, write_error ) result Lwt.t

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 connect : string -> t Lwt.t