Struct Qcow2Header

Source
pub struct Qcow2Header { /* private fields */ }

Implementations§

Source§

impl Qcow2Header

Source

pub const QCOW2_MAGIC: u32 = 1_363_560_955u32

Source

pub const MAX_CLUSTER_SIZE: u32 = 2_097_152u32

Source

pub const MAX_L1_SIZE: u32 = 33_554_432u32

Source

pub const MAX_REFCOUNT_TABLE_SIZE: u32 = 8_388_608u32

Source

pub fn from_buf(header_buf: &[u8]) -> Qcow2Result<Self>

Source

pub fn calculate_meta_params( size: u64, cluster_bits: usize, refcount_order: u8, block_size: usize, ) -> ((u64, u32), (u64, u32), (u64, u32))

Source

pub fn format_qcow2( buf: &mut [u8], size: u64, cluster_bits: usize, refcount_order: u8, block_size: usize, ) -> Qcow2Result<()>

Format in-ram qcow2 image, for test purpose

Source

pub fn serialize_to_buf(&mut self) -> Qcow2Result<Vec<u8>>

Source

pub fn version(&self) -> u32

Source

pub fn crypt_method(&self) -> u32

Source

pub fn compression_type(&self) -> u8

Source

pub fn header_length(&self) -> u32

Source

pub fn size(&self) -> u64

Source

pub fn cluster_bits(&self) -> u32

Source

pub fn refcount_order(&self) -> u32

Source

pub fn l1_table_offset(&self) -> u64

Source

pub fn l1_table_entries(&self) -> usize

Source

pub fn set_l1_table(&mut self, offset: u64, entries: usize) -> Qcow2Result<()>

Source

pub fn nb_snapshots(&self) -> u32

Source

pub fn snapshots_offset(&self) -> u64

Source

pub fn reftable_offset(&self) -> u64

Source

pub fn reftable_clusters(&self) -> usize

Source

pub fn set_reftable(&mut self, offset: u64, clusters: usize) -> Qcow2Result<()>

Source

pub fn backing_filename(&self) -> Option<&String>

Source

pub fn backing_format(&self) -> Option<&String>

Source

pub fn feature_name( &self, feat_type: Qcow2FeatureType, bit: u32, ) -> Option<&String>

Trait Implementations§

Source§

impl Debug for Qcow2Header

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. 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.

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.