imago/format/
mod.rs

1//! Core functionality.
2//!
3//! Provides access to different image formats via `FormatAccess` objects.
4
5pub mod access;
6pub mod builder;
7pub mod drivers;
8pub mod gate;
9#[cfg(feature = "sync-wrappers")]
10pub mod sync_wrappers;
11pub mod wrapped;
12
13/// List of imago formats.
14#[derive(Clone, Copy, Debug, Eq, PartialEq)]
15#[non_exhaustive]
16pub enum Format {
17    /// Raw format (no metadata at all, everything stored 1:1)
18    Raw,
19
20    /// Qcow2 format (version 2 or 3)
21    Qcow2,
22}
23
24/// Format layer preallocation modes.
25///
26/// When resizing or create an image, this mode determines whether and how the new data range is to
27/// be preallocated.
28#[derive(Clone, Copy, Debug, Eq, PartialEq)]
29#[non_exhaustive]
30pub enum PreallocateMode {
31    /// No preallocation.
32    ///
33    /// Reading the new range may return random data.
34    None,
35
36    /// Ensure range reads as zeroes.
37    ///
38    /// Does not necessarily allocate data, but has to ensure the new range will read back as
39    /// zeroes (e.g. a backing file’s contents must not show through).
40    Zero,
41
42    /// Metadata preallocation.
43    ///
44    /// Do not write data, but ensure all blocks are mapped as data.  They must read as zero still.
45    FormatAllocate,
46
47    /// Metadata and extent preallocation.
48    ///
49    /// Same as `FormatAllocate`, but also allocate all blocks on the underlying storage.
50    FullAllocate,
51
52    /// Full data preallocation.
53    ///
54    /// Write zeroes to the whole range.
55    WriteData,
56}