pub enum Chunk {
Raw {
start: u64,
size: u64,
},
Fill {
start: u64,
size: u64,
value: u32,
},
DontCare {
start: u64,
size: u64,
},
Crc32 {
checksum: u32,
},
}Variants§
Raw
Raw represents a set of blocks to be written to disk as-is.
start is the offset in the expanded image at which the Raw section starts.
start and size are in bytes, but must be block-aligned.
Fill
Fill represents a Chunk that has the value repeated enough to fill size bytes.
start is the offset in the expanded image at which the Fill section starts.
start and size are in bytes, but must be block-aligned.
DontCare
DontCare represents a set of blocks that need to be “offset” by the
image recipient. If an image needs to be broken up into two sparse images, and we flash n
bytes for Sparse Image 1, Sparse Image 2 needs to start with a DontCareChunk with
(n/blocksize) blocks as its “size” property.
start is the offset in the expanded image at which the DontCare section starts.
start and size are in bytes, but must be block-aligned.
Crc32
Crc32Chunk is used as a checksum of a given set of Chunks for a SparseImage. This is not
required and unused in most implementations of the Sparse Image format. The type is included
for completeness. It has 4 bytes of CRC32 checksum as describable in a u32.
Implementations§
Source§impl Chunk
impl Chunk
Sourcepub fn read_metadata<R: Read>(
reader: &mut R,
offset: u64,
block_size: u32,
) -> Result<Self>
pub fn read_metadata<R: Read>( reader: &mut R, offset: u64, block_size: u32, ) -> Result<Self>
Attempts to read a Chunk from reader. The reader will be positioned at the first byte
following the chunk header and any extra data; for a Raw chunk this means it will point at
the data payload, and for other chunks it will point at the next chunk header (or EOF).
offset is the current offset in the logical volume.