package qcow-format

  1. Overview
  2. Docs
module Version : sig ... end
module CryptMethod : sig ... end
module Feature : sig ... end
type offset = int64

Offset within the image

type extension = [
  1. | `Unknown of int32 * string
  2. | `Backing_file of string
  3. | `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 = {
  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

val sexp_of_additional : additional -> Ppx_sexp_conv_lib.Sexp.t
val additional_of_sexp : Ppx_sexp_conv_lib.Sexp.t -> additional
type 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 : offset;
    (*

    offset of the L1 table

    *)
  9. refcount_table_offset : offset;
    (*

    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 Ppx_sexp_conv_lib.Sexpable.S with type 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
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
val to_string : t -> string

Produce a pretty human-readable string from a value

include Set.OrderedType with type t := t
val 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 Pervasives.compare.