mirror of
https://github.com/RGBCube/serenity
synced 2025-05-28 11:45:11 +00:00
Kernel: Expose SMBIOS blobs in ProcFS
This commit is contained in:
parent
e4e74c48ea
commit
df59b80e23
5 changed files with 252 additions and 0 deletions
|
@ -32,6 +32,7 @@
|
|||
#include <Kernel/Arch/i386/ProcessorInfo.h>
|
||||
#include <Kernel/CommandLine.h>
|
||||
#include <Kernel/Console.h>
|
||||
#include <Kernel/DMI.h>
|
||||
#include <Kernel/Debug.h>
|
||||
#include <Kernel/Devices/BlockDevice.h>
|
||||
#include <Kernel/Devices/KeyboardDevice.h>
|
||||
|
@ -86,6 +87,8 @@ enum ProcFileType {
|
|||
FI_Root_cpuinfo,
|
||||
FI_Root_dmesg,
|
||||
FI_Root_interrupts,
|
||||
FI_Root_dmi,
|
||||
FI_Root_smbios_entry_point,
|
||||
FI_Root_keymap,
|
||||
FI_Root_pci,
|
||||
FI_Root_devices,
|
||||
|
@ -377,6 +380,24 @@ static bool procfs$pci(InodeIdentifier, KBufferBuilder& builder)
|
|||
return true;
|
||||
}
|
||||
|
||||
static bool procfs$dmi(InodeIdentifier, KBufferBuilder& builder)
|
||||
{
|
||||
if (!DMIExpose::the().is_available())
|
||||
return false;
|
||||
auto structures_ptr = DMIExpose::the().structure_table();
|
||||
builder.append_bytes(ReadonlyBytes { structures_ptr->data(), structures_ptr->size() });
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool procfs$smbios_entry_point(InodeIdentifier, KBufferBuilder& builder)
|
||||
{
|
||||
if (!DMIExpose::the().is_available())
|
||||
return false;
|
||||
auto structures_ptr = DMIExpose::the().entry_point();
|
||||
builder.append_bytes(ReadonlyBytes { structures_ptr->data(), structures_ptr->size() });
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool procfs$interrupts(InodeIdentifier, KBufferBuilder& builder)
|
||||
{
|
||||
JsonArraySerializer array { builder };
|
||||
|
@ -1628,6 +1649,8 @@ ProcFS::ProcFS()
|
|||
m_entries[FI_Root_self] = { "self", FI_Root_self, false, procfs$self };
|
||||
m_entries[FI_Root_pci] = { "pci", FI_Root_pci, false, procfs$pci };
|
||||
m_entries[FI_Root_interrupts] = { "interrupts", FI_Root_interrupts, false, procfs$interrupts };
|
||||
m_entries[FI_Root_dmi] = { "DMI", FI_Root_dmi, false, procfs$dmi };
|
||||
m_entries[FI_Root_smbios_entry_point] = { "smbios_entry_point", FI_Root_smbios_entry_point, false, procfs$smbios_entry_point };
|
||||
m_entries[FI_Root_keymap] = { "keymap", FI_Root_keymap, false, procfs$keymap };
|
||||
m_entries[FI_Root_devices] = { "devices", FI_Root_devices, false, procfs$devices };
|
||||
m_entries[FI_Root_uptime] = { "uptime", FI_Root_uptime, false, procfs$uptime };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue