From 7988f0248959b2284ce5cc74bac6aef897627a8e Mon Sep 17 00:00:00 2001 From: bunnei Date: Fri, 19 Jan 2018 22:08:21 -0500 Subject: archive_backend: Minor changes to match Switch IFileSystem. --- src/core/file_sys/archive_backend.h | 44 +++++++++++++++++----------------- src/core/file_sys/romfs_archive.cpp | 2 +- src/core/file_sys/romfs_archive.h | 2 +- src/core/file_sys/savedata_archive.cpp | 2 +- src/core/file_sys/savedata_archive.h | 2 +- 5 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/core/file_sys/archive_backend.h b/src/core/file_sys/archive_backend.h index 58f6c150c..2255bee42 100644 --- a/src/core/file_sys/archive_backend.h +++ b/src/core/file_sys/archive_backend.h @@ -81,13 +81,12 @@ public: virtual std::string GetName() const = 0; /** - * Open a file specified by its path, using the specified mode - * @param path Path relative to the archive - * @param mode Mode to open the file with - * @return Opened file, or error code + * Create a file specified by its path + * @param path Path relative to the Archive + * @param size The size of the new file, filled with zeroes + * @return Result of the operation */ - virtual ResultVal> OpenFile(const Path& path, - const Mode& mode) const = 0; + virtual ResultCode CreateFile(const Path& path, u64 size) const = 0; /** * Delete a file specified by its path @@ -97,12 +96,11 @@ public: virtual ResultCode DeleteFile(const Path& path) const = 0; /** - * Rename a File specified by its path - * @param src_path Source path relative to the archive - * @param dest_path Destination path relative to the archive + * Create a directory specified by its path + * @param path Path relative to the archive * @return Result of the operation */ - virtual ResultCode RenameFile(const Path& src_path, const Path& dest_path) const = 0; + virtual ResultCode CreateDirectory(const Path& path) const = 0; /** * Delete a directory specified by its path @@ -119,19 +117,12 @@ public: virtual ResultCode DeleteDirectoryRecursively(const Path& path) const = 0; /** - * Create a file specified by its path - * @param path Path relative to the Archive - * @param size The size of the new file, filled with zeroes - * @return Result of the operation - */ - virtual ResultCode CreateFile(const Path& path, u64 size) const = 0; - - /** - * Create a directory specified by its path - * @param path Path relative to the archive + * Rename a File specified by its path + * @param src_path Source path relative to the archive + * @param dest_path Destination path relative to the archive * @return Result of the operation */ - virtual ResultCode CreateDirectory(const Path& path) const = 0; + virtual ResultCode RenameFile(const Path& src_path, const Path& dest_path) const = 0; /** * Rename a Directory specified by its path @@ -141,6 +132,15 @@ public: */ virtual ResultCode RenameDirectory(const Path& src_path, const Path& dest_path) const = 0; + /** + * Open a file specified by its path, using the specified mode + * @param path Path relative to the archive + * @param mode Mode to open the file with + * @return Opened file, or error code + */ + virtual ResultVal> OpenFile(const Path& path, + const Mode& mode) const = 0; + /** * Open a directory specified by its path * @param path Path relative to the archive @@ -152,7 +152,7 @@ public: * Get the free space * @return The number of free bytes in the archive */ - virtual u64 GetFreeBytes() const = 0; + virtual u64 GetFreeSpaceSize() const = 0; }; class ArchiveFactory : NonCopyable { diff --git a/src/core/file_sys/romfs_archive.cpp b/src/core/file_sys/romfs_archive.cpp index 482de2220..0d93fccd4 100644 --- a/src/core/file_sys/romfs_archive.cpp +++ b/src/core/file_sys/romfs_archive.cpp @@ -73,7 +73,7 @@ ResultVal> ROMFSArchive::OpenDirectory(const P return MakeResult>(std::make_unique()); } -u64 ROMFSArchive::GetFreeBytes() const { +u64 ROMFSArchive::GetFreeSpaceSize() const { LOG_WARNING(Service_FS, "Attempted to get the free space in an ROMFS archive"); return 0; } diff --git a/src/core/file_sys/romfs_archive.h b/src/core/file_sys/romfs_archive.h index 2bb13146b..2b6c573ba 100644 --- a/src/core/file_sys/romfs_archive.h +++ b/src/core/file_sys/romfs_archive.h @@ -39,7 +39,7 @@ public: ResultCode CreateDirectory(const Path& path) const override; ResultCode RenameDirectory(const Path& src_path, const Path& dest_path) const override; ResultVal> OpenDirectory(const Path& path) const override; - u64 GetFreeBytes() const override; + u64 GetFreeSpaceSize() const override; protected: std::shared_ptr romfs_file; diff --git a/src/core/file_sys/savedata_archive.cpp b/src/core/file_sys/savedata_archive.cpp index d7b012f6e..d12739ca7 100644 --- a/src/core/file_sys/savedata_archive.cpp +++ b/src/core/file_sys/savedata_archive.cpp @@ -322,7 +322,7 @@ ResultVal> SaveDataArchive::OpenDirectory( return MakeResult>(std::move(directory)); } -u64 SaveDataArchive::GetFreeBytes() const { +u64 SaveDataArchive::GetFreeSpaceSize() const { // TODO: Stubbed to return 1GiB return 1024 * 1024 * 1024; } diff --git a/src/core/file_sys/savedata_archive.h b/src/core/file_sys/savedata_archive.h index 176d35710..931dfb17b 100644 --- a/src/core/file_sys/savedata_archive.h +++ b/src/core/file_sys/savedata_archive.h @@ -34,7 +34,7 @@ public: ResultCode CreateDirectory(const Path& path) const override; ResultCode RenameDirectory(const Path& src_path, const Path& dest_path) const override; ResultVal> OpenDirectory(const Path& path) const override; - u64 GetFreeBytes() const override; + u64 GetFreeSpaceSize() const override; protected: std::string mount_point; -- cgit v1.2.3