Module From_file.Vhd_IO

val openchain : ?path:string list -> string -> bool -> F.fd Vhd.t F.t

openchain ?path filename reads the vhd metadata from filename (and other files on the path from filename to the root of the tree). If filename or any of the parent locators have relative paths, then they will be searched for on the ?path.

val openfile : string -> bool -> F.fd Vhd.t F.t

openfile filename reads the vhd metadata from filename, but not any other files on the path to the root of the tree.

val close : F.fd Vhd.t -> unit F.t

close t frees all resources associated with t

val create_dynamic : filename:string -> size:int64 -> ?uuid:Uuidm.t -> ?saved_state:bool -> ?features:Feature.t list -> unit -> F.fd Vhd.t F.t

create_dynamic ~filename ~size creates an empty dynamic vhd with virtual size size bytes and filename filename.

val create_difference : filename:string -> parent:F.fd Vhd.t -> ?relative_path:bool -> ?uuid:Uuidm.t -> ?saved_state:bool -> ?features:Feature.t list -> unit -> F.fd Vhd.t F.t

create_difference ~filename ~parent creates an empty differencing vhd with filename filename backed by parent parent.

val get_sector_location : F.fd Vhd.t -> int64 -> (F.fd Vhd.t * int64) option F.t

get_sector_location t sector returns Some (t', sector') if the sector in the virtual disk resides in physical sector' in the vhd t' (where t' may be any vhd on the path from t to the root of the tree. If no sector is present, this returns None.

val read_sector : F.fd Vhd.t -> int64 -> Cstruct.t -> bool F.t

read_sector t sector buffer: if any data exists at sector in the virtual disk, reads it into buffer and returns true. If no data exists (i.e. the data should be interpreted as zeros) the function returns false but does not write into buffer.

val write : F.fd Vhd.t -> int64 -> Cstruct.t list -> unit F.t

write t sector data writes data at sector in t and updates all file metadata to preserve consistency.