From 0931a42af0c0666dd9fbc20484b399c0e1ad3361 Mon Sep 17 00:00:00 2001 From: Yuri Kunde Schlesner Date: Mon, 15 Dec 2014 05:03:17 -0200 Subject: Service.FS: Rename FileSys::File to FileBackend --- src/core/CMakeLists.txt | 2 +- src/core/file_sys/archive_backend.h | 4 +-- src/core/file_sys/archive_romfs.cpp | 4 +-- src/core/file_sys/archive_romfs.h | 2 +- src/core/file_sys/archive_sdmc.cpp | 4 +-- src/core/file_sys/archive_sdmc.h | 2 +- src/core/file_sys/file.h | 66 ------------------------------------- src/core/file_sys/file_backend.h | 66 +++++++++++++++++++++++++++++++++++++ src/core/file_sys/file_romfs.h | 4 +-- src/core/file_sys/file_sdmc.h | 4 +-- src/core/hle/service/fs/archive.cpp | 2 +- 11 files changed, 80 insertions(+), 80 deletions(-) delete mode 100644 src/core/file_sys/file.h create mode 100644 src/core/file_sys/file_backend.h diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index c0ebd1c7..ce63aab0 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -96,7 +96,7 @@ set(HEADERS file_sys/archive_backend.h file_sys/archive_romfs.h file_sys/archive_sdmc.h - file_sys/file.h + file_sys/file_backend.h file_sys/file_romfs.h file_sys/file_sdmc.h file_sys/directory_backend.h diff --git a/src/core/file_sys/archive_backend.h b/src/core/file_sys/archive_backend.h index 49a31038..8d7a6a05 100644 --- a/src/core/file_sys/archive_backend.h +++ b/src/core/file_sys/archive_backend.h @@ -10,7 +10,7 @@ #include "common/string_util.h" #include "common/bit_field.h" -#include "core/file_sys/file.h" +#include "core/file_sys/file_backend.h" #include "core/file_sys/directory_backend.h" #include "core/mem_map.h" @@ -175,7 +175,7 @@ public: * @param mode Mode to open the file with * @return Opened file, or nullptr */ - virtual std::unique_ptr OpenFile(const Path& path, const Mode mode) const = 0; + virtual std::unique_ptr OpenFile(const Path& path, const Mode mode) const = 0; /** * Delete a file specified by its path diff --git a/src/core/file_sys/archive_romfs.cpp b/src/core/file_sys/archive_romfs.cpp index 8db7d69c..c515e0dd 100644 --- a/src/core/file_sys/archive_romfs.cpp +++ b/src/core/file_sys/archive_romfs.cpp @@ -29,8 +29,8 @@ Archive_RomFS::~Archive_RomFS() { * @param mode Mode to open the file with * @return Opened file, or nullptr */ -std::unique_ptr Archive_RomFS::OpenFile(const Path& path, const Mode mode) const { - return std::unique_ptr(new File_RomFS); +std::unique_ptr Archive_RomFS::OpenFile(const Path& path, const Mode mode) const { + return std::unique_ptr(new File_RomFS); } /** diff --git a/src/core/file_sys/archive_romfs.h b/src/core/file_sys/archive_romfs.h index 5a8a6b04..0390821b 100644 --- a/src/core/file_sys/archive_romfs.h +++ b/src/core/file_sys/archive_romfs.h @@ -30,7 +30,7 @@ public: * @param mode Mode to open the file with * @return Opened file, or nullptr */ - std::unique_ptr OpenFile(const Path& path, const Mode mode) const override; + std::unique_ptr OpenFile(const Path& path, const Mode mode) const override; /** * Delete a file specified by its path diff --git a/src/core/file_sys/archive_sdmc.cpp b/src/core/file_sys/archive_sdmc.cpp index 9d26d228..43252b98 100644 --- a/src/core/file_sys/archive_sdmc.cpp +++ b/src/core/file_sys/archive_sdmc.cpp @@ -49,12 +49,12 @@ bool Archive_SDMC::Initialize() { * @param mode Mode to open the file with * @return Opened file, or nullptr */ -std::unique_ptr Archive_SDMC::OpenFile(const Path& path, const Mode mode) const { +std::unique_ptr Archive_SDMC::OpenFile(const Path& path, const Mode mode) const { LOG_DEBUG(Service_FS, "called path=%s mode=%u", path.DebugStr().c_str(), mode.hex); File_SDMC* file = new File_SDMC(this, path, mode); if (!file->Open()) return nullptr; - return std::unique_ptr(file); + return std::unique_ptr(file); } /** diff --git a/src/core/file_sys/archive_sdmc.h b/src/core/file_sys/archive_sdmc.h index f4cb9615..5920051f 100644 --- a/src/core/file_sys/archive_sdmc.h +++ b/src/core/file_sys/archive_sdmc.h @@ -34,7 +34,7 @@ public: * @param mode Mode to open the file with * @return Opened file, or nullptr */ - std::unique_ptr OpenFile(const Path& path, const Mode mode) const override; + std::unique_ptr OpenFile(const Path& path, const Mode mode) const override; /** * Delete a file specified by its path diff --git a/src/core/file_sys/file.h b/src/core/file_sys/file.h deleted file mode 100644 index 4013b6c3..00000000 --- a/src/core/file_sys/file.h +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2014 Citra Emulator Project -// Licensed under GPLv2 -// Refer to the license.txt file included. - -#pragma once - -#include "common/common_types.h" - -#include "core/hle/kernel/kernel.h" - -//////////////////////////////////////////////////////////////////////////////////////////////////// -// FileSys namespace - -namespace FileSys { - -class File : NonCopyable { -public: - File() { } - virtual ~File() { } - - /** - * Open the file - * @return true if the file opened correctly - */ - virtual bool Open() = 0; - - /** - * Read data from the file - * @param offset Offset in bytes to start reading data from - * @param length Length in bytes of data to read from file - * @param buffer Buffer to read data into - * @return Number of bytes read - */ - virtual size_t Read(const u64 offset, const u32 length, u8* buffer) const = 0; - - /** - * Write data to the file - * @param offset Offset in bytes to start writing data to - * @param length Length in bytes of data to write to file - * @param flush The flush parameters (0 == do not flush) - * @param buffer Buffer to read data from - * @return Number of bytes written - */ - virtual size_t Write(const u64 offset, const u32 length, const u32 flush, const u8* buffer) const = 0; - - /** - * Get the size of the file in bytes - * @return Size of the file in bytes - */ - virtual size_t GetSize() const = 0; - - /** - * Set the size of the file in bytes - * @param size New size of the file - * @return true if successful - */ - virtual bool SetSize(const u64 size) const = 0; - - /** - * Close the file - * @return true if the file closed correctly - */ - virtual bool Close() const = 0; -}; - -} // namespace FileSys diff --git a/src/core/file_sys/file_backend.h b/src/core/file_sys/file_backend.h new file mode 100644 index 00000000..1b81d5fe --- /dev/null +++ b/src/core/file_sys/file_backend.h @@ -0,0 +1,66 @@ +// Copyright 2014 Citra Emulator Project +// Licensed under GPLv2 +// Refer to the license.txt file included. + +#pragma once + +#include "common/common_types.h" + +#include "core/hle/kernel/kernel.h" + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// FileSys namespace + +namespace FileSys { + +class FileBackend : NonCopyable { +public: + FileBackend() { } + virtual ~FileBackend() { } + + /** + * Open the file + * @return true if the file opened correctly + */ + virtual bool Open() = 0; + + /** + * Read data from the file + * @param offset Offset in bytes to start reading data from + * @param length Length in bytes of data to read from file + * @param buffer Buffer to read data into + * @return Number of bytes read + */ + virtual size_t Read(const u64 offset, const u32 length, u8* buffer) const = 0; + + /** + * Write data to the file + * @param offset Offset in bytes to start writing data to + * @param length Length in bytes of data to write to file + * @param flush The flush parameters (0 == do not flush) + * @param buffer Buffer to read data from + * @return Number of bytes written + */ + virtual size_t Write(const u64 offset, const u32 length, const u32 flush, const u8* buffer) const = 0; + + /** + * Get the size of the file in bytes + * @return Size of the file in bytes + */ + virtual size_t GetSize() const = 0; + + /** + * Set the size of the file in bytes + * @param size New size of the file + * @return true if successful + */ + virtual bool SetSize(const u64 size) const = 0; + + /** + * Close the file + * @return true if the file closed correctly + */ + virtual bool Close() const = 0; +}; + +} // namespace FileSys diff --git a/src/core/file_sys/file_romfs.h b/src/core/file_sys/file_romfs.h index 5196701d..4ddaafe2 100644 --- a/src/core/file_sys/file_romfs.h +++ b/src/core/file_sys/file_romfs.h @@ -6,7 +6,7 @@ #include "common/common_types.h" -#include "core/file_sys/file.h" +#include "core/file_sys/file_backend.h" #include "core/loader/loader.h" //////////////////////////////////////////////////////////////////////////////////////////////////// @@ -14,7 +14,7 @@ namespace FileSys { -class File_RomFS final : public File { +class File_RomFS final : public FileBackend { public: File_RomFS(); ~File_RomFS() override; diff --git a/src/core/file_sys/file_sdmc.h b/src/core/file_sys/file_sdmc.h index 80b44596..e0154859 100644 --- a/src/core/file_sys/file_sdmc.h +++ b/src/core/file_sys/file_sdmc.h @@ -7,7 +7,7 @@ #include "common/common_types.h" #include "common/file_util.h" -#include "core/file_sys/file.h" +#include "core/file_sys/file_backend.h" #include "core/file_sys/archive_sdmc.h" #include "core/loader/loader.h" @@ -16,7 +16,7 @@ namespace FileSys { -class File_SDMC final : public File { +class File_SDMC final : public FileBackend { public: File_SDMC(); File_SDMC(const Archive_SDMC* archive, const Path& path, const Mode mode); diff --git a/src/core/hle/service/fs/archive.cpp b/src/core/hle/service/fs/archive.cpp index 9a372513..d04e5b2e 100644 --- a/src/core/hle/service/fs/archive.cpp +++ b/src/core/hle/service/fs/archive.cpp @@ -112,7 +112,7 @@ public: std::string GetName() const override { return "Path: " + path.DebugStr(); } FileSys::Path path; ///< Path of the file - std::unique_ptr backend; ///< File backend interface + std::unique_ptr backend; ///< File backend interface ResultVal SyncRequest() override { u32* cmd_buff = Kernel::GetCommandBuffer(); -- cgit v1.2.3