morpheus_network::transfer::disk::manifest

Struct ManifestWriter

Source
pub struct ManifestWriter {
    name: [u8; 64],
    name_len: usize,
    total_size: u64,
    sha256: [u8; 32],
    flags: u8,
}
Expand description

Binary manifest for ISO chunks

Format:

Offset  Size  Field
0x00    8     Magic "MXISO\x02\x00\x00"
0x08    64    ISO name (null-terminated)
0x48    8     Total size (u64 LE)
0x50    32    SHA256 hash (or zeros)
0x70    1     Number of chunks
0x71    1     Flags
0x72    2     Reserved
0x74    4     Header CRC32
0x78    8     Reserved
0x80    N*48  Chunk entries

Fields§

§name: [u8; 64]

ISO name

§name_len: usize

Name length

§total_size: u64

Total ISO size

§sha256: [u8; 32]

SHA256 hash

§flags: u8

Flags

Implementations§

Source§

impl ManifestWriter

Source

pub fn new(iso_name: &str, total_size: u64) -> Self

Create new manifest writer

Source

pub fn set_hash(&mut self, hash: &[u8; 32])

Set SHA256 hash

Source

pub fn set_complete(&mut self, complete: bool)

Mark as complete

Source

pub fn set_verified(&mut self, verified: bool)

Mark as verified

Source

pub fn serialize( &self, chunks: &ChunkSet, buffer: &mut [u8], ) -> DiskResult<usize>

Serialize manifest to buffer

Returns number of bytes written.

Source

pub fn write_to_esp<B: BlockIo>( &self, block_io: &mut B, esp_start_lba: u64, manifest_offset: u64, chunks: &ChunkSet, ) -> DiskResult<()>

Write manifest to ESP partition

Writes to /.iso/<name>.manifest conceptually, but since we can’t do FAT32 file ops without alloc, we write to a fixed location within the ESP.

§Arguments
  • block_io - Block I/O device
  • esp_start_lba - Start LBA of ESP partition
  • manifest_offset - Sector offset within ESP for manifest storage
  • chunks - Chunk information to write
Source

pub fn write_to_esp_fat32<B: BlockIo>( &self, block_io: &mut B, esp_start_lba: u64, chunks: &ChunkSet, ) -> DiskResult<()>

Write manifest as FAT32 file to ESP

Writes to /.iso/<short_name>.mfst on the ESP. Uses 8.3 compatible filenames for FAT32 compatibility. This is the preferred method as it integrates with the bootloader scanner.

§Requirements
  • Heap allocator must be initialized (crate::alloc_heap::init_heap())
  • ESP must be a valid FAT32 partition
§Arguments
  • block_io - Block I/O device
  • esp_start_lba - Start LBA of ESP partition
  • chunks - Chunk information to write

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.