summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service/fs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/core/hle/service/fs/archive.cpp12
-rw-r--r--src/core/hle/service/fs/archive.h12
-rw-r--r--src/core/hle/service/fs/fs_user.cpp9
3 files changed, 18 insertions, 15 deletions
diff --git a/src/core/hle/service/fs/archive.cpp b/src/core/hle/service/fs/archive.cpp
index 4c29784e8..da009df91 100644
--- a/src/core/hle/service/fs/archive.cpp
+++ b/src/core/hle/service/fs/archive.cpp
@@ -92,7 +92,7 @@ File::File(std::unique_ptr<FileSys::FileBackend>&& backend, const FileSys::Path&
File::~File() {}
-ResultVal<bool> File::SyncRequest() {
+ResultCode File::HandleSyncRequest() {
u32* cmd_buff = Kernel::GetCommandBuffer();
FileCommand cmd = static_cast<FileCommand>(cmd_buff[0]);
switch (cmd) {
@@ -193,10 +193,10 @@ ResultVal<bool> File::SyncRequest() {
LOG_ERROR(Service_FS, "Unknown command=0x%08X!", cmd);
ResultCode error = UnimplementedFunction(ErrorModule::FS);
cmd_buff[1] = error.raw; // TODO(Link Mauve): use the correct error code for that.
- return error;
+ return ServerSession::HandleSyncRequest();
}
cmd_buff[1] = RESULT_SUCCESS.raw; // No error
- return MakeResult<bool>(false);
+ return ServerSession::HandleSyncRequest();
}
Directory::Directory(std::unique_ptr<FileSys::DirectoryBackend>&& backend,
@@ -205,7 +205,7 @@ Directory::Directory(std::unique_ptr<FileSys::DirectoryBackend>&& backend,
Directory::~Directory() {}
-ResultVal<bool> Directory::SyncRequest() {
+ResultCode Directory::HandleSyncRequest() {
u32* cmd_buff = Kernel::GetCommandBuffer();
DirectoryCommand cmd = static_cast<DirectoryCommand>(cmd_buff[0]);
switch (cmd) {
@@ -236,10 +236,10 @@ ResultVal<bool> Directory::SyncRequest() {
LOG_ERROR(Service_FS, "Unknown command=0x%08X!", cmd);
ResultCode error = UnimplementedFunction(ErrorModule::FS);
cmd_buff[1] = error.raw; // TODO(Link Mauve): use the correct error code for that.
- return MakeResult<bool>(false);
+ return ServerSession::HandleSyncRequest();
}
cmd_buff[1] = RESULT_SUCCESS.raw; // No error
- return MakeResult<bool>(false);
+ return ServerSession::HandleSyncRequest();
}
////////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/core/hle/service/fs/archive.h b/src/core/hle/service/fs/archive.h
index 21ed9717b..22e659c40 100644
--- a/src/core/hle/service/fs/archive.h
+++ b/src/core/hle/service/fs/archive.h
@@ -8,7 +8,7 @@
#include <string>
#include "common/common_types.h"
#include "core/file_sys/archive_backend.h"
-#include "core/hle/kernel/session.h"
+#include "core/hle/kernel/server_session.h"
#include "core/hle/result.h"
namespace FileSys {
@@ -41,7 +41,7 @@ enum class MediaType : u32 { NAND = 0, SDMC = 1 };
typedef u64 ArchiveHandle;
-class File : public Kernel::Session {
+class File : public Kernel::ServerSession {
public:
File(std::unique_ptr<FileSys::FileBackend>&& backend, const FileSys::Path& path);
~File();
@@ -49,14 +49,15 @@ public:
std::string GetName() const override {
return "Path: " + path.DebugStr();
}
- ResultVal<bool> SyncRequest() override;
+
+ ResultCode HandleSyncRequest() override;
FileSys::Path path; ///< Path of the file
u32 priority; ///< Priority of the file. TODO(Subv): Find out what this means
std::unique_ptr<FileSys::FileBackend> backend; ///< File backend interface
};
-class Directory : public Kernel::Session {
+class Directory : public Kernel::ServerSession {
public:
Directory(std::unique_ptr<FileSys::DirectoryBackend>&& backend, const FileSys::Path& path);
~Directory();
@@ -64,7 +65,8 @@ public:
std::string GetName() const override {
return "Directory: " + path.DebugStr();
}
- ResultVal<bool> SyncRequest() override;
+
+ ResultCode HandleSyncRequest() override;
FileSys::Path path; ///< Path of the directory
std::unique_ptr<FileSys::DirectoryBackend> backend; ///< File backend interface
diff --git a/src/core/hle/service/fs/fs_user.cpp b/src/core/hle/service/fs/fs_user.cpp
index 9ec17b395..bb78091f9 100644
--- a/src/core/hle/service/fs/fs_user.cpp
+++ b/src/core/hle/service/fs/fs_user.cpp
@@ -8,6 +8,7 @@
#include "common/logging/log.h"
#include "common/scope_exit.h"
#include "common/string_util.h"
+#include "core/hle/kernel/client_session.h"
#include "core/hle/result.h"
#include "core/hle/service/fs/archive.h"
#include "core/hle/service/fs/fs_user.h"
@@ -17,7 +18,7 @@
// Namespace FS_User
using Kernel::SharedPtr;
-using Kernel::Session;
+using Kernel::ServerSession;
namespace Service {
namespace FS {
@@ -70,7 +71,7 @@ static void OpenFile(Service::Interface* self) {
ResultVal<SharedPtr<File>> file_res = OpenFileFromArchive(archive_handle, file_path, mode);
cmd_buff[1] = file_res.Code().raw;
if (file_res.Succeeded()) {
- cmd_buff[3] = Kernel::g_handle_table.Create(*file_res).MoveFrom();
+ cmd_buff[3] = Kernel::g_handle_table.Create((*file_res)->CreateClientSession()).MoveFrom();
} else {
cmd_buff[3] = 0;
LOG_ERROR(Service_FS, "failed to get a handle for file %s", file_path.DebugStr().c_str());
@@ -130,7 +131,7 @@ static void OpenFileDirectly(Service::Interface* self) {
ResultVal<SharedPtr<File>> file_res = OpenFileFromArchive(*archive_handle, file_path, mode);
cmd_buff[1] = file_res.Code().raw;
if (file_res.Succeeded()) {
- cmd_buff[3] = Kernel::g_handle_table.Create(*file_res).MoveFrom();
+ cmd_buff[3] = Kernel::g_handle_table.Create((*file_res)->CreateClientSession()).MoveFrom();
} else {
cmd_buff[3] = 0;
LOG_ERROR(Service_FS, "failed to get a handle for file %s mode=%u attributes=%u",
@@ -391,7 +392,7 @@ static void OpenDirectory(Service::Interface* self) {
ResultVal<SharedPtr<Directory>> dir_res = OpenDirectoryFromArchive(archive_handle, dir_path);
cmd_buff[1] = dir_res.Code().raw;
if (dir_res.Succeeded()) {
- cmd_buff[3] = Kernel::g_handle_table.Create(*dir_res).MoveFrom();
+ cmd_buff[3] = Kernel::g_handle_table.Create((*dir_res)->CreateClientSession()).MoveFrom();
} else {
LOG_ERROR(Service_FS, "failed to get a handle for directory type=%d size=%d data=%s",
dirname_type, dirname_size, dir_path.DebugStr().c_str());