package qcow-types

  1. Overview
  2. Docs

Module Qcow_headerSource

Sourcemodule Version : sig ... end
Sourcemodule CryptMethod : sig ... end
Sourcemodule Feature : sig ... end
Sourcetype offset = int64

Offset within the image

Sourcetype extension = [
  1. | `Unknown of int32 * string
  2. | `Backing_file of string
  3. | `Feature_name_table of Feature.t list
]
Sourceval sexp_of_extension : extension -> Sexplib0.Sexp.t
Sourceval extension_of_sexp : Sexplib0.Sexp.t -> extension
Sourceval __extension_of_sexp__ : Sexplib0.Sexp.t -> extension
Sourcetype additional = {
  1. dirty : bool;
  2. corrupt : bool;
  3. lazy_refcounts : bool;
  4. autoclear_features : int64;
  5. refcount_order : int32;
}

Version 3 and above have additional header fields

Sourceval sexp_of_additional : additional -> Sexplib0.Sexp.t
Sourceval additional_of_sexp : Sexplib0.Sexp.t -> additional
Sourcetype t = {
  1. version : Version.t;
  2. backing_file_offset : offset;
    (*

    offset of the backing file path

    *)
  3. backing_file_size : int32;
    (*

    length of the backing file path

    *)
  4. cluster_bits : int32;
    (*

    a cluster is 2 ** cluster_bits in size

    *)
  5. size : int64;
    (*

    virtual size of the image

    *)
  6. crypt_method : CryptMethod.t;
  7. l1_size : int32;
    (*

    number of 8-byte entries in the L1 table

    *)
  8. l1_table_offset : Qcow_physical.t;
    (*

    offset of the L1 table

    *)
  9. refcount_table_offset : Qcow_physical.t;
    (*

    offset of the refcount table

    *)
  10. refcount_table_clusters : int32;
    (*

    size of the refcount table in clusters

    *)
  11. nb_snapshots : int32;
    (*

    the number of internal snapshots

    *)
  12. snapshots_offset : offset;
    (*

    offset of the snapshot header

    *)
  13. additional : additional option;
    (*

    for version 3 or higher

    *)
  14. extensions : extension list;
    (*

    for version 3 or higher

    *)
}

The qcow2 header

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

The number of 16-bit reference counts per cluster

Sourceval max_refcount_table_size : t -> int64

Compute the maximum size of the refcount table

Sourceval 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
Sourceval sizeof : t -> int

The size of a buffer needed to hold t

Sourceval read : Cstruct.t -> (t * Cstruct.t, [ `Msg of string ]) 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.

Sourceval write : t -> Cstruct.t -> (Cstruct.t, [ `Msg of string ]) 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
Sourceval to_string : t -> string

Produce a pretty human-readable string from a value

include Set.OrderedType with type t := t
Sourceval compare : t -> t -> int

A total ordering function over the set elements. This is a two-argument function f such that f e1 e2 is zero if the elements e1 and e2 are equal, f e1 e2 is strictly negative if e1 is smaller than e2, and f e1 e2 is strictly positive if e1 is greater than e2. Example: a suitable ordering function is the generic structural comparison function Stdlib.compare.