summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service/filesystem/fsp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/hle/service/filesystem/fsp')
-rw-r--r--src/core/hle/service/filesystem/fsp/fs_i_directory.cpp26
-rw-r--r--src/core/hle/service/filesystem/fsp/fs_i_directory.h7
-rw-r--r--src/core/hle/service/filesystem/fsp/fs_i_file.h1
-rw-r--r--src/core/hle/service/filesystem/fsp/fs_i_filesystem.cpp10
-rw-r--r--src/core/hle/service/filesystem/fsp/fsp_srv.cpp8
5 files changed, 28 insertions, 24 deletions
diff --git a/src/core/hle/service/filesystem/fsp/fs_i_directory.cpp b/src/core/hle/service/filesystem/fsp/fs_i_directory.cpp
index 62512ad0f..1e8ef366e 100644
--- a/src/core/hle/service/filesystem/fsp/fs_i_directory.cpp
+++ b/src/core/hle/service/filesystem/fsp/fs_i_directory.cpp
@@ -8,23 +8,26 @@
namespace Service::FileSystem {
template <typename T>
-static void BuildEntryIndex(std::vector<FileSys::Entry>& entries, const std::vector<T>& new_data,
- FileSys::EntryType type) {
+static void BuildEntryIndex(std::vector<FileSys::DirectoryEntry>& entries,
+ const std::vector<T>& new_data, FileSys::DirectoryEntryType type) {
entries.reserve(entries.size() + new_data.size());
for (const auto& new_entry : new_data) {
auto name = new_entry->GetName();
- if (type == FileSys::EntryType::File && name == FileSys::GetSaveDataSizeFileName()) {
+ if (type == FileSys::DirectoryEntryType::File &&
+ name == FileSys::GetSaveDataSizeFileName()) {
continue;
}
- entries.emplace_back(name, type,
- type == FileSys::EntryType::Directory ? 0 : new_entry->GetSize());
+ entries.emplace_back(name, static_cast<s8>(type),
+ type == FileSys::DirectoryEntryType::Directory ? 0
+ : new_entry->GetSize());
}
}
-IDirectory::IDirectory(Core::System& system_, FileSys::VirtualDir backend_, OpenDirectoryMode mode)
+IDirectory::IDirectory(Core::System& system_, FileSys::VirtualDir backend_,
+ FileSys::OpenDirectoryMode mode)
: ServiceFramework{system_, "IDirectory"}, backend(std::move(backend_)) {
static const FunctionInfo functions[] = {
{0, &IDirectory::Read, "Read"},
@@ -34,11 +37,12 @@ IDirectory::IDirectory(Core::System& system_, FileSys::VirtualDir backend_, Open
// TODO(DarkLordZach): Verify that this is the correct behavior.
// Build entry index now to save time later.
- if (True(mode & OpenDirectoryMode::Directory)) {
- BuildEntryIndex(entries, backend->GetSubdirectories(), FileSys::EntryType::Directory);
+ if (True(mode & FileSys::OpenDirectoryMode::Directory)) {
+ BuildEntryIndex(entries, backend->GetSubdirectories(),
+ FileSys::DirectoryEntryType::Directory);
}
- if (True(mode & OpenDirectoryMode::File)) {
- BuildEntryIndex(entries, backend->GetFiles(), FileSys::EntryType::File);
+ if (True(mode & FileSys::OpenDirectoryMode::File)) {
+ BuildEntryIndex(entries, backend->GetFiles(), FileSys::DirectoryEntryType::File);
}
}
@@ -46,7 +50,7 @@ void IDirectory::Read(HLERequestContext& ctx) {
LOG_DEBUG(Service_FS, "called.");
// Calculate how many entries we can fit in the output buffer
- const u64 count_entries = ctx.GetWriteBufferNumElements<FileSys::Entry>();
+ const u64 count_entries = ctx.GetWriteBufferNumElements<FileSys::DirectoryEntry>();
// Cap at total number of entries.
const u64 actual_entries = std::min(count_entries, entries.size() - next_entry_index);
diff --git a/src/core/hle/service/filesystem/fsp/fs_i_directory.h b/src/core/hle/service/filesystem/fsp/fs_i_directory.h
index ecc4ecada..9f5d7c054 100644
--- a/src/core/hle/service/filesystem/fsp/fs_i_directory.h
+++ b/src/core/hle/service/filesystem/fsp/fs_i_directory.h
@@ -3,9 +3,10 @@
#pragma once
+#include "core/file_sys/fs_filesystem.h"
#include "core/file_sys/vfs/vfs.h"
#include "core/hle/service/filesystem/filesystem.h"
-#include "core/hle/service/filesystem/fsp_util.h"
+#include "core/hle/service/filesystem/fsp/fsp_util.h"
#include "core/hle/service/service.h"
namespace Service::FileSystem {
@@ -13,11 +14,11 @@ namespace Service::FileSystem {
class IDirectory final : public ServiceFramework<IDirectory> {
public:
explicit IDirectory(Core::System& system_, FileSys::VirtualDir backend_,
- OpenDirectoryMode mode);
+ FileSys::OpenDirectoryMode mode);
private:
FileSys::VirtualDir backend;
- std::vector<FileSys::Entry> entries;
+ std::vector<FileSys::DirectoryEntry> entries;
u64 next_entry_index = 0;
void Read(HLERequestContext& ctx);
diff --git a/src/core/hle/service/filesystem/fsp/fs_i_file.h b/src/core/hle/service/filesystem/fsp/fs_i_file.h
index a7eb1a1e9..5e5430c67 100644
--- a/src/core/hle/service/filesystem/fsp/fs_i_file.h
+++ b/src/core/hle/service/filesystem/fsp/fs_i_file.h
@@ -3,7 +3,6 @@
#pragma once
-#include "core/file_sys/vfs.h"
#include "core/hle/service/filesystem/filesystem.h"
#include "core/hle/service/service.h"
diff --git a/src/core/hle/service/filesystem/fsp/fs_i_filesystem.cpp b/src/core/hle/service/filesystem/fsp/fs_i_filesystem.cpp
index 3e72101a4..efa394dd1 100644
--- a/src/core/hle/service/filesystem/fsp/fs_i_filesystem.cpp
+++ b/src/core/hle/service/filesystem/fsp/fs_i_filesystem.cpp
@@ -10,8 +10,8 @@
namespace Service::FileSystem {
IFileSystem::IFileSystem(Core::System& system_, FileSys::VirtualDir backend_, SizeGetter size_)
- : ServiceFramework{system_, "IFileSystem"}, backend{std::move(backend_)},
- size{std::move(size_)} {
+ : ServiceFramework{system_, "IFileSystem"}, backend{std::move(backend_)}, size{std::move(
+ size_)} {
static const FunctionInfo functions[] = {
{0, &IFileSystem::CreateFile, "CreateFile"},
{1, &IFileSystem::DeleteFile, "DeleteFile"},
@@ -116,7 +116,7 @@ void IFileSystem::OpenFile(HLERequestContext& ctx) {
const auto file_buffer = ctx.ReadBuffer();
const std::string name = Common::StringFromBuffer(file_buffer);
- const auto mode = static_cast<FileSys::Mode>(rp.Pop<u32>());
+ const auto mode = static_cast<FileSys::OpenMode>(rp.Pop<u32>());
LOG_DEBUG(Service_FS, "called. file={}, mode={}", name, mode);
@@ -140,7 +140,7 @@ void IFileSystem::OpenDirectory(HLERequestContext& ctx) {
const auto file_buffer = ctx.ReadBuffer();
const std::string name = Common::StringFromBuffer(file_buffer);
- const auto mode = rp.PopRaw<OpenDirectoryMode>();
+ const auto mode = rp.PopRaw<FileSys::OpenDirectoryMode>();
LOG_DEBUG(Service_FS, "called. directory={}, mode={}", name, mode);
@@ -165,7 +165,7 @@ void IFileSystem::GetEntryType(HLERequestContext& ctx) {
LOG_DEBUG(Service_FS, "called. file={}", name);
- FileSys::EntryType vfs_entry_type{};
+ FileSys::DirectoryEntryType vfs_entry_type{};
auto result = backend.GetEntryType(&vfs_entry_type, name);
if (result != ResultSuccess) {
IPC::ResponseBuilder rb{ctx, 2};
diff --git a/src/core/hle/service/filesystem/fsp/fsp_srv.cpp b/src/core/hle/service/filesystem/fsp/fsp_srv.cpp
index d04fb079f..c35df5530 100644
--- a/src/core/hle/service/filesystem/fsp/fsp_srv.cpp
+++ b/src/core/hle/service/filesystem/fsp/fsp_srv.cpp
@@ -15,9 +15,9 @@
#include "common/settings.h"
#include "common/string_util.h"
#include "core/core.h"
-#include "core/file_sys/directory.h"
#include "core/file_sys/errors.h"
-#include "core/file_sys/mode.h"
+#include "core/file_sys/fs_directory.h"
+#include "core/file_sys/fs_filesystem.h"
#include "core/file_sys/nca_metadata.h"
#include "core/file_sys/patch_manager.h"
#include "core/file_sys/romfs_factory.h"
@@ -52,8 +52,8 @@ public:
explicit ISaveDataInfoReader(Core::System& system_,
std::shared_ptr<SaveDataController> save_data_controller_,
FileSys::SaveDataSpaceId space)
- : ServiceFramework{system_, "ISaveDataInfoReader"},
- save_data_controller{save_data_controller_} {
+ : ServiceFramework{system_, "ISaveDataInfoReader"}, save_data_controller{
+ save_data_controller_} {
static const FunctionInfo functions[] = {
{0, &ISaveDataInfoReader::ReadSaveDataInfo, "ReadSaveDataInfo"},
};