mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-09 20:52:54 +00:00
Kernel/SysFS: Split the bulky BIOS.h file into multiple files
This commit is contained in:
parent
9c6834698f
commit
4d05a41b30
Notes:
sideshowbarker
2024-07-17 10:07:42 +09:00
Author: https://github.com/supercomputer7
Commit: 4d05a41b30
Pull-request: https://github.com/SerenityOS/serenity/pull/13772
12 changed files with 297 additions and 180 deletions
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* Copyright (c) 2022, Liav A. <liavalb@hotmail.co.il>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <AK/StringView.h>
|
||||
#include <Kernel/FileSystem/OpenFileDescription.h>
|
||||
#include <Kernel/FileSystem/SysFS/Subsystems/Firmware/BIOS/Component.h>
|
||||
#include <Kernel/Firmware/BIOS.h>
|
||||
#include <Kernel/KBufferBuilder.h>
|
||||
#include <Kernel/Memory/MemoryManager.h>
|
||||
#include <Kernel/Memory/TypedMapping.h>
|
||||
#include <Kernel/Sections.h>
|
||||
|
||||
namespace Kernel {
|
||||
|
||||
UNMAP_AFTER_INIT BIOSSysFSComponent::BIOSSysFSComponent()
|
||||
{
|
||||
}
|
||||
|
||||
ErrorOr<size_t> BIOSSysFSComponent::read_bytes(off_t offset, size_t count, UserOrKernelBuffer& buffer, OpenFileDescription*) const
|
||||
{
|
||||
auto blob = TRY(try_to_generate_buffer());
|
||||
|
||||
if ((size_t)offset >= blob->size())
|
||||
return 0;
|
||||
|
||||
ssize_t nread = min(static_cast<off_t>(blob->size() - offset), static_cast<off_t>(count));
|
||||
TRY(buffer.write(blob->data() + offset, nread));
|
||||
return nread;
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue