From 65c27bfe52df291875ed0dc95340c3173ed09cc8 Mon Sep 17 00:00:00 2001 From: Liav A Date: Fri, 29 Jan 2021 21:01:56 +0200 Subject: [PATCH] Kernel: Set file size for smbios_entry_point and DMI blobs in ProcFS This is needed to support dmidecode version 3.3, so it can read the 2 blobs in ProcFS. --- Kernel/DMI.cpp | 9 +++++++++ Kernel/DMI.h | 2 ++ Kernel/FileSystem/ProcFS.cpp | 8 ++++++++ 3 files changed, 19 insertions(+) diff --git a/Kernel/DMI.cpp b/Kernel/DMI.cpp index f542aafc53a..238b646d932 100644 --- a/Kernel/DMI.cpp +++ b/Kernel/DMI.cpp @@ -70,6 +70,15 @@ DMIExpose& DMIExpose::the() return *s_the; } +size_t DMIExpose::entry_point_length() const +{ + return m_entry_point_length; +} +size_t DMIExpose::structure_table_length() const +{ + return m_structure_table_length; +} + void DMIExpose::initialize_exposer() { ASSERT(!(m_entry_point.is_null())); diff --git a/Kernel/DMI.h b/Kernel/DMI.h index 660fbadfe2d..4ee9aea141f 100644 --- a/Kernel/DMI.h +++ b/Kernel/DMI.h @@ -85,6 +85,8 @@ public: bool is_available() const { return m_available; } OwnPtr entry_point() const; OwnPtr structure_table() const; + size_t entry_point_length() const; + size_t structure_table_length() const; private: void set_64_bit_entry_initialization_values(); diff --git a/Kernel/FileSystem/ProcFS.cpp b/Kernel/FileSystem/ProcFS.cpp index 6b9a1bdde2a..d377410fdb7 100644 --- a/Kernel/FileSystem/ProcFS.cpp +++ b/Kernel/FileSystem/ProcFS.cpp @@ -1176,6 +1176,14 @@ InodeMetadata ProcFSInode::metadata() const case FI_PID_stacks: metadata.mode = S_IFDIR | S_IRUSR | S_IXUSR; break; + case FI_Root_smbios_entry_point: + metadata.mode = S_IFREG | S_IRUSR | S_IRGRP | S_IROTH; + metadata.size = DMIExpose::the().entry_point_length(); + break; + case FI_Root_dmi: + metadata.mode = S_IFREG | S_IRUSR | S_IRGRP | S_IROTH; + metadata.size = DMIExpose::the().structure_table_length(); + break; default: metadata.mode = S_IFREG | S_IRUSR | S_IRGRP | S_IROTH; break;