ams: use R_SUCCEED, R_THROW globally
This commit is contained in:
@@ -44,7 +44,7 @@ namespace ams::sf::cmif {
|
||||
AMS_ABORT_UNLESS(entry->owner == nullptr);
|
||||
out_ids[i] = m_manager->m_entry_manager.GetId(entry);
|
||||
}
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
void ServerDomainManager::Domain::ReserveSpecificIds(const DomainObjectId *ids, size_t count) {
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace ams::sf::cmif {
|
||||
case CmifDomainRequestType_Close:
|
||||
/* TODO: N doesn't error check here. Should we? */
|
||||
domain->UnregisterObject(target_object_id);
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
default:
|
||||
return sf::cmif::ResultInvalidInHeader();
|
||||
}
|
||||
@@ -103,7 +103,7 @@ namespace ams::sf::cmif {
|
||||
|
||||
/* If the object is in the domain, close our copy of it. Mitm objects are required to close their associated domain id, so this shouldn't cause desynch. */
|
||||
domain->UnregisterObject(target_object_id);
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
default:
|
||||
return sf::cmif::ResultInvalidInHeader();
|
||||
@@ -125,7 +125,7 @@ namespace ams::sf::cmif {
|
||||
for (size_t i = 0; i < this->GetInObjectCount(); i++) {
|
||||
in_objects[i] = m_domain->GetObject(m_in_object_ids[i]);
|
||||
}
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
HipcRequest DomainServiceObjectProcessor::PrepareForReply(const cmif::ServiceDispatchContext &ctx, PointerAndSize &out_raw_data, const ServerMessageRuntimeMetadata runtime_metadata) {
|
||||
|
||||
@@ -117,7 +117,7 @@ namespace ams::sf::cmif {
|
||||
/* Write output header to raw data. */
|
||||
*out_header = CmifOutHeader{OutHeaderMagic, 0, command_result.GetValue(), interface_id_for_debug};
|
||||
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
#if AMS_SF_MITM_SUPPORTED
|
||||
@@ -164,7 +164,7 @@ namespace ams::sf::cmif {
|
||||
/* Write output header to raw data. */
|
||||
*out_header = CmifOutHeader{OutHeaderMagic, 0, command_result.GetValue(), interface_id_for_debug};
|
||||
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -53,26 +53,26 @@ namespace ams::sf::hipc {
|
||||
R_TRY_CATCH(ReceiveImpl(session_handle, message_buffer.GetPointer(), message_buffer.GetSize())) {
|
||||
R_CATCH(svc::ResultSessionClosed) {
|
||||
*out_recv_result = ReceiveResult::Closed;
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
R_CATCH(svc::ResultReceiveListBroken) {
|
||||
*out_recv_result = ReceiveResult::NeedsRetry;
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
} R_END_TRY_CATCH;
|
||||
*out_recv_result = ReceiveResult::Success;
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result Receive(bool *out_closed, os::NativeHandle session_handle, const cmif::PointerAndSize &message_buffer) {
|
||||
R_TRY_CATCH(ReceiveImpl(session_handle, message_buffer.GetPointer(), message_buffer.GetSize())) {
|
||||
R_CATCH(svc::ResultSessionClosed) {
|
||||
*out_closed = true;
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
} R_END_TRY_CATCH;
|
||||
*out_closed = false;
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result Reply(os::NativeHandle session_handle, const cmif::PointerAndSize &message_buffer) {
|
||||
@@ -88,7 +88,7 @@ namespace ams::sf::hipc {
|
||||
R_TRY_CATCH(svc::CreateSession(out_server_handle, out_client_handle, 0, 0)) {
|
||||
R_CONVERT(svc::ResultOutOfResource, sf::hipc::ResultOutOfSessions());
|
||||
} R_END_TRY_CATCH;
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace ams::sf::hipc {
|
||||
|
||||
/* Set output client handle. */
|
||||
out_client_handle.SetValue(client_handle, false);
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
public:
|
||||
#if AMS_SF_MITM_SUPPORTED
|
||||
@@ -113,7 +113,7 @@ namespace ams::sf::hipc {
|
||||
/* Return the allocated id. */
|
||||
AMS_ABORT_UNLESS(object_id != cmif::InvalidDomainObjectId);
|
||||
*out = object_id;
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result CopyFromCurrentDomain(sf::OutMoveHandle out, cmif::DomainObjectId object_id) {
|
||||
@@ -134,7 +134,7 @@ namespace ams::sf::hipc {
|
||||
R_TRY(cmifCopyFromCurrentDomain(util::GetReference(m_session->m_forward_service)->session, object_id.value, std::addressof(handle)));
|
||||
|
||||
out.SetValue(handle, false);
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
#else
|
||||
R_UNLESS(!!(object), sf::hipc::ResultDomainObjectNotFound());
|
||||
@@ -177,7 +177,7 @@ namespace ams::sf::hipc {
|
||||
#endif
|
||||
}
|
||||
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result CloneCurrentObject(sf::OutMoveHandle out) {
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace ams::sf::hipc {
|
||||
/* Clear future declarations if any, now that our query handler is present. */
|
||||
R_ABORT_UNLESS(sm::mitm::ClearFutureMitm(service_name));
|
||||
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -158,7 +158,7 @@ namespace ams::sf::hipc {
|
||||
} R_END_TRY_CATCH;
|
||||
}
|
||||
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result ServerManagerBase::Process(os::MultiWaitHolderType *holder) {
|
||||
|
||||
@@ -73,7 +73,7 @@ namespace ams::sf::hipc {
|
||||
}
|
||||
}
|
||||
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -102,7 +102,7 @@ namespace ams::sf::hipc {
|
||||
|
||||
/* Register to wait list. */
|
||||
this->RegisterServerSessionToWait(session_memory);
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result ServerSessionManager::AcceptSessionImpl(ServerSession *session_memory, os::NativeHandle port_handle, cmif::ServiceObjectHolder &&obj) {
|
||||
@@ -121,7 +121,7 @@ namespace ams::sf::hipc {
|
||||
R_TRY(this->RegisterSessionImpl(session_memory, session_handle, std::forward<cmif::ServiceObjectHolder>(obj)));
|
||||
|
||||
session_guard.Cancel();
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
#if AMS_SF_MITM_SUPPORTED
|
||||
@@ -141,7 +141,7 @@ namespace ams::sf::hipc {
|
||||
|
||||
/* Register to wait list. */
|
||||
this->RegisterServerSessionToWait(session_memory);
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result ServerSessionManager::AcceptMitmSessionImpl(ServerSession *session_memory, os::NativeHandle mitm_port_handle, cmif::ServiceObjectHolder &&obj, std::shared_ptr<::Service> &&fsrv) {
|
||||
@@ -157,7 +157,7 @@ namespace ams::sf::hipc {
|
||||
R_TRY(this->RegisterMitmSessionImpl(session_memory, mitm_session_handle, std::forward<cmif::ServiceObjectHolder>(obj), std::forward<std::shared_ptr<::Service>>(fsrv)));
|
||||
|
||||
session_guard.Cancel();
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -207,10 +207,10 @@ namespace ams::sf::hipc {
|
||||
switch (recv_result) {
|
||||
case hipc::ReceiveResult::Success:
|
||||
session->m_is_closed = false;
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
case hipc::ReceiveResult::Closed:
|
||||
session->m_is_closed = true;
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
case hipc::ReceiveResult::NeedsRetry:
|
||||
continue;
|
||||
AMS_UNREACHABLE_DEFAULT_CASE();
|
||||
@@ -231,14 +231,14 @@ namespace ams::sf::hipc {
|
||||
Result ServerSessionManager::ProcessRequest(ServerSession *session, const cmif::PointerAndSize &message) {
|
||||
if (session->m_is_closed) {
|
||||
this->CloseSessionImpl(session);
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
switch (GetCmifCommandType(message)) {
|
||||
case CmifCommandType_Close:
|
||||
{
|
||||
this->CloseSessionImpl(session);
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
default:
|
||||
{
|
||||
@@ -250,13 +250,13 @@ namespace ams::sf::hipc {
|
||||
R_CATCH_ALL() {
|
||||
/* All other results indicate something went very wrong. */
|
||||
this->CloseSessionImpl(session);
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
} R_END_TRY_CATCH;
|
||||
|
||||
/* We succeeded, so we can process future messages on this session. */
|
||||
this->RegisterServerSessionToWait(session);
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -297,7 +297,7 @@ namespace ams::sf::hipc {
|
||||
Result ServerSessionManager::DispatchManagerRequest(ServerSession *session, const cmif::PointerAndSize &in_message, const cmif::PointerAndSize &out_message) {
|
||||
/* This will get overridden by ... WithDomain class. */
|
||||
AMS_UNUSED(session, in_message, out_message);
|
||||
return sf::ResultNotSupported();
|
||||
R_THROW(sf::ResultNotSupported());
|
||||
}
|
||||
|
||||
Result ServerSessionManager::DispatchRequest(cmif::ServiceObjectHolder &&obj_holder, ServerSession *session, const cmif::PointerAndSize &in_message, const cmif::PointerAndSize &out_message) {
|
||||
@@ -342,7 +342,7 @@ namespace ams::sf::hipc {
|
||||
R_TRY(hipc::Reply(session->m_session_handle, out_message));
|
||||
}
|
||||
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user