limine_protocol_for_rust/requests/
bootloader_info.rs1
2use crate::requests::LimineRequest;
4use core::mem::MaybeUninit;
5use crate::{impl_limine_req, LimineReqId};
6use core::ffi::{c_char, CStr};
7
8#[repr(C, align(8))]
9pub struct BootloaderInfoRequest{
10 id: LimineReqId,
11 revision: u64,
12 resp: MaybeUninit<usize>
13}
14
15impl BootloaderInfoRequest {
16 pub const fn new(revision: u64) -> Self {
17 Self {
18 id: LimineReqId::new([0xf55038d8e2a1202f, 0x279426fcf5f59740]),
19 revision,
20 resp: MaybeUninit::uninit()
21 }
22 }
23}
24
25impl_limine_req!(BootloaderInfoRequest, BootloaderInfoResponse);
26
27#[repr(C, align(8))]
28#[derive(Copy, Clone)]
29pub struct BootloaderInfoResponse {
30 revision: u64,
31 name: *const c_char,
32 version: *const c_char
33}
34impl BootloaderInfoResponse {
35 pub fn get_name(&self) -> &str {
36 unsafe {
37 CStr::from_ptr(self.name).to_str().unwrap()
38 }
39 }
40
41 pub fn get_version(&self) -> &str {
42 unsafe {
43 CStr::from_ptr(self.version).to_str().unwrap()
44 }
45 }
46}