package fat-filesystem

  1. Overview
  2. Docs

Module Fat.MakeSource

Parameters

module B : Mirage_block.S

Signature

Sourcetype error = [
  1. | `Is_a_directory
  2. | `No_directory_entry
  3. | `Not_a_directory
  4. | `Block_read of B.error
]
Sourceval pp_error : error Fmt.t

pp_error is the pretty-printer for errors.

Sourcetype write_error = [
  1. | error
  2. | `Is_a_directory
  3. | `No_directory_entry
  4. | `Not_a_directory
  5. | `File_already_exists
  6. | `No_directory_entry
  7. | `No_space
  8. | `Directory_not_empty
  9. | `Block_write of B.write_error
  10. | `Exn of exn
]
Sourceval pp_write_error : write_error Fmt.t

pp_write_error is the pretty-printer for write errors.

Sourcetype t

The type representing the internal state of the device

Sourceval disconnect : t -> unit Lwt.t

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

Sourceval connect : B.t -> t Lwt.t
Sourceval format : B.t -> int64 -> (t, write_error) result Lwt.t
Sourceval 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.

Sourceval size : t -> string -> (int64, error) result Lwt.t

Get the value size.

Sourceval 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.

Sourceval 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.

Sourceval 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.

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

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

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

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

Sourceval 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.