Module Qcow_header

module Version : sig ... end
module CryptMethod : sig ... end
module Feature : sig ... end
type offset = int64

Offset within the image

type extension = [
| `Unknown of int32 * string
| `Backing_file of string
| `Feature_name_table of Feature.t list
]
val sexp_of_extension : extension -> Ppx_sexp_conv_lib.Sexp.t
val extension_of_sexp : Ppx_sexp_conv_lib.Sexp.t -> extension
val __extension_of_sexp__ : Ppx_sexp_conv_lib.Sexp.t -> extension
type additional = {
dirty : bool;
corrupt : bool;
lazy_refcounts : bool;
autoclear_features : int64;
refcount_order : int32;
}

Version 3 and above have additional header fields

val sexp_of_additional : additional -> Ppx_sexp_conv_lib.Sexp.t
val additional_of_sexp : Ppx_sexp_conv_lib.Sexp.t -> additional
type t = {
version : Version.t;
backing_file_offset : offset;

offset of the backing file path

backing_file_size : int32;

length of the backing file path

cluster_bits : int32;

a cluster is 2 ** cluster_bits in size

size : int64;

virtual size of the image

crypt_method : CryptMethod.t;
l1_size : int32;

number of 8-byte entries in the L1 table

l1_table_offset : Qcow_physical.t;

offset of the L1 table

refcount_table_offset : Qcow_physical.t;

offset of the refcount table

refcount_table_clusters : int32;

size of the refcount table in clusters

nb_snapshots : int32;

the number of internal snapshots

snapshots_offset : offset;

offset of the snapshot header

additional : additional option;

for version 3 or higher

extensions : extension list;

for version 3 or higher

}

The qcow2 header

include Ppx_sexp_conv_lib.Sexpable.S with type Qcow_header.t := t
val t_of_sexp : Sexplib0.Sexp.t -> t
val sexp_of_t : t -> Sexplib0.Sexp.t
val refcounts_per_cluster : t -> int64

The number of 16-bit reference counts per cluster

val max_refcount_table_size : t -> int64

Compute the maximum size of the refcount table

val l2_tables_required : cluster_bits:int -> int64 -> int64

Compute the number of L2 tables required for this size of image

include Qcow_s.SERIALISABLE with type t := t
type t

Instances of this type can be read and written

val sizeof : t -> int

The size of a buffer needed to hold t

val read : Cstruct.t -> (t * Cstruct.t, [ `Msg of string ]) Result.result

Read a t from the given buffer and return it, along with the unused remainder of the buffer. If the buffer cannot be parsed then return an error.

val write : t -> Cstruct.t -> (Cstruct.t, [ `Msg of string ]) Result.result

Write a t into the given buffer. If the buffer is too small, then return an error. Return the unused remainder of the buffer.

include Qcow_s.PRINTABLE with type t := t
type t

Instances of this type can be pretty-printed

val to_string : t -> string

Produce a pretty human-readable string from a value

include Stdlib.Set.OrderedType with type Qcow_header.t := t
val compare : t -> t -> int