package mirage-types
FS
A filesystem module.
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
]
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.
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
*)
}
Per-file/directory statistics
format t size
erases the contents of t
and creates an empty filesystem of size size
bytes
create t path
creates an empty file at path
mkdir t path
creates an empty directory at path
destroy t path
removes a path
(which may be a file or an empty directory) on filesystem t
stat t path
returns information about file or directory at path
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