pub fn new(mut file: File) -> Result<Vhdx> {
        let vhdx_header = VhdxHeader::new(&mut file).map_err(VhdxError::ParseVhdxHeader)?;

        let collected_entries = RegionInfo::new(
            &mut file,
            vhdx_header::REGION_TABLE_1_START,
            vhdx_header.region_entry_count(),
        )
        .map_err(VhdxError::ParseVhdxRegionEntry)?;

        let bat_entry = collected_entries.bat_entry;
        let mdr_entry = collected_entries.mdr_entry;

        let disk_spec =
            DiskSpec::new(&mut file, &mdr_entry).map_err(VhdxError::ParseVhdxMetadata)?;
        let bat_entries = BatEntry::collect_bat_entries(&mut file, &disk_spec, &bat_entry)
            .map_err(VhdxError::ReadBatEntry)?;

        Ok(Vhdx {
            file,
            vhdx_header,
            region_entries: collected_entries.region_entries,
            bat_entry,
            mdr_entry,
            disk_spec,
            bat_entries,
            current_offset: 0,
            first_write: true,
        })
    }
/// Parse the Vhdx header, BAT, and metadata from a file and store info
// in Vhdx structure.
Parse the Vhdx header, BAT, and metadata from a file and store info
in Vhdx structure.
Parse the Vhdx header BAT and metadata from a file and store info in Vhdx structure .
pub fn new(mut file: File) -> Result<Vhdx> {
        let vhdx_header = VhdxHeader::new(&mut file).map_err(VhdxError::ParseVhdxHeader)?;
        let collected_entries = RegionInfo::new(
            &mut file,
            vhdx_header::REGION_TABLE_1_START,
            vhdx_header.region_entry_count(),
        )
        .map_err(VhdxError::ParseVhdxRegionEntry)?;
        let bat_entry = collected_entries.bat_entry;
        let mdr_entry = collected_entries.mdr_entry;
        let disk_spec =
            DiskSpec::new(&mut file, &mdr_entry).map_err(VhdxError::ParseVhdxMetadata)?;
        let bat_entries = BatEntry::collect_bat_entries(&mut file, &disk_spec, &bat_entry)
            .map_err(VhdxError::ReadBatEntry)?;
        Ok(Vhdx {
            file,
            vhdx_header,
            region_entries: collected_entries.region_entries,
            bat_entry,
            mdr_entry,
            disk_spec,
            bat_entries,
            current_offset: 0,
            first_write: true,
        })
    }
pub fn new ( mut file : File ) -> Result < Vhdx > { let vhdx_header = VhdxHeader :: new ( & mut file ) . map_err ( VhdxError :: ParseVhdxHeader ) ? ; let collected_entries = RegionInfo :: new ( & mut file , vhdx_header :: REGION_TABLE_1_START , vhdx_header . region_entry_count ( ) , ) . map_err ( VhdxError :: ParseVhdxRegionEntry ) ? ; let bat_entry = collected_entries . bat_entry ; let mdr_entry = collected_entries . mdr_entry ; let disk_spec = DiskSpec :: new ( & mut file , & mdr_entry ) . map_err ( VhdxError :: ParseVhdxMetadata ) ? ; let bat_entries = BatEntry :: collect_bat_entries ( & mut file , & disk_spec , & bat_entry ) . map_err ( VhdxError :: ReadBatEntry ) ? ; Ok ( Vhdx { file , vhdx_header , region_entries : collected_entries . region_entries , bat_entry , mdr_entry , disk_spec , bat_entries , current_offset : 0 , first_write : true , } ) }
Parse the Vhdx header, BAT, and metadata from a file and store info
in Vhdx structure.
Parse the Vhdx header BAT and metadata from a file and store info in Vhdx structure .
file
File
file
File