Kernel/IPC: Use Ports and Sessions as the fundamental building block of Inter Process Communication.

All handles obtained via srv::GetServiceHandle or svcConnectToPort are references to ClientSessions.
Service modules will wait on the counterpart of those ClientSessions (Called ServerSessions) using svcReplyAndReceive or svcWaitSynchronization[1|N], and will be awoken when a SyncRequest is performed.

HLE Interfaces are now ClientPorts which override the HandleSyncRequest virtual member function to perform command handling immediately.
This commit is contained in:
Subv
2016-06-14 18:03:30 -05:00
parent 68c00ee771
commit 073653e858
16 changed files with 315 additions and 89 deletions

View File

@ -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