1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 08:17:34 +00:00

LibCore+AK: Move MappedFile from AK to LibCore

MappedFile is strictly a userspace thing, so it doesn't belong in AK
(which is supposed to be user/kernel agnostic.)
This commit is contained in:
Andreas Kling 2021-11-23 11:32:25 +01:00
parent c1c9da6c35
commit 58fb3ebf66
48 changed files with 101 additions and 103 deletions

View file

@ -6,7 +6,7 @@
#include "DisassemblyModel.h"
#include "Profile.h"
#include <AK/MappedFile.h>
#include <LibCore/MappedFile.h>
#include <LibDebug/DebugInfo.h>
#include <LibELF/Image.h>
#include <LibGUI/Painter.h>
@ -40,7 +40,7 @@ static ELF::Image* try_load_kernel_binary()
{
if (s_kernel_binary.has_value())
return &s_kernel_binary->elf;
auto kernel_binary_or_error = MappedFile::map("/boot/Kernel");
auto kernel_binary_or_error = Core::MappedFile::map("/boot/Kernel");
if (!kernel_binary_or_error.is_error()) {
auto kernel_binary = kernel_binary_or_error.release_value();
s_kernel_binary = { { kernel_binary, ELF::Image(kernel_binary->bytes()) } };

View file

@ -48,7 +48,7 @@ static MappedObject* get_or_create_mapped_object(const String& path)
if (auto it = g_mapped_object_cache.find(path); it != g_mapped_object_cache.end())
return it->value.ptr();
auto file_or_error = MappedFile::map(path);
auto file_or_error = Core::MappedFile::map(path);
if (file_or_error.is_error()) {
g_mapped_object_cache.set(path, {});
return nullptr;

View file

@ -8,16 +8,16 @@
#include "EventSerialNumber.h"
#include <AK/HashMap.h>
#include <AK/MappedFile.h>
#include <AK/OwnPtr.h>
#include <AK/Vector.h>
#include <LibCore/MappedFile.h>
#include <LibDebug/DebugInfo.h>
#include <LibELF/Image.h>
namespace Profiler {
struct MappedObject {
NonnullRefPtr<MappedFile> file;
NonnullRefPtr<Core::MappedFile> file;
ELF::Image elf;
};

View file

@ -10,12 +10,12 @@
#include "SamplesModel.h"
#include <AK/HashTable.h>
#include <AK/LexicalPath.h>
#include <AK/MappedFile.h>
#include <AK/NonnullOwnPtrVector.h>
#include <AK/QuickSort.h>
#include <AK/RefPtr.h>
#include <AK/Try.h>
#include <LibCore/File.h>
#include <LibCore/MappedFile.h>
#include <LibELF/Image.h>
#include <LibSymbolication/Symbolication.h>
#include <sys/stat.h>
@ -226,7 +226,7 @@ ErrorOr<NonnullOwnPtr<Profile>> Profile::load_from_perfcore_file(StringView path
auto& object = json.value().as_object();
if (!g_kernel_debuginfo_object.has_value()) {
auto debuginfo_file_or_error = MappedFile::map("/boot/Kernel.debug");
auto debuginfo_file_or_error = Core::MappedFile::map("/boot/Kernel.debug");
if (!debuginfo_file_or_error.is_error()) {
auto debuginfo_file = debuginfo_file_or_error.release_value();
auto debuginfo_image = ELF::Image(debuginfo_file->bytes());

View file

@ -17,10 +17,10 @@
#include <AK/JsonArray.h>
#include <AK/JsonObject.h>
#include <AK/JsonValue.h>
#include <AK/MappedFile.h>
#include <AK/NonnullRefPtrVector.h>
#include <AK/OwnPtr.h>
#include <AK/Variant.h>
#include <LibCore/MappedFile.h>
#include <LibELF/Image.h>
#include <LibGUI/Forward.h>
#include <LibGUI/ModelIndex.h>