[][src]Struct gptman::GPTHeader

pub struct GPTHeader {
    pub signature: [u8; 8],
    pub revision: [u8; 4],
    pub header_size: u32,
    pub crc32_checksum: u32,
    pub reserved: [u8; 4],
    pub primary_lba: u64,
    pub backup_lba: u64,
    pub first_usable_lba: u64,
    pub last_usable_lba: u64,
    pub disk_guid: [u8; 16],
    pub partition_entry_lba: u64,
    pub number_of_partition_entries: u32,
    pub size_of_partition_entry: u32,
    pub partition_entry_array_crc32: u32,
}

A GUID Partition Table header as describe on Wikipedia's page.

Fields

signature: [u8; 8]

GPT signature (must be "EFI PART").

revision: [u8; 4]

GPT revision (must be 00 00 01 00).

header_size: u32

GPT header size (must be 92).

crc32_checksum: u32

CRC32 checksum of the header.

reserved: [u8; 4]

Reserved bytes of the header.

primary_lba: u64

Location (in sectors) of the primary header.

backup_lba: u64

Location (in sectors) of the backup header.

first_usable_lba: u64

Location (in sectors) of the first usable sector.

last_usable_lba: u64

Location (in sectors) of the last usable sector.

disk_guid: [u8; 16]

16 bytes representing the UUID of the GPT.

partition_entry_lba: u64

Location (in sectors) of the partition entries array.

number_of_partition_entries: u32

Number of partition entries in the array.

size_of_partition_entry: u32

Size (in bytes) of a partition entry.

partition_entry_array_crc32: u32

CRC32 checksum of the partition array.

Methods

impl GPTHeader[src]

pub fn new_from<R>(
    reader: &mut R,
    sector_size: u64,
    disk_guid: [u8; 16]
) -> Result<GPTHeader> where
    R: Read + Seek
[src]

Make a new GPT header based on a reader. (This operation does not write anything to disk!)

pub fn read_from<R: ?Sized>(reader: &mut R) -> Result<GPTHeader> where
    R: Read + Seek
[src]

Attempt to read a GPT header from a reader.

pub fn write_into<W: ?Sized>(
    &mut self,
    writer: &mut W,
    sector_size: u64,
    partitions: &[GPTPartitionEntry]
) -> Result<()> where
    W: Write + Seek
[src]

Write the GPT header into a writer. This operation will update the CRC32 checksums of the current struct and seek at the correct location before trying to write to disk.

pub fn generate_crc32_checksum(&self) -> u32[src]

Generate the CRC32 checksum of the partition header only.

pub fn update_crc32_checksum(&mut self)[src]

Update the CRC32 checksum of this header.

pub fn generate_partition_entry_array_crc32(
    &self,
    partitions: &[GPTPartitionEntry]
) -> u32
[src]

Generate the CRC32 checksum of the partition entry array.

pub fn update_partition_entry_array_crc32(
    &mut self,
    partitions: &[GPTPartitionEntry]
)
[src]

Update the CRC32 checksum of the partition entry array.

pub fn update_from<S: ?Sized>(
    &mut self,
    seeker: &mut S,
    sector_size: u64
) -> Result<()> where
    S: Seek
[src]

Updates the header to match the specifications of the reader given in argument. first_usable_lba, last_usable_lba, primary_lba, backup_lba will be updated after this operation.

Trait Implementations

impl Clone for GPTHeader[src]

impl Debug for GPTHeader[src]

impl<'de> Deserialize<'de> for GPTHeader[src]

impl Serialize for GPTHeader[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

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

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,