union Media [src]

Fields

hard_drive: *const HardDriveDevicePath
cdrom: *const CdromDevicePath
vendor: *const VendorDevicePath
file_path: *const FilePathDevicePath
media_protocol: *const MediaProtocolDevicePath
piwg_firmware_file: *const PiwgFirmwareFileDevicePath
piwg_firmware_volume: *const PiwgFirmwareVolumeDevicePath
relative_offset_range: *const RelativeOffsetRangeDevicePath
ram_disk: *const RamDiskDevicePath

Members

Source

pub const Media = union(Subtype) { hard_drive: *const HardDriveDevicePath, cdrom: *const CdromDevicePath, vendor: *const VendorDevicePath, file_path: *const FilePathDevicePath, media_protocol: *const MediaProtocolDevicePath, piwg_firmware_file: *const PiwgFirmwareFileDevicePath, piwg_firmware_volume: *const PiwgFirmwareVolumeDevicePath, relative_offset_range: *const RelativeOffsetRangeDevicePath, ram_disk: *const RamDiskDevicePath, pub const Subtype = enum(u8) { hard_drive = 1, cdrom = 2, vendor = 3, file_path = 4, media_protocol = 5, piwg_firmware_file = 6, piwg_firmware_volume = 7, relative_offset_range = 8, ram_disk = 9, _, }; pub const HardDriveDevicePath = extern struct { pub const Format = enum(u8) { legacy_mbr = 0x01, guid_partition_table = 0x02, }; pub const SignatureType = enum(u8) { no_signature = 0x00, /// "32-bit signature from address 0x1b8 of the type 0x01 MBR" mbr_signature = 0x01, guid_signature = 0x02, }; type: DevicePath.Type, subtype: Subtype, length: u16 align(1), partition_number: u32 align(1), partition_start: u64 align(1), partition_size: u64 align(1), partition_signature: [16]u8, partition_format: Format, signature_type: SignatureType, }; comptime { assert(42 == @sizeOf(HardDriveDevicePath)); assert(1 == @alignOf(HardDriveDevicePath)); assert(0 == @offsetOf(HardDriveDevicePath, "type")); assert(1 == @offsetOf(HardDriveDevicePath, "subtype")); assert(2 == @offsetOf(HardDriveDevicePath, "length")); assert(4 == @offsetOf(HardDriveDevicePath, "partition_number")); assert(8 == @offsetOf(HardDriveDevicePath, "partition_start")); assert(16 == @offsetOf(HardDriveDevicePath, "partition_size")); assert(24 == @offsetOf(HardDriveDevicePath, "partition_signature")); assert(40 == @offsetOf(HardDriveDevicePath, "partition_format")); assert(41 == @offsetOf(HardDriveDevicePath, "signature_type")); } pub const CdromDevicePath = extern struct { type: DevicePath.Type, subtype: Subtype, length: u16 align(1), boot_entry: u32 align(1), partition_start: u64 align(1), partition_size: u64 align(1), }; comptime { assert(24 == @sizeOf(CdromDevicePath)); assert(1 == @alignOf(CdromDevicePath)); assert(0 == @offsetOf(CdromDevicePath, "type")); assert(1 == @offsetOf(CdromDevicePath, "subtype")); assert(2 == @offsetOf(CdromDevicePath, "length")); assert(4 == @offsetOf(CdromDevicePath, "boot_entry")); assert(8 == @offsetOf(CdromDevicePath, "partition_start")); assert(16 == @offsetOf(CdromDevicePath, "partition_size")); } pub const VendorDevicePath = extern struct { type: DevicePath.Type, subtype: Subtype, length: u16 align(1), guid: Guid align(1), }; comptime { assert(20 == @sizeOf(VendorDevicePath)); assert(1 == @alignOf(VendorDevicePath)); assert(0 == @offsetOf(VendorDevicePath, "type")); assert(1 == @offsetOf(VendorDevicePath, "subtype")); assert(2 == @offsetOf(VendorDevicePath, "length")); assert(4 == @offsetOf(VendorDevicePath, "guid")); } pub const FilePathDevicePath = extern struct { type: DevicePath.Type, subtype: Subtype, length: u16 align(1), pub fn getPath(self: *const FilePathDevicePath) [*:0]align(1) const u16 { return @as([*:0]align(1) const u16, @ptrCast(@as([*]const u8, @ptrCast(self)) + @sizeOf(FilePathDevicePath))); } }; comptime { assert(4 == @sizeOf(FilePathDevicePath)); assert(1 == @alignOf(FilePathDevicePath)); assert(0 == @offsetOf(FilePathDevicePath, "type")); assert(1 == @offsetOf(FilePathDevicePath, "subtype")); assert(2 == @offsetOf(FilePathDevicePath, "length")); } pub const MediaProtocolDevicePath = extern struct { type: DevicePath.Type, subtype: Subtype, length: u16 align(1), guid: Guid align(1), }; comptime { assert(20 == @sizeOf(MediaProtocolDevicePath)); assert(1 == @alignOf(MediaProtocolDevicePath)); assert(0 == @offsetOf(MediaProtocolDevicePath, "type")); assert(1 == @offsetOf(MediaProtocolDevicePath, "subtype")); assert(2 == @offsetOf(MediaProtocolDevicePath, "length")); assert(4 == @offsetOf(MediaProtocolDevicePath, "guid")); } pub const PiwgFirmwareFileDevicePath = extern struct { type: DevicePath.Type, subtype: Subtype, length: u16 align(1), fv_filename: Guid align(1), }; comptime { assert(20 == @sizeOf(PiwgFirmwareFileDevicePath)); assert(1 == @alignOf(PiwgFirmwareFileDevicePath)); assert(0 == @offsetOf(PiwgFirmwareFileDevicePath, "type")); assert(1 == @offsetOf(PiwgFirmwareFileDevicePath, "subtype")); assert(2 == @offsetOf(PiwgFirmwareFileDevicePath, "length")); assert(4 == @offsetOf(PiwgFirmwareFileDevicePath, "fv_filename")); } pub const PiwgFirmwareVolumeDevicePath = extern struct { type: DevicePath.Type, subtype: Subtype, length: u16 align(1), fv_name: Guid align(1), }; comptime { assert(20 == @sizeOf(PiwgFirmwareVolumeDevicePath)); assert(1 == @alignOf(PiwgFirmwareVolumeDevicePath)); assert(0 == @offsetOf(PiwgFirmwareVolumeDevicePath, "type")); assert(1 == @offsetOf(PiwgFirmwareVolumeDevicePath, "subtype")); assert(2 == @offsetOf(PiwgFirmwareVolumeDevicePath, "length")); assert(4 == @offsetOf(PiwgFirmwareVolumeDevicePath, "fv_name")); } pub const RelativeOffsetRangeDevicePath = extern struct { type: DevicePath.Type, subtype: Subtype, length: u16 align(1), reserved: u32 align(1), start: u64 align(1), end: u64 align(1), }; comptime { assert(24 == @sizeOf(RelativeOffsetRangeDevicePath)); assert(1 == @alignOf(RelativeOffsetRangeDevicePath)); assert(0 == @offsetOf(RelativeOffsetRangeDevicePath, "type")); assert(1 == @offsetOf(RelativeOffsetRangeDevicePath, "subtype")); assert(2 == @offsetOf(RelativeOffsetRangeDevicePath, "length")); assert(4 == @offsetOf(RelativeOffsetRangeDevicePath, "reserved")); assert(8 == @offsetOf(RelativeOffsetRangeDevicePath, "start")); assert(16 == @offsetOf(RelativeOffsetRangeDevicePath, "end")); } pub const RamDiskDevicePath = extern struct { type: DevicePath.Type, subtype: Subtype, length: u16 align(1), start: u64 align(1), end: u64 align(1), disk_type: Guid align(1), instance: u16 align(1), }; comptime { assert(38 == @sizeOf(RamDiskDevicePath)); assert(1 == @alignOf(RamDiskDevicePath)); assert(0 == @offsetOf(RamDiskDevicePath, "type")); assert(1 == @offsetOf(RamDiskDevicePath, "subtype")); assert(2 == @offsetOf(RamDiskDevicePath, "length")); assert(4 == @offsetOf(RamDiskDevicePath, "start")); assert(12 == @offsetOf(RamDiskDevicePath, "end")); assert(20 == @offsetOf(RamDiskDevicePath, "disk_type")); assert(36 == @offsetOf(RamDiskDevicePath, "instance")); } }