Struct V3HeaderBase

Source
struct V3HeaderBase {
    incompatible_features: u64,
    compatible_features: u64,
    autoclear_features: u64,
    refcount_order: u32,
    header_length: u32,
}
Expand description

Qcow2 v3 header.

Fields§

§incompatible_features: u64

Bitmask of incompatible features. An implementation must fail to open an image if an unknown bit is set.

  1. Dirty bit. If this bit is set then refcounts may be inconsistent, make sure to scan L1/L2 tables to repair refcounts before accessing the image.
  2. Corrupt bit. If this bit is set then any data structure may be corrupt and the image must not be written to (unless for regaining consistency).
  3. External data file bit. If this bit is set, an external data file is used. Guest clusters are then stored in the external data file. For such images, clusters in the external data file are not refcounted. The offset field in the Standard Cluster Descriptor must match the guest offset and neither compressed clusters nor internal snapshots are supported. An External Data File Name header extension may be present if this bit is set.
  4. Compression type bit. If this bit is set, a non-default compression is used for compressed clusters. The compression_type field must be present and not zero.
  5. Extended L2 Entries. If this bit is set then L2 table entries use an extended format that allows subcluster-based allocation. See the Extended L2 Entries section for more details.

Bits 5-63 are reserved (set to 0).

§compatible_features: u64

Bitmask of compatible features. An implementation can safely ignore any unknown bits that are set.

  1. Lazy refcounts bit. If this bit is set then lazy refcount updates can be used. This means marking the image file dirty and postponing refcount metadata updates.

Bits 1-63 are reserved (set to 0).

§autoclear_features: u64

Bitmask of auto-clear features. An implementation may only write to an image with unknown auto-clear features if it clears the respective bits from this field first.

  1. Bitmaps extension bit. This bit indicates consistency for the bitmaps extension data. It is an error if this bit is set without the bitmaps extension present. If the bitmaps extension is present but this bit is unset, the bitmaps extension data must be considered inconsistent.
  2. Raw external data bit. If this bit is set, the external data file can be read as a consistent standalone raw image without looking at the qcow2 metadata. Setting this bit has a performance impact for some operations on the image (e.g. writing zeros requires writing to the data file instead of only setting the zero flag in the L2 table entry) and conflicts with backing files. This bit may only be set if the External Data File bit (incompatible feature bit 1) is also set.

Bits 2-63 are reserved (set to 0).

§refcount_order: u32

Describes the width of a reference count block entry (width in bits: refcount_bits = 1 << refcount_order). For version 2 images, the order is always assumed to be 4 (i.e. refcount_bits = 16). This value may not exceed 6 (i.e. refcount_bits = 64).

§header_length: u32

Length of the header structure in bytes. For version 2 images, the length is always assumed to be 72 bytes. For version 3 it’s at least 104 bytes and must be a multiple of 8.

Implementations§

Source§

impl V3HeaderBase

Source

const RAW_SIZE: usize = 32usize

Raw v3 header length beyond the v2 header.

Trait Implementations§

Source§

impl Default for V3HeaderBase

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for V3HeaderBase

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for V3HeaderBase

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,