mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
Kernel: Allow SysFS components to have non-zero size
This is important for dmidecode because it does an fstat on the DMI blobs, trying to figure out their size. Because we already know the size of the blobs when creating the SysFS components, there's no performance penalty whatsoever, and this allows dmidecode to not use the /dev/mem device as a fallback.
This commit is contained in:
parent
66ff60db07
commit
ae2ec45e78
Notes:
sideshowbarker
2024-07-17 16:22:19 +09:00
Author: https://github.com/supercomputer7 Commit: https://github.com/SerenityOS/serenity/commit/ae2ec45e78 Pull-request: https://github.com/SerenityOS/serenity/pull/13400
3 changed files with 7 additions and 1 deletions
|
@ -137,7 +137,7 @@ InodeMetadata SysFSInode::metadata() const
|
|||
metadata.mode = S_IFREG | m_associated_component->permissions();
|
||||
metadata.uid = 0;
|
||||
metadata.gid = 0;
|
||||
metadata.size = 0;
|
||||
metadata.size = m_associated_component->size();
|
||||
metadata.mtime = mepoch;
|
||||
return metadata;
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@ public:
|
|||
virtual RefPtr<SysFSComponent> lookup(StringView) { VERIFY_NOT_REACHED(); };
|
||||
virtual mode_t permissions() const;
|
||||
virtual ErrorOr<void> truncate(u64) { return EPERM; }
|
||||
virtual size_t size() const { return 0; }
|
||||
virtual ErrorOr<void> set_mtime(time_t) { return ENOTIMPL; }
|
||||
virtual ErrorOr<size_t> write_bytes(off_t, size_t, UserOrKernelBuffer const&, OpenFileDescription*) { return EROFS; }
|
||||
virtual ErrorOr<void> refresh_data(OpenFileDescription&) const { return {}; }
|
||||
|
|
|
@ -77,6 +77,9 @@ public:
|
|||
private:
|
||||
DMIEntryPointExposedBlob(PhysicalAddress dmi_entry_point, size_t blob_size);
|
||||
virtual ErrorOr<NonnullOwnPtr<KBuffer>> try_to_generate_buffer() const override;
|
||||
|
||||
virtual size_t size() const override { return m_dmi_entry_point_length; }
|
||||
|
||||
PhysicalAddress m_dmi_entry_point;
|
||||
size_t const m_dmi_entry_point_length { 0 };
|
||||
};
|
||||
|
@ -90,6 +93,8 @@ private:
|
|||
SMBIOSExposedTable(PhysicalAddress dmi_entry_point, size_t blob_size);
|
||||
virtual ErrorOr<NonnullOwnPtr<KBuffer>> try_to_generate_buffer() const override;
|
||||
|
||||
virtual size_t size() const override { return m_smbios_structure_table_length; }
|
||||
|
||||
PhysicalAddress m_smbios_structure_table;
|
||||
size_t const m_smbios_structure_table_length { 0 };
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue