ams: globally prefer R_RETURN to return for ams::Result
This commit is contained in:
@@ -19,7 +19,7 @@ namespace ams::capsrv {
|
||||
|
||||
Result InitializeScreenShotControl() {
|
||||
#if defined(ATMOSPHERE_OS_HORIZON)
|
||||
return ::capsscInitialize();
|
||||
R_RETURN(::capsscInitialize());
|
||||
#else
|
||||
AMS_ABORT("TODO");
|
||||
#endif
|
||||
@@ -35,7 +35,7 @@ namespace ams::capsrv {
|
||||
|
||||
Result CaptureJpegScreenshot(u64 *out_size, void *dst, size_t dst_size, vi::LayerStack layer_stack, TimeSpan timeout) {
|
||||
#if defined(ATMOSPHERE_OS_HORIZON)
|
||||
return ::capsscCaptureJpegScreenShot(out_size, dst, dst_size, static_cast<::ViLayerStack>(layer_stack), timeout.GetNanoSeconds());
|
||||
R_RETURN(::capsscCaptureJpegScreenShot(out_size, dst, dst_size, static_cast<::ViLayerStack>(layer_stack), timeout.GetNanoSeconds()));
|
||||
#else
|
||||
AMS_UNUSED(out_size, dst, dst_size, layer_stack, timeout);
|
||||
AMS_ABORT("TODO");
|
||||
|
||||
@@ -75,7 +75,7 @@ namespace ams::capsrv::server {
|
||||
size_t work_size = sizeof(g_work_memory.jpeg_decoder_memory);
|
||||
|
||||
/* Call the decoder implementation. */
|
||||
return DecodeJpegImpl(out.GetPointer(), out.GetSize(), in.GetPointer(), in.GetSize(), width, height, option, work, work_size);
|
||||
R_RETURN(DecodeJpegImpl(out.GetPointer(), out.GetSize(), in.GetPointer(), in.GetSize(), width, height, option, work, work_size));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -42,7 +42,7 @@ namespace ams::dd {
|
||||
}
|
||||
|
||||
Result CreateDeviceAddressSpace(DeviceAddressSpaceType *das, u64 size) {
|
||||
return CreateDeviceAddressSpace(das, 0, size);
|
||||
R_RETURN(CreateDeviceAddressSpace(das, 0, size));
|
||||
}
|
||||
|
||||
void DestroyDeviceAddressSpace(DeviceAddressSpaceType *das) {
|
||||
@@ -86,7 +86,7 @@ namespace ams::dd {
|
||||
AMS_ASSERT(size > 0);
|
||||
AMS_ASSERT((process_address & (4_MB - 1)) == (device_address & (4_MB - 1)));
|
||||
|
||||
return impl::DeviceAddressSpaceImpl::MapAligned(das->device_handle, process_handle, process_address, size, device_address, device_perm);
|
||||
R_RETURN(impl::DeviceAddressSpaceImpl::MapAligned(das->device_handle, process_handle, process_address, size, device_address, device_perm));
|
||||
}
|
||||
|
||||
Result MapDeviceAddressSpaceNotAligned(DeviceAddressSpaceType *das, ProcessHandle process_handle, u64 process_address, size_t size, DeviceVirtualAddress device_address, MemoryPermission device_perm) {
|
||||
@@ -99,7 +99,7 @@ namespace ams::dd {
|
||||
AMS_ASSERT(device_address + size > device_address);
|
||||
AMS_ASSERT(size > 0);
|
||||
|
||||
return impl::DeviceAddressSpaceImpl::MapNotAligned(das->device_handle, process_handle, process_address, size, device_address, device_perm);
|
||||
R_RETURN(impl::DeviceAddressSpaceImpl::MapNotAligned(das->device_handle, process_handle, process_address, size, device_address, device_perm));
|
||||
}
|
||||
|
||||
void UnmapDeviceAddressSpace(DeviceAddressSpaceType *das, ProcessHandle process_handle, u64 process_address, size_t size, DeviceVirtualAddress device_address) {
|
||||
@@ -119,7 +119,7 @@ namespace ams::dd {
|
||||
/* Check pre-conditions. */
|
||||
AMS_ASSERT(das->state == DeviceAddressSpaceType::State_Initialized);
|
||||
|
||||
return impl::DeviceAddressSpaceImpl::Attach(das, device_name);
|
||||
R_RETURN(impl::DeviceAddressSpaceImpl::Attach(das, device_name));
|
||||
}
|
||||
|
||||
void DetachDeviceAddressSpace(DeviceAddressSpaceType *das, DeviceName device_name) {
|
||||
|
||||
@@ -46,18 +46,18 @@ namespace ams::erpt::srv {
|
||||
|
||||
Result Attachment::Open(AttachmentOpenType type) {
|
||||
switch (type) {
|
||||
case AttachmentOpenType_Create: return this->OpenStream(this->FileName().name, StreamMode_Write, AttachmentStreamBufferSize);
|
||||
case AttachmentOpenType_Read: return this->OpenStream(this->FileName().name, StreamMode_Read, AttachmentStreamBufferSize);
|
||||
case AttachmentOpenType_Create: R_RETURN(this->OpenStream(this->FileName().name, StreamMode_Write, AttachmentStreamBufferSize));
|
||||
case AttachmentOpenType_Read: R_RETURN(this->OpenStream(this->FileName().name, StreamMode_Read, AttachmentStreamBufferSize));
|
||||
default: R_THROW(erpt::ResultInvalidArgument());
|
||||
}
|
||||
}
|
||||
|
||||
Result Attachment::Read(u32 *out_read_count, u8 *dst, u32 dst_size) {
|
||||
return this->ReadStream(out_read_count, dst, dst_size);
|
||||
R_RETURN(this->ReadStream(out_read_count, dst, dst_size));
|
||||
}
|
||||
|
||||
Result Attachment::Delete() {
|
||||
return this->DeleteStream(this->FileName().name);
|
||||
R_RETURN(this->DeleteStream(this->FileName().name));
|
||||
}
|
||||
|
||||
void Attachment::Close() {
|
||||
@@ -72,13 +72,13 @@ namespace ams::erpt::srv {
|
||||
Result Attachment::SetFlags(AttachmentFlagSet flags) {
|
||||
if (((~m_record->m_info.flags) & flags).IsAnySet()) {
|
||||
m_record->m_info.flags |= flags;
|
||||
return Journal::Commit();
|
||||
R_RETURN(Journal::Commit());
|
||||
}
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result Attachment::GetSize(s64 *out) const {
|
||||
return this->GetStreamSize(out);
|
||||
R_RETURN(this->GetStreamSize(out));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -50,12 +50,12 @@ namespace ams::erpt::srv {
|
||||
|
||||
template<typename T>
|
||||
Result Write(T val) {
|
||||
return this->WriteStream(reinterpret_cast<const u8 *>(std::addressof(val)), sizeof(val));
|
||||
R_RETURN(this->WriteStream(reinterpret_cast<const u8 *>(std::addressof(val)), sizeof(val)));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
Result Write(const T *buf, u32 buffer_size) {
|
||||
return this->WriteStream(reinterpret_cast<const u8 *>(buf), buffer_size);
|
||||
R_RETURN(this->WriteStream(reinterpret_cast<const u8 *>(buf), buffer_size));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -46,19 +46,19 @@ namespace ams::erpt::srv {
|
||||
Result AttachmentImpl::Read(ams::sf::Out<u32> out_count, const ams::sf::OutBuffer &out_buffer) {
|
||||
R_UNLESS(m_attachment != nullptr, erpt::ResultNotInitialized());
|
||||
|
||||
return m_attachment->Read(out_count.GetPointer(), static_cast<u8 *>(out_buffer.GetPointer()), static_cast<u32>(out_buffer.GetSize()));
|
||||
R_RETURN(m_attachment->Read(out_count.GetPointer(), static_cast<u8 *>(out_buffer.GetPointer()), static_cast<u32>(out_buffer.GetSize())));
|
||||
}
|
||||
|
||||
Result AttachmentImpl::SetFlags(AttachmentFlagSet flags) {
|
||||
R_UNLESS(m_attachment != nullptr, erpt::ResultNotInitialized());
|
||||
|
||||
return m_attachment->SetFlags(flags);
|
||||
R_RETURN(m_attachment->SetFlags(flags));
|
||||
}
|
||||
|
||||
Result AttachmentImpl::GetFlags(ams::sf::Out<AttachmentFlagSet> out) {
|
||||
R_UNLESS(m_attachment != nullptr, erpt::ResultNotInitialized());
|
||||
|
||||
return m_attachment->GetFlags(out.GetPointer());
|
||||
R_RETURN(m_attachment->GetFlags(out.GetPointer()));
|
||||
}
|
||||
|
||||
Result AttachmentImpl::Close() {
|
||||
@@ -73,7 +73,7 @@ namespace ams::erpt::srv {
|
||||
Result AttachmentImpl::GetSize(ams::sf::Out<s64> out) {
|
||||
R_UNLESS(m_attachment != nullptr, erpt::ResultNotInitialized());
|
||||
|
||||
return m_attachment->GetSize(out.GetPointer());
|
||||
R_RETURN(m_attachment->GetSize(out.GetPointer()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -59,14 +59,14 @@ namespace ams::erpt::srv {
|
||||
|
||||
ON_SCOPE_EXIT { std::memset(hdr, 0, sizeof(hdr) + data_size); s_need_to_store_cipher = true; };
|
||||
|
||||
return Formatter::AddField(report, field_id, reinterpret_cast<u8 *>(hdr), sizeof(hdr) + data_size);
|
||||
R_RETURN(Formatter::AddField(report, field_id, reinterpret_cast<u8 *>(hdr), sizeof(hdr) + data_size));
|
||||
}
|
||||
public:
|
||||
static Result Begin(Report *report, u32 record_count) {
|
||||
s_need_to_store_cipher = false;
|
||||
crypto::GenerateCryptographicallyRandomBytes(s_key, sizeof(s_key));
|
||||
|
||||
return Formatter::Begin(report, record_count + 1);
|
||||
R_RETURN(Formatter::Begin(report, record_count + 1));
|
||||
}
|
||||
|
||||
static Result End(Report *report) {
|
||||
@@ -84,40 +84,40 @@ namespace ams::erpt::srv {
|
||||
Formatter::AddField(report, FieldId_CipherKey, cipher, sizeof(cipher));
|
||||
std::memset(s_key, 0, sizeof(s_key));
|
||||
|
||||
return Formatter::End(report);
|
||||
R_RETURN(Formatter::End(report));
|
||||
}
|
||||
|
||||
static Result AddField(Report *report, FieldId field_id, bool value) {
|
||||
return Formatter::AddField(report, field_id, value);
|
||||
R_RETURN(Formatter::AddField(report, field_id, value));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
static Result AddField(Report *report, FieldId field_id, T value) {
|
||||
return Formatter::AddField<T>(report, field_id, value);
|
||||
R_RETURN(Formatter::AddField<T>(report, field_id, value));
|
||||
}
|
||||
|
||||
static Result AddField(Report *report, FieldId field_id, char *str, u32 len) {
|
||||
if (FieldToFlagMap[field_id] == FieldFlag_Encrypt) {
|
||||
return EncryptArray<char>(report, field_id, str, len);
|
||||
R_RETURN(EncryptArray<char>(report, field_id, str, len));
|
||||
} else {
|
||||
return Formatter::AddField(report, field_id, str, len);
|
||||
R_RETURN(Formatter::AddField(report, field_id, str, len));
|
||||
}
|
||||
}
|
||||
|
||||
static Result AddField(Report *report, FieldId field_id, u8 *bin, u32 len) {
|
||||
if (FieldToFlagMap[field_id] == FieldFlag_Encrypt) {
|
||||
return EncryptArray<u8>(report, field_id, bin, len);
|
||||
R_RETURN(EncryptArray<u8>(report, field_id, bin, len));
|
||||
} else {
|
||||
return Formatter::AddField(report, field_id, bin, len);
|
||||
R_RETURN(Formatter::AddField(report, field_id, bin, len));
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
static Result AddField(Report *report, FieldId field_id, T *arr, u32 len) {
|
||||
if (FieldToFlagMap[field_id] == FieldFlag_Encrypt) {
|
||||
return EncryptArray<T>(report, field_id, arr, len);
|
||||
R_RETURN(EncryptArray<T>(report, field_id, arr, len));
|
||||
} else {
|
||||
return Formatter::AddField<T>(report, field_id, arr, len);
|
||||
R_RETURN(Formatter::AddField<T>(report, field_id, arr, len));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -100,7 +100,7 @@ namespace ams::erpt::srv {
|
||||
});
|
||||
R_UNLESS(it != g_category_list.end(), erpt::ResultCategoryNotFound());
|
||||
|
||||
return it->AddContextToCategory(entry, data, data_size);
|
||||
R_RETURN(it->AddContextToCategory(entry, data, data_size));
|
||||
}
|
||||
|
||||
Result Context::SubmitContextRecord(std::unique_ptr<ContextRecord> record) {
|
||||
@@ -109,7 +109,7 @@ namespace ams::erpt::srv {
|
||||
});
|
||||
R_UNLESS(it != g_category_list.end(), erpt::ResultCategoryNotFound());
|
||||
|
||||
return it->AddContextRecordToCategory(std::move(record));
|
||||
R_RETURN(it->AddContextRecordToCategory(std::move(record)));
|
||||
}
|
||||
|
||||
Result Context::WriteContextsToReport(Report *report) {
|
||||
@@ -132,7 +132,7 @@ namespace ams::erpt::srv {
|
||||
R_UNLESS(record != nullptr, erpt::ResultOutOfMemory());
|
||||
|
||||
/* Submit the context record. */
|
||||
return SubmitContextRecord(std::move(record));
|
||||
R_RETURN(SubmitContextRecord(std::move(record)));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace ams::erpt::srv {
|
||||
|
||||
SubmitContextForForcedShutdownDetection(ctx, data, data_size);
|
||||
|
||||
return Context::SubmitContext(ctx, data, data_size);
|
||||
R_RETURN(Context::SubmitContext(ctx, data, data_size));
|
||||
}
|
||||
|
||||
Result ContextImpl::CreateReport(ReportType report_type, const ams::sf::InBuffer &ctx_buffer, const ams::sf::InBuffer &data_buffer, const ams::sf::InBuffer &meta_buffer, Result result) {
|
||||
@@ -58,7 +58,7 @@ namespace ams::erpt::srv {
|
||||
}
|
||||
|
||||
Result ContextImpl::CreateReportV0(ReportType report_type, const ams::sf::InBuffer &ctx_buffer, const ams::sf::InBuffer &data_buffer, const ams::sf::InBuffer &meta_buffer) {
|
||||
return this->CreateReport(report_type, ctx_buffer, data_buffer, meta_buffer, ResultSuccess());
|
||||
R_RETURN(this->CreateReport(report_type, ctx_buffer, data_buffer, meta_buffer, ResultSuccess()));
|
||||
}
|
||||
|
||||
Result ContextImpl::SetInitialLaunchSettingsCompletionTime(const time::SteadyClockTimePoint &time_point) {
|
||||
@@ -135,7 +135,7 @@ namespace ams::erpt::srv {
|
||||
char name_safe[AttachmentNameSizeMax];
|
||||
util::Strlcpy(name_safe, name, sizeof(name_safe));
|
||||
|
||||
return JournalForAttachments::SubmitAttachment(out.GetPointer(), name_safe, data, data_size);
|
||||
R_RETURN(JournalForAttachments::SubmitAttachment(out.GetPointer(), name_safe, data, data_size));
|
||||
}
|
||||
|
||||
Result ContextImpl::CreateReportWithAttachments(ReportType report_type, const ams::sf::InBuffer &ctx_buffer, const ams::sf::InBuffer &data_buffer, const ams::sf::InBuffer &attachment_ids_buffer, Result result) {
|
||||
@@ -158,19 +158,19 @@ namespace ams::erpt::srv {
|
||||
}
|
||||
|
||||
Result ContextImpl::CreateReportWithAttachmentsDeprecated(ReportType report_type, const ams::sf::InBuffer &ctx_buffer, const ams::sf::InBuffer &data_buffer, const ams::sf::InBuffer &attachment_ids_buffer) {
|
||||
return this->CreateReportWithAttachments(report_type, ctx_buffer, data_buffer, attachment_ids_buffer, ResultSuccess());
|
||||
R_RETURN(this->CreateReportWithAttachments(report_type, ctx_buffer, data_buffer, attachment_ids_buffer, ResultSuccess()));
|
||||
}
|
||||
|
||||
Result ContextImpl::RegisterRunningApplet(ncm::ProgramId program_id) {
|
||||
return Reporter::RegisterRunningApplet(program_id);
|
||||
R_RETURN(Reporter::RegisterRunningApplet(program_id));
|
||||
}
|
||||
|
||||
Result ContextImpl::UnregisterRunningApplet(ncm::ProgramId program_id) {
|
||||
return Reporter::UnregisterRunningApplet(program_id);
|
||||
R_RETURN(Reporter::UnregisterRunningApplet(program_id));
|
||||
}
|
||||
|
||||
Result ContextImpl::UpdateAppletSuspendedDuration(ncm::ProgramId program_id, TimeSpanType duration) {
|
||||
return Reporter::UpdateAppletSuspendedDuration(program_id, duration);
|
||||
R_RETURN(Reporter::UpdateAppletSuspendedDuration(program_id, duration));
|
||||
}
|
||||
|
||||
Result ContextImpl::InvalidateForcedShutdownDetection() {
|
||||
|
||||
@@ -202,11 +202,11 @@ namespace ams::erpt::srv {
|
||||
}
|
||||
|
||||
Result ContextRecord::Add(FieldId field_id, const char *str, u32 str_size) {
|
||||
return this->Add(field_id, str, str_size, FieldType_String);
|
||||
R_RETURN(this->Add(field_id, str, str_size, FieldType_String));
|
||||
}
|
||||
|
||||
Result ContextRecord::Add(FieldId field_id, const u8 *data, u32 size) {
|
||||
return this->Add(field_id, data, size, FieldType_U8Array);
|
||||
R_RETURN(this->Add(field_id, data, size, FieldType_U8Array));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -138,12 +138,12 @@ namespace ams::erpt::srv {
|
||||
|
||||
template<typename T>
|
||||
static Result AddField(Report *report, FieldId field_id, T value) {
|
||||
return AddIdValuePair<T>(report, field_id, value);
|
||||
R_RETURN(AddIdValuePair<T>(report, field_id, value));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
static Result AddField(Report *report, FieldId field_id, T *arr, u32 arr_size) {
|
||||
return AddIdValueArray(report, field_id, arr, arr_size);
|
||||
R_RETURN(AddIdValueArray(report, field_id, arr, arr_size));
|
||||
}
|
||||
|
||||
static Result AddField(Report *report, FieldId field_id, bool value) {
|
||||
|
||||
@@ -48,11 +48,11 @@ namespace ams::erpt::srv {
|
||||
}
|
||||
|
||||
Result Journal::Delete(ReportId report_id) {
|
||||
return JournalForReports::DeleteReport(report_id);
|
||||
R_RETURN(JournalForReports::DeleteReport(report_id));
|
||||
}
|
||||
|
||||
Result Journal::GetAttachmentList(AttachmentList *out, ReportId report_id) {
|
||||
return JournalForAttachments::GetAttachmentList(out, report_id);
|
||||
R_RETURN(JournalForAttachments::GetAttachmentList(out, report_id));
|
||||
}
|
||||
|
||||
util::Uuid Journal::GetJournalId() {
|
||||
@@ -64,7 +64,7 @@ namespace ams::erpt::srv {
|
||||
}
|
||||
|
||||
Result Journal::GetReportList(ReportList *out, ReportType type_filter) {
|
||||
return JournalForReports::GetReportList(out, type_filter);
|
||||
R_RETURN(JournalForReports::GetReportList(out, type_filter));
|
||||
}
|
||||
|
||||
u32 Journal::GetStoredReportCount(ReportType type) {
|
||||
@@ -109,11 +109,11 @@ namespace ams::erpt::srv {
|
||||
}
|
||||
|
||||
Result Journal::Store(JournalRecord<ReportInfo> *record) {
|
||||
return JournalForReports::StoreRecord(record);
|
||||
R_RETURN(JournalForReports::StoreRecord(record));
|
||||
}
|
||||
|
||||
Result Journal::Store(JournalRecord<AttachmentInfo> *record) {
|
||||
return JournalForAttachments::StoreRecord(record);
|
||||
R_RETURN(JournalForAttachments::StoreRecord(record));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace ams::erpt::srv {
|
||||
}
|
||||
|
||||
Result JournalForMeta::CommitJournal(Stream *stream) {
|
||||
return stream->WriteStream(reinterpret_cast<const u8 *>(std::addressof(s_journal_meta)), sizeof(s_journal_meta));
|
||||
R_RETURN(stream->WriteStream(reinterpret_cast<const u8 *>(std::addressof(s_journal_meta)), sizeof(s_journal_meta)));
|
||||
}
|
||||
|
||||
Result JournalForMeta::RestoreJournal(Stream *stream) {
|
||||
|
||||
@@ -123,11 +123,11 @@ namespace ams::erpt::srv {
|
||||
/* NOTE: Nintendo does not check error code here. */
|
||||
InitializeForcedShutdownDetection();
|
||||
|
||||
return InitializeService();
|
||||
R_RETURN(InitializeService());
|
||||
}
|
||||
|
||||
Result SetSerialNumberAndOsVersion(const char *sn, u32 sn_len, const char *os, u32 os_len, const char *os_priv, u32 os_priv_len) {
|
||||
return Reporter::SetSerialNumberAndOsVersion(sn, sn_len, os, os_len, os_priv, os_priv_len);
|
||||
R_RETURN(Reporter::SetSerialNumberAndOsVersion(sn, sn_len, os, os_len, os_priv, os_priv_len));
|
||||
}
|
||||
|
||||
Result SetProductModel(const char *model, u32 model_len) {
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace ams::erpt::srv {
|
||||
Result ManagerImpl::GetReportList(const ams::sf::OutBuffer &out_list, ReportType type_filter) {
|
||||
R_UNLESS(out_list.GetSize() == sizeof(ReportList), erpt::ResultInvalidArgument());
|
||||
|
||||
return Journal::GetReportList(reinterpret_cast<ReportList *>(out_list.GetPointer()), type_filter);
|
||||
R_RETURN(Journal::GetReportList(reinterpret_cast<ReportList *>(out_list.GetPointer()), type_filter));
|
||||
}
|
||||
|
||||
Result ManagerImpl::GetEvent(ams::sf::OutCopyHandle out) {
|
||||
@@ -60,12 +60,12 @@ namespace ams::erpt::srv {
|
||||
Result ManagerImpl::CleanupReports() {
|
||||
Journal::CleanupReports();
|
||||
Journal::CleanupAttachments();
|
||||
return Journal::Commit();
|
||||
R_RETURN(Journal::Commit());
|
||||
}
|
||||
|
||||
Result ManagerImpl::DeleteReport(const ReportId &report_id) {
|
||||
R_TRY(Journal::Delete(report_id));
|
||||
return Journal::Commit();
|
||||
R_RETURN(Journal::Commit());
|
||||
}
|
||||
|
||||
Result ManagerImpl::GetStorageUsageStatistics(ams::sf::Out<StorageUsageStatistics> out) {
|
||||
@@ -89,7 +89,7 @@ namespace ams::erpt::srv {
|
||||
Result ManagerImpl::GetAttachmentList(const ams::sf::OutBuffer &out_list, const ReportId &report_id) {
|
||||
R_UNLESS(out_list.GetSize() == sizeof(AttachmentList), erpt::ResultInvalidArgument());
|
||||
|
||||
return Journal::GetAttachmentList(reinterpret_cast<AttachmentList *>(out_list.GetPointer()), report_id);
|
||||
R_RETURN(Journal::GetAttachmentList(reinterpret_cast<AttachmentList *>(out_list.GetPointer()), report_id));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -52,18 +52,18 @@ namespace ams::erpt::srv {
|
||||
|
||||
Result Report::Open(ReportOpenType type) {
|
||||
switch (type) {
|
||||
case ReportOpenType_Create: return this->OpenStream(this->FileName().name, StreamMode_Write, ReportStreamBufferSize);
|
||||
case ReportOpenType_Read: return this->OpenStream(this->FileName().name, StreamMode_Read, ReportStreamBufferSize);
|
||||
case ReportOpenType_Create: R_RETURN(this->OpenStream(this->FileName().name, StreamMode_Write, ReportStreamBufferSize));
|
||||
case ReportOpenType_Read: R_RETURN(this->OpenStream(this->FileName().name, StreamMode_Read, ReportStreamBufferSize));
|
||||
default: R_THROW(erpt::ResultInvalidArgument());
|
||||
}
|
||||
}
|
||||
|
||||
Result Report::Read(u32 *out_read_count, u8 *dst, u32 dst_size) {
|
||||
return this->ReadStream(out_read_count, dst, dst_size);
|
||||
R_RETURN(this->ReadStream(out_read_count, dst, dst_size));
|
||||
}
|
||||
|
||||
Result Report::Delete() {
|
||||
return this->DeleteStream(this->FileName().name);
|
||||
R_RETURN(this->DeleteStream(this->FileName().name));
|
||||
}
|
||||
|
||||
void Report::Close() {
|
||||
@@ -78,13 +78,13 @@ namespace ams::erpt::srv {
|
||||
Result Report::SetFlags(ReportFlagSet flags) {
|
||||
if (((~m_record->m_info.flags) & flags).IsAnySet()) {
|
||||
m_record->m_info.flags |= flags;
|
||||
return Journal::Commit();
|
||||
R_RETURN(Journal::Commit());
|
||||
}
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result Report::GetSize(s64 *out) const {
|
||||
return this->GetStreamSize(out);
|
||||
R_RETURN(this->GetStreamSize(out));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -51,12 +51,12 @@ namespace ams::erpt::srv {
|
||||
|
||||
template<typename T>
|
||||
Result Write(T val) {
|
||||
return this->WriteStream(reinterpret_cast<const u8 *>(std::addressof(val)), sizeof(val));
|
||||
R_RETURN(this->WriteStream(reinterpret_cast<const u8 *>(std::addressof(val)), sizeof(val)));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
Result Write(const T *buf, u32 buffer_size) {
|
||||
return this->WriteStream(reinterpret_cast<const u8 *>(buf), buffer_size);
|
||||
R_RETURN(this->WriteStream(reinterpret_cast<const u8 *>(buf), buffer_size));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -46,19 +46,19 @@ namespace ams::erpt::srv {
|
||||
Result ReportImpl::Read(ams::sf::Out<u32> out_count, const ams::sf::OutBuffer &out_buffer) {
|
||||
R_UNLESS(m_report != nullptr, erpt::ResultNotInitialized());
|
||||
|
||||
return m_report->Read(out_count.GetPointer(), static_cast<u8 *>(out_buffer.GetPointer()), static_cast<u32>(out_buffer.GetSize()));
|
||||
R_RETURN(m_report->Read(out_count.GetPointer(), static_cast<u8 *>(out_buffer.GetPointer()), static_cast<u32>(out_buffer.GetSize())));
|
||||
}
|
||||
|
||||
Result ReportImpl::SetFlags(ReportFlagSet flags) {
|
||||
R_UNLESS(m_report != nullptr, erpt::ResultNotInitialized());
|
||||
|
||||
return m_report->SetFlags(flags);
|
||||
R_RETURN(m_report->SetFlags(flags));
|
||||
}
|
||||
|
||||
Result ReportImpl::GetFlags(ams::sf::Out<ReportFlagSet> out) {
|
||||
R_UNLESS(m_report != nullptr, erpt::ResultNotInitialized());
|
||||
|
||||
return m_report->GetFlags(out.GetPointer());
|
||||
R_RETURN(m_report->GetFlags(out.GetPointer()));
|
||||
}
|
||||
|
||||
Result ReportImpl::Close() {
|
||||
@@ -73,7 +73,7 @@ namespace ams::erpt::srv {
|
||||
Result ReportImpl::GetSize(ams::sf::Out<s64> out) {
|
||||
R_UNLESS(m_report != nullptr, erpt::ResultNotInitialized());
|
||||
|
||||
return m_report->GetSize(out.GetPointer());
|
||||
R_RETURN(m_report->GetSize(out.GetPointer()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -422,7 +422,7 @@ namespace ams::erpt::srv {
|
||||
R_TRY(record->Initialize(ctx, data, data_size));
|
||||
|
||||
/* Create the report. */
|
||||
return CreateReport(type, ctx_result, std::move(record), meta, attachments, num_attachments);
|
||||
R_RETURN(CreateReport(type, ctx_result, std::move(record), meta, attachments, num_attachments));
|
||||
}
|
||||
|
||||
Result Reporter::CreateReport(ReportType type, Result ctx_result, std::unique_ptr<ContextRecord> record, const ReportMetaData *meta, const AttachmentId *attachments, u32 num_attachments) {
|
||||
|
||||
@@ -66,10 +66,10 @@ namespace ams::erpt::srv {
|
||||
{
|
||||
auto intf = ams::sf::ObjectFactory<ams::sf::ExpHeapAllocator::Policy>::CreateSharedEmplaced<erpt::sf::ISession, erpt::srv::SessionImpl>(std::addressof(g_sf_allocator));
|
||||
AMS_ABORT_UNLESS(intf != nullptr);
|
||||
return this->AcceptImpl(server, intf);
|
||||
R_RETURN(this->AcceptImpl(server, intf));
|
||||
}
|
||||
case PortIndex_Context:
|
||||
return AcceptImpl(server, m_context_session_object.GetShared());
|
||||
R_RETURN(AcceptImpl(server, m_context_session_object.GetShared()));
|
||||
default:
|
||||
R_THROW(erpt::ResultNotSupported());
|
||||
}
|
||||
@@ -144,7 +144,7 @@ namespace ams::erpt::srv {
|
||||
|
||||
Result InitializeService() {
|
||||
util::ConstructAt(g_erpt_server_manager);
|
||||
return util::GetReference(g_erpt_server_manager).Initialize();
|
||||
R_RETURN(util::GetReference(g_erpt_server_manager).Initialize());
|
||||
}
|
||||
|
||||
void WaitService() {
|
||||
|
||||
@@ -39,15 +39,15 @@ namespace ams::erpt::srv {
|
||||
}
|
||||
|
||||
Result SessionImpl::OpenReport(ams::sf::Out<ams::sf::SharedPointer<erpt::sf::IReport>> out) {
|
||||
return OpenInterface<erpt::sf::IReport, ReportImpl>(out);
|
||||
R_RETURN((OpenInterface<erpt::sf::IReport, ReportImpl>(out)));
|
||||
}
|
||||
|
||||
Result SessionImpl::OpenManager(ams::sf::Out<ams::sf::SharedPointer<erpt::sf::IManager>> out) {
|
||||
return OpenInterface<erpt::sf::IManager, ManagerImpl>(out);
|
||||
R_RETURN((OpenInterface<erpt::sf::IManager, ManagerImpl>(out)));
|
||||
}
|
||||
|
||||
Result SessionImpl::OpenAttachment(ams::sf::Out<ams::sf::SharedPointer<erpt::sf::IAttachment>> out) {
|
||||
return OpenInterface<erpt::sf::IAttachment, AttachmentImpl>(out);
|
||||
R_RETURN((OpenInterface<erpt::sf::IAttachment, AttachmentImpl>(out)));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace ams::erpt::srv {
|
||||
|
||||
Result Stream::DeleteStream(const char *path) {
|
||||
R_UNLESS(s_can_access_fs, erpt::ResultInvalidPowerState());
|
||||
return fs::DeleteFile(path);
|
||||
R_RETURN(fs::DeleteFile(path));
|
||||
}
|
||||
|
||||
Result Stream::CommitStream() {
|
||||
@@ -47,7 +47,7 @@ namespace ams::erpt::srv {
|
||||
R_TRY(fs::OpenFile(std::addressof(file), path, fs::OpenMode_Read));
|
||||
ON_SCOPE_EXIT { fs::CloseFile(file); };
|
||||
|
||||
return fs::GetFileSize(out, file);
|
||||
R_RETURN(fs::GetFileSize(out, file));
|
||||
}
|
||||
|
||||
Stream::Stream() : m_buffer_size(0), m_file_position(0), m_buffer_count(0), m_buffer(nullptr), m_stream_mode(StreamMode_Invalid), m_initialized(false) {
|
||||
@@ -206,7 +206,7 @@ namespace ams::erpt::srv {
|
||||
}
|
||||
|
||||
Result Stream::GetStreamSize(s64 *out) const {
|
||||
return GetStreamSize(out, m_file_name);
|
||||
R_RETURN(GetStreamSize(out, m_file_name));
|
||||
}
|
||||
|
||||
Result Stream::Flush() {
|
||||
|
||||
@@ -74,7 +74,7 @@ namespace ams::fs {
|
||||
.dir = InvalidPosition,
|
||||
.file = InvalidPosition,
|
||||
};
|
||||
return m_dir_table.Add(std::addressof(root_pos), root_key, root_entry);
|
||||
R_RETURN(m_dir_table.Add(std::addressof(root_pos), root_key, root_entry));
|
||||
}
|
||||
|
||||
Result HierarchicalRomFileTable::CreateDirectory(RomDirectoryId *out, const RomPathChar *path, const DirectoryInfo &info) {
|
||||
@@ -213,7 +213,7 @@ namespace ams::fs {
|
||||
EntryKey key = {};
|
||||
R_TRY(this->FindDirectoryRecursive(std::addressof(key), std::addressof(parent_entry), path));
|
||||
|
||||
return this->GetDirectoryInformation(out, key);
|
||||
R_RETURN(this->GetDirectoryInformation(out, key));
|
||||
}
|
||||
|
||||
Result HierarchicalRomFileTable::GetDirectoryInformation(DirectoryInfo *out, RomDirectoryId id) {
|
||||
@@ -235,7 +235,7 @@ namespace ams::fs {
|
||||
EntryKey key = {};
|
||||
R_TRY(this->FindFileRecursive(std::addressof(key), std::addressof(parent_entry), path));
|
||||
|
||||
return this->OpenFile(out, key);
|
||||
R_RETURN(this->OpenFile(out, key));
|
||||
}
|
||||
|
||||
Result HierarchicalRomFileTable::OpenFile(FileInfo *out, RomFileId id) {
|
||||
@@ -256,7 +256,7 @@ namespace ams::fs {
|
||||
EntryKey key = {};
|
||||
R_TRY(this->FindDirectoryRecursive(std::addressof(key), std::addressof(parent_entry), path));
|
||||
|
||||
return this->FindOpen(out, key);
|
||||
R_RETURN(this->FindOpen(out, key));
|
||||
}
|
||||
|
||||
Result HierarchicalRomFileTable::FindOpen(FindPosition *out, RomDirectoryId id) {
|
||||
@@ -442,7 +442,7 @@ namespace ams::fs {
|
||||
AMS_ASSERT(out_dir_entry != nullptr);
|
||||
AMS_ASSERT(path != nullptr);
|
||||
|
||||
return this->FindPathRecursive(out_key, out_dir_entry, true, path);
|
||||
R_RETURN(this->FindPathRecursive(out_key, out_dir_entry, true, path));
|
||||
}
|
||||
|
||||
Result HierarchicalRomFileTable::FindFileRecursive(EntryKey *out_key, RomDirectoryEntry *out_dir_entry, const RomPathChar *path) {
|
||||
@@ -450,7 +450,7 @@ namespace ams::fs {
|
||||
AMS_ASSERT(out_dir_entry != nullptr);
|
||||
AMS_ASSERT(path != nullptr);
|
||||
|
||||
return this->FindPathRecursive(out_key, out_dir_entry, false, path);
|
||||
R_RETURN(this->FindPathRecursive(out_key, out_dir_entry, false, path));
|
||||
}
|
||||
|
||||
Result HierarchicalRomFileTable::CheckSameEntryExists(const EntryKey &key, Result if_exists) {
|
||||
@@ -461,7 +461,7 @@ namespace ams::fs {
|
||||
const Result get_res = m_dir_table.Get(std::addressof(pos), std::addressof(entry), key);
|
||||
if (!fs::ResultDbmKeyNotFound::Includes(get_res)) {
|
||||
R_TRY(get_res);
|
||||
return if_exists;
|
||||
R_RETURN(if_exists);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -472,7 +472,7 @@ namespace ams::fs {
|
||||
const Result get_res = m_file_table.Get(std::addressof(pos), std::addressof(entry), key);
|
||||
if (!fs::ResultDbmKeyNotFound::Includes(get_res)) {
|
||||
R_TRY(get_res);
|
||||
return if_exists;
|
||||
R_RETURN(if_exists);
|
||||
}
|
||||
}
|
||||
R_SUCCEED();
|
||||
@@ -491,7 +491,7 @@ namespace ams::fs {
|
||||
const Result file_res = m_file_table.Get(std::addressof(pos), std::addressof(entry), key);
|
||||
R_UNLESS(R_FAILED(file_res), fs::ResultDbmInvalidOperation());
|
||||
R_UNLESS(!fs::ResultDbmKeyNotFound::Includes(file_res), fs::ResultDbmDirectoryNotFound());
|
||||
return file_res;
|
||||
R_RETURN(file_res);
|
||||
}
|
||||
|
||||
Result HierarchicalRomFileTable::GetDirectoryEntry(RomDirectoryEntry *out_entry, RomDirectoryId id) {
|
||||
@@ -507,7 +507,7 @@ namespace ams::fs {
|
||||
const Result file_res = m_file_table.GetByPosition(std::addressof(key), std::addressof(entry), pos);
|
||||
R_UNLESS(R_FAILED(file_res), fs::ResultDbmInvalidOperation());
|
||||
R_UNLESS(!fs::ResultDbmKeyNotFound::Includes(file_res), fs::ResultDbmDirectoryNotFound());
|
||||
return file_res;
|
||||
R_RETURN(file_res);
|
||||
}
|
||||
|
||||
Result HierarchicalRomFileTable::GetFileEntry(Position *out_pos, RomFileEntry *out_entry, const EntryKey &key) {
|
||||
@@ -523,7 +523,7 @@ namespace ams::fs {
|
||||
const Result dir_res = m_dir_table.Get(std::addressof(pos), std::addressof(entry), key);
|
||||
R_UNLESS(R_FAILED(dir_res), fs::ResultDbmInvalidOperation());
|
||||
R_UNLESS(!fs::ResultDbmKeyNotFound::Includes(dir_res), fs::ResultDbmFileNotFound());
|
||||
return dir_res;
|
||||
R_RETURN(dir_res);
|
||||
}
|
||||
|
||||
Result HierarchicalRomFileTable::GetFileEntry(RomFileEntry *out_entry, RomFileId id) {
|
||||
@@ -539,7 +539,7 @@ namespace ams::fs {
|
||||
const Result dir_res = m_dir_table.GetByPosition(std::addressof(key), std::addressof(entry), pos);
|
||||
R_UNLESS(R_FAILED(dir_res), fs::ResultDbmInvalidOperation());
|
||||
R_UNLESS(!fs::ResultDbmKeyNotFound::Includes(dir_res), fs::ResultDbmFileNotFound());
|
||||
return dir_res;
|
||||
R_RETURN(dir_res);
|
||||
}
|
||||
|
||||
Result HierarchicalRomFileTable::GetDirectoryInformation(DirectoryInfo *out, const EntryKey &key) {
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace ams::fs {
|
||||
|
||||
Result FileStorage::UpdateSize() {
|
||||
R_SUCCEED_IF(m_size != InvalidSize);
|
||||
return m_base_file->GetSize(std::addressof(m_size));
|
||||
R_RETURN(m_base_file->GetSize(std::addressof(m_size)));
|
||||
}
|
||||
|
||||
Result FileStorage::Read(s64 offset, void *buffer, size_t size) {
|
||||
@@ -36,7 +36,7 @@ namespace ams::fs {
|
||||
R_TRY(IStorage::CheckAccessRange(offset, size, m_size));
|
||||
|
||||
size_t read_size;
|
||||
return m_base_file->Read(std::addressof(read_size), offset, buffer, size);
|
||||
R_RETURN(m_base_file->Read(std::addressof(read_size), offset, buffer, size));
|
||||
}
|
||||
|
||||
Result FileStorage::Write(s64 offset, const void *buffer, size_t size) {
|
||||
@@ -52,11 +52,11 @@ namespace ams::fs {
|
||||
/* Ensure our access is valid. */
|
||||
R_TRY(IStorage::CheckAccessRange(offset, size, m_size));
|
||||
|
||||
return m_base_file->Write(offset, buffer, size, fs::WriteOption());
|
||||
R_RETURN(m_base_file->Write(offset, buffer, size, fs::WriteOption()));
|
||||
}
|
||||
|
||||
Result FileStorage::Flush() {
|
||||
return m_base_file->Flush();
|
||||
R_RETURN(m_base_file->Flush());
|
||||
}
|
||||
|
||||
Result FileStorage::GetSize(s64 *out_size) {
|
||||
@@ -67,7 +67,7 @@ namespace ams::fs {
|
||||
|
||||
Result FileStorage::SetSize(s64 size) {
|
||||
m_size = InvalidSize;
|
||||
return m_base_file->SetSize(size);
|
||||
R_RETURN(m_base_file->SetSize(size));
|
||||
}
|
||||
|
||||
Result FileStorage::OperateRange(void *dst, size_t dst_size, OperationId op_id, s64 offset, s64 size, const void *src, size_t src_size) {
|
||||
@@ -105,7 +105,7 @@ namespace ams::fs {
|
||||
|
||||
Result FileHandleStorage::UpdateSize() {
|
||||
R_SUCCEED_IF(m_size != InvalidSize);
|
||||
return GetFileSize(std::addressof(m_size), m_handle);
|
||||
R_RETURN(GetFileSize(std::addressof(m_size), m_handle));
|
||||
}
|
||||
|
||||
Result FileHandleStorage::Read(s64 offset, void *buffer, size_t size) {
|
||||
@@ -124,7 +124,7 @@ namespace ams::fs {
|
||||
/* Ensure our access is valid. */
|
||||
R_TRY(IStorage::CheckAccessRange(offset, size, m_size));
|
||||
|
||||
return ReadFile(m_handle, offset, buffer, size, fs::ReadOption());
|
||||
R_RETURN(ReadFile(m_handle, offset, buffer, size, fs::ReadOption()));
|
||||
}
|
||||
|
||||
Result FileHandleStorage::Write(s64 offset, const void *buffer, size_t size) {
|
||||
@@ -143,11 +143,11 @@ namespace ams::fs {
|
||||
/* Ensure our access is valid. */
|
||||
R_TRY(IStorage::CheckAccessRange(offset, size, m_size));
|
||||
|
||||
return WriteFile(m_handle, offset, buffer, size, fs::WriteOption());
|
||||
R_RETURN(WriteFile(m_handle, offset, buffer, size, fs::WriteOption()));
|
||||
}
|
||||
|
||||
Result FileHandleStorage::Flush() {
|
||||
return FlushFile(m_handle);
|
||||
R_RETURN(FlushFile(m_handle));
|
||||
}
|
||||
|
||||
Result FileHandleStorage::GetSize(s64 *out_size) {
|
||||
@@ -158,7 +158,7 @@ namespace ams::fs {
|
||||
|
||||
Result FileHandleStorage::SetSize(s64 size) {
|
||||
m_size = InvalidSize;
|
||||
return SetFileSize(m_handle, size);
|
||||
R_RETURN(SetFileSize(m_handle, size));
|
||||
}
|
||||
|
||||
Result FileHandleStorage::OperateRange(void *dst, size_t dst_size, OperationId op_id, s64 offset, s64 size, const void *src, size_t src_size) {
|
||||
@@ -170,7 +170,7 @@ namespace ams::fs {
|
||||
R_UNLESS(dst != nullptr, fs::ResultNullptrArgument());
|
||||
R_UNLESS(dst_size == sizeof(QueryRangeInfo), fs::ResultInvalidSize());
|
||||
|
||||
return QueryRange(static_cast<QueryRangeInfo *>(dst), m_handle, offset, size);
|
||||
R_RETURN(QueryRange(static_cast<QueryRangeInfo *>(dst), m_handle, offset, size));
|
||||
default:
|
||||
R_THROW(fs::ResultUnsupportedOperateRangeForFileHandleStorage());
|
||||
}
|
||||
|
||||
@@ -103,11 +103,11 @@ namespace ams::fs {
|
||||
}
|
||||
|
||||
Result MountBis(BisPartitionId id, const char *root_path) {
|
||||
return impl::MountBisImpl(GetBisMountName(id), id, root_path);
|
||||
R_RETURN(impl::MountBisImpl(GetBisMountName(id), id, root_path));
|
||||
}
|
||||
|
||||
Result MountBis(const char *name, BisPartitionId id) {
|
||||
return impl::MountBisImpl(name, id, nullptr);
|
||||
R_RETURN(impl::MountBisImpl(name, id, nullptr));
|
||||
}
|
||||
|
||||
void SetBisRootForHost(BisPartitionId id, const char *root_path) {
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace ams::fs {
|
||||
}
|
||||
|
||||
Result MountContentStorage(ContentStorageId id) {
|
||||
return MountContentStorage(GetContentStorageMountName(id), id);
|
||||
R_RETURN(MountContentStorage(GetContentStorageMountName(id), id));
|
||||
}
|
||||
|
||||
Result MountContentStorage(const char *name, ContentStorageId id) {
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace ams::fs::impl {
|
||||
R_UNLESS(fs != nullptr, fs::ResultAllocationMemoryFailedInDataB());
|
||||
R_TRY(fs->Initialize(std::move(storage), cache_buffer, cache_size, use_cache));
|
||||
|
||||
return fsa::Register(name, std::move(fs), nullptr, use_data_cache, use_path_cache, false);
|
||||
R_RETURN(fsa::Register(name, std::move(fs), nullptr, use_data_cache, use_path_cache, false));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -73,7 +73,7 @@ namespace ams::fs::impl {
|
||||
/* Validate the mount name. */
|
||||
AMS_FS_R_TRY(impl::CheckMountName(name));
|
||||
|
||||
return MountDataImpl(name, data_id, storage_id, nullptr, 0, false, false, false);
|
||||
R_RETURN(MountDataImpl(name, data_id, storage_id, nullptr, 0, false, false, false));
|
||||
}
|
||||
|
||||
Result MountData(const char *name, ncm::DataId data_id, ncm::StorageId storage_id, void *cache_buffer, size_t cache_size) {
|
||||
@@ -82,7 +82,7 @@ namespace ams::fs::impl {
|
||||
|
||||
AMS_FS_R_UNLESS(cache_buffer != nullptr, fs::ResultNullptrArgument());
|
||||
|
||||
return MountDataImpl(name, data_id, storage_id, cache_buffer, cache_size, true, false, false);
|
||||
R_RETURN(MountDataImpl(name, data_id, storage_id, cache_buffer, cache_size, true, false, false));
|
||||
}
|
||||
|
||||
Result MountData(const char *name, ncm::DataId data_id, ncm::StorageId storage_id, void *cache_buffer, size_t cache_size, bool use_data_cache, bool use_path_cache) {
|
||||
@@ -91,7 +91,7 @@ namespace ams::fs::impl {
|
||||
|
||||
AMS_FS_R_UNLESS(cache_buffer != nullptr, fs::ResultNullptrArgument());
|
||||
|
||||
return MountDataImpl(name, data_id, storage_id, cache_buffer, cache_size, true, use_data_cache, use_path_cache);
|
||||
R_RETURN(MountDataImpl(name, data_id, storage_id, cache_buffer, cache_size, true, use_data_cache, use_path_cache));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace ams::fs {
|
||||
R_UNLESS(fsa != nullptr, fs::ResultAllocationMemoryFailedInDeviceSaveDataA());
|
||||
|
||||
/* Register. */
|
||||
return fsa::Register(name, std::move(fsa));
|
||||
R_RETURN(fsa::Register(name, std::move(fsa)));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace ams::fs {
|
||||
R_TRY(accessor->SetUpPath(std::addressof(sub_fs_path), sub_path));
|
||||
|
||||
/* Use the system implementation. */
|
||||
return fssystem::EnsureDirectory(accessor->GetRawFileSystemUnsafe(), sub_fs_path);
|
||||
R_RETURN(fssystem::EnsureDirectory(accessor->GetRawFileSystemUnsafe(), sub_fs_path));
|
||||
}
|
||||
|
||||
Result EnsureParentDirectory(const char *path) {
|
||||
@@ -47,7 +47,7 @@ namespace ams::fs {
|
||||
R_TRY(sub_fs_path.RemoveChild());
|
||||
|
||||
/* Use the system implementation. */
|
||||
return fssystem::EnsureDirectory(accessor->GetRawFileSystemUnsafe(), sub_fs_path);
|
||||
R_RETURN(fssystem::EnsureDirectory(accessor->GetRawFileSystemUnsafe(), sub_fs_path));
|
||||
}
|
||||
|
||||
Result HasFile(bool *out, const char *path) {
|
||||
@@ -60,7 +60,7 @@ namespace ams::fs {
|
||||
fs::Path sub_fs_path;
|
||||
R_TRY(accessor->SetUpPath(std::addressof(sub_fs_path), sub_path));
|
||||
|
||||
return fssystem::HasFile(out, accessor->GetRawFileSystemUnsafe(), sub_fs_path);
|
||||
R_RETURN(fssystem::HasFile(out, accessor->GetRawFileSystemUnsafe(), sub_fs_path));
|
||||
}
|
||||
|
||||
Result HasDirectory(bool *out, const char *path) {
|
||||
@@ -73,7 +73,7 @@ namespace ams::fs {
|
||||
fs::Path sub_fs_path;
|
||||
R_TRY(accessor->SetUpPath(std::addressof(sub_fs_path), sub_path));
|
||||
|
||||
return fssystem::HasDirectory(out, accessor->GetRawFileSystemUnsafe(), sub_fs_path);
|
||||
R_RETURN(fssystem::HasDirectory(out, accessor->GetRawFileSystemUnsafe(), sub_fs_path));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ namespace ams::fs {
|
||||
Result ConvertFatFileSystemCorruptedResult(Result res) {
|
||||
AMS_ASSERT(fs::ResultFatFileSystemCorrupted::Includes(res));
|
||||
|
||||
return res;
|
||||
R_RETURN(res);
|
||||
}
|
||||
|
||||
Result ConvertHostFileSystemCorruptedResult(Result res) {
|
||||
@@ -149,14 +149,14 @@ namespace ams::fs {
|
||||
AMS_ASSERT(offset >= 0);
|
||||
AMS_ASSERT(buffer != nullptr || size == 0);
|
||||
|
||||
return ConvertRomFsResult(storage->Read(offset, buffer, size));
|
||||
R_RETURN(ConvertRomFsResult(storage->Read(offset, buffer, size)));
|
||||
}
|
||||
|
||||
Result ReadFileHeader(IStorage *storage, RomFileSystemInformation *out) {
|
||||
AMS_ASSERT(storage != nullptr);
|
||||
AMS_ASSERT(out != nullptr);
|
||||
|
||||
return ReadFile(storage, 0, out, sizeof(*out));
|
||||
R_RETURN(ReadFile(storage, 0, out, sizeof(*out)));
|
||||
}
|
||||
|
||||
constexpr size_t CalculateRequiredWorkingMemorySize(const RomFileSystemInformation &header) {
|
||||
@@ -185,7 +185,7 @@ namespace ams::fs {
|
||||
}
|
||||
|
||||
Result ConvertResult(Result res) const {
|
||||
return ConvertRomFsResult(res);
|
||||
R_RETURN(ConvertRomFsResult(res));
|
||||
}
|
||||
|
||||
s64 GetOffset() const {
|
||||
@@ -242,7 +242,7 @@ namespace ams::fs {
|
||||
operate_size = this->GetSize() - offset;
|
||||
}
|
||||
|
||||
return this->GetStorage()->OperateRange(dst, dst_size, op_id, m_start + offset, operate_size, src, src_size);
|
||||
R_RETURN(this->GetStorage()->OperateRange(dst, dst_size, op_id, m_start + offset, operate_size, src, src_size));
|
||||
}
|
||||
default:
|
||||
R_THROW(fs::ResultUnsupportedOperateRangeForRomFsFile());
|
||||
@@ -267,12 +267,12 @@ namespace ams::fs {
|
||||
virtual ~RomFsDirectory() override { /* ... */ }
|
||||
public:
|
||||
virtual Result DoRead(s64 *out_count, DirectoryEntry *out_entries, s64 max_entries) override {
|
||||
return this->ReadInternal(out_count, std::addressof(m_current_find), out_entries, max_entries);
|
||||
R_RETURN(this->ReadInternal(out_count, std::addressof(m_current_find), out_entries, max_entries));
|
||||
}
|
||||
|
||||
virtual Result DoGetEntryCount(s64 *out) override {
|
||||
FindPosition find = m_first_find;
|
||||
return this->ReadInternal(out, std::addressof(find), nullptr, 0);
|
||||
R_RETURN(this->ReadInternal(out, std::addressof(find), nullptr, 0));
|
||||
}
|
||||
private:
|
||||
Result ReadInternal(s64 *out_count, FindPosition *find, DirectoryEntry *out_entries, s64 max_entries) {
|
||||
@@ -416,7 +416,7 @@ namespace ams::fs {
|
||||
|
||||
Result RomFsFileSystem::Initialize(std::unique_ptr<IStorage>&& base, void *work, size_t work_size, bool use_cache) {
|
||||
m_unique_storage = std::move(base);
|
||||
return this->Initialize(m_unique_storage.get(), work, work_size, use_cache);
|
||||
R_RETURN(this->Initialize(m_unique_storage.get(), work, work_size, use_cache));
|
||||
}
|
||||
|
||||
Result RomFsFileSystem::GetFileInfo(RomFileTable::FileInfo *out, const char *path) {
|
||||
|
||||
@@ -68,23 +68,23 @@ namespace ams::fs {
|
||||
}
|
||||
|
||||
Result CreateSystemSaveData(SystemSaveDataId save_id, s64 size, s64 journal_size, u32 flags) {
|
||||
return CreateSystemSaveData(SaveDataSpaceId::System, save_id, InvalidUserId, 0, size, journal_size, flags);
|
||||
R_RETURN(CreateSystemSaveData(SaveDataSpaceId::System, save_id, InvalidUserId, 0, size, journal_size, flags));
|
||||
}
|
||||
|
||||
Result CreateSystemSaveData(SystemSaveDataId save_id, u64 owner_id, s64 size, s64 journal_size, u32 flags) {
|
||||
return CreateSystemSaveData(SaveDataSpaceId::System, save_id, InvalidUserId, owner_id, size, journal_size, flags);
|
||||
R_RETURN(CreateSystemSaveData(SaveDataSpaceId::System, save_id, InvalidUserId, owner_id, size, journal_size, flags));
|
||||
}
|
||||
|
||||
Result CreateSystemSaveData(SaveDataSpaceId space_id, SystemSaveDataId save_id, u64 owner_id, s64 size, s64 journal_size, u32 flags) {
|
||||
return CreateSystemSaveData(space_id, save_id, InvalidUserId, owner_id, size, journal_size, flags);
|
||||
R_RETURN(CreateSystemSaveData(space_id, save_id, InvalidUserId, owner_id, size, journal_size, flags));
|
||||
}
|
||||
|
||||
Result CreateSystemSaveData(SystemSaveDataId save_id, UserId user_id, s64 size, s64 journal_size, u32 flags) {
|
||||
return CreateSystemSaveData(SaveDataSpaceId::System, save_id, user_id, 0, size, journal_size, flags);
|
||||
R_RETURN(CreateSystemSaveData(SaveDataSpaceId::System, save_id, user_id, 0, size, journal_size, flags));
|
||||
}
|
||||
|
||||
Result CreateSystemSaveData(SystemSaveDataId save_id, UserId user_id, u64 owner_id, s64 size, s64 journal_size, u32 flags) {
|
||||
return CreateSystemSaveData(SaveDataSpaceId::System, save_id, user_id, owner_id, size, journal_size, flags);
|
||||
R_RETURN(CreateSystemSaveData(SaveDataSpaceId::System, save_id, user_id, owner_id, size, journal_size, flags));
|
||||
}
|
||||
|
||||
Result DeleteSaveData(SaveDataId id) {
|
||||
@@ -139,7 +139,7 @@ namespace ams::fs {
|
||||
SaveDataExtraData extra_data;
|
||||
R_TRY(impl::ReadSaveDataFileSystemExtraData(std::addressof(extra_data), space_id, id));
|
||||
extra_data.flags = flags;
|
||||
return impl::WriteSaveDataFileSystemExtraData(space_id, id, extra_data);
|
||||
R_RETURN(impl::WriteSaveDataFileSystemExtraData(space_id, id, extra_data));
|
||||
}
|
||||
|
||||
Result GetSaveDataAvailableSize(s64 *out, SaveDataId id) {
|
||||
|
||||
@@ -66,7 +66,7 @@ namespace ams::fs {
|
||||
R_UNLESS(generator != nullptr, fs::ResultAllocationMemoryFailedInSdCardA());
|
||||
|
||||
/* Register. */
|
||||
return fsa::Register(name, std::move(fsa), std::move(generator));
|
||||
R_RETURN(fsa::Register(name, std::move(fsa), std::move(generator)));
|
||||
}
|
||||
|
||||
Result MountSdCardErrorReportDirectoryForAtmosphere(const char *name) {
|
||||
@@ -92,7 +92,7 @@ namespace ams::fs {
|
||||
R_TRY(subdir_fs->Initialize(fs_path));
|
||||
|
||||
/* Register. */
|
||||
return fsa::Register(name, std::move(subdir_fs));
|
||||
R_RETURN(fsa::Register(name, std::move(subdir_fs)));
|
||||
}
|
||||
|
||||
Result OpenSdCardDetectionEventNotifier(std::unique_ptr<IEventNotifier> *out) {
|
||||
|
||||
@@ -21,15 +21,15 @@
|
||||
namespace ams::fs {
|
||||
|
||||
Result MountSystemSaveData(const char *name, SystemSaveDataId id) {
|
||||
return MountSystemSaveData(name, id, InvalidUserId);
|
||||
R_RETURN(MountSystemSaveData(name, id, InvalidUserId));
|
||||
}
|
||||
|
||||
Result MountSystemSaveData(const char *name, SaveDataSpaceId space_id, SystemSaveDataId id) {
|
||||
return MountSystemSaveData(name, space_id, id, InvalidUserId);
|
||||
R_RETURN(MountSystemSaveData(name, space_id, id, InvalidUserId));
|
||||
}
|
||||
|
||||
Result MountSystemSaveData(const char *name, SystemSaveDataId id, UserId user_id) {
|
||||
return MountSystemSaveData(name, SaveDataSpaceId::System, id, user_id);
|
||||
R_RETURN(MountSystemSaveData(name, SaveDataSpaceId::System, id, user_id));
|
||||
}
|
||||
|
||||
Result MountSystemSaveData(const char *name, SaveDataSpaceId space_id, SystemSaveDataId id, UserId user_id) {
|
||||
@@ -50,7 +50,7 @@ namespace ams::fs {
|
||||
R_UNLESS(fsa != nullptr, fs::ResultAllocationMemoryFailedInSystemSaveDataA());
|
||||
|
||||
/* Register. */
|
||||
return fsa::Register(name, std::move(fsa));
|
||||
R_RETURN(fsa::Register(name, std::move(fsa)));
|
||||
};
|
||||
|
||||
AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG_SYSTEM_MOUNT(mount_impl(), name, AMS_FS_IMPL_ACCESS_LOG_FORMAT_MOUNT_SYSTEM_SAVE_DATA(name, space_id, id, user_id)));
|
||||
|
||||
@@ -29,11 +29,11 @@ namespace ams::fs::impl {
|
||||
}
|
||||
|
||||
Result DirectoryAccessor::Read(s64 *out_count, DirectoryEntry *out_entries, s64 max_entries) {
|
||||
return m_impl->Read(out_count, out_entries, max_entries);
|
||||
R_RETURN(m_impl->Read(out_count, out_entries, max_entries));
|
||||
}
|
||||
|
||||
Result DirectoryAccessor::GetEntryCount(s64 *out) {
|
||||
return m_impl->GetEntryCount(out);
|
||||
R_RETURN(m_impl->GetEntryCount(out));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace ams::fs::impl {
|
||||
}
|
||||
|
||||
Result FileAccessor::ReadWithoutCacheAccessLog(size_t *out, s64 offset, void *buf, size_t size, const ReadOption &option) {
|
||||
return m_impl->Read(out, offset, buf, size, option);
|
||||
R_RETURN(m_impl->Read(out, offset, buf, size, option));
|
||||
}
|
||||
|
||||
Result FileAccessor::Read(size_t *out, s64 offset, void *buf, size_t size, const ReadOption &option) {
|
||||
@@ -62,9 +62,9 @@ namespace ams::fs::impl {
|
||||
|
||||
if (use_path_cache && use_data_cache && false) {
|
||||
/* TODO */
|
||||
return this->ReadWithCacheAccessLog(out, offset, buf, size, option, use_path_cache, use_data_cache);
|
||||
R_RETURN(this->ReadWithCacheAccessLog(out, offset, buf, size, option, use_path_cache, use_data_cache));
|
||||
} else {
|
||||
return AMS_FS_IMPL_ACCESS_LOG_WITH_NAME(this->ReadWithoutCacheAccessLog(out, offset, buf, size, option), handle, "ReadFile", AMS_FS_IMPL_ACCESS_LOG_FORMAT_READ_FILE(out, offset, size));
|
||||
R_RETURN(AMS_FS_IMPL_ACCESS_LOG_WITH_NAME(this->ReadWithoutCacheAccessLog(out, offset, buf, size, option), handle, "ReadFile", AMS_FS_IMPL_ACCESS_LOG_FORMAT_READ_FILE(out, offset, size)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,11 +117,11 @@ namespace ams::fs::impl {
|
||||
/* Fail after a write fails. */
|
||||
R_TRY(m_write_result);
|
||||
|
||||
return m_impl->GetSize(out);
|
||||
R_RETURN(m_impl->GetSize(out));
|
||||
}
|
||||
|
||||
Result FileAccessor::OperateRange(void *dst, size_t dst_size, OperationId operation, s64 offset, s64 size, const void *src, size_t src_size) {
|
||||
return m_impl->OperateRange(dst, dst_size, operation, offset, size, src, src_size);
|
||||
R_RETURN(m_impl->OperateRange(dst, dst_size, operation, offset, size, src, src_size));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -61,7 +61,7 @@ namespace ams::fs::impl {
|
||||
if (!fs::ResultNotEnoughFreeSpace::Includes(r)) {
|
||||
m_write_result = r;
|
||||
}
|
||||
return r;
|
||||
R_RETURN(r);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -125,7 +125,7 @@ namespace ams::fs::impl {
|
||||
MountName mount_name;
|
||||
R_TRY(GetMountNameAndSubPath(std::addressof(mount_name), out_sub_path, path));
|
||||
|
||||
return impl::Find(out_accessor, mount_name.str);
|
||||
R_RETURN(impl::Find(out_accessor, mount_name.str));
|
||||
}
|
||||
|
||||
Result Unmount(const char *name) {
|
||||
|
||||
@@ -23,14 +23,14 @@ namespace ams::fs::fsa {
|
||||
auto accessor = std::make_unique<impl::FileSystemAccessor>(name, std::move(fs));
|
||||
R_UNLESS(accessor != nullptr, fs::ResultAllocationMemoryFailedInRegisterA());
|
||||
|
||||
return impl::Register(std::move(accessor));
|
||||
R_RETURN(impl::Register(std::move(accessor)));
|
||||
}
|
||||
|
||||
Result Register(const char *name, std::unique_ptr<IFileSystem> &&fs, std::unique_ptr<ICommonMountNameGenerator> &&generator) {
|
||||
auto accessor = std::make_unique<impl::FileSystemAccessor>(name, std::move(fs), std::move(generator));
|
||||
R_UNLESS(accessor != nullptr, fs::ResultAllocationMemoryFailedInRegisterB());
|
||||
|
||||
return impl::Register(std::move(accessor));
|
||||
R_RETURN(impl::Register(std::move(accessor)));
|
||||
}
|
||||
|
||||
Result Register(const char *name, std::unique_ptr<IFileSystem> &&fs, std::unique_ptr<ICommonMountNameGenerator> &&generator, bool use_data_cache, bool use_path_cache, bool support_multi_commit) {
|
||||
@@ -41,7 +41,7 @@ namespace ams::fs::fsa {
|
||||
accessor->SetPathBasedFileDataCacheAttachable(use_path_cache);
|
||||
accessor->SetMultiCommitSupported(support_multi_commit);
|
||||
|
||||
return impl::Register(std::move(accessor));
|
||||
R_RETURN(impl::Register(std::move(accessor)));
|
||||
}
|
||||
|
||||
void Unregister(const char *name) {
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
namespace ams::fs {
|
||||
|
||||
Result CreateFile(const char *path, s64 size) {
|
||||
return CreateFile(path, size, 0);
|
||||
R_RETURN(CreateFile(path, size, 0));
|
||||
}
|
||||
|
||||
Result CreateFile(const char* path, s64 size, int option) {
|
||||
@@ -220,11 +220,11 @@ namespace ams::fs {
|
||||
}
|
||||
|
||||
Result Commit(const char *mount_name) {
|
||||
return CommitImpl(mount_name, AMS_CURRENT_FUNCTION_NAME);
|
||||
R_RETURN(CommitImpl(mount_name, AMS_CURRENT_FUNCTION_NAME));
|
||||
}
|
||||
|
||||
Result CommitSaveData(const char *mount_name) {
|
||||
return CommitImpl(mount_name, AMS_CURRENT_FUNCTION_NAME);
|
||||
R_RETURN(CommitImpl(mount_name, AMS_CURRENT_FUNCTION_NAME));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -27,11 +27,11 @@ namespace ams::fs::impl {
|
||||
}
|
||||
|
||||
Result Register(std::unique_ptr<FileSystemAccessor> &&fs) {
|
||||
return g_mount_table.Mount(std::move(fs));
|
||||
R_RETURN(g_mount_table.Mount(std::move(fs)));
|
||||
}
|
||||
|
||||
Result Find(FileSystemAccessor **out, const char *name) {
|
||||
return g_mount_table.Find(out, name);
|
||||
R_RETURN(g_mount_table.Find(out, name));
|
||||
}
|
||||
|
||||
void Unregister(const char *name) {
|
||||
|
||||
@@ -37,18 +37,18 @@ namespace ams::fssrv::fscreator {
|
||||
/* Check if the buffer is eligible for cache. */
|
||||
size_t buffer_size = 0;
|
||||
if (R_FAILED(RomFsFileSystem::GetRequiredWorkingMemorySize(std::addressof(buffer_size), storage.get())) || buffer_size == 0 || buffer_size >= 128_KB) {
|
||||
return RomFsFileSystem::Initialize(std::move(storage), nullptr, 0, false);
|
||||
R_RETURN(RomFsFileSystem::Initialize(std::move(storage), nullptr, 0, false));
|
||||
}
|
||||
|
||||
/* Allocate a buffer. */
|
||||
m_meta_cache_buffer = m_allocator->Allocate(buffer_size);
|
||||
if (m_meta_cache_buffer == nullptr) {
|
||||
return RomFsFileSystem::Initialize(std::move(storage), nullptr, 0, false);
|
||||
R_RETURN(RomFsFileSystem::Initialize(std::move(storage), nullptr, 0, false));
|
||||
}
|
||||
|
||||
/* Initialize with cache buffer. */
|
||||
m_meta_cache_buffer_size = buffer_size;
|
||||
return RomFsFileSystem::Initialize(std::move(storage), m_meta_cache_buffer, m_meta_cache_buffer_size, true);
|
||||
R_RETURN(RomFsFileSystem::Initialize(std::move(storage), m_meta_cache_buffer, m_meta_cache_buffer_size, true));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -51,39 +51,28 @@ namespace ams::fssrv {
|
||||
switch (port_index) {
|
||||
case PortIndex_FileSystemProxy:
|
||||
{
|
||||
return this->AcceptImpl(server, impl::GetFileSystemProxyServiceObject());
|
||||
R_RETURN(this->AcceptImpl(server, impl::GetFileSystemProxyServiceObject()));
|
||||
}
|
||||
break;
|
||||
case PortIndex_ProgramRegistry:
|
||||
{
|
||||
if (os::TryAcquireSemaphore(std::addressof(g_semaphore_for_program_registry))) {
|
||||
auto sema_guard = SCOPE_GUARD { os::ReleaseSemaphore(std::addressof(g_semaphore_for_program_registry)); };
|
||||
ON_RESULT_FAILURE { os::ReleaseSemaphore(std::addressof(g_semaphore_for_program_registry)); };
|
||||
|
||||
R_TRY(this->AcceptImpl(server, impl::GetProgramRegistryServiceObject()));
|
||||
|
||||
sema_guard.Cancel();
|
||||
R_RETURN(this->AcceptImpl(server, impl::GetProgramRegistryServiceObject()));
|
||||
} else {
|
||||
R_TRY(this->AcceptImpl(server, impl::GetInvalidProgramRegistryServiceObject()));
|
||||
R_RETURN(this->AcceptImpl(server, impl::GetInvalidProgramRegistryServiceObject()));
|
||||
}
|
||||
|
||||
R_SUCCEED();
|
||||
}
|
||||
break;
|
||||
case PortIndex_FileSystemProxyForLoader:
|
||||
{
|
||||
if (os::TryAcquireSemaphore(std::addressof(g_semaphore_for_file_system_proxy_for_loader))) {
|
||||
auto sema_guard = SCOPE_GUARD { os::ReleaseSemaphore(std::addressof(g_semaphore_for_file_system_proxy_for_loader)); };
|
||||
ON_RESULT_FAILURE { os::ReleaseSemaphore(std::addressof(g_semaphore_for_file_system_proxy_for_loader)); };
|
||||
|
||||
R_TRY(this->AcceptImpl(server, impl::GetFileSystemProxyForLoaderServiceObject()));
|
||||
|
||||
sema_guard.Cancel();
|
||||
R_RETURN(this->AcceptImpl(server, impl::GetFileSystemProxyForLoaderServiceObject()));
|
||||
} else {
|
||||
R_TRY(this->AcceptImpl(server, impl::GetInvalidFileSystemProxyForLoaderServiceObject()));
|
||||
R_RETURN(this->AcceptImpl(server, impl::GetInvalidFileSystemProxyForLoaderServiceObject()));
|
||||
}
|
||||
|
||||
R_SUCCEED();
|
||||
}
|
||||
break;
|
||||
AMS_UNREACHABLE_DEFAULT_CASE();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace ams::fssrv {
|
||||
R_UNLESS(desc.GetSize() >= static_cast<size_t>(desc_size), fs::ResultInvalidSize());
|
||||
|
||||
/* Register the program. */
|
||||
return g_impl->RegisterProgramInfo(process_id, program_id, storage_id, data.GetPointer(), data_size, desc.GetPointer(), desc_size);
|
||||
R_RETURN(g_impl->RegisterProgramInfo(process_id, program_id, storage_id, data.GetPointer(), data_size, desc.GetPointer(), desc_size));
|
||||
}
|
||||
|
||||
Result ProgramRegistryImpl::UnregisterProgram(u64 process_id) {
|
||||
@@ -64,7 +64,7 @@ namespace ams::fssrv {
|
||||
R_UNLESS(fssrv::impl::IsInitialProgram(m_process_id), fs::ResultPermissionDenied());
|
||||
|
||||
/* Unregister the program. */
|
||||
return g_impl->UnregisterProgramInfo(process_id);
|
||||
R_RETURN(g_impl->UnregisterProgramInfo(process_id));
|
||||
}
|
||||
|
||||
Result ProgramRegistryImpl::SetCurrentProcess(const ams::sf::ClientProcessId &client_pid) {
|
||||
|
||||
@@ -20,23 +20,23 @@
|
||||
namespace ams::fssrv {
|
||||
|
||||
Result ProgramRegistryServiceImpl::RegisterProgramInfo(u64 process_id, u64 program_id, u8 storage_id, const void *data, s64 data_size, const void *desc, s64 desc_size) {
|
||||
return m_registry_manager->RegisterProgram(process_id, program_id, storage_id, data, data_size, desc, desc_size);
|
||||
R_RETURN(m_registry_manager->RegisterProgram(process_id, program_id, storage_id, data, data_size, desc, desc_size));
|
||||
}
|
||||
|
||||
Result ProgramRegistryServiceImpl::UnregisterProgramInfo(u64 process_id) {
|
||||
return m_registry_manager->UnregisterProgram(process_id);
|
||||
R_RETURN(m_registry_manager->UnregisterProgram(process_id));
|
||||
}
|
||||
|
||||
Result ProgramRegistryServiceImpl::ResetProgramIndexMapInfo(const fs::ProgramIndexMapInfo *infos, int count) {
|
||||
return m_index_map_info_manager->Reset(infos, count);
|
||||
R_RETURN(m_index_map_info_manager->Reset(infos, count));
|
||||
}
|
||||
|
||||
Result ProgramRegistryServiceImpl::GetProgramInfo(std::shared_ptr<impl::ProgramInfo> *out, u64 process_id) {
|
||||
return m_registry_manager->GetProgramInfo(out, process_id);
|
||||
R_RETURN(m_registry_manager->GetProgramInfo(out, process_id));
|
||||
}
|
||||
|
||||
Result ProgramRegistryServiceImpl::GetProgramInfoByProgramId(std::shared_ptr<impl::ProgramInfo> *out, u64 program_id) {
|
||||
return m_registry_manager->GetProgramInfoByProgramId(out, program_id);
|
||||
R_RETURN(m_registry_manager->GetProgramInfoByProgramId(out, program_id));
|
||||
}
|
||||
|
||||
size_t ProgramRegistryServiceImpl::GetProgramIndexMapInfoCount() {
|
||||
|
||||
@@ -76,7 +76,7 @@ namespace ams::fssystem {
|
||||
R_TRY(CreateSoftwareDecryptor(std::addressof(sw_decryptor)));
|
||||
|
||||
/* Initialize. */
|
||||
return this->Initialize(allocator, key, key_size, secure_value, 0, data_storage, fs::SubStorage(std::addressof(table_storage), node_storage_offset, node_storage_size), fs::SubStorage(std::addressof(table_storage), entry_storage_offset, entry_storage_size), header.entry_count, std::move(sw_decryptor));
|
||||
R_RETURN(this->Initialize(allocator, key, key_size, secure_value, 0, data_storage, fs::SubStorage(std::addressof(table_storage), node_storage_offset, node_storage_size), fs::SubStorage(std::addressof(table_storage), entry_storage_offset, entry_storage_size), header.entry_count, std::move(sw_decryptor)));
|
||||
}
|
||||
|
||||
Result AesCtrCounterExtendedStorage::Initialize(IAllocator *allocator, const void *key, size_t key_size, u32 secure_value, s64 counter_offset, fs::SubStorage data_storage, fs::SubStorage node_storage, fs::SubStorage entry_storage, s32 entry_count, std::unique_ptr<IDecryptor> &&decryptor) {
|
||||
|
||||
@@ -129,7 +129,7 @@ namespace ams::fssystem {
|
||||
|
||||
template<typename BasePointer>
|
||||
Result AesCtrStorage<BasePointer>::Flush() {
|
||||
return m_base_storage->Flush();
|
||||
R_RETURN(m_base_storage->Flush());
|
||||
}
|
||||
|
||||
template<typename BasePointer>
|
||||
@@ -140,7 +140,7 @@ namespace ams::fssystem {
|
||||
|
||||
template<typename BasePointer>
|
||||
Result AesCtrStorage<BasePointer>::GetSize(s64 *out) {
|
||||
return m_base_storage->GetSize(out);
|
||||
R_RETURN(m_base_storage->GetSize(out));
|
||||
}
|
||||
|
||||
template<typename BasePointer>
|
||||
|
||||
@@ -191,7 +191,7 @@ namespace ams::fssystem {
|
||||
if (!entry.is_cached) {
|
||||
if (const Result result = m_data_storage->Read(entry.range.offset, src, entry.range.size); R_FAILED(result)) {
|
||||
m_block_cache_manager.ReleaseCacheEntry(std::addressof(entry), range);
|
||||
return this->UpdateLastResult(result);
|
||||
R_RETURN(this->UpdateLastResult(result));
|
||||
}
|
||||
entry.is_cached = true;
|
||||
}
|
||||
@@ -293,7 +293,7 @@ namespace ams::fssystem {
|
||||
if (!entry.is_cached && ((offset != entry.range.offset) || (offset + size < static_cast<size_t>(entry.range.GetEndOffset())))) {
|
||||
if (Result result = m_data_storage->Read(entry.range.offset, dst, entry.range.size); R_FAILED(result)) {
|
||||
m_block_cache_manager.ReleaseCacheEntry(std::addressof(entry), range);
|
||||
return this->UpdateLastResult(result);
|
||||
R_RETURN(this->UpdateLastResult(result));
|
||||
}
|
||||
}
|
||||
entry.is_cached = true;
|
||||
|
||||
@@ -237,7 +237,7 @@ namespace ams::fssystem {
|
||||
|
||||
R_TRY(visitor->Initialize(this, offsets));
|
||||
|
||||
return visitor->Find(virtual_address);
|
||||
R_RETURN(visitor->Find(virtual_address));
|
||||
}
|
||||
|
||||
Result BucketTree::InvalidateCache() {
|
||||
@@ -429,10 +429,10 @@ namespace ams::fssystem {
|
||||
|
||||
PooledBuffer pool(node_size, 1);
|
||||
if (node_size <= pool.GetSize()) {
|
||||
return this->FindEntrySetWithBuffer(out_index, virtual_address, node_index, pool.GetBuffer());
|
||||
R_RETURN(this->FindEntrySetWithBuffer(out_index, virtual_address, node_index, pool.GetBuffer()));
|
||||
} else {
|
||||
pool.Deallocate();
|
||||
return this->FindEntrySetWithoutBuffer(out_index, virtual_address, node_index);
|
||||
R_RETURN(this->FindEntrySetWithoutBuffer(out_index, virtual_address, node_index));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -486,10 +486,10 @@ namespace ams::fssystem {
|
||||
|
||||
PooledBuffer pool(entry_set_size, 1);
|
||||
if (entry_set_size <= pool.GetSize()) {
|
||||
return this->FindEntryWithBuffer(virtual_address, entry_set_index, pool.GetBuffer());
|
||||
R_RETURN(this->FindEntryWithBuffer(virtual_address, entry_set_index, pool.GetBuffer()));
|
||||
} else {
|
||||
pool.Deallocate();
|
||||
return this->FindEntryWithoutBuffer(virtual_address, entry_set_index);
|
||||
R_RETURN(this->FindEntryWithoutBuffer(virtual_address, entry_set_index));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -517,7 +517,7 @@ namespace ams::fssystem {
|
||||
|
||||
Result Flush() {
|
||||
AMS_ASSERT(m_cache != nullptr);
|
||||
return m_cache->Flush();
|
||||
R_RETURN(m_cache->Flush());
|
||||
}
|
||||
|
||||
void Invalidate() {
|
||||
@@ -573,7 +573,7 @@ namespace ams::fssystem {
|
||||
|
||||
Result Fetch(s64 offset) {
|
||||
AMS_ASSERT(m_cache != nullptr);
|
||||
return m_cache->Fetch(offset);
|
||||
R_RETURN(m_cache->Fetch(offset));
|
||||
}
|
||||
|
||||
Result FetchFromBuffer(s64 offset, const void *buffer, size_t buffer_size) {
|
||||
@@ -728,7 +728,7 @@ namespace ams::fssystem {
|
||||
}
|
||||
}
|
||||
|
||||
return m_base_storage.OperateRange(dst, dst_size, op_id, offset, size, src, src_size);
|
||||
R_RETURN(m_base_storage.OperateRange(dst, dst_size, op_id, offset, size, src, src_size));
|
||||
}
|
||||
|
||||
void BufferedStorage::InvalidateCaches() {
|
||||
|
||||
@@ -45,27 +45,27 @@ namespace ams::fssystem {
|
||||
}
|
||||
public:
|
||||
virtual Result DoRead(size_t *out, s64 offset, void *buffer, size_t size, const fs::ReadOption &option) override {
|
||||
return m_base_file->Read(out, offset, buffer, size, option);
|
||||
R_RETURN(m_base_file->Read(out, offset, buffer, size, option));
|
||||
}
|
||||
|
||||
virtual Result DoGetSize(s64 *out) override {
|
||||
return m_base_file->GetSize(out);
|
||||
R_RETURN(m_base_file->GetSize(out));
|
||||
}
|
||||
|
||||
virtual Result DoFlush() override {
|
||||
return m_base_file->Flush();
|
||||
R_RETURN(m_base_file->Flush());
|
||||
}
|
||||
|
||||
virtual Result DoWrite(s64 offset, const void *buffer, size_t size, const fs::WriteOption &option) override {
|
||||
return m_base_file->Write(offset, buffer, size, option);
|
||||
R_RETURN(m_base_file->Write(offset, buffer, size, option));
|
||||
}
|
||||
|
||||
virtual Result DoSetSize(s64 size) override {
|
||||
return m_base_file->SetSize(size);
|
||||
R_RETURN(m_base_file->SetSize(size));
|
||||
}
|
||||
|
||||
virtual Result DoOperateRange(void *dst, size_t dst_size, fs::OperationId op_id, s64 offset, s64 size, const void *src, size_t src_size) override {
|
||||
return m_base_file->OperateRange(dst, dst_size, op_id, offset, size, src, src_size);
|
||||
R_RETURN(m_base_file->OperateRange(dst, dst_size, op_id, offset, size, src, src_size));
|
||||
}
|
||||
public:
|
||||
virtual sf::cmif::DomainObjectId GetDomainObjectId() const override {
|
||||
|
||||
@@ -175,7 +175,7 @@ namespace ams::fssystem {
|
||||
template<typename BaseStorageType>
|
||||
Result HierarchicalSha256Storage<BaseStorageType>::OperateRange(void *dst, size_t dst_size, fs::OperationId op_id, s64 offset, s64 size, const void *src, size_t src_size) {
|
||||
if (op_id == fs::OperationId::Invalidate) {
|
||||
return m_base_storage->OperateRange(fs::OperationId::Invalidate, offset, size);
|
||||
R_RETURN(m_base_storage->OperateRange(fs::OperationId::Invalidate, offset, size));
|
||||
} else {
|
||||
/* Succeed if zero-size. */
|
||||
R_SUCCEED_IF(size == 0);
|
||||
@@ -188,7 +188,7 @@ namespace ams::fssystem {
|
||||
const auto reduced_size = std::min<s64>(m_base_storage_size, util::AlignUp(offset + size, m_hash_target_block_size)) - offset;
|
||||
|
||||
/* Operate on the base storage. */
|
||||
return m_base_storage->OperateRange(dst, dst_size, op_id, offset, reduced_size, src, src_size);
|
||||
R_RETURN(m_base_storage->OperateRange(dst, dst_size, op_id, offset, reduced_size, src, src_size));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -44,11 +44,11 @@ namespace ams::fssystem {
|
||||
virtual Result OperateRange(void *dst, size_t dst_size, fs::OperationId op_id, s64 offset, s64 size, const void *src, size_t src_size) override;
|
||||
|
||||
virtual Result GetSize(s64 *out) override {
|
||||
return m_base_storage->GetSize(out);
|
||||
R_RETURN(m_base_storage->GetSize(out));
|
||||
}
|
||||
|
||||
virtual Result Flush() override {
|
||||
return m_base_storage->Flush();
|
||||
R_RETURN(m_base_storage->Flush());
|
||||
}
|
||||
|
||||
virtual Result SetSize(s64 size) override {
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace ams::fssystem {
|
||||
const auto entry_storage_offset = node_storage_offset + node_storage_size;
|
||||
|
||||
/* Initialize. */
|
||||
return this->Initialize(allocator, fs::SubStorage(std::addressof(table_storage), node_storage_offset, node_storage_size), fs::SubStorage(std::addressof(table_storage), entry_storage_offset, entry_storage_size), header.entry_count);
|
||||
R_RETURN(this->Initialize(allocator, fs::SubStorage(std::addressof(table_storage), node_storage_offset, node_storage_size), fs::SubStorage(std::addressof(table_storage), entry_storage_offset, entry_storage_size), header.entry_count));
|
||||
}
|
||||
|
||||
void IndirectStorage::Finalize() {
|
||||
|
||||
@@ -73,11 +73,11 @@ namespace ams::fssystem {
|
||||
constexpr KeySlotCache() : m_mutex(), m_high_priority_mru_list(), m_low_priority_mru_list() { /* ... */ }
|
||||
|
||||
Result AllocateHighPriority(std::unique_ptr<KeySlotCacheAccessor> *out, const void *key, size_t key_size, s32 key2) {
|
||||
return this->AllocateFromLru(out, m_high_priority_mru_list, key, key_size, key2);
|
||||
R_RETURN(this->AllocateFromLru(out, m_high_priority_mru_list, key, key_size, key2));
|
||||
}
|
||||
|
||||
Result AllocateLowPriority(std::unique_ptr<KeySlotCacheAccessor> *out, const void *key, size_t key_size, s32 key2) {
|
||||
return this->AllocateFromLru(out, m_high_priority_mru_list, key, key_size, key2);
|
||||
R_RETURN(this->AllocateFromLru(out, m_high_priority_mru_list, key, key_size, key2));
|
||||
}
|
||||
|
||||
Result Find(std::unique_ptr<KeySlotCacheAccessor> *out, const void *key, size_t key_size, s32 key2) {
|
||||
|
||||
@@ -45,42 +45,42 @@ namespace ams::fssystem {
|
||||
/* Check pre-conditions. */
|
||||
AMS_ASSERT(m_storage != nullptr);
|
||||
|
||||
return m_storage->Read(offset, buffer, size);
|
||||
R_RETURN(m_storage->Read(offset, buffer, size));
|
||||
}
|
||||
|
||||
virtual Result OperateRange(void *dst, size_t dst_size, fs::OperationId op_id, s64 offset, s64 size, const void *src, size_t src_size) override {
|
||||
/* Check pre-conditions. */
|
||||
AMS_ASSERT(m_storage != nullptr);
|
||||
|
||||
return m_storage->OperateRange(dst, dst_size, op_id, offset, size, src, src_size);
|
||||
R_RETURN(m_storage->OperateRange(dst, dst_size, op_id, offset, size, src, src_size));
|
||||
}
|
||||
|
||||
virtual Result GetSize(s64 *out) override {
|
||||
/* Check pre-conditions. */
|
||||
AMS_ASSERT(m_storage != nullptr);
|
||||
|
||||
return m_storage->GetSize(out);
|
||||
R_RETURN(m_storage->GetSize(out));
|
||||
}
|
||||
|
||||
virtual Result Flush() override {
|
||||
/* Check pre-conditions. */
|
||||
AMS_ASSERT(m_storage != nullptr);
|
||||
|
||||
return m_storage->Flush();
|
||||
R_RETURN(m_storage->Flush());
|
||||
}
|
||||
|
||||
virtual Result Write(s64 offset, const void *buffer, size_t size) override {
|
||||
/* Check pre-conditions. */
|
||||
AMS_ASSERT(m_storage != nullptr);
|
||||
|
||||
return m_storage->Write(offset, buffer, size);
|
||||
R_RETURN(m_storage->Write(offset, buffer, size));
|
||||
}
|
||||
|
||||
virtual Result SetSize(s64 size) override {
|
||||
/* Check pre-conditions. */
|
||||
AMS_ASSERT(m_storage != nullptr);
|
||||
|
||||
return m_storage->SetSize(size);
|
||||
R_RETURN(m_storage->SetSize(size));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -392,7 +392,7 @@ namespace ams::fssystem {
|
||||
AMS_ASSERT(0 <= index && index < NcaHeader::FsCountMax);
|
||||
|
||||
const s64 offset = sizeof(NcaHeader) + sizeof(NcaFsHeader) * index;
|
||||
return m_header_storage->Read(offset, dst, sizeof(NcaFsHeader));
|
||||
R_RETURN(m_header_storage->Read(offset, dst, sizeof(NcaFsHeader)));
|
||||
}
|
||||
|
||||
bool NcaReader::GetHeaderSign1Valid() const {
|
||||
@@ -506,7 +506,7 @@ namespace ams::fssystem {
|
||||
AMS_ASSERT(out != nullptr);
|
||||
AMS_ASSERT(this->IsInitialized());
|
||||
|
||||
return m_data.GetHashTargetOffset(out);
|
||||
R_RETURN(m_data.GetHashTargetOffset(out));
|
||||
}
|
||||
|
||||
bool NcaFsHeaderReader::ExistsSparseLayer() const {
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace ams::fssystem {
|
||||
R_UNLESS(m_buffer != nullptr, fs::ResultAllocationMemoryFailedInPartitionFileSystemMetaA());
|
||||
|
||||
/* Perform regular initialization. */
|
||||
return this->Initialize(storage, m_buffer, m_meta_data_size);
|
||||
R_RETURN(this->Initialize(storage, m_buffer, m_meta_data_size));
|
||||
}
|
||||
|
||||
template <typename Format>
|
||||
|
||||
@@ -84,7 +84,7 @@ namespace ams::fssystem {
|
||||
|
||||
R_SUCCEED();
|
||||
} else {
|
||||
return m_base_storage->Read(offset, buffer, size);
|
||||
R_RETURN(m_base_storage->Read(offset, buffer, size));
|
||||
}
|
||||
}
|
||||
virtual Result OperateRange(void *dst, size_t dst_size, fs::OperationId op_id, s64 offset, s64 size, const void *src, size_t src_size) override {
|
||||
@@ -106,11 +106,11 @@ namespace ams::fssystem {
|
||||
}
|
||||
|
||||
/* Operate on the base storage. */
|
||||
return m_base_storage->OperateRange(dst, dst_size, op_id, offset, size, src, src_size);
|
||||
R_RETURN(m_base_storage->OperateRange(dst, dst_size, op_id, offset, size, src, src_size));
|
||||
}
|
||||
|
||||
virtual Result GetSize(s64 *out) override {
|
||||
return m_base_storage->GetSize(out);
|
||||
R_RETURN(m_base_storage->GetSize(out));
|
||||
}
|
||||
|
||||
virtual Result Flush() override {
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace ams::gpio::driver {
|
||||
}
|
||||
|
||||
Result RegisterDeviceCode(DeviceCode device_code, Pad *pad) {
|
||||
return impl::RegisterDeviceCode(device_code, pad);
|
||||
R_RETURN(impl::RegisterDeviceCode(device_code, pad));
|
||||
}
|
||||
|
||||
bool UnregisterDeviceCode(DeviceCode device_code) {
|
||||
|
||||
@@ -110,7 +110,7 @@ namespace ams::gpio::driver::impl {
|
||||
AMS_ASSERT(driver.GetInterruptControlMutex(pad).IsLockedByCurrentThread());
|
||||
|
||||
/* Set interrupt enabled. */
|
||||
return driver.SetInterruptEnabled(std::addressof(pad), pad.IsInterruptRequiredForDriver());
|
||||
R_RETURN(driver.SetInterruptEnabled(std::addressof(pad), pad.IsInterruptRequiredForDriver()));
|
||||
}
|
||||
|
||||
Result PadSessionImpl::GetInterruptEnabled(bool *out) const {
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace ams::gpio {
|
||||
}
|
||||
|
||||
Result IsWakeEventActive(ams::sf::Out<bool> out, gpio::GpioPadName pad_name) {
|
||||
return ::gpioIsWakeEventActive2(out.GetPointer(), static_cast<::GpioPadName>(static_cast<u32>(pad_name)));
|
||||
R_RETURN(::gpioIsWakeEventActive2(out.GetPointer(), static_cast<::GpioPadName>(static_cast<u32>(pad_name))));
|
||||
}
|
||||
|
||||
Result GetWakeEventActiveFlagSet(ams::sf::Out<gpio::WakeBitFlag> out) {
|
||||
@@ -66,7 +66,7 @@ namespace ams::gpio {
|
||||
Result OpenSession2(ams::sf::Out<ams::sf::SharedPointer<gpio::sf::IPadSession>> out, DeviceCode device_code, ddsf::AccessMode access_mode);
|
||||
|
||||
Result IsWakeEventActive2(ams::sf::Out<bool> out, DeviceCode device_code) {
|
||||
return ::gpioIsWakeEventActive2(out.GetPointer(), device_code.GetInternalValue());
|
||||
R_RETURN(::gpioIsWakeEventActive2(out.GetPointer(), device_code.GetInternalValue()));
|
||||
}
|
||||
|
||||
Result SetWakeEventActiveFlagSetForDebug2(DeviceCode device_code, bool is_enabled) {
|
||||
|
||||
@@ -29,47 +29,47 @@ namespace ams::gpio {
|
||||
public:
|
||||
/* Actual commands. */
|
||||
Result SetDirection(gpio::Direction direction) {
|
||||
return ::gpioPadSetDirection(std::addressof(m_srv), static_cast<::GpioDirection>(static_cast<u32>(direction)));
|
||||
R_RETURN(::gpioPadSetDirection(std::addressof(m_srv), static_cast<::GpioDirection>(static_cast<u32>(direction))));
|
||||
}
|
||||
|
||||
Result GetDirection(ams::sf::Out<gpio::Direction> out) {
|
||||
static_assert(sizeof(gpio::Direction) == sizeof(::GpioDirection));
|
||||
return ::gpioPadGetDirection(std::addressof(m_srv), reinterpret_cast<::GpioDirection *>(out.GetPointer()));
|
||||
R_RETURN(::gpioPadGetDirection(std::addressof(m_srv), reinterpret_cast<::GpioDirection *>(out.GetPointer())));
|
||||
}
|
||||
|
||||
Result SetInterruptMode(gpio::InterruptMode mode) {
|
||||
return ::gpioPadSetInterruptMode(std::addressof(m_srv), static_cast<::GpioInterruptMode>(static_cast<u32>(mode)));
|
||||
R_RETURN(::gpioPadSetInterruptMode(std::addressof(m_srv), static_cast<::GpioInterruptMode>(static_cast<u32>(mode))));
|
||||
}
|
||||
|
||||
Result GetInterruptMode(ams::sf::Out<gpio::InterruptMode> out) {
|
||||
static_assert(sizeof(gpio::InterruptMode) == sizeof(::GpioInterruptMode));
|
||||
return ::gpioPadGetInterruptMode(std::addressof(m_srv), reinterpret_cast<::GpioInterruptMode *>(out.GetPointer()));
|
||||
R_RETURN(::gpioPadGetInterruptMode(std::addressof(m_srv), reinterpret_cast<::GpioInterruptMode *>(out.GetPointer())));
|
||||
}
|
||||
|
||||
Result SetInterruptEnable(bool enable) {
|
||||
return ::gpioPadSetInterruptEnable(std::addressof(m_srv), enable);
|
||||
R_RETURN(::gpioPadSetInterruptEnable(std::addressof(m_srv), enable));
|
||||
}
|
||||
|
||||
Result GetInterruptEnable(ams::sf::Out<bool> out) {
|
||||
return ::gpioPadGetInterruptEnable(std::addressof(m_srv), out.GetPointer());
|
||||
R_RETURN(::gpioPadGetInterruptEnable(std::addressof(m_srv), out.GetPointer()));
|
||||
}
|
||||
|
||||
Result GetInterruptStatus(ams::sf::Out<gpio::InterruptStatus> out) {
|
||||
static_assert(sizeof(gpio::InterruptStatus) == sizeof(::GpioInterruptStatus));
|
||||
return ::gpioPadGetInterruptStatus(std::addressof(m_srv), reinterpret_cast<::GpioInterruptStatus *>(out.GetPointer()));
|
||||
R_RETURN(::gpioPadGetInterruptStatus(std::addressof(m_srv), reinterpret_cast<::GpioInterruptStatus *>(out.GetPointer())));
|
||||
}
|
||||
|
||||
Result ClearInterruptStatus() {
|
||||
return ::gpioPadClearInterruptStatus(std::addressof(m_srv));
|
||||
R_RETURN(::gpioPadClearInterruptStatus(std::addressof(m_srv)));
|
||||
}
|
||||
|
||||
Result SetValue(gpio::GpioValue value) {
|
||||
return ::gpioPadSetValue(std::addressof(m_srv), static_cast<::GpioValue>(static_cast<u32>(value)));
|
||||
R_RETURN(::gpioPadSetValue(std::addressof(m_srv), static_cast<::GpioValue>(static_cast<u32>(value))));
|
||||
}
|
||||
|
||||
Result GetValue(ams::sf::Out<gpio::GpioValue> out) {
|
||||
static_assert(sizeof(gpio::GpioValue) == sizeof(::GpioValue));
|
||||
return ::gpioPadGetValue(std::addressof(m_srv), reinterpret_cast<::GpioValue *>(out.GetPointer()));
|
||||
R_RETURN(::gpioPadGetValue(std::addressof(m_srv), reinterpret_cast<::GpioValue *>(out.GetPointer())));
|
||||
}
|
||||
|
||||
Result BindInterrupt(ams::sf::OutCopyHandle out) {
|
||||
@@ -80,23 +80,23 @@ namespace ams::gpio {
|
||||
}
|
||||
|
||||
Result UnbindInterrupt() {
|
||||
return ::gpioPadUnbindInterrupt(std::addressof(m_srv));
|
||||
R_RETURN(::gpioPadUnbindInterrupt(std::addressof(m_srv)));
|
||||
}
|
||||
|
||||
Result SetDebounceEnabled(bool enable) {
|
||||
return ::gpioPadSetDebounceEnabled(std::addressof(m_srv), enable);
|
||||
R_RETURN(::gpioPadSetDebounceEnabled(std::addressof(m_srv), enable));
|
||||
}
|
||||
|
||||
Result GetDebounceEnabled(ams::sf::Out<bool> out) {
|
||||
return ::gpioPadGetDebounceEnabled(std::addressof(m_srv), out.GetPointer());
|
||||
R_RETURN(::gpioPadGetDebounceEnabled(std::addressof(m_srv), out.GetPointer()));
|
||||
}
|
||||
|
||||
Result SetDebounceTime(s32 ms) {
|
||||
return ::gpioPadSetDebounceTime(std::addressof(m_srv), ms);
|
||||
R_RETURN(::gpioPadSetDebounceTime(std::addressof(m_srv), ms));
|
||||
}
|
||||
|
||||
Result GetDebounceTime(ams::sf::Out<s32> out) {
|
||||
return ::gpioPadGetDebounceTime(std::addressof(m_srv), out.GetPointer());
|
||||
R_RETURN(::gpioPadGetDebounceTime(std::addressof(m_srv), out.GetPointer()));
|
||||
}
|
||||
|
||||
Result SetValueForSleepState(gpio::GpioValue value) {
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace ams::gpio::server {
|
||||
}
|
||||
|
||||
Result ManagerImpl::OpenSession(ams::sf::Out<ams::sf::SharedPointer<gpio::sf::IPadSession>> out, gpio::GpioPadName pad_name) {
|
||||
return this->OpenSession2(out, ConvertToDeviceCode(pad_name), ddsf::AccessMode_ReadWrite);
|
||||
R_RETURN(this->OpenSession2(out, ConvertToDeviceCode(pad_name), ddsf::AccessMode_ReadWrite));
|
||||
}
|
||||
|
||||
Result ManagerImpl::OpenSessionForTest(ams::sf::Out<ams::sf::SharedPointer<gpio::sf::IPadSession>> out, gpio::GpioPadName pad_name) {
|
||||
|
||||
@@ -52,7 +52,7 @@ namespace ams::hid {
|
||||
if (!g_initialized_hid) {
|
||||
if (!serviceIsActive(hidGetServiceSession())) {
|
||||
if (!pm::info::HasLaunchedBootProgram(ncm::SystemProgramId::Hid)) {
|
||||
return MAKERESULT(Module_Libnx, LibnxError_InitFail_HID);
|
||||
R_THROW(MAKERESULT(Module_Libnx, LibnxError_InitFail_HID));
|
||||
}
|
||||
InitializeHid();
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace ams::htc::server::driver {
|
||||
AMS_ABORT("Unsupported channel");
|
||||
}
|
||||
|
||||
return this->Open(channel, m_default_receive_buffer, sizeof(m_default_receive_buffer), m_default_send_buffer, sizeof(m_default_send_buffer));
|
||||
R_RETURN(this->Open(channel, m_default_receive_buffer, sizeof(m_default_receive_buffer), m_default_send_buffer, sizeof(m_default_send_buffer)));
|
||||
}
|
||||
|
||||
Result HtclowDriver::Open(htclow::ChannelId channel, void *receive_buffer, size_t receive_buffer_size, void *send_buffer, size_t send_buffer_size) {
|
||||
@@ -132,7 +132,7 @@ namespace ams::htc::server::driver {
|
||||
this->WaitTask(task_id);
|
||||
|
||||
/* Finish receiving. */
|
||||
return m_manager->ReceiveEnd(out, dst, dst_size, GetHtclowChannel(channel, m_module_id), task_id);
|
||||
R_RETURN(m_manager->ReceiveEnd(out, dst, dst_size, GetHtclowChannel(channel, m_module_id), task_id));
|
||||
}
|
||||
|
||||
Result HtclowDriver::Receive(s64 *out, void *dst, s64 dst_size, htclow::ChannelId channel, htclow::ReceiveOption option) {
|
||||
@@ -164,7 +164,7 @@ namespace ams::htc::server::driver {
|
||||
if (htclow::ResultChannelNotExist::Includes(result)) {
|
||||
*out = received;
|
||||
}
|
||||
return result;
|
||||
R_RETURN(result);
|
||||
}
|
||||
|
||||
received += cur_received;
|
||||
|
||||
@@ -80,11 +80,11 @@ namespace ams::htc::server {
|
||||
}
|
||||
|
||||
Result HtcServiceObject::GetWorkingDirectoryPath(const sf::OutBuffer &out, s32 max_len) {
|
||||
return htcfs::GetWorkingDirectory(reinterpret_cast<char *>(out.GetPointer()), max_len);
|
||||
R_RETURN(htcfs::GetWorkingDirectory(reinterpret_cast<char *>(out.GetPointer()), max_len));
|
||||
}
|
||||
|
||||
Result HtcServiceObject::GetWorkingDirectoryPathSize(sf::Out<s32> out_size) {
|
||||
return htcfs::GetWorkingDirectorySize(out_size.GetPointer());
|
||||
R_RETURN(htcfs::GetWorkingDirectorySize(out_size.GetPointer()));
|
||||
}
|
||||
|
||||
Result HtcServiceObject::RunOnHostStart(sf::Out<u32> out_id, sf::OutCopyHandle out, const sf::InBuffer &args) {
|
||||
@@ -111,7 +111,7 @@ namespace ams::htc::server {
|
||||
}
|
||||
|
||||
/* Finish the run on host task. */
|
||||
return m_misc_impl.RunOnHostEnd(out_result.GetPointer(), id);
|
||||
R_RETURN(m_misc_impl.RunOnHostEnd(out_result.GetPointer(), id));
|
||||
}
|
||||
|
||||
Result HtcServiceObject::GetBridgeIpAddress(const sf::OutBuffer &out) {
|
||||
|
||||
@@ -26,43 +26,43 @@ namespace ams::htcfs {
|
||||
public:
|
||||
Client(htclow::HtclowManager *manager) : m_impl(manager) { /* ... */ }
|
||||
public:
|
||||
Result OpenFile(s32 *out_handle, const char *path, fs::OpenMode mode, bool case_sensitive) { return ConvertToFsResult(m_impl.OpenFile(out_handle, path, mode, case_sensitive)); }
|
||||
Result FileExists(bool *out, const char *path, bool case_sensitive) { return ConvertToFsResult(m_impl.FileExists(out, path, case_sensitive)); }
|
||||
Result DeleteFile(const char *path, bool case_sensitive) { return ConvertToFsResult(m_impl.DeleteFile(path, case_sensitive)); }
|
||||
Result RenameFile(const char *old_path, const char *new_path, bool case_sensitive) { return ConvertToFsResult(m_impl.RenameFile(old_path, new_path, case_sensitive)); }
|
||||
Result GetEntryType(fs::DirectoryEntryType *out, const char *path, bool case_sensitive) { return ConvertToFsResult(m_impl.GetEntryType(out, path, case_sensitive)); }
|
||||
Result OpenDirectory(s32 *out_handle, const char *path, fs::OpenDirectoryMode mode, bool case_sensitive) { return ConvertToFsResult(m_impl.OpenDirectory(out_handle, path, mode, case_sensitive)); }
|
||||
Result DirectoryExists(bool *out, const char *path, bool case_sensitive) { return ConvertToFsResult(m_impl.DirectoryExists(out, path, case_sensitive)); }
|
||||
Result CreateDirectory(const char *path, bool case_sensitive) { return ConvertToFsResult(m_impl.CreateDirectory(path, case_sensitive)); }
|
||||
Result DeleteDirectory(const char *path, bool recursively, bool case_sensitive) { return ConvertToFsResult(m_impl.DeleteDirectory(path, recursively, case_sensitive)); }
|
||||
Result RenameDirectory(const char *old_path, const char *new_path, bool case_sensitive) { return ConvertToFsResult(m_impl.RenameDirectory(old_path, new_path, case_sensitive)); }
|
||||
Result CreateFile(const char *path, s64 size, bool case_sensitive) { return ConvertToFsResult(m_impl.CreateFile(path, size, case_sensitive)); }
|
||||
Result GetFileTimeStamp(u64 *out_create, u64 *out_access, u64 *out_modify, const char *path, bool case_sensitive) { return ConvertToFsResult(m_impl.GetFileTimeStamp(out_create, out_access, out_modify, path, case_sensitive)); }
|
||||
Result GetCaseSensitivePath(char *dst, size_t dst_size, const char *path) { return ConvertToFsResult(m_impl.GetCaseSensitivePath(dst, dst_size, path)); }
|
||||
Result GetDiskFreeSpace(s64 *out_free, s64 *out_total, s64 *out_total_free, const char *path) { return ConvertToFsResult(m_impl.GetDiskFreeSpace(out_free, out_total, out_total_free, path)); }
|
||||
Result OpenFile(s32 *out_handle, const char *path, fs::OpenMode mode, bool case_sensitive) { R_RETURN(ConvertToFsResult(m_impl.OpenFile(out_handle, path, mode, case_sensitive))); }
|
||||
Result FileExists(bool *out, const char *path, bool case_sensitive) { R_RETURN(ConvertToFsResult(m_impl.FileExists(out, path, case_sensitive))); }
|
||||
Result DeleteFile(const char *path, bool case_sensitive) { R_RETURN(ConvertToFsResult(m_impl.DeleteFile(path, case_sensitive))); }
|
||||
Result RenameFile(const char *old_path, const char *new_path, bool case_sensitive) { R_RETURN(ConvertToFsResult(m_impl.RenameFile(old_path, new_path, case_sensitive))); }
|
||||
Result GetEntryType(fs::DirectoryEntryType *out, const char *path, bool case_sensitive) { R_RETURN(ConvertToFsResult(m_impl.GetEntryType(out, path, case_sensitive))); }
|
||||
Result OpenDirectory(s32 *out_handle, const char *path, fs::OpenDirectoryMode mode, bool case_sensitive) { R_RETURN(ConvertToFsResult(m_impl.OpenDirectory(out_handle, path, mode, case_sensitive))); }
|
||||
Result DirectoryExists(bool *out, const char *path, bool case_sensitive) { R_RETURN(ConvertToFsResult(m_impl.DirectoryExists(out, path, case_sensitive))); }
|
||||
Result CreateDirectory(const char *path, bool case_sensitive) { R_RETURN(ConvertToFsResult(m_impl.CreateDirectory(path, case_sensitive))); }
|
||||
Result DeleteDirectory(const char *path, bool recursively, bool case_sensitive) { R_RETURN(ConvertToFsResult(m_impl.DeleteDirectory(path, recursively, case_sensitive))); }
|
||||
Result RenameDirectory(const char *old_path, const char *new_path, bool case_sensitive) { R_RETURN(ConvertToFsResult(m_impl.RenameDirectory(old_path, new_path, case_sensitive))); }
|
||||
Result CreateFile(const char *path, s64 size, bool case_sensitive) { R_RETURN(ConvertToFsResult(m_impl.CreateFile(path, size, case_sensitive))); }
|
||||
Result GetFileTimeStamp(u64 *out_create, u64 *out_access, u64 *out_modify, const char *path, bool case_sensitive) { R_RETURN(ConvertToFsResult(m_impl.GetFileTimeStamp(out_create, out_access, out_modify, path, case_sensitive))); }
|
||||
Result GetCaseSensitivePath(char *dst, size_t dst_size, const char *path) { R_RETURN(ConvertToFsResult(m_impl.GetCaseSensitivePath(dst, dst_size, path))); }
|
||||
Result GetDiskFreeSpace(s64 *out_free, s64 *out_total, s64 *out_total_free, const char *path) { R_RETURN(ConvertToFsResult(m_impl.GetDiskFreeSpace(out_free, out_total, out_total_free, path))); }
|
||||
|
||||
Result CloseDirectory(s32 handle) { return ConvertToFsResult(m_impl.CloseDirectory(handle)); }
|
||||
Result CloseDirectory(s32 handle) { R_RETURN(ConvertToFsResult(m_impl.CloseDirectory(handle))); }
|
||||
|
||||
Result GetEntryCount(s64 *out, s32 handle) { return ConvertToFsResult(m_impl.GetEntryCount(out, handle)); }
|
||||
Result ReadDirectory(s64 *out, fs::DirectoryEntry *out_entries, size_t max_out_entries, s32 handle) { return ConvertToFsResult(m_impl.ReadDirectory(out, out_entries, max_out_entries, handle)); }
|
||||
Result ReadDirectoryLarge(s64 *out, fs::DirectoryEntry *out_entries, size_t max_out_entries, s32 handle) { return ConvertToFsResult(m_impl.ReadDirectoryLarge(out, out_entries, max_out_entries, handle)); }
|
||||
Result GetPriorityForDirectory(s32 *out, s32 handle) { return ConvertToFsResult(m_impl.GetPriorityForDirectory(out, handle)); }
|
||||
Result SetPriorityForDirectory(s32 priority, s32 handle) { return ConvertToFsResult(m_impl.SetPriorityForDirectory(priority, handle)); }
|
||||
Result GetEntryCount(s64 *out, s32 handle) { R_RETURN(ConvertToFsResult(m_impl.GetEntryCount(out, handle))); }
|
||||
Result ReadDirectory(s64 *out, fs::DirectoryEntry *out_entries, size_t max_out_entries, s32 handle) { R_RETURN(ConvertToFsResult(m_impl.ReadDirectory(out, out_entries, max_out_entries, handle))); }
|
||||
Result ReadDirectoryLarge(s64 *out, fs::DirectoryEntry *out_entries, size_t max_out_entries, s32 handle) { R_RETURN(ConvertToFsResult(m_impl.ReadDirectoryLarge(out, out_entries, max_out_entries, handle))); }
|
||||
Result GetPriorityForDirectory(s32 *out, s32 handle) { R_RETURN(ConvertToFsResult(m_impl.GetPriorityForDirectory(out, handle))); }
|
||||
Result SetPriorityForDirectory(s32 priority, s32 handle) { R_RETURN(ConvertToFsResult(m_impl.SetPriorityForDirectory(priority, handle))); }
|
||||
|
||||
Result CloseFile(s32 handle) { return ConvertToFsResult(m_impl.CloseFile(handle)); }
|
||||
Result CloseFile(s32 handle) { R_RETURN(ConvertToFsResult(m_impl.CloseFile(handle))); }
|
||||
|
||||
Result ReadFile(s64 *out, void *buffer, s32 handle, s64 offset, s64 buffer_size, fs::ReadOption option) { return ConvertToFsResult(m_impl.ReadFile(out, buffer, handle, offset, buffer_size, option)); }
|
||||
Result ReadFileLarge(s64 *out, void *buffer, s32 handle, s64 offset, s64 buffer_size, fs::ReadOption option) { return ConvertToFsResult(m_impl.ReadFileLarge(out, buffer, handle, offset, buffer_size, option)); }
|
||||
Result WriteFile(const void *buffer, s32 handle, s64 offset, s64 buffer_size, fs::WriteOption option) { return ConvertToFsResult(m_impl.WriteFile(buffer, handle, offset, buffer_size, option)); }
|
||||
Result WriteFileLarge(const void *buffer, s32 handle, s64 offset, s64 buffer_size, fs::WriteOption option) { return ConvertToFsResult(m_impl.WriteFileLarge(buffer, handle, offset, buffer_size, option)); }
|
||||
Result GetFileSize(s64 *out, s32 handle) { return ConvertToFsResult(m_impl.GetFileSize(out, handle)); }
|
||||
Result SetFileSize(s64 size, s32 handle) { return ConvertToFsResult(m_impl.SetFileSize(size, handle)); }
|
||||
Result FlushFile(s32 handle) { return ConvertToFsResult(m_impl.FlushFile(handle)); }
|
||||
Result GetPriorityForFile(s32 *out, s32 handle) { return ConvertToFsResult(m_impl.GetPriorityForFile(out, handle)); }
|
||||
Result SetPriorityForFile(s32 priority, s32 handle) { return ConvertToFsResult(m_impl.SetPriorityForFile(priority, handle)); }
|
||||
Result ReadFile(s64 *out, void *buffer, s32 handle, s64 offset, s64 buffer_size, fs::ReadOption option) { R_RETURN(ConvertToFsResult(m_impl.ReadFile(out, buffer, handle, offset, buffer_size, option))); }
|
||||
Result ReadFileLarge(s64 *out, void *buffer, s32 handle, s64 offset, s64 buffer_size, fs::ReadOption option) { R_RETURN(ConvertToFsResult(m_impl.ReadFileLarge(out, buffer, handle, offset, buffer_size, option))); }
|
||||
Result WriteFile(const void *buffer, s32 handle, s64 offset, s64 buffer_size, fs::WriteOption option) { R_RETURN(ConvertToFsResult(m_impl.WriteFile(buffer, handle, offset, buffer_size, option))); }
|
||||
Result WriteFileLarge(const void *buffer, s32 handle, s64 offset, s64 buffer_size, fs::WriteOption option) { R_RETURN(ConvertToFsResult(m_impl.WriteFileLarge(buffer, handle, offset, buffer_size, option))); }
|
||||
Result GetFileSize(s64 *out, s32 handle) { R_RETURN(ConvertToFsResult(m_impl.GetFileSize(out, handle))); }
|
||||
Result SetFileSize(s64 size, s32 handle) { R_RETURN(ConvertToFsResult(m_impl.SetFileSize(size, handle))); }
|
||||
Result FlushFile(s32 handle) { R_RETURN(ConvertToFsResult(m_impl.FlushFile(handle))); }
|
||||
Result GetPriorityForFile(s32 *out, s32 handle) { R_RETURN(ConvertToFsResult(m_impl.GetPriorityForFile(out, handle))); }
|
||||
Result SetPriorityForFile(s32 priority, s32 handle) { R_RETURN(ConvertToFsResult(m_impl.SetPriorityForFile(priority, handle))); }
|
||||
|
||||
Result GetWorkingDirectory(char *dst, size_t dst_size) { return ConvertToFsResult(m_impl.GetWorkingDirectory(dst, dst_size)); }
|
||||
Result GetWorkingDirectorySize(s32 *out) { return ConvertToFsResult(m_impl.GetWorkingDirectorySize(out)); }
|
||||
Result GetWorkingDirectory(char *dst, size_t dst_size) { R_RETURN(ConvertToFsResult(m_impl.GetWorkingDirectory(dst, dst_size))); }
|
||||
Result GetWorkingDirectorySize(s32 *out) { R_RETURN(ConvertToFsResult(m_impl.GetWorkingDirectorySize(out))); }
|
||||
};
|
||||
|
||||
void InitializeClient(htclow::HtclowManager *manager);
|
||||
|
||||
@@ -261,19 +261,19 @@ namespace ams::htcfs {
|
||||
}
|
||||
|
||||
Result ClientImpl::SendToRpcChannel(const void *src, s64 size) {
|
||||
return this->SendToHtclow(src, size, std::addressof(m_rpc_channel));
|
||||
R_RETURN(this->SendToHtclow(src, size, std::addressof(m_rpc_channel)));
|
||||
}
|
||||
|
||||
Result ClientImpl::ReceiveFromRpcChannel(void *dst, s64 size) {
|
||||
return this->ReceiveFromHtclow(dst, size, std::addressof(m_rpc_channel));
|
||||
R_RETURN(this->ReceiveFromHtclow(dst, size, std::addressof(m_rpc_channel)));
|
||||
}
|
||||
|
||||
Result ClientImpl::ReceiveFromDataChannel(s64 size) {
|
||||
return m_data_channel.WaitReceive(size);
|
||||
R_RETURN(m_data_channel.WaitReceive(size));
|
||||
}
|
||||
|
||||
Result ClientImpl::SendToDataChannel() {
|
||||
return m_data_channel.Flush();
|
||||
R_RETURN(m_data_channel.Flush());
|
||||
}
|
||||
|
||||
Result ClientImpl::SendToHtclow(const void *src, s64 size, htclow::Channel *channel) {
|
||||
@@ -856,14 +856,14 @@ namespace ams::htcfs {
|
||||
const auto htcfs_result = ConvertHtcfsResult(response.params[0]);
|
||||
if (R_FAILED(htcfs_result)) {
|
||||
R_UNLESS(response.body_size == 0, htcfs::ResultUnexpectedResponseBodySize());
|
||||
return htcfs_result;
|
||||
R_RETURN(htcfs_result);
|
||||
}
|
||||
|
||||
/* Check our operation's result. */
|
||||
const auto native_result = ConvertNativeResult(response.params[1]);
|
||||
if (R_FAILED(native_result)) {
|
||||
R_UNLESS(response.body_size == 0, htcfs::ResultUnexpectedResponseBodySize());
|
||||
return native_result;
|
||||
R_RETURN(native_result);
|
||||
}
|
||||
|
||||
/* Check the body size. */
|
||||
@@ -1016,7 +1016,7 @@ namespace ams::htcfs {
|
||||
|
||||
/* Receive the entries. */
|
||||
*out = response.params[2];
|
||||
return this->ReceiveFromRpcChannel(out_entries, response.body_size);
|
||||
R_RETURN(this->ReceiveFromRpcChannel(out_entries, response.body_size));
|
||||
}
|
||||
|
||||
Result ClientImpl::ReadDirectoryLarge(s64 *out, fs::DirectoryEntry *out_entries, size_t max_out_entries, s32 handle) {
|
||||
@@ -1052,14 +1052,14 @@ namespace ams::htcfs {
|
||||
const auto htcfs_result = ConvertHtcfsResult(response.params[0]);
|
||||
if (R_FAILED(htcfs_result)) {
|
||||
R_UNLESS(response.body_size == 0, htcfs::ResultUnexpectedResponseBodySize());
|
||||
return htcfs_result;
|
||||
R_RETURN(htcfs_result);
|
||||
}
|
||||
|
||||
/* Check our operation's result. */
|
||||
const auto native_result = ConvertNativeResult(response.params[1]);
|
||||
if (R_FAILED(native_result)) {
|
||||
R_UNLESS(response.body_size == 0, htcfs::ResultUnexpectedResponseBodySize());
|
||||
return native_result;
|
||||
R_RETURN(native_result);
|
||||
}
|
||||
|
||||
/* Check that the number of entries read is allowable. */
|
||||
@@ -1208,14 +1208,14 @@ namespace ams::htcfs {
|
||||
const auto htcfs_result = ConvertHtcfsResult(response.params[0]);
|
||||
if (R_FAILED(htcfs_result)) {
|
||||
R_UNLESS(response.body_size == 0, htcfs::ResultUnexpectedResponseBodySize());
|
||||
return htcfs_result;
|
||||
R_RETURN(htcfs_result);
|
||||
}
|
||||
|
||||
/* Check our operation's result. */
|
||||
const auto native_result = ConvertNativeResult(response.params[1]);
|
||||
if (R_FAILED(native_result)) {
|
||||
R_UNLESS(response.body_size == 0, htcfs::ResultUnexpectedResponseBodySize());
|
||||
return native_result;
|
||||
R_RETURN(native_result);
|
||||
}
|
||||
|
||||
/* Check the body size. */
|
||||
@@ -1265,14 +1265,14 @@ namespace ams::htcfs {
|
||||
const auto htcfs_result = ConvertHtcfsResult(response.params[0]);
|
||||
if (R_FAILED(htcfs_result)) {
|
||||
R_UNLESS(response.body_size == 0, htcfs::ResultUnexpectedResponseBodySize());
|
||||
return htcfs_result;
|
||||
R_RETURN(htcfs_result);
|
||||
}
|
||||
|
||||
/* Check our operation's result. */
|
||||
const auto native_result = ConvertNativeResult(response.params[1]);
|
||||
if (R_FAILED(native_result)) {
|
||||
R_UNLESS(response.body_size == 0, htcfs::ResultUnexpectedResponseBodySize());
|
||||
return native_result;
|
||||
R_RETURN(native_result);
|
||||
}
|
||||
|
||||
/* Check that the size read is allowable. */
|
||||
@@ -1348,7 +1348,7 @@ namespace ams::htcfs {
|
||||
|
||||
/* Verify that the host reports ready to receive our data. */
|
||||
if (static_cast<HtcfsResult>(response.params[0]) != HtcfsResult::Ready) {
|
||||
return ConvertHtcfsResult(response.params[0]);
|
||||
R_RETURN(ConvertHtcfsResult(response.params[0]));
|
||||
}
|
||||
|
||||
/* Verify that our send will be valid. */
|
||||
@@ -1569,7 +1569,7 @@ namespace ams::htcfs {
|
||||
const auto htcfs_result = ConvertHtcfsResult(response.params[0]);
|
||||
if (R_FAILED(htcfs_result)) {
|
||||
R_UNLESS(response.body_size == 0, htcfs::ResultUnexpectedResponseBodySize());
|
||||
return htcfs_result;
|
||||
R_RETURN(htcfs_result);
|
||||
}
|
||||
|
||||
/* Check that the body size is valid. */
|
||||
@@ -1610,7 +1610,7 @@ namespace ams::htcfs {
|
||||
const auto htcfs_result = ConvertHtcfsResult(response.params[0]);
|
||||
if (R_FAILED(htcfs_result)) {
|
||||
R_UNLESS(response.body_size == 0, htcfs::ResultUnexpectedResponseBodySize());
|
||||
return htcfs_result;
|
||||
R_RETURN(htcfs_result);
|
||||
}
|
||||
|
||||
/* Check that the size is representable. */
|
||||
|
||||
@@ -117,8 +117,8 @@ namespace ams::htcfs {
|
||||
Result SendToHtclow(const void *src, s64 size, htclow::Channel *channel);
|
||||
Result ReceiveFromHtclow(void *dst, s64 size, htclow::Channel *channel);
|
||||
|
||||
Result SendRequest(const Header &request) { return this->SendRequest(request, nullptr, 0, nullptr, 0); }
|
||||
Result SendRequest(const Header &request, const void *arg1, size_t arg1_size) { return this->SendRequest(request, arg1, arg1_size, nullptr, 0); }
|
||||
Result SendRequest(const Header &request) { R_RETURN(this->SendRequest(request, nullptr, 0, nullptr, 0)); }
|
||||
Result SendRequest(const Header &request, const void *arg1, size_t arg1_size) { R_RETURN(this->SendRequest(request, arg1, arg1_size, nullptr, 0)); }
|
||||
Result SendRequest(const Header &request, const void *arg1, size_t arg1_size, const void *arg2, size_t arg2_size);
|
||||
|
||||
void InitializeDataChannelForReceive(void *dst, size_t size);
|
||||
|
||||
@@ -26,23 +26,23 @@ namespace ams::htcfs {
|
||||
}
|
||||
|
||||
Result DirectoryServiceObject::GetEntryCount(ams::sf::Out<s64> out) {
|
||||
return htcfs::GetClient().GetEntryCount(out.GetPointer(), m_handle);
|
||||
R_RETURN(htcfs::GetClient().GetEntryCount(out.GetPointer(), m_handle));
|
||||
}
|
||||
|
||||
Result DirectoryServiceObject::Read(ams::sf::Out<s64> out, const ams::sf::OutMapAliasArray<fs::DirectoryEntry> &out_entries) {
|
||||
if (out_entries.GetSize() * sizeof(fs::DirectoryEntry) >= ClientImpl::MaxPacketBodySize) {
|
||||
return htcfs::GetClient().ReadDirectoryLarge(out.GetPointer(), out_entries.GetPointer(), out_entries.GetSize(), m_handle);
|
||||
R_RETURN(htcfs::GetClient().ReadDirectoryLarge(out.GetPointer(), out_entries.GetPointer(), out_entries.GetSize(), m_handle));
|
||||
} else {
|
||||
return htcfs::GetClient().ReadDirectory(out.GetPointer(), out_entries.GetPointer(), out_entries.GetSize(), m_handle);
|
||||
R_RETURN(htcfs::GetClient().ReadDirectory(out.GetPointer(), out_entries.GetPointer(), out_entries.GetSize(), m_handle));
|
||||
}
|
||||
}
|
||||
|
||||
Result DirectoryServiceObject::SetPriorityForDirectory(s32 priority) {
|
||||
return htcfs::GetClient().SetPriorityForDirectory(priority, m_handle);
|
||||
R_RETURN(htcfs::GetClient().SetPriorityForDirectory(priority, m_handle));
|
||||
}
|
||||
|
||||
Result DirectoryServiceObject::GetPriorityForDirectory(ams::sf::Out<s32> out) {
|
||||
return htcfs::GetClient().GetPriorityForDirectory(out.GetPointer(), m_handle);
|
||||
R_RETURN(htcfs::GetClient().GetPriorityForDirectory(out.GetPointer(), m_handle));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -30,9 +30,9 @@ namespace ams::htcfs {
|
||||
R_UNLESS(offset >= 0, htcfs::ResultInvalidArgument());
|
||||
|
||||
if (buffer.GetSize() >= ClientImpl::MaxPacketBodySize) {
|
||||
return htcfs::GetClient().ReadFileLarge(out.GetPointer(), buffer.GetPointer(), m_handle, offset, buffer.GetSize(), option);
|
||||
R_RETURN(htcfs::GetClient().ReadFileLarge(out.GetPointer(), buffer.GetPointer(), m_handle, offset, buffer.GetSize(), option));
|
||||
} else {
|
||||
return htcfs::GetClient().ReadFile(out.GetPointer(), buffer.GetPointer(), m_handle, offset, buffer.GetSize(), option);
|
||||
R_RETURN(htcfs::GetClient().ReadFile(out.GetPointer(), buffer.GetPointer(), m_handle, offset, buffer.GetSize(), option));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,33 +41,33 @@ namespace ams::htcfs {
|
||||
R_UNLESS(offset >= 0, htcfs::ResultInvalidArgument());
|
||||
|
||||
if (buffer.GetSize() >= ClientImpl::MaxPacketBodySize) {
|
||||
return htcfs::GetClient().WriteFileLarge(buffer.GetPointer(), m_handle, offset, buffer.GetSize(), option);
|
||||
R_RETURN(htcfs::GetClient().WriteFileLarge(buffer.GetPointer(), m_handle, offset, buffer.GetSize(), option));
|
||||
} else {
|
||||
return htcfs::GetClient().WriteFile(buffer.GetPointer(), m_handle, offset, buffer.GetSize(), option);
|
||||
R_RETURN(htcfs::GetClient().WriteFile(buffer.GetPointer(), m_handle, offset, buffer.GetSize(), option));
|
||||
}
|
||||
}
|
||||
|
||||
Result FileServiceObject::GetFileSize(ams::sf::Out<s64> out) {
|
||||
return htcfs::GetClient().GetFileSize(out.GetPointer(), m_handle);
|
||||
R_RETURN(htcfs::GetClient().GetFileSize(out.GetPointer(), m_handle));
|
||||
}
|
||||
|
||||
Result FileServiceObject::SetFileSize(s64 size) {
|
||||
/* Validate size. */
|
||||
R_UNLESS(size >= 0, htcfs::ResultInvalidArgument());
|
||||
|
||||
return htcfs::GetClient().SetFileSize(size, m_handle);
|
||||
R_RETURN(htcfs::GetClient().SetFileSize(size, m_handle));
|
||||
}
|
||||
|
||||
Result FileServiceObject::FlushFile() {
|
||||
return htcfs::GetClient().FlushFile(m_handle);
|
||||
R_RETURN(htcfs::GetClient().FlushFile(m_handle));
|
||||
}
|
||||
|
||||
Result FileServiceObject::SetPriorityForFile(s32 priority) {
|
||||
return htcfs::GetClient().SetPriorityForFile(priority, m_handle);
|
||||
R_RETURN(htcfs::GetClient().SetPriorityForFile(priority, m_handle));
|
||||
}
|
||||
|
||||
Result FileServiceObject::GetPriorityForFile(ams::sf::Out<s32> out) {
|
||||
return htcfs::GetClient().GetPriorityForFile(out.GetPointer(), m_handle);
|
||||
R_RETURN(htcfs::GetClient().GetPriorityForFile(out.GetPointer(), m_handle));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ namespace ams::htcfs {
|
||||
R_UNLESS(IsValidPath(path), htcfs::ResultInvalidArgument());
|
||||
|
||||
/* Get whether the file exists. */
|
||||
return htcfs::GetClient().FileExists(out.GetPointer(), path.str, case_sensitive);
|
||||
R_RETURN(htcfs::GetClient().FileExists(out.GetPointer(), path.str, case_sensitive));
|
||||
}
|
||||
|
||||
Result FileSystemServiceObject::DeleteFile(const tma::Path &path, bool case_sensitive) {
|
||||
@@ -94,7 +94,7 @@ namespace ams::htcfs {
|
||||
R_UNLESS(IsValidPath(path), htcfs::ResultInvalidArgument());
|
||||
|
||||
/* Delete the file. */
|
||||
return htcfs::GetClient().DeleteFile(path.str, case_sensitive);
|
||||
R_RETURN(htcfs::GetClient().DeleteFile(path.str, case_sensitive));
|
||||
}
|
||||
|
||||
Result FileSystemServiceObject::RenameFile(const tma::Path &old_path, const tma::Path &new_path, bool case_sensitive) {
|
||||
@@ -103,7 +103,7 @@ namespace ams::htcfs {
|
||||
R_UNLESS(IsValidPath(new_path), htcfs::ResultInvalidArgument());
|
||||
|
||||
/* Rename the file. */
|
||||
return htcfs::GetClient().RenameFile(old_path.str, new_path.str, case_sensitive);
|
||||
R_RETURN(htcfs::GetClient().RenameFile(old_path.str, new_path.str, case_sensitive));
|
||||
}
|
||||
|
||||
Result FileSystemServiceObject::GetIOType(sf::Out<s32> out, const tma::Path &path, bool case_sensitive) {
|
||||
@@ -112,7 +112,7 @@ namespace ams::htcfs {
|
||||
|
||||
/* Get the entry type. */
|
||||
static_assert(sizeof(s32) == sizeof(fs::DirectoryEntryType));
|
||||
return htcfs::GetClient().GetEntryType(reinterpret_cast<fs::DirectoryEntryType *>(out.GetPointer()), path.str, case_sensitive);
|
||||
R_RETURN(htcfs::GetClient().GetEntryType(reinterpret_cast<fs::DirectoryEntryType *>(out.GetPointer()), path.str, case_sensitive));
|
||||
}
|
||||
|
||||
Result FileSystemServiceObject::OpenDirectory(sf::Out<sf::SharedPointer<tma::IDirectoryAccessor>> out, const tma::Path &path, s32 open_mode, bool case_sensitive) {
|
||||
@@ -133,7 +133,7 @@ namespace ams::htcfs {
|
||||
R_UNLESS(IsValidPath(path), htcfs::ResultInvalidArgument());
|
||||
|
||||
/* Get whether the file exists. */
|
||||
return htcfs::GetClient().DirectoryExists(out.GetPointer(), path.str, case_sensitive);
|
||||
R_RETURN(htcfs::GetClient().DirectoryExists(out.GetPointer(), path.str, case_sensitive));
|
||||
}
|
||||
|
||||
Result FileSystemServiceObject::CreateDirectory(const tma::Path &path, bool case_sensitive) {
|
||||
@@ -141,7 +141,7 @@ namespace ams::htcfs {
|
||||
R_UNLESS(IsValidPath(path), htcfs::ResultInvalidArgument());
|
||||
|
||||
/* Create the directory. */
|
||||
return htcfs::GetClient().CreateDirectory(path.str, case_sensitive);
|
||||
R_RETURN(htcfs::GetClient().CreateDirectory(path.str, case_sensitive));
|
||||
}
|
||||
|
||||
Result FileSystemServiceObject::DeleteDirectory(const tma::Path &path, bool recursively, bool case_sensitive) {
|
||||
@@ -149,7 +149,7 @@ namespace ams::htcfs {
|
||||
R_UNLESS(IsValidPath(path), htcfs::ResultInvalidArgument());
|
||||
|
||||
/* Delete the directory. */
|
||||
return htcfs::GetClient().DeleteDirectory(path.str, recursively, case_sensitive);
|
||||
R_RETURN(htcfs::GetClient().DeleteDirectory(path.str, recursively, case_sensitive));
|
||||
}
|
||||
|
||||
Result FileSystemServiceObject::RenameDirectory(const tma::Path &old_path, const tma::Path &new_path, bool case_sensitive) {
|
||||
@@ -158,7 +158,7 @@ namespace ams::htcfs {
|
||||
R_UNLESS(IsValidPath(new_path), htcfs::ResultInvalidArgument());
|
||||
|
||||
/* Rename the file. */
|
||||
return htcfs::GetClient().RenameDirectory(old_path.str, new_path.str, case_sensitive);
|
||||
R_RETURN(htcfs::GetClient().RenameDirectory(old_path.str, new_path.str, case_sensitive));
|
||||
}
|
||||
|
||||
Result FileSystemServiceObject::CreateFile(const tma::Path &path, s64 size, bool case_sensitive) {
|
||||
@@ -166,7 +166,7 @@ namespace ams::htcfs {
|
||||
R_UNLESS(IsValidPath(path), htcfs::ResultInvalidArgument());
|
||||
|
||||
/* Create the file. */
|
||||
return htcfs::GetClient().CreateFile(path.str, size, case_sensitive);
|
||||
R_RETURN(htcfs::GetClient().CreateFile(path.str, size, case_sensitive));
|
||||
}
|
||||
|
||||
Result FileSystemServiceObject::GetFileTimeStamp(sf::Out<u64> out_create, sf::Out<u64> out_access, sf::Out<u64> out_modify, const tma::Path &path, bool case_sensitive) {
|
||||
@@ -174,7 +174,7 @@ namespace ams::htcfs {
|
||||
R_UNLESS(IsValidPath(path), htcfs::ResultInvalidArgument());
|
||||
|
||||
/* Get the timestamp. */
|
||||
return htcfs::GetClient().GetFileTimeStamp(out_create.GetPointer(), out_access.GetPointer(), out_modify.GetPointer(), path.str, case_sensitive);
|
||||
R_RETURN(htcfs::GetClient().GetFileTimeStamp(out_create.GetPointer(), out_access.GetPointer(), out_modify.GetPointer(), path.str, case_sensitive));
|
||||
}
|
||||
|
||||
Result FileSystemServiceObject::GetCaseSensitivePath(const tma::Path &path, const sf::OutBuffer &out) {
|
||||
@@ -182,7 +182,7 @@ namespace ams::htcfs {
|
||||
R_UNLESS(IsValidPath(path), htcfs::ResultInvalidArgument());
|
||||
|
||||
/* Get the case sensitive path. */
|
||||
return htcfs::GetClient().GetCaseSensitivePath(reinterpret_cast<char *>(out.GetPointer()), out.GetSize(), path.str);
|
||||
R_RETURN(htcfs::GetClient().GetCaseSensitivePath(reinterpret_cast<char *>(out.GetPointer()), out.GetSize(), path.str));
|
||||
}
|
||||
|
||||
Result FileSystemServiceObject::GetDiskFreeSpaceExW(sf::Out<s64> out_free, sf::Out<s64> out_total, sf::Out<s64> out_total_free, const tma::Path &path) {
|
||||
@@ -190,7 +190,7 @@ namespace ams::htcfs {
|
||||
R_UNLESS(IsValidPath(path), htcfs::ResultInvalidArgument());
|
||||
|
||||
/* Get the timestamp. */
|
||||
return htcfs::GetClient().GetDiskFreeSpace(out_free.GetPointer(), out_total.GetPointer(), out_total_free.GetPointer(), path.str);
|
||||
R_RETURN(htcfs::GetClient().GetDiskFreeSpace(out_free.GetPointer(), out_total.GetPointer(), out_total_free.GetPointer(), path.str));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace ams::htcfs {
|
||||
}
|
||||
|
||||
inline Result ConvertHtcfsResult(s64 param) {
|
||||
return ConvertHtcfsResult(static_cast<HtcfsResult>(param));
|
||||
R_RETURN(ConvertHtcfsResult(static_cast<HtcfsResult>(param)));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace ams::htcfs {
|
||||
R_CONVERT(htcfs::ResultInternalError, fs::ResultInternal())
|
||||
} R_END_TRY_CATCH;
|
||||
|
||||
return result;
|
||||
R_RETURN(result);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -19,11 +19,11 @@
|
||||
namespace ams::htcfs {
|
||||
|
||||
Result GetWorkingDirectory(char *dst, size_t dst_size) {
|
||||
return htcfs::GetClient().GetWorkingDirectory(dst, dst_size);
|
||||
R_RETURN(htcfs::GetClient().GetWorkingDirectory(dst, dst_size));
|
||||
}
|
||||
|
||||
Result GetWorkingDirectorySize(s32 *out) {
|
||||
return htcfs::GetClient().GetWorkingDirectorySize(out);
|
||||
R_RETURN(htcfs::GetClient().GetWorkingDirectorySize(out));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -122,19 +122,19 @@ namespace ams::htclow::ctrl {
|
||||
|
||||
switch (header.packet_type) {
|
||||
case HtcctrlPacketType_ConnectFromHost:
|
||||
return this->ProcessReceiveConnectPacket();
|
||||
R_RETURN(this->ProcessReceiveConnectPacket());
|
||||
case HtcctrlPacketType_ReadyFromHost:
|
||||
return this->ProcessReceiveReadyPacket(body, body_size);
|
||||
R_RETURN(this->ProcessReceiveReadyPacket(body, body_size));
|
||||
case HtcctrlPacketType_SuspendFromHost:
|
||||
return this->ProcessReceiveSuspendPacket();
|
||||
R_RETURN(this->ProcessReceiveSuspendPacket());
|
||||
case HtcctrlPacketType_ResumeFromHost:
|
||||
return this->ProcessReceiveResumePacket();
|
||||
R_RETURN(this->ProcessReceiveResumePacket());
|
||||
case HtcctrlPacketType_DisconnectFromHost:
|
||||
return this->ProcessReceiveDisconnectPacket();
|
||||
R_RETURN(this->ProcessReceiveDisconnectPacket());
|
||||
case HtcctrlPacketType_BeaconQuery:
|
||||
return this->ProcessReceiveBeaconQueryPacket();
|
||||
R_RETURN(this->ProcessReceiveBeaconQueryPacket());
|
||||
default:
|
||||
return this->ProcessReceiveUnexpectedPacket();
|
||||
R_RETURN(this->ProcessReceiveUnexpectedPacket());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -142,7 +142,7 @@ namespace ams::htclow::ctrl {
|
||||
/* Try to transition to sent connect state. */
|
||||
if (R_FAILED(this->SetState(HtcctrlState_SentConnectFromHost))) {
|
||||
/* We couldn't transition to sent connect. */
|
||||
return this->ProcessReceiveUnexpectedPacket();
|
||||
R_RETURN(this->ProcessReceiveUnexpectedPacket());
|
||||
}
|
||||
|
||||
/* Send a connect packet. */
|
||||
@@ -160,7 +160,7 @@ namespace ams::htclow::ctrl {
|
||||
|
||||
/* Check that our version is correct. */
|
||||
if (m_version < ProtocolVersion) {
|
||||
return this->ProcessReceiveUnexpectedPacket();
|
||||
R_RETURN(this->ProcessReceiveUnexpectedPacket());
|
||||
}
|
||||
|
||||
/* Set our version. */
|
||||
@@ -169,7 +169,7 @@ namespace ams::htclow::ctrl {
|
||||
|
||||
/* Set our state. */
|
||||
if (R_FAILED(this->SetState(HtcctrlState_SentReadyFromHost))) {
|
||||
return this->ProcessReceiveUnexpectedPacket();
|
||||
R_RETURN(this->ProcessReceiveUnexpectedPacket());
|
||||
}
|
||||
|
||||
/* Ready ourselves. */
|
||||
@@ -181,7 +181,7 @@ namespace ams::htclow::ctrl {
|
||||
/* Try to set our state to enter sleep. */
|
||||
if (R_FAILED(this->SetState(HtcctrlState_EnterSleep))) {
|
||||
/* We couldn't transition to sleep. */
|
||||
return this->ProcessReceiveUnexpectedPacket();
|
||||
R_RETURN(this->ProcessReceiveUnexpectedPacket());
|
||||
}
|
||||
|
||||
R_SUCCEED();
|
||||
@@ -191,7 +191,7 @@ namespace ams::htclow::ctrl {
|
||||
/* If our state is sent-resume, change to readied. */
|
||||
if (m_state_machine->GetHtcctrlState() != HtcctrlState_SentResumeFromTarget || R_FAILED(this->SetState(HtcctrlState_Ready))) {
|
||||
/* We couldn't perform a valid resume transition. */
|
||||
return this->ProcessReceiveUnexpectedPacket();
|
||||
R_RETURN(this->ProcessReceiveUnexpectedPacket());
|
||||
}
|
||||
|
||||
R_SUCCEED();
|
||||
|
||||
@@ -226,7 +226,7 @@ namespace ams::htclow::driver {
|
||||
}
|
||||
|
||||
/* Return our connection result. */
|
||||
return m_connect_result;
|
||||
R_RETURN(m_connect_result);
|
||||
}
|
||||
|
||||
void SocketDriver::Shutdown() {
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace ams::htclow::driver {
|
||||
SetUsbAvailabilityChangeCallback(OnUsbAvailabilityChange, this);
|
||||
|
||||
/* Initialize the interface. */
|
||||
return InitializeUsbInterface();
|
||||
R_RETURN(InitializeUsbInterface());
|
||||
}
|
||||
|
||||
void UsbDriver::Close() {
|
||||
|
||||
@@ -214,7 +214,7 @@ namespace ams::htclow::driver {
|
||||
R_THROW(htclow::ResultUsbDriverUnknownError());
|
||||
}
|
||||
} else {
|
||||
return result;
|
||||
R_RETURN(result);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace ams::htclow {
|
||||
};
|
||||
|
||||
/* Open the channel. */
|
||||
return m_manager->Open(impl::ConvertChannelType(m_channel));
|
||||
R_RETURN(m_manager->Open(impl::ConvertChannelType(m_channel)));
|
||||
}
|
||||
|
||||
void Channel::Close() {
|
||||
@@ -56,7 +56,7 @@ namespace ams::htclow {
|
||||
this->WaitEvent(m_manager->GetTaskEvent(task_id), false);
|
||||
|
||||
/* End the flush. */
|
||||
return m_manager->ConnectEnd(channel, task_id);
|
||||
R_RETURN(m_manager->ConnectEnd(channel, task_id));
|
||||
}
|
||||
|
||||
Result Channel::Flush() {
|
||||
@@ -68,7 +68,7 @@ namespace ams::htclow {
|
||||
this->WaitEvent(m_manager->GetTaskEvent(task_id), true);
|
||||
|
||||
/* End the flush. */
|
||||
return m_manager->FlushEnd(task_id);
|
||||
R_RETURN(m_manager->FlushEnd(task_id));
|
||||
}
|
||||
|
||||
void Channel::Shutdown() {
|
||||
@@ -101,7 +101,7 @@ namespace ams::htclow {
|
||||
if (htclow::ResultChannelNotExist::Includes(result)) {
|
||||
*out = received;
|
||||
}
|
||||
return result;
|
||||
R_RETURN(result);
|
||||
}
|
||||
|
||||
received += static_cast<size_t>(cur_received);
|
||||
@@ -134,7 +134,7 @@ namespace ams::htclow {
|
||||
if (total_sent != 0) {
|
||||
break;
|
||||
} else {
|
||||
return begin_result;
|
||||
R_RETURN(begin_result);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -172,7 +172,7 @@ namespace ams::htclow {
|
||||
/* Check pre-conditions. */
|
||||
AMS_ASSERT(util::IsIntValueRepresentable<size_t>(size));
|
||||
|
||||
return this->WaitReceiveInternal(size, nullptr);
|
||||
R_RETURN(this->WaitReceiveInternal(size, nullptr));
|
||||
}
|
||||
|
||||
Result Channel::WaitReceive(s64 size, os::EventType *event) {
|
||||
@@ -180,7 +180,7 @@ namespace ams::htclow {
|
||||
AMS_ASSERT(util::IsIntValueRepresentable<size_t>(size));
|
||||
AMS_ASSERT(event != nullptr);
|
||||
|
||||
return this->WaitReceiveInternal(size, event);
|
||||
R_RETURN(this->WaitReceiveInternal(size, event));
|
||||
}
|
||||
|
||||
void Channel::WaitEvent(os::EventType *event, bool) {
|
||||
@@ -229,7 +229,7 @@ namespace ams::htclow {
|
||||
}
|
||||
|
||||
/* End the wait. */
|
||||
return m_manager->WaitReceiveEnd(task_id);
|
||||
R_RETURN(m_manager->WaitReceiveEnd(task_id));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace ams::htclow {
|
||||
}
|
||||
|
||||
Result HtclowManager::OpenDriver(impl::DriverType driver_type) {
|
||||
return m_impl->OpenDriver(driver_type);
|
||||
R_RETURN(m_impl->OpenDriver(driver_type));
|
||||
}
|
||||
|
||||
void HtclowManager::CloseDriver() {
|
||||
@@ -37,11 +37,11 @@ namespace ams::htclow {
|
||||
}
|
||||
|
||||
Result HtclowManager::Open(impl::ChannelInternalType channel) {
|
||||
return m_impl->Open(channel);
|
||||
R_RETURN(m_impl->Open(channel));
|
||||
}
|
||||
|
||||
Result HtclowManager::Close(impl::ChannelInternalType channel) {
|
||||
return m_impl->Close(channel);
|
||||
R_RETURN(m_impl->Close(channel));
|
||||
}
|
||||
|
||||
void HtclowManager::Resume() {
|
||||
@@ -53,11 +53,11 @@ namespace ams::htclow {
|
||||
}
|
||||
|
||||
Result HtclowManager::ConnectBegin(u32 *out_task_id, impl::ChannelInternalType channel) {
|
||||
return m_impl->ConnectBegin(out_task_id, channel);
|
||||
R_RETURN(m_impl->ConnectBegin(out_task_id, channel));
|
||||
}
|
||||
|
||||
Result HtclowManager::ConnectEnd(impl::ChannelInternalType channel, u32 task_id) {
|
||||
return m_impl->ConnectEnd(channel, task_id);
|
||||
R_RETURN(m_impl->ConnectEnd(channel, task_id));
|
||||
}
|
||||
|
||||
void HtclowManager::Disconnect() {
|
||||
@@ -65,11 +65,11 @@ namespace ams::htclow {
|
||||
}
|
||||
|
||||
Result HtclowManager::FlushBegin(u32 *out_task_id, impl::ChannelInternalType channel) {
|
||||
return m_impl->FlushBegin(out_task_id, channel);
|
||||
R_RETURN(m_impl->FlushBegin(out_task_id, channel));
|
||||
}
|
||||
|
||||
Result HtclowManager::FlushEnd(u32 task_id) {
|
||||
return m_impl->FlushEnd(task_id);
|
||||
R_RETURN(m_impl->FlushEnd(task_id));
|
||||
}
|
||||
|
||||
ChannelState HtclowManager::GetChannelState(impl::ChannelInternalType channel) {
|
||||
@@ -97,27 +97,27 @@ namespace ams::htclow {
|
||||
}
|
||||
|
||||
Result HtclowManager::ReceiveBegin(u32 *out_task_id, impl::ChannelInternalType channel, size_t size) {
|
||||
return m_impl->ReceiveBegin(out_task_id, channel, size);
|
||||
R_RETURN(m_impl->ReceiveBegin(out_task_id, channel, size));
|
||||
}
|
||||
|
||||
Result HtclowManager::ReceiveEnd(size_t *out, void *dst, size_t dst_size, impl::ChannelInternalType channel, u32 task_id) {
|
||||
return m_impl->ReceiveEnd(out, dst, dst_size, channel, task_id);
|
||||
R_RETURN(m_impl->ReceiveEnd(out, dst, dst_size, channel, task_id));
|
||||
}
|
||||
|
||||
Result HtclowManager::SendBegin(u32 *out_task_id, size_t *out, const void *src, size_t src_size, impl::ChannelInternalType channel) {
|
||||
return m_impl->SendBegin(out_task_id, out, src, src_size, channel);
|
||||
R_RETURN(m_impl->SendBegin(out_task_id, out, src, src_size, channel));
|
||||
}
|
||||
|
||||
Result HtclowManager::SendEnd(u32 task_id) {
|
||||
return m_impl->SendEnd(task_id);
|
||||
R_RETURN(m_impl->SendEnd(task_id));
|
||||
}
|
||||
|
||||
Result HtclowManager::WaitReceiveBegin(u32 *out_task_id, impl::ChannelInternalType channel, size_t size) {
|
||||
return m_impl->WaitReceiveBegin(out_task_id, channel, size);
|
||||
R_RETURN(m_impl->WaitReceiveBegin(out_task_id, channel, size));
|
||||
}
|
||||
|
||||
Result HtclowManager::WaitReceiveEnd(u32 task_id) {
|
||||
return m_impl->WaitReceiveEnd(task_id);
|
||||
R_RETURN(m_impl->WaitReceiveEnd(task_id));
|
||||
}
|
||||
|
||||
void HtclowManager::SetConfig(impl::ChannelInternalType channel, const ChannelConfig &config) {
|
||||
@@ -141,7 +141,7 @@ namespace ams::htclow {
|
||||
}
|
||||
|
||||
Result HtclowManager::Shutdown(impl::ChannelInternalType channel) {
|
||||
return m_impl->Shutdown(channel);
|
||||
R_RETURN(m_impl->Shutdown(channel));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -75,11 +75,11 @@ namespace ams::htclow {
|
||||
}
|
||||
|
||||
Result HtclowManagerImpl::Open(impl::ChannelInternalType channel) {
|
||||
return m_mux.Open(channel);
|
||||
R_RETURN(m_mux.Open(channel));
|
||||
}
|
||||
|
||||
Result HtclowManagerImpl::Close(impl::ChannelInternalType channel) {
|
||||
return m_mux.Close(channel);
|
||||
R_RETURN(m_mux.Close(channel));
|
||||
}
|
||||
|
||||
void HtclowManagerImpl::Resume() {
|
||||
@@ -118,7 +118,7 @@ namespace ams::htclow {
|
||||
}
|
||||
|
||||
Result HtclowManagerImpl::ConnectEnd(impl::ChannelInternalType channel, u32 task_id) {
|
||||
return m_mux.ConnectEnd(channel, task_id);
|
||||
R_RETURN(m_mux.ConnectEnd(channel, task_id));
|
||||
}
|
||||
|
||||
void HtclowManagerImpl::Disconnect() {
|
||||
@@ -126,11 +126,11 @@ namespace ams::htclow {
|
||||
}
|
||||
|
||||
Result HtclowManagerImpl::FlushBegin(u32 *out_task_id, impl::ChannelInternalType channel) {
|
||||
return m_mux.FlushBegin(out_task_id, channel);
|
||||
R_RETURN(m_mux.FlushBegin(out_task_id, channel));
|
||||
}
|
||||
|
||||
Result HtclowManagerImpl::FlushEnd(u32 task_id) {
|
||||
return m_mux.FlushEnd(task_id);
|
||||
R_RETURN(m_mux.FlushEnd(task_id));
|
||||
}
|
||||
|
||||
ChannelState HtclowManagerImpl::GetChannelState(impl::ChannelInternalType channel) {
|
||||
@@ -158,27 +158,27 @@ namespace ams::htclow {
|
||||
}
|
||||
|
||||
Result HtclowManagerImpl::ReceiveBegin(u32 *out_task_id, impl::ChannelInternalType channel, size_t size) {
|
||||
return m_mux.ReceiveBegin(out_task_id, channel, size);
|
||||
R_RETURN(m_mux.ReceiveBegin(out_task_id, channel, size));
|
||||
}
|
||||
|
||||
Result HtclowManagerImpl::ReceiveEnd(size_t *out, void *dst, size_t dst_size, impl::ChannelInternalType channel, u32 task_id) {
|
||||
return m_mux.ReceiveEnd(out, dst, dst_size, channel, task_id);
|
||||
R_RETURN(m_mux.ReceiveEnd(out, dst, dst_size, channel, task_id));
|
||||
}
|
||||
|
||||
Result HtclowManagerImpl::SendBegin(u32 *out_task_id, size_t *out, const void *src, size_t src_size, impl::ChannelInternalType channel) {
|
||||
return m_mux.SendBegin(out_task_id, out, src, src_size, channel);
|
||||
R_RETURN(m_mux.SendBegin(out_task_id, out, src, src_size, channel));
|
||||
}
|
||||
|
||||
Result HtclowManagerImpl::SendEnd(u32 task_id) {
|
||||
return m_mux.SendEnd(task_id);
|
||||
R_RETURN(m_mux.SendEnd(task_id));
|
||||
}
|
||||
|
||||
Result HtclowManagerImpl::WaitReceiveBegin(u32 *out_task_id, impl::ChannelInternalType channel, size_t size) {
|
||||
return m_mux.WaitReceiveBegin(out_task_id, channel, size);
|
||||
R_RETURN(m_mux.WaitReceiveBegin(out_task_id, channel, size));
|
||||
}
|
||||
|
||||
Result HtclowManagerImpl::WaitReceiveEnd(u32 task_id) {
|
||||
return m_mux.WaitReceiveEnd(task_id);
|
||||
R_RETURN(m_mux.WaitReceiveEnd(task_id));
|
||||
}
|
||||
|
||||
void HtclowManagerImpl::SetConfig(impl::ChannelInternalType channel, const ChannelConfig &config) {
|
||||
@@ -202,7 +202,7 @@ namespace ams::htclow {
|
||||
}
|
||||
|
||||
Result HtclowManagerImpl::Shutdown(impl::ChannelInternalType channel) {
|
||||
return m_mux.Shutdown(channel);
|
||||
R_RETURN(m_mux.Shutdown(channel));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ namespace ams::htclow::mux {
|
||||
|
||||
/* Process for the channel. */
|
||||
if (auto it = m_channel_impl_map.GetMap().find(header.channel); it != m_channel_impl_map.GetMap().end()) {
|
||||
return m_channel_impl_map[it->second].ProcessReceivePacket(header, body, body_size);
|
||||
R_RETURN(m_channel_impl_map[it->second].ProcessReceivePacket(header, body, body_size));
|
||||
} else {
|
||||
if (header.packet_type == PacketType_Data || header.packet_type == PacketType_MaxData) {
|
||||
this->SendErrorPacket(header.channel);
|
||||
@@ -209,7 +209,7 @@ namespace ams::htclow::mux {
|
||||
R_UNLESS(it != m_channel_impl_map.GetMap().end(), htclow::ResultChannelNotExist());
|
||||
|
||||
/* Perform the connection. */
|
||||
return m_channel_impl_map[it->second].DoConnectBegin(out_task_id);
|
||||
R_RETURN(m_channel_impl_map[it->second].DoConnectBegin(out_task_id));
|
||||
}
|
||||
|
||||
Result Mux::ConnectEnd(impl::ChannelInternalType channel, u32 task_id) {
|
||||
@@ -230,7 +230,7 @@ namespace ams::htclow::mux {
|
||||
R_UNLESS(it != m_channel_impl_map.GetMap().end(), htclow::ResultChannelNotExist());
|
||||
|
||||
/* Perform the disconnection. */
|
||||
return m_channel_impl_map[it->second].DoConnectEnd();
|
||||
R_RETURN(m_channel_impl_map[it->second].DoConnectEnd());
|
||||
}
|
||||
|
||||
ChannelState Mux::GetChannelState(impl::ChannelInternalType channel) {
|
||||
@@ -256,7 +256,7 @@ namespace ams::htclow::mux {
|
||||
R_UNLESS(it != m_channel_impl_map.GetMap().end(), htclow::ResultChannelNotExist());
|
||||
|
||||
/* Perform the connection. */
|
||||
return m_channel_impl_map[it->second].DoFlush(out_task_id);
|
||||
R_RETURN(m_channel_impl_map[it->second].DoFlush(out_task_id));
|
||||
}
|
||||
|
||||
Result Mux::FlushEnd(u32 task_id) {
|
||||
@@ -291,7 +291,7 @@ namespace ams::htclow::mux {
|
||||
R_UNLESS(it != m_channel_impl_map.GetMap().end(), htclow::ResultChannelNotExist());
|
||||
|
||||
/* Perform the connection. */
|
||||
return m_channel_impl_map[it->second].DoReceiveBegin(out_task_id, size);
|
||||
R_RETURN(m_channel_impl_map[it->second].DoReceiveBegin(out_task_id, size));
|
||||
}
|
||||
|
||||
Result Mux::ReceiveEnd(size_t *out, void *dst, size_t dst_size, impl::ChannelInternalType channel, u32 task_id) {
|
||||
@@ -308,7 +308,7 @@ namespace ams::htclow::mux {
|
||||
R_UNLESS(it != m_channel_impl_map.GetMap().end(), htclow::ResultChannelNotExist());
|
||||
|
||||
/* Perform the receive. */
|
||||
return m_channel_impl_map[it->second].DoReceiveEnd(out, dst, dst_size);
|
||||
R_RETURN(m_channel_impl_map[it->second].DoReceiveEnd(out, dst, dst_size));
|
||||
} else {
|
||||
*out = 0;
|
||||
R_SUCCEED();
|
||||
@@ -324,7 +324,7 @@ namespace ams::htclow::mux {
|
||||
R_UNLESS(it != m_channel_impl_map.GetMap().end(), htclow::ResultChannelNotExist());
|
||||
|
||||
/* Perform the connection. */
|
||||
return m_channel_impl_map[it->second].DoSend(out_task_id, out, src, src_size);
|
||||
R_RETURN(m_channel_impl_map[it->second].DoSend(out_task_id, out, src, src_size));
|
||||
}
|
||||
|
||||
Result Mux::SendEnd(u32 task_id) {
|
||||
@@ -344,7 +344,7 @@ namespace ams::htclow::mux {
|
||||
}
|
||||
|
||||
Result Mux::WaitReceiveBegin(u32 *out_task_id, impl::ChannelInternalType channel, size_t size) {
|
||||
return this->ReceiveBegin(out_task_id, channel, size);
|
||||
R_RETURN(this->ReceiveBegin(out_task_id, channel, size));
|
||||
}
|
||||
|
||||
Result Mux::WaitReceiveEnd(u32 task_id) {
|
||||
@@ -420,7 +420,7 @@ namespace ams::htclow::mux {
|
||||
R_UNLESS(it != m_channel_impl_map.GetMap().end(), htclow::ResultChannelNotExist());
|
||||
|
||||
/* Perform the shutdown. */
|
||||
return m_channel_impl_map[it->second].DoShutdown();
|
||||
R_RETURN(m_channel_impl_map[it->second].DoShutdown());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -67,11 +67,11 @@ namespace ams::htclow::mux {
|
||||
Result ChannelImpl::ProcessReceivePacket(const PacketHeader &header, const void *body, size_t body_size) {
|
||||
switch (header.packet_type) {
|
||||
case PacketType_Data:
|
||||
return this->ProcessReceiveDataPacket(header.version, header.share, header.offset, body, body_size);
|
||||
R_RETURN(this->ProcessReceiveDataPacket(header.version, header.share, header.offset, body, body_size));
|
||||
case PacketType_MaxData:
|
||||
return this->ProcessReceiveMaxDataPacket(header.version, header.share);
|
||||
R_RETURN(this->ProcessReceiveMaxDataPacket(header.version, header.share));
|
||||
case PacketType_Error:
|
||||
return this->ProcessReceiveErrorPacket();
|
||||
R_RETURN(this->ProcessReceiveErrorPacket());
|
||||
default:
|
||||
R_THROW(htclow::ResultProtocolError());
|
||||
}
|
||||
|
||||
@@ -109,12 +109,12 @@ namespace ams::htcs::client {
|
||||
|
||||
Result RemoteManager::GetPeerNameAny(sf::Out<htcs::HtcsPeerName> out) {
|
||||
static_assert(sizeof(htcs::HtcsPeerName) == sizeof(::HtcsPeerName));
|
||||
return ::htcsGetPeerNameAny(reinterpret_cast<::HtcsPeerName *>(out.GetPointer()));
|
||||
R_RETURN(::htcsGetPeerNameAny(reinterpret_cast<::HtcsPeerName *>(out.GetPointer())));
|
||||
}
|
||||
|
||||
Result RemoteManager::GetDefaultHostName(sf::Out<htcs::HtcsPeerName> out) {
|
||||
static_assert(sizeof(htcs::HtcsPeerName) == sizeof(::HtcsPeerName));
|
||||
return ::htcsGetDefaultHostName(reinterpret_cast<::HtcsPeerName *>(out.GetPointer()));
|
||||
R_RETURN(::htcsGetDefaultHostName(reinterpret_cast<::HtcsPeerName *>(out.GetPointer())));
|
||||
}
|
||||
|
||||
Result RemoteManager::CreateSocket(sf::Out<s32> out_err, sf::Out<sf::SharedPointer<tma::ISocket>> out, bool enable_disconnection_emulation) {
|
||||
@@ -148,33 +148,33 @@ namespace ams::htcs::client {
|
||||
}
|
||||
|
||||
Result RemoteManager::EndSelect(sf::Out<s32> out_err, sf::Out<s32> out_count, const sf::OutMapAliasArray<s32> &read_handles, const sf::OutMapAliasArray<s32> &write_handles, const sf::OutMapAliasArray<s32> &exception_handles, u32 task_id) {
|
||||
return ::htcsEndSelect(out_err.GetPointer(), out_count.GetPointer(), read_handles.GetPointer(), read_handles.GetSize(), write_handles.GetPointer(), write_handles.GetSize(), exception_handles.GetPointer(), exception_handles.GetSize(), task_id);
|
||||
R_RETURN(::htcsEndSelect(out_err.GetPointer(), out_count.GetPointer(), read_handles.GetPointer(), read_handles.GetSize(), write_handles.GetPointer(), write_handles.GetSize(), exception_handles.GetPointer(), exception_handles.GetSize(), task_id));
|
||||
}
|
||||
|
||||
Result RemoteSocket::Close(sf::Out<s32> out_err, sf::Out<s32> out_res) {
|
||||
return ::htcsSocketClose(std::addressof(m_s), out_err.GetPointer(), out_res.GetPointer());
|
||||
R_RETURN(::htcsSocketClose(std::addressof(m_s), out_err.GetPointer(), out_res.GetPointer()));
|
||||
}
|
||||
|
||||
Result RemoteSocket::Connect(sf::Out<s32> out_err, sf::Out<s32> out_res, const htcs::SockAddrHtcs &address) {
|
||||
static_assert(sizeof(htcs::SockAddrHtcs) == sizeof(::HtcsSockAddr));
|
||||
return ::htcsSocketConnect(std::addressof(m_s), out_err.GetPointer(), out_res.GetPointer(), reinterpret_cast<const ::HtcsSockAddr *>(std::addressof(address)));
|
||||
R_RETURN(::htcsSocketConnect(std::addressof(m_s), out_err.GetPointer(), out_res.GetPointer(), reinterpret_cast<const ::HtcsSockAddr *>(std::addressof(address))));
|
||||
}
|
||||
|
||||
Result RemoteSocket::Bind(sf::Out<s32> out_err, sf::Out<s32> out_res, const htcs::SockAddrHtcs &address) {
|
||||
static_assert(sizeof(htcs::SockAddrHtcs) == sizeof(::HtcsSockAddr));
|
||||
return ::htcsSocketBind(std::addressof(m_s), out_err.GetPointer(), out_res.GetPointer(), reinterpret_cast<const ::HtcsSockAddr *>(std::addressof(address)));
|
||||
R_RETURN(::htcsSocketBind(std::addressof(m_s), out_err.GetPointer(), out_res.GetPointer(), reinterpret_cast<const ::HtcsSockAddr *>(std::addressof(address))));
|
||||
}
|
||||
|
||||
Result RemoteSocket::Listen(sf::Out<s32> out_err, sf::Out<s32> out_res, s32 backlog_count) {
|
||||
return ::htcsSocketListen(std::addressof(m_s), out_err.GetPointer(), out_res.GetPointer(), backlog_count);
|
||||
R_RETURN(::htcsSocketListen(std::addressof(m_s), out_err.GetPointer(), out_res.GetPointer(), backlog_count));
|
||||
}
|
||||
|
||||
Result RemoteSocket::Shutdown(sf::Out<s32> out_err, sf::Out<s32> out_res, s32 how) {
|
||||
return ::htcsSocketShutdown(std::addressof(m_s), out_err.GetPointer(), out_res.GetPointer(), how);
|
||||
R_RETURN(::htcsSocketShutdown(std::addressof(m_s), out_err.GetPointer(), out_res.GetPointer(), how));
|
||||
}
|
||||
|
||||
Result RemoteSocket::Fcntl(sf::Out<s32> out_err, sf::Out<s32> out_res, s32 command, s32 value) {
|
||||
return ::htcsSocketFcntl(std::addressof(m_s), out_err.GetPointer(), out_res.GetPointer(), command, value);
|
||||
R_RETURN(::htcsSocketFcntl(std::addressof(m_s), out_err.GetPointer(), out_res.GetPointer(), command, value));
|
||||
}
|
||||
|
||||
Result RemoteSocket::AcceptStart(sf::Out<u32> out_task_id, sf::OutCopyHandle out_event) {
|
||||
@@ -205,7 +205,7 @@ namespace ams::htcs::client {
|
||||
}
|
||||
|
||||
Result RemoteSocket::RecvResults(sf::Out<s32> out_err, sf::Out<s64> out_size, const sf::OutAutoSelectBuffer &buffer, u32 task_id) {
|
||||
return ::htcsSocketRecvResults(std::addressof(m_s), out_err.GetPointer(), out_size.GetPointer(), buffer.GetPointer(), buffer.GetSize(), task_id);
|
||||
R_RETURN(::htcsSocketRecvResults(std::addressof(m_s), out_err.GetPointer(), out_size.GetPointer(), buffer.GetPointer(), buffer.GetSize(), task_id));
|
||||
}
|
||||
|
||||
Result RemoteSocket::SendStart(sf::Out<u32> out_task_id, sf::OutCopyHandle out_event, const sf::InNonSecureAutoSelectBuffer &buffer, s32 flags) {
|
||||
@@ -217,7 +217,7 @@ namespace ams::htcs::client {
|
||||
}
|
||||
|
||||
Result RemoteSocket::SendResults(sf::Out<s32> out_err, sf::Out<s64> out_size, u32 task_id) {
|
||||
return ::htcsSocketSendResults(std::addressof(m_s), out_err.GetPointer(), out_size.GetPointer(), task_id);
|
||||
R_RETURN(::htcsSocketSendResults(std::addressof(m_s), out_err.GetPointer(), out_size.GetPointer(), task_id));
|
||||
}
|
||||
|
||||
Result RemoteSocket::StartSend(sf::Out<u32> out_task_id, sf::OutCopyHandle out_event, sf::Out<s64> out_max_size, s64 size, s32 flags) {
|
||||
@@ -229,11 +229,11 @@ namespace ams::htcs::client {
|
||||
}
|
||||
|
||||
Result RemoteSocket::ContinueSend(sf::Out<s64> out_size, sf::Out<bool> out_wait, const sf::InNonSecureAutoSelectBuffer &buffer, u32 task_id) {
|
||||
return ::htcsSocketContinueSend(std::addressof(m_s), out_size.GetPointer(), out_wait.GetPointer(), buffer.GetPointer(), buffer.GetSize(), task_id);
|
||||
R_RETURN(::htcsSocketContinueSend(std::addressof(m_s), out_size.GetPointer(), out_wait.GetPointer(), buffer.GetPointer(), buffer.GetSize(), task_id));
|
||||
}
|
||||
|
||||
Result RemoteSocket::EndSend(sf::Out<s32> out_err, sf::Out<s64> out_size, u32 task_id) {
|
||||
return ::htcsSocketEndSend(std::addressof(m_s), out_err.GetPointer(), out_size.GetPointer(), task_id);
|
||||
R_RETURN(::htcsSocketEndSend(std::addressof(m_s), out_err.GetPointer(), out_size.GetPointer(), task_id));
|
||||
}
|
||||
|
||||
Result RemoteSocket::StartRecv(sf::Out<u32> out_task_id, sf::OutCopyHandle out_event, s64 size, s32 flags) {
|
||||
@@ -245,11 +245,11 @@ namespace ams::htcs::client {
|
||||
}
|
||||
|
||||
Result RemoteSocket::EndRecv(sf::Out<s32> out_err, sf::Out<s64> out_size, const sf::OutAutoSelectBuffer &buffer, u32 task_id) {
|
||||
return ::htcsSocketEndRecv(std::addressof(m_s), out_err.GetPointer(), out_size.GetPointer(), buffer.GetPointer(), buffer.GetSize(), task_id);
|
||||
R_RETURN(::htcsSocketEndRecv(std::addressof(m_s), out_err.GetPointer(), out_size.GetPointer(), buffer.GetPointer(), buffer.GetSize(), task_id));
|
||||
}
|
||||
|
||||
Result RemoteSocket::GetPrimitive(sf::Out<s32> out) {
|
||||
return ::htcsSocketGetPrimitive(std::addressof(m_s), out.GetPointer());
|
||||
R_RETURN(::htcsSocketGetPrimitive(std::addressof(m_s), out.GetPointer()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -205,7 +205,7 @@ namespace ams::htcs::impl {
|
||||
}
|
||||
|
||||
Result HtcsManager::AcceptStart(u32 *out_task_id, os::NativeHandle *out_handle, s32 desc) {
|
||||
return m_impl->AcceptStart(out_task_id, out_handle, desc);
|
||||
R_RETURN(m_impl->AcceptStart(out_task_id, out_handle, desc));
|
||||
}
|
||||
|
||||
void HtcsManager::AcceptResults(s32 *out_err, s32 *out_desc, SockAddrHtcs *out_address, u32 task_id, s32 desc) {
|
||||
@@ -228,7 +228,7 @@ namespace ams::htcs::impl {
|
||||
}
|
||||
|
||||
Result HtcsManager::RecvStart(u32 *out_task_id, os::NativeHandle *out_handle, s64 size, s32 desc, s32 flags) {
|
||||
return m_impl->RecvStart(out_task_id, out_handle, size, desc, flags);
|
||||
R_RETURN(m_impl->RecvStart(out_task_id, out_handle, size, desc, flags));
|
||||
}
|
||||
|
||||
void HtcsManager::RecvResults(s32 *out_err, s64 *out_size, char *buffer, s64 buffer_size, u32 task_id, s32 desc) {
|
||||
@@ -256,11 +256,11 @@ namespace ams::htcs::impl {
|
||||
}
|
||||
|
||||
Result HtcsManager::SendStart(u32 *out_task_id, os::NativeHandle *out_handle, const char *buffer, s64 size, s32 desc, s32 flags) {
|
||||
return m_impl->SendStart(out_task_id, out_handle, buffer, size, desc, flags);
|
||||
R_RETURN(m_impl->SendStart(out_task_id, out_handle, buffer, size, desc, flags));
|
||||
}
|
||||
|
||||
Result HtcsManager::SendLargeStart(u32 *out_task_id, os::NativeHandle *out_handle, const char **buffers, const s64 *sizes, s32 count, s32 desc, s32 flags) {
|
||||
return m_impl->SendLargeStart(out_task_id, out_handle, buffers, sizes, count, desc, flags);
|
||||
R_RETURN(m_impl->SendLargeStart(out_task_id, out_handle, buffers, sizes, count, desc, flags));
|
||||
}
|
||||
|
||||
void HtcsManager::SendResults(s32 *out_err, s64 *out_size, u32 task_id, s32 desc) {
|
||||
@@ -288,7 +288,7 @@ namespace ams::htcs::impl {
|
||||
}
|
||||
|
||||
Result HtcsManager::StartSend(u32 *out_task_id, os::NativeHandle *out_handle, s32 desc, s64 size, s32 flags) {
|
||||
return m_impl->StartSend(out_task_id, out_handle, desc, size, flags);
|
||||
R_RETURN(m_impl->StartSend(out_task_id, out_handle, desc, size, flags));
|
||||
}
|
||||
|
||||
Result HtcsManager::ContinueSend(s64 *out_size, const char *buffer, s64 buffer_size, u32 task_id, s32 desc) {
|
||||
@@ -329,7 +329,7 @@ namespace ams::htcs::impl {
|
||||
}
|
||||
|
||||
Result HtcsManager::StartRecv(u32 *out_task_id, os::NativeHandle *out_handle, s64 size, s32 desc, s32 flags) {
|
||||
return m_impl->StartRecv(out_task_id, out_handle, size, desc, flags);
|
||||
R_RETURN(m_impl->StartRecv(out_task_id, out_handle, size, desc, flags));
|
||||
}
|
||||
|
||||
void HtcsManager::EndRecv(s32 *out_err, s64 *out_size, char *buffer, s64 buffer_size, u32 task_id, s32 desc) {
|
||||
|
||||
@@ -47,55 +47,55 @@ namespace ams::htcs::impl {
|
||||
}
|
||||
|
||||
Result HtcsManagerImpl::CreateSocket(s32 *out_err, s32 *out_desc, bool enable_disconnection_emulation) {
|
||||
return m_service.CreateSocket(out_err, out_desc, enable_disconnection_emulation);
|
||||
R_RETURN(m_service.CreateSocket(out_err, out_desc, enable_disconnection_emulation));
|
||||
}
|
||||
|
||||
Result HtcsManagerImpl::DestroySocket(s32 desc) {
|
||||
return m_service.DestroySocket(desc);
|
||||
R_RETURN(m_service.DestroySocket(desc));
|
||||
}
|
||||
|
||||
Result HtcsManagerImpl::Connect(s32 *out_err, s32 desc, const SockAddrHtcs &address) {
|
||||
return m_service.Connect(out_err, desc, address);
|
||||
R_RETURN(m_service.Connect(out_err, desc, address));
|
||||
}
|
||||
|
||||
Result HtcsManagerImpl::Bind(s32 *out_err, s32 desc, const SockAddrHtcs &address) {
|
||||
return m_service.Bind(out_err, desc, address);
|
||||
R_RETURN(m_service.Bind(out_err, desc, address));
|
||||
}
|
||||
|
||||
Result HtcsManagerImpl::Listen(s32 *out_err, s32 desc, s32 backlog_count) {
|
||||
return m_service.Listen(out_err, desc, backlog_count);
|
||||
R_RETURN(m_service.Listen(out_err, desc, backlog_count));
|
||||
}
|
||||
|
||||
Result HtcsManagerImpl::Receive(s32 *out_err, s64 *out_size, char *buffer, size_t size, s32 desc, s32 flags) {
|
||||
return m_service.Receive(out_err, out_size, buffer, size, desc, flags);
|
||||
R_RETURN(m_service.Receive(out_err, out_size, buffer, size, desc, flags));
|
||||
}
|
||||
|
||||
Result HtcsManagerImpl::Send(s32 *out_err, s64 *out_size, const char *buffer, size_t size, s32 desc, s32 flags) {
|
||||
return m_service.Send(out_err, out_size, buffer, size, desc, flags);
|
||||
R_RETURN(m_service.Send(out_err, out_size, buffer, size, desc, flags));
|
||||
}
|
||||
|
||||
Result HtcsManagerImpl::Shutdown(s32 *out_err, s32 desc, s32 how) {
|
||||
return m_service.Shutdown(out_err, desc, how);
|
||||
R_RETURN(m_service.Shutdown(out_err, desc, how));
|
||||
}
|
||||
|
||||
Result HtcsManagerImpl::Fcntl(s32 *out_err, s32 *out_res, s32 desc, s32 command, s32 value) {
|
||||
return m_service.Fcntl(out_err, out_res, desc, command, value);
|
||||
R_RETURN(m_service.Fcntl(out_err, out_res, desc, command, value));
|
||||
}
|
||||
|
||||
Result HtcsManagerImpl::AcceptStart(u32 *out_task_id, os::NativeHandle *out_handle, s32 desc) {
|
||||
return m_service.AcceptStart(out_task_id, out_handle, desc);
|
||||
R_RETURN(m_service.AcceptStart(out_task_id, out_handle, desc));
|
||||
}
|
||||
|
||||
Result HtcsManagerImpl::AcceptResults(s32 *out_err, s32 *out_desc, SockAddrHtcs *out_address, u32 task_id, s32 desc) {
|
||||
return m_service.AcceptResults(out_err, out_desc, out_address, task_id, desc);
|
||||
R_RETURN(m_service.AcceptResults(out_err, out_desc, out_address, task_id, desc));
|
||||
}
|
||||
|
||||
Result HtcsManagerImpl::RecvStart(u32 *out_task_id, os::NativeHandle *out_handle, s64 size, s32 desc, s32 flags) {
|
||||
return m_service.ReceiveSmallStart(out_task_id, out_handle, size, desc, flags);
|
||||
R_RETURN(m_service.ReceiveSmallStart(out_task_id, out_handle, size, desc, flags));
|
||||
}
|
||||
|
||||
Result HtcsManagerImpl::RecvResults(s32 *out_err, s64 *out_size, char *buffer, s64 buffer_size, u32 task_id, s32 desc) {
|
||||
return m_service.ReceiveSmallResults(out_err, out_size, buffer, buffer_size, task_id, desc);
|
||||
R_RETURN(m_service.ReceiveSmallResults(out_err, out_size, buffer, buffer_size, task_id, desc));
|
||||
}
|
||||
|
||||
Result HtcsManagerImpl::SendStart(u32 *out_task_id, os::NativeHandle *out_handle, const char *buffer, s64 size, s32 desc, s32 flags) {
|
||||
@@ -110,6 +110,8 @@ namespace ams::htcs::impl {
|
||||
if (R_SUCCEEDED(result) || htcs::ResultCompleted::Includes(result) || htc::ResultTaskQueueNotAvailable::Includes(result)) {
|
||||
*out_task_id = task_id;
|
||||
*out_handle = handle;
|
||||
|
||||
R_SUCCEED();
|
||||
} else {
|
||||
os::SystemEventType event;
|
||||
os::AttachReadableHandleToSystemEvent(std::addressof(event), handle, true, os::EventClearMode_ManualClear);
|
||||
@@ -120,10 +122,8 @@ namespace ams::htcs::impl {
|
||||
|
||||
os::DestroySystemEvent(std::addressof(event));
|
||||
|
||||
return result;
|
||||
R_RETURN(result);
|
||||
}
|
||||
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result HtcsManagerImpl::SendLargeStart(u32 *out_task_id, os::NativeHandle *out_handle, const char **buffers, const s64 *sizes, s32 count, s32 desc, s32 flags) {
|
||||
@@ -133,27 +133,27 @@ namespace ams::htcs::impl {
|
||||
}
|
||||
|
||||
Result HtcsManagerImpl::SendResults(s32 *out_err, s64 *out_size, u32 task_id, s32 desc) {
|
||||
return m_service.SendSmallResults(out_err, out_size, task_id, desc);
|
||||
R_RETURN(m_service.SendSmallResults(out_err, out_size, task_id, desc));
|
||||
}
|
||||
|
||||
Result HtcsManagerImpl::StartSend(u32 *out_task_id, os::NativeHandle *out_handle, s32 desc, s64 size, s32 flags) {
|
||||
return m_service.SendStart(out_task_id, out_handle, desc, size, flags);
|
||||
R_RETURN(m_service.SendStart(out_task_id, out_handle, desc, size, flags));
|
||||
}
|
||||
|
||||
Result HtcsManagerImpl::ContinueSend(s64 *out_size, const char *buffer, s64 buffer_size, u32 task_id, s32 desc) {
|
||||
return m_service.SendContinue(out_size, buffer, buffer_size, task_id, desc);
|
||||
R_RETURN(m_service.SendContinue(out_size, buffer, buffer_size, task_id, desc));
|
||||
}
|
||||
|
||||
Result HtcsManagerImpl::EndSend(s32 *out_err, s64 *out_size, u32 task_id, s32 desc) {
|
||||
return m_service.SendResults(out_err, out_size, task_id, desc);
|
||||
R_RETURN(m_service.SendResults(out_err, out_size, task_id, desc));
|
||||
}
|
||||
|
||||
Result HtcsManagerImpl::StartRecv(u32 *out_task_id, os::NativeHandle *out_handle, s64 size, s32 desc, s32 flags) {
|
||||
return m_service.ReceiveStart(out_task_id, out_handle, size, desc, flags);
|
||||
R_RETURN(m_service.ReceiveStart(out_task_id, out_handle, size, desc, flags));
|
||||
}
|
||||
|
||||
Result HtcsManagerImpl::EndRecv(s32 *out_err, s64 *out_size, char *buffer, s64 buffer_size, u32 task_id, s32 desc) {
|
||||
return m_service.ReceiveResults(out_err, out_size, buffer, buffer_size, task_id, desc);
|
||||
R_RETURN(m_service.ReceiveResults(out_err, out_size, buffer, buffer_size, task_id, desc));
|
||||
}
|
||||
|
||||
Result HtcsManagerImpl::StartSelect(u32 *out_task_id, os::NativeHandle *out_handle, Span<const int> read_handles, Span<const int> write_handles, Span<const int> exception_handles, s64 tv_sec, s64 tv_usec) {
|
||||
@@ -179,11 +179,11 @@ namespace ams::htcs::impl {
|
||||
*out_handle = handle;
|
||||
}
|
||||
|
||||
return result;
|
||||
R_RETURN(result);
|
||||
}
|
||||
|
||||
Result HtcsManagerImpl::EndSelect(s32 *out_err, bool *out_empty, Span<int> read_handles, Span<int> write_handles, Span<int> exception_handles, u32 task_id) {
|
||||
return m_service.SelectEnd(out_err, out_empty, read_handles, write_handles, exception_handles, task_id);
|
||||
R_RETURN(m_service.SelectEnd(out_err, out_empty, read_handles, write_handles, exception_handles, task_id));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -148,7 +148,7 @@ namespace ams::htcs::impl {
|
||||
s64 cont_size;
|
||||
const Result result = this->SendContinue(std::addressof(cont_size), buffer, size, task_id, desc);
|
||||
if (R_FAILED(result)) {
|
||||
return this->SendResults(out_err, out_size, task_id, desc);
|
||||
R_RETURN(this->SendResults(out_err, out_size, task_id, desc));
|
||||
}
|
||||
|
||||
/* Wait for the task to complete. */
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace ams::htcs::server {
|
||||
}
|
||||
|
||||
Result ManagerServiceObject::CreateSocketOld(sf::Out<s32> out_err, sf::Out<sf::SharedPointer<tma::ISocket>> out) {
|
||||
return this->CreateSocket(out_err, out, false);
|
||||
R_RETURN(this->CreateSocket(out_err, out, false));
|
||||
}
|
||||
|
||||
Result ManagerServiceObject::CreateSocket(sf::Out<s32> out_err, sf::Out<sf::SharedPointer<tma::ISocket>> out, bool enable_disconnection_emulation) {
|
||||
@@ -94,7 +94,7 @@ namespace ams::htcs::server {
|
||||
auto *manager = impl::HtcsManagerHolder::GetHtcsManager();
|
||||
|
||||
/* End the select. */
|
||||
return manager->EndSelect(out_err.GetPointer(), out_count.GetPointer(), read_handles.ToSpan(), write_handles.ToSpan(), exception_handles.ToSpan(), task_id);
|
||||
R_RETURN(manager->EndSelect(out_err.GetPointer(), out_count.GetPointer(), read_handles.ToSpan(), write_handles.ToSpan(), exception_handles.ToSpan(), task_id));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -194,7 +194,7 @@ namespace ams::htcs::server {
|
||||
}
|
||||
|
||||
Result SocketServiceObject::SendStartOld(sf::Out<u32> out_task_id, sf::OutCopyHandle out_event, const sf::InAutoSelectBuffer &buffer, s32 flags) {
|
||||
return this->SendStart(out_task_id, out_event, sf::InNonSecureAutoSelectBuffer(buffer.GetPointer(), buffer.GetSize()), flags);
|
||||
R_RETURN(this->SendStart(out_task_id, out_event, sf::InNonSecureAutoSelectBuffer(buffer.GetPointer(), buffer.GetSize()), flags));
|
||||
}
|
||||
|
||||
Result SocketServiceObject::SendLargeStart(sf::Out<u32> out_task_id, sf::OutCopyHandle out_event, const sf::InAutoSelectBuffer &start_buffer, const sf::InAutoSelectBuffer &end_buffer, sf::CopyHandle &&mem_handle, s64 aligned_size, s32 flags) {
|
||||
@@ -257,7 +257,7 @@ namespace ams::htcs::server {
|
||||
}
|
||||
|
||||
Result SocketServiceObject::ContinueSendOld(sf::Out<s64> out_size, sf::Out<bool> out_wait, const sf::InAutoSelectBuffer &buffer, u32 task_id) {
|
||||
return this->ContinueSend(out_size, out_wait, sf::InNonSecureAutoSelectBuffer(buffer.GetPointer(), buffer.GetSize()), task_id);
|
||||
R_RETURN(this->ContinueSend(out_size, out_wait, sf::InNonSecureAutoSelectBuffer(buffer.GetPointer(), buffer.GetSize()), task_id));
|
||||
}
|
||||
|
||||
Result SocketServiceObject::EndSend(sf::Out<s32> out_err, sf::Out<s64> out_size, u32 task_id) {
|
||||
|
||||
@@ -192,7 +192,7 @@ namespace ams::i2c::driver::board::nintendo::nx::impl {
|
||||
}
|
||||
|
||||
/* Send the data. */
|
||||
return this->Send(static_cast<const u8 *>(src), src_size, option, device->GetAddress(), device->GetAddressingMode());
|
||||
R_RETURN(this->Send(static_cast<const u8 *>(src), src_size, option, device->GetAddress(), device->GetAddressingMode()));
|
||||
}
|
||||
|
||||
Result I2cBusAccessor::Receive(void *dst, size_t dst_size, I2cDeviceProperty *device, TransactionOption option) {
|
||||
@@ -208,7 +208,7 @@ namespace ams::i2c::driver::board::nintendo::nx::impl {
|
||||
}
|
||||
|
||||
/* Send the data. */
|
||||
return this->Receive(static_cast<u8 *>(dst), dst_size, option, device->GetAddress(), device->GetAddressingMode());
|
||||
R_RETURN(this->Receive(static_cast<u8 *>(dst), dst_size, option, device->GetAddress(), device->GetAddressingMode()));
|
||||
}
|
||||
|
||||
void I2cBusAccessor::SuspendBus() {
|
||||
@@ -399,7 +399,7 @@ namespace ams::i2c::driver::board::nintendo::nx::impl {
|
||||
|
||||
this->DisableInterruptMask();
|
||||
os::ClearInterruptEvent(std::addressof(m_interrupt_event));
|
||||
return i2c::ResultTimeout();
|
||||
R_THROW(i2c::ResultTimeout());
|
||||
}
|
||||
|
||||
/* Check and handle any errors. */
|
||||
@@ -429,7 +429,7 @@ namespace ams::i2c::driver::board::nintendo::nx::impl {
|
||||
|
||||
this->DisableInterruptMask();
|
||||
os::ClearInterruptEvent(std::addressof(m_interrupt_event));
|
||||
return i2c::ResultTimeout();
|
||||
R_THROW(i2c::ResultTimeout());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -474,7 +474,7 @@ namespace ams::i2c::driver::board::nintendo::nx::impl {
|
||||
|
||||
this->DisableInterruptMask();
|
||||
os::ClearInterruptEvent(std::addressof(m_interrupt_event));
|
||||
return i2c::ResultTimeout();
|
||||
R_THROW(i2c::ResultTimeout());
|
||||
}
|
||||
|
||||
/* Check and handle any errors. */
|
||||
|
||||
@@ -101,13 +101,13 @@ namespace ams::i2c::driver::board::nintendo::nx::impl {
|
||||
Result CheckAndHandleError() {
|
||||
const Result result = this->GetTransactionResult();
|
||||
this->HandleTransactionError(result);
|
||||
|
||||
if (R_FAILED(result)) {
|
||||
this->DisableInterruptMask();
|
||||
os::ClearInterruptEvent(std::addressof(m_interrupt_event));
|
||||
return result;
|
||||
}
|
||||
|
||||
R_SUCCEED();
|
||||
R_RETURN(result);
|
||||
}
|
||||
public:
|
||||
virtual void InitializeDriver() override;
|
||||
|
||||
@@ -27,14 +27,10 @@ namespace ams::i2c::driver {
|
||||
Result OpenSessionImpl(I2cSession *out, I2cDeviceProperty *device) {
|
||||
/* Construct the session. */
|
||||
auto *session = std::construct_at(std::addressof(impl::GetI2cSessionImpl(*out)), DefaultRetryCount, DefaultRetryInterval);
|
||||
auto session_guard = SCOPE_GUARD { std::destroy_at(session); };
|
||||
ON_RESULT_FAILURE { std::destroy_at(session); };
|
||||
|
||||
/* Open the session. */
|
||||
R_TRY(session->Open(device, ddsf::AccessMode_ReadWrite));
|
||||
|
||||
/* We succeeded. */
|
||||
session_guard.Cancel();
|
||||
R_SUCCEED();
|
||||
R_RETURN(session->Open(device, ddsf::AccessMode_ReadWrite));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -48,9 +44,7 @@ namespace ams::i2c::driver {
|
||||
AMS_ASSERT(device != nullptr);
|
||||
|
||||
/* Open the session. */
|
||||
R_TRY(OpenSessionImpl(out, device));
|
||||
|
||||
R_SUCCEED();
|
||||
R_RETURN(OpenSessionImpl(out, device));
|
||||
}
|
||||
|
||||
void CloseSession(I2cSession &session) {
|
||||
@@ -61,14 +55,14 @@ namespace ams::i2c::driver {
|
||||
AMS_ASSERT(src != nullptr);
|
||||
AMS_ABORT_UNLESS(src_size > 0);
|
||||
|
||||
return impl::GetOpenI2cSessionImpl(session).Send(src, src_size, option);
|
||||
R_RETURN(impl::GetOpenI2cSessionImpl(session).Send(src, src_size, option));
|
||||
}
|
||||
|
||||
Result Receive(void *dst, size_t dst_size, I2cSession &session, TransactionOption option) {
|
||||
AMS_ASSERT(dst != nullptr);
|
||||
AMS_ABORT_UNLESS(dst_size > 0);
|
||||
|
||||
return impl::GetOpenI2cSessionImpl(session).Receive(dst, dst_size, option);
|
||||
R_RETURN(impl::GetOpenI2cSessionImpl(session).Receive(dst, dst_size, option));
|
||||
}
|
||||
|
||||
Result ExecuteCommandList(void *dst, size_t dst_size, I2cSession &session, const void *src, size_t src_size) {
|
||||
@@ -78,14 +72,14 @@ namespace ams::i2c::driver {
|
||||
AMS_ABORT_UNLESS(src_size > 0);
|
||||
AMS_ABORT_UNLESS(dst_size > 0);
|
||||
|
||||
return impl::GetOpenI2cSessionImpl(session).ExecuteCommandList(dst, dst_size, src, src_size);
|
||||
R_RETURN(impl::GetOpenI2cSessionImpl(session).ExecuteCommandList(dst, dst_size, src, src_size));
|
||||
}
|
||||
|
||||
Result SetRetryPolicy(I2cSession &session, int max_retry_count, int retry_interval_us) {
|
||||
AMS_ASSERT(max_retry_count > 0);
|
||||
AMS_ASSERT(retry_interval_us > 0);
|
||||
|
||||
return impl::GetOpenI2cSessionImpl(session).SetRetryPolicy(max_retry_count, retry_interval_us);
|
||||
R_RETURN(impl::GetOpenI2cSessionImpl(session).SetRetryPolicy(max_retry_count, retry_interval_us));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace ams::i2c::driver {
|
||||
}
|
||||
|
||||
Result RegisterDeviceCode(DeviceCode device_code, I2cDeviceProperty *device) {
|
||||
return impl::RegisterDeviceCode(device_code, device);
|
||||
R_RETURN(impl::RegisterDeviceCode(device_code, device));
|
||||
}
|
||||
|
||||
bool UnregisterDeviceCode(DeviceCode device_code) {
|
||||
|
||||
@@ -148,7 +148,7 @@ namespace ams::i2c::driver::impl {
|
||||
os::SleepThread(m_retry_interval);
|
||||
continue;
|
||||
}
|
||||
return i2c::ResultBusBusy();
|
||||
R_THROW(i2c::ResultBusBusy());
|
||||
}
|
||||
} R_END_TRY_CATCH;
|
||||
|
||||
@@ -160,14 +160,14 @@ namespace ams::i2c::driver::impl {
|
||||
/* Acquire exclusive access to the device. */
|
||||
std::scoped_lock lk(this->GetDevice().SafeCastTo<I2cDeviceProperty>().GetDriver().SafeCastTo<II2cDriver>().GetTransactionOrderMutex());
|
||||
|
||||
return this->ExecuteTransactionWithRetry(nullptr, Command::Send, src, src_size, option);
|
||||
R_RETURN(this->ExecuteTransactionWithRetry(nullptr, Command::Send, src, src_size, option));
|
||||
}
|
||||
|
||||
Result I2cSessionImpl::Receive(void *dst, size_t dst_size, TransactionOption option) {
|
||||
/* Acquire exclusive access to the device. */
|
||||
std::scoped_lock lk(this->GetDevice().SafeCastTo<I2cDeviceProperty>().GetDriver().SafeCastTo<II2cDriver>().GetTransactionOrderMutex());
|
||||
|
||||
return this->ExecuteTransactionWithRetry(dst, Command::Receive, nullptr, dst_size, option);
|
||||
R_RETURN(this->ExecuteTransactionWithRetry(dst, Command::Receive, nullptr, dst_size, option));
|
||||
}
|
||||
|
||||
Result I2cSessionImpl::ExecuteCommandList(void *dst, size_t dst_size, const void *src, size_t src_size) {
|
||||
|
||||
@@ -130,20 +130,20 @@ namespace ams::i2c {
|
||||
Result Send(const I2cSession &session, const void *src, size_t src_size, TransactionOption option) {
|
||||
const ams::sf::InAutoSelectBuffer buf(src, src_size);
|
||||
|
||||
return GetInterface(session)->Send(buf, option);
|
||||
R_RETURN(GetInterface(session)->Send(buf, option));
|
||||
}
|
||||
|
||||
Result Receive(void *dst, size_t dst_size, const I2cSession &session, TransactionOption option) {
|
||||
const ams::sf::OutAutoSelectBuffer buf(dst, dst_size);
|
||||
|
||||
return GetInterface(session)->Receive(buf, option);
|
||||
R_RETURN(GetInterface(session)->Receive(buf, option));
|
||||
}
|
||||
|
||||
Result ExecuteCommandList(void *dst, size_t dst_size, const I2cSession &session, const void *src, size_t src_size) {
|
||||
const ams::sf::OutAutoSelectBuffer buf(dst, dst_size);
|
||||
const ams::sf::InPointerArray<i2c::I2cCommand> arr(static_cast<const i2c::I2cCommand *>(src), src_size);
|
||||
|
||||
return GetInterface(session)->ExecuteCommandList(buf, arr);
|
||||
R_RETURN(GetInterface(session)->ExecuteCommandList(buf, arr));
|
||||
}
|
||||
|
||||
void SetRetryPolicy(const I2cSession &session, int max_retry_count, int retry_interval_us) {
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace ams::i2c::server {
|
||||
}
|
||||
|
||||
Result ManagerImpl::OpenSession(ams::sf::Out<ams::sf::SharedPointer<i2c::sf::ISession>> out, i2c::I2cDevice device) {
|
||||
return this->OpenSession2(out, ConvertToDeviceCode(device));
|
||||
R_RETURN(this->OpenSession2(out, ConvertToDeviceCode(device)));
|
||||
}
|
||||
|
||||
Result ManagerImpl::HasDevice(ams::sf::Out<bool> out, i2c::I2cDevice device) {
|
||||
|
||||
@@ -44,31 +44,31 @@ namespace ams::i2c::server {
|
||||
public:
|
||||
/* Actual commands. */
|
||||
Result SendOld(const ams::sf::InBuffer &in_data, i2c::TransactionOption option) {
|
||||
return i2c::driver::Send(m_internal_session, in_data.GetPointer(), in_data.GetSize(), option);
|
||||
R_RETURN(i2c::driver::Send(m_internal_session, in_data.GetPointer(), in_data.GetSize(), option));
|
||||
}
|
||||
|
||||
Result ReceiveOld(const ams::sf::OutBuffer &out_data, i2c::TransactionOption option) {
|
||||
return i2c::driver::Receive(out_data.GetPointer(), out_data.GetSize(), m_internal_session, option);
|
||||
R_RETURN(i2c::driver::Receive(out_data.GetPointer(), out_data.GetSize(), m_internal_session, option));
|
||||
}
|
||||
|
||||
Result ExecuteCommandListOld(const ams::sf::OutBuffer &rcv_buf, const ams::sf::InPointerArray<i2c::I2cCommand> &command_list){
|
||||
return i2c::driver::ExecuteCommandList(rcv_buf.GetPointer(), rcv_buf.GetSize(), m_internal_session, command_list.GetPointer(), command_list.GetSize() * sizeof(i2c::I2cCommand));
|
||||
R_RETURN(i2c::driver::ExecuteCommandList(rcv_buf.GetPointer(), rcv_buf.GetSize(), m_internal_session, command_list.GetPointer(), command_list.GetSize() * sizeof(i2c::I2cCommand)));
|
||||
}
|
||||
|
||||
Result Send(const ams::sf::InAutoSelectBuffer &in_data, i2c::TransactionOption option) {
|
||||
return i2c::driver::Send(m_internal_session, in_data.GetPointer(), in_data.GetSize(), option);
|
||||
R_RETURN(i2c::driver::Send(m_internal_session, in_data.GetPointer(), in_data.GetSize(), option));
|
||||
}
|
||||
|
||||
Result Receive(const ams::sf::OutAutoSelectBuffer &out_data, i2c::TransactionOption option) {
|
||||
return i2c::driver::Receive(out_data.GetPointer(), out_data.GetSize(), m_internal_session, option);
|
||||
R_RETURN(i2c::driver::Receive(out_data.GetPointer(), out_data.GetSize(), m_internal_session, option));
|
||||
}
|
||||
|
||||
Result ExecuteCommandList(const ams::sf::OutAutoSelectBuffer &rcv_buf, const ams::sf::InPointerArray<i2c::I2cCommand> &command_list) {
|
||||
return i2c::driver::ExecuteCommandList(rcv_buf.GetPointer(), rcv_buf.GetSize(), m_internal_session, command_list.GetPointer(), command_list.GetSize() * sizeof(i2c::I2cCommand));
|
||||
R_RETURN(i2c::driver::ExecuteCommandList(rcv_buf.GetPointer(), rcv_buf.GetSize(), m_internal_session, command_list.GetPointer(), command_list.GetSize() * sizeof(i2c::I2cCommand)));
|
||||
}
|
||||
|
||||
Result SetRetryPolicy(s32 max_retry_count, s32 retry_interval_us) {
|
||||
return i2c::driver::SetRetryPolicy(m_internal_session, max_retry_count, retry_interval_us);
|
||||
R_RETURN(i2c::driver::SetRetryPolicy(m_internal_session, max_retry_count, retry_interval_us));
|
||||
}
|
||||
};
|
||||
static_assert(i2c::sf::IsISession<SessionImpl>);
|
||||
|
||||
@@ -174,7 +174,7 @@ namespace ams::kvdb {
|
||||
}
|
||||
|
||||
Result FileKeyValueStore::Initialize(const char *dir) {
|
||||
return this->InitializeWithCache(dir, nullptr, 0, 0);
|
||||
R_RETURN(this->InitializeWithCache(dir, nullptr, 0, 0));
|
||||
}
|
||||
|
||||
Result FileKeyValueStore::InitializeWithCache(const char *dir, void *cache_buffer, size_t cache_buffer_size, size_t cache_capacity) {
|
||||
|
||||
@@ -20,39 +20,39 @@ namespace ams::ldr::pm {
|
||||
|
||||
/* Information API. */
|
||||
Result CreateProcess(os::NativeHandle *out, PinId pin_id, u32 flags, Handle reslimit) {
|
||||
return ldrPmCreateProcess(pin_id.value, flags, reslimit, out);
|
||||
R_RETURN(ldrPmCreateProcess(pin_id.value, flags, reslimit, out));
|
||||
}
|
||||
|
||||
Result GetProgramInfo(ProgramInfo *out, const ncm::ProgramLocation &loc) {
|
||||
return ldrPmGetProgramInfo(reinterpret_cast<const NcmProgramLocation *>(std::addressof(loc)), reinterpret_cast<LoaderProgramInfo *>(out));
|
||||
R_RETURN(ldrPmGetProgramInfo(reinterpret_cast<const NcmProgramLocation *>(std::addressof(loc)), reinterpret_cast<LoaderProgramInfo *>(out)));
|
||||
}
|
||||
|
||||
Result PinProgram(PinId *out, const ncm::ProgramLocation &loc) {
|
||||
static_assert(sizeof(*out) == sizeof(u64), "PinId definition!");
|
||||
return ldrPmPinProgram(reinterpret_cast<const NcmProgramLocation *>(std::addressof(loc)), reinterpret_cast<u64 *>(out));
|
||||
R_RETURN(ldrPmPinProgram(reinterpret_cast<const NcmProgramLocation *>(std::addressof(loc)), reinterpret_cast<u64 *>(out)));
|
||||
}
|
||||
|
||||
Result UnpinProgram(PinId pin_id) {
|
||||
return ldrPmUnpinProgram(pin_id.value);
|
||||
R_RETURN(ldrPmUnpinProgram(pin_id.value));
|
||||
}
|
||||
|
||||
Result HasLaunchedBootProgram(bool *out, ncm::ProgramId program_id) {
|
||||
return ldrPmAtmosphereHasLaunchedBootProgram(out, static_cast<u64>(program_id));
|
||||
R_RETURN(ldrPmAtmosphereHasLaunchedBootProgram(out, static_cast<u64>(program_id)));
|
||||
}
|
||||
|
||||
Result AtmosphereGetProgramInfo(ProgramInfo *out, cfg::OverrideStatus *out_status, const ncm::ProgramLocation &loc) {
|
||||
static_assert(sizeof(*out_status) == sizeof(CfgOverrideStatus), "CfgOverrideStatus definition!");
|
||||
return ldrPmAtmosphereGetProgramInfo(reinterpret_cast<LoaderProgramInfo *>(out), reinterpret_cast<CfgOverrideStatus *>(out_status), reinterpret_cast<const NcmProgramLocation *>(std::addressof(loc)));
|
||||
R_RETURN(ldrPmAtmosphereGetProgramInfo(reinterpret_cast<LoaderProgramInfo *>(out), reinterpret_cast<CfgOverrideStatus *>(out_status), reinterpret_cast<const NcmProgramLocation *>(std::addressof(loc))));
|
||||
}
|
||||
|
||||
Result SetEnabledProgramVerification(bool enabled) {
|
||||
return ldrPmSetEnabledProgramVerification(enabled);
|
||||
R_RETURN(ldrPmSetEnabledProgramVerification(enabled));
|
||||
}
|
||||
|
||||
Result AtmospherePinProgram(PinId *out, const ncm::ProgramLocation &loc, const cfg::OverrideStatus &status) {
|
||||
static_assert(sizeof(*out) == sizeof(u64), "PinId definition!");
|
||||
static_assert(sizeof(status) == sizeof(CfgOverrideStatus), "CfgOverrideStatus definition!");
|
||||
return ldrPmAtmospherePinProgram(reinterpret_cast<u64 *>(out), reinterpret_cast<const NcmProgramLocation *>(std::addressof(loc)), reinterpret_cast<const CfgOverrideStatus *>(std::addressof(status)));
|
||||
R_RETURN(ldrPmAtmospherePinProgram(reinterpret_cast<u64 *>(out), reinterpret_cast<const NcmProgramLocation *>(std::addressof(loc)), reinterpret_cast<const CfgOverrideStatus *>(std::addressof(status))));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user