1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
use core::ffi::CStr;
use super::uuid::UUID;
#[repr(u32)]
#[derive(Debug, PartialEq, Eq)]
/// File types
pub enum FileType {
/// Generic file type
Generic = 0,
/// Optical drive
Optical = 1,
/// Remote server
TFTP = 2,
/// Unknown
Unknown,
}
impl From<u32> for FileType {
fn from(v: u32) -> Self {
match v {
0 => Self::Generic,
1 => Self::Optical,
2 => Self::TFTP,
_ => Self::Unknown,
}
}
}
#[repr(C)]
#[derive(Debug, PartialEq, Eq)]
/// File structure
pub struct File<'a> {
/// Revision of the File structure
pub revision: u64,
/// The address of the file
pub address: *const u8,
/// The size of the file
pub size: u64,
/// The path of the file
pub path: &'a CStr,
/// A command line associated with the file
pub cmdline: &'a CStr,
/// The kind of media the file is on
pub media_type: FileType,
/// Unused
unused: u32,
/// IP of the TFTP server, if one was used
pub tftp_ip: u32,
/// Port of the TFTP server, if one was used
pub tftp_port: u32,
/// !-based partition index of the volume from which the file was loaded
pub partition_index: u32,
/// If non-zero, the ID of the disk from the MBR
pub mbr_disk_id: u32,
/// The UUID of the disk from which the file was loaded from GPT, if it is non-zero
pub gpt_disk_uuid: UUID,
/// The UUID of the partition from which the file was loaded from GPT, if it is non-zero
pub gpt_part_uuid: UUID,
/// The UUID of the filesystem frmo which the file was laoded from GPT, if it is non-zero,
pub part_uuid: UUID,
}