limine_protocol/structures/
file.rs

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