mirror of
https://github.com/Atmosphere-NX/Atmosphere-libs.git
synced 2025-06-26 04:52:47 +02:00
ams_mitm: update for new sf semantics
This commit is contained in:
parent
98c78b2622
commit
b209249e12
@ -27,7 +27,7 @@ namespace ams::fs {
|
|||||||
|
|
||||||
namespace ams::fssrv::impl {
|
namespace ams::fssrv::impl {
|
||||||
|
|
||||||
class StorageInterfaceAdapter final {
|
class StorageInterfaceAdapter {
|
||||||
NON_COPYABLE(StorageInterfaceAdapter);
|
NON_COPYABLE(StorageInterfaceAdapter);
|
||||||
private:
|
private:
|
||||||
/* TODO: Nintendo uses fssystem::AsynchronousAccessStorage here. */
|
/* TODO: Nintendo uses fssystem::AsynchronousAccessStorage here. */
|
||||||
@ -39,7 +39,7 @@ namespace ams::fssrv::impl {
|
|||||||
public:
|
public:
|
||||||
StorageInterfaceAdapter(fs::IStorage *storage);
|
StorageInterfaceAdapter(fs::IStorage *storage);
|
||||||
StorageInterfaceAdapter(std::unique_ptr<fs::IStorage> storage);
|
StorageInterfaceAdapter(std::unique_ptr<fs::IStorage> storage);
|
||||||
explicit StorageInterfaceAdapter(std::shared_ptr<fs::IStorage> &&storage);
|
explicit StorageInterfaceAdapter(std::shared_ptr<fs::IStorage> storage);
|
||||||
/* TODO: Other constructors. */
|
/* TODO: Other constructors. */
|
||||||
|
|
||||||
~StorageInterfaceAdapter();
|
~StorageInterfaceAdapter();
|
||||||
|
@ -53,13 +53,24 @@ namespace ams::sf::hipc {
|
|||||||
friend class ServerManager;
|
friend class ServerManager;
|
||||||
NON_COPYABLE(Server);
|
NON_COPYABLE(Server);
|
||||||
NON_MOVEABLE(Server);
|
NON_MOVEABLE(Server);
|
||||||
protected:
|
private:
|
||||||
cmif::ServiceObjectHolder static_object;
|
cmif::ServiceObjectHolder static_object;
|
||||||
::Handle port_handle;
|
::Handle port_handle;
|
||||||
sm::ServiceName service_name;
|
sm::ServiceName service_name;
|
||||||
int index;
|
int index;
|
||||||
bool service_managed;
|
bool service_managed;
|
||||||
bool is_mitm_server;
|
bool is_mitm_server;
|
||||||
|
public:
|
||||||
|
void AcknowledgeMitmSession(std::shared_ptr<::Service> *out_fsrv, sm::MitmProcessInfo *out_client_info) {
|
||||||
|
/* Check mitm server. */
|
||||||
|
AMS_ABORT_UNLESS(this->is_mitm_server);
|
||||||
|
|
||||||
|
/* Create forward service. */
|
||||||
|
*out_fsrv = ServerSession::CreateForwardService();
|
||||||
|
|
||||||
|
/* Get client info. */
|
||||||
|
R_ABORT_UNLESS(sm::mitm::AcknowledgeSession(out_fsrv->get(), out_client_info, this->service_name));
|
||||||
|
}
|
||||||
};
|
};
|
||||||
private:
|
private:
|
||||||
/* Management of waitables. */
|
/* Management of waitables. */
|
||||||
@ -172,6 +183,11 @@ namespace ams::sf::hipc {
|
|||||||
Result AcceptImpl(Server *server, SharedPointer<Interface> p) {
|
Result AcceptImpl(Server *server, SharedPointer<Interface> p) {
|
||||||
return ServerSessionManager::AcceptSession(server->port_handle, std::move(p));
|
return ServerSessionManager::AcceptSession(server->port_handle, std::move(p));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<typename Interface>
|
||||||
|
Result AcceptMitmImpl(Server *server, SharedPointer<Interface> p, std::shared_ptr<::Service> forward_service) {
|
||||||
|
return ServerSessionManager::AcceptMitmSession(server->port_handle, std::move(p), std::move(forward_service));
|
||||||
|
}
|
||||||
public:
|
public:
|
||||||
ServerManagerBase(DomainEntryStorage *entry_storage, size_t entry_count) :
|
ServerManagerBase(DomainEntryStorage *entry_storage, size_t entry_count) :
|
||||||
ServerDomainSessionManager(entry_storage, entry_count),
|
ServerDomainSessionManager(entry_storage, entry_count),
|
||||||
|
@ -25,10 +25,10 @@ namespace ams::sf::impl {
|
|||||||
return ImplGetter::GetImplPointer(static_cast<ImplHolder *>(this))->NAME ARGNAMES; \
|
return ImplGetter::GetImplPointer(static_cast<ImplHolder *>(this))->NAME ARGNAMES; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define AMS_SF_DEFINE_INTERFACE(NAMESPACE, INTERFACE, CMD_MACRO) \
|
#define AMS_SF_DEFINE_INTERFACE_WITH_DEFAULT_BASE(NAMESPACE, INTERFACE, BASE, CMD_MACRO) \
|
||||||
namespace NAMESPACE { \
|
namespace NAMESPACE { \
|
||||||
\
|
\
|
||||||
AMS_SF_DEFINE_INTERFACE_IMPL(::ams::sf::IServiceObject, INTERFACE, CMD_MACRO) \
|
AMS_SF_DEFINE_INTERFACE_IMPL(BASE, INTERFACE, CMD_MACRO) \
|
||||||
\
|
\
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
@ -45,6 +45,12 @@ namespace ams::sf::impl {
|
|||||||
\
|
\
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define AMS_SF_DEFINE_INTERFACE(NAMESPACE, INTERFACE, CMD_MACRO) \
|
||||||
|
AMS_SF_DEFINE_INTERFACE_WITH_DEFAULT_BASE(NAMESPACE, INTERFACE, ::ams::sf::IServiceObject, CMD_MACRO)
|
||||||
|
|
||||||
|
#define AMS_SF_DEFINE_MITM_INTERFACE(NAMESPACE, INTERFACE, CMD_MACRO) \
|
||||||
|
AMS_SF_DEFINE_INTERFACE_WITH_DEFAULT_BASE(NAMESPACE, INTERFACE, ::ams::sf::IMitmServiceObject, CMD_MACRO)
|
||||||
|
|
||||||
#define AMS_SF_DEFINE_INTERFACE_WITH_BASE(NAMESPACE, INTERFACE, BASE, CMD_MACRO) \
|
#define AMS_SF_DEFINE_INTERFACE_WITH_BASE(NAMESPACE, INTERFACE, BASE, CMD_MACRO) \
|
||||||
namespace NAMESPACE { \
|
namespace NAMESPACE { \
|
||||||
\
|
\
|
||||||
|
@ -196,16 +196,8 @@ extern "C" {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace {
|
|
||||||
|
|
||||||
constinit ams::os::Mutex g_abort_lock(true);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Custom abort handler, so that std::abort will trigger these. */
|
/* Custom abort handler, so that std::abort will trigger these. */
|
||||||
void abort() {
|
void abort() {
|
||||||
std::scoped_lock lk(g_abort_lock);
|
|
||||||
|
|
||||||
ams::AbortImpl();
|
ams::AbortImpl();
|
||||||
__builtin_unreachable();
|
__builtin_unreachable();
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ namespace ams::fssrv::impl {
|
|||||||
/* ... */
|
/* ... */
|
||||||
}
|
}
|
||||||
|
|
||||||
StorageInterfaceAdapter::StorageInterfaceAdapter(std::shared_ptr<fs::IStorage> &&storage) : base_storage(std::move(storage)) {
|
StorageInterfaceAdapter::StorageInterfaceAdapter(std::shared_ptr<fs::IStorage> storage) : base_storage(std::move(storage)) {
|
||||||
/* ... */
|
/* ... */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user