mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 12:37:44 +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:
parent
c1c9da6c35
commit
58fb3ebf66
48 changed files with 101 additions and 103 deletions
|
@ -5,11 +5,11 @@
|
|||
*/
|
||||
|
||||
#include <AK/Debug.h>
|
||||
#include <AK/MappedFile.h>
|
||||
#include <AK/OwnPtr.h>
|
||||
#include <AK/QuickSort.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/MappedFile.h>
|
||||
#include <LibELF/Image.h>
|
||||
#include <LibX86/Disassembler.h>
|
||||
#include <LibX86/ELFSymbolProvider.h>
|
||||
|
@ -26,7 +26,7 @@ int main(int argc, char** argv)
|
|||
args_parser.add_positional_argument(path, "Path to i386 binary file", "path");
|
||||
args_parser.parse(argc, argv);
|
||||
|
||||
auto file_or_error = MappedFile::map(path);
|
||||
auto file_or_error = Core::MappedFile::map(path);
|
||||
if (file_or_error.is_error()) {
|
||||
warnln("Could not map file: {}", file_or_error.error());
|
||||
return 1;
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <AK/MappedFile.h>
|
||||
#include <AK/String.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/MappedFile.h>
|
||||
#include <LibDeviceTree/Validation.h>
|
||||
#include <serenity.h>
|
||||
|
||||
|
@ -24,7 +24,7 @@ int main(int argc, char* argv[])
|
|||
args.parse(argc, argv);
|
||||
|
||||
// FIXME: Figure out how to do this sanely from stdin
|
||||
auto maybe_file = MappedFile::map(filename);
|
||||
auto maybe_file = Core::MappedFile::map(filename);
|
||||
if (maybe_file.is_error()) {
|
||||
warnln("Unable to dump device tree from file {}: {}", filename, maybe_file.error());
|
||||
return 1;
|
||||
|
|
|
@ -4,11 +4,11 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <AK/MappedFile.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <LibCompress/Gzip.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/FileStream.h>
|
||||
#include <LibCore/MappedFile.h>
|
||||
#include <LibCore/MimeData.h>
|
||||
#include <LibELF/Image.h>
|
||||
#include <LibELF/Validation.h>
|
||||
|
@ -25,7 +25,7 @@ static Optional<String> description_only(String description, [[maybe_unused]] co
|
|||
// FIXME: Ideally Gfx::ImageDecoder could tell us the image type directly.
|
||||
static Optional<String> image_details(const String& description, const String& path)
|
||||
{
|
||||
auto file_or_error = MappedFile::map(path);
|
||||
auto file_or_error = Core::MappedFile::map(path);
|
||||
if (file_or_error.is_error())
|
||||
return {};
|
||||
|
||||
|
@ -39,7 +39,7 @@ static Optional<String> image_details(const String& description, const String& p
|
|||
|
||||
static Optional<String> gzip_details(String description, const String& path)
|
||||
{
|
||||
auto file_or_error = MappedFile::map(path);
|
||||
auto file_or_error = Core::MappedFile::map(path);
|
||||
if (file_or_error.is_error())
|
||||
return {};
|
||||
|
||||
|
@ -56,7 +56,7 @@ static Optional<String> gzip_details(String description, const String& path)
|
|||
|
||||
static Optional<String> elf_details(String description, const String& path)
|
||||
{
|
||||
auto file_or_error = MappedFile::map(path);
|
||||
auto file_or_error = Core::MappedFile::map(path);
|
||||
if (file_or_error.is_error())
|
||||
return {};
|
||||
auto& mapped_file = *file_or_error.value();
|
||||
|
|
|
@ -4,10 +4,10 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <AK/MappedFile.h>
|
||||
#include <LibCompress/Gzip.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/FileStream.h>
|
||||
#include <LibCore/MappedFile.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int main(int argc, char** argv)
|
||||
|
@ -41,7 +41,7 @@ int main(int argc, char** argv)
|
|||
|
||||
// We map the whole file instead of streaming to reduce size overhead (gzip header) and increase the deflate block size (better compression)
|
||||
// TODO: automatically fallback to buffered streaming for very large files
|
||||
auto file_or_error = MappedFile::map(input_filename);
|
||||
auto file_or_error = Core::MappedFile::map(input_filename);
|
||||
if (file_or_error.is_error()) {
|
||||
warnln("Failed opening input file for reading: {}", file_or_error.error());
|
||||
return 1;
|
||||
|
|
|
@ -4,12 +4,12 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <AK/MappedFile.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <AK/StringView.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/MappedFile.h>
|
||||
#include <LibELF/DynamicLoader.h>
|
||||
#include <LibELF/DynamicObject.h>
|
||||
#include <LibELF/Image.h>
|
||||
|
@ -283,7 +283,7 @@ int main(int argc, char** argv)
|
|||
display_hardening = true;
|
||||
}
|
||||
|
||||
auto file_or_error = MappedFile::map(path);
|
||||
auto file_or_error = Core::MappedFile::map(path);
|
||||
|
||||
if (file_or_error.is_error()) {
|
||||
warnln("Unable to map file {}: {}", path, file_or_error.error());
|
||||
|
@ -315,7 +315,7 @@ int main(int argc, char** argv)
|
|||
warnln("Warning: Dynamic ELF object has no interpreter path. Using: {}", interpreter_path);
|
||||
}
|
||||
|
||||
auto interpreter_file_or_error = MappedFile::map(interpreter_path);
|
||||
auto interpreter_file_or_error = Core::MappedFile::map(interpreter_path);
|
||||
|
||||
if (interpreter_file_or_error.is_error()) {
|
||||
warnln("Unable to map interpreter file {}: {}", interpreter_path, interpreter_file_or_error.error());
|
||||
|
|
|
@ -5,12 +5,12 @@
|
|||
*/
|
||||
|
||||
#include <AK/Assertions.h>
|
||||
#include <AK/MappedFile.h>
|
||||
#include <AK/NumberFormat.h>
|
||||
#include <LibArchive/Zip.h>
|
||||
#include <LibCompress/Deflate.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/MappedFile.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
|
@ -104,7 +104,7 @@ int main(int argc, char** argv)
|
|||
return 1;
|
||||
}
|
||||
|
||||
auto file_or_error = MappedFile::map(zip_file_path);
|
||||
auto file_or_error = Core::MappedFile::map(zip_file_path);
|
||||
if (file_or_error.is_error()) {
|
||||
warnln("Failed to open {}: {}", zip_file_path, file_or_error.error());
|
||||
return 1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue