Function is_gpt_disk

Source
pub fn is_gpt_disk(device: &Device) -> bool
Expand description

Check if a device uses GPT (GUID Partition Table) instead of MBR.

This function checks if the device contains a GPT protective partition in its MBR, which indicates that the device uses GPT partitioning instead of traditional MBR. GPT is the modern replacement for MBR and supports larger disks and more partitions.

§Arguments

  • Device - The storage device to check

§Returns

  • true - Device uses GPT partitioning (has protective MBR)
  • false - Device uses traditional MBR or cannot be read

§Examples

extern crate alloc;
use file_system::*;

let device = create_device!(Memory_device_type::<512>::new(4 * 1024 * 1024));

if is_gpt_disk(&device) {
    println!("Device uses GPT partitioning");
} else {
    println!("Device uses MBR partitioning");
}