mirror of
https://github.com/Atmosphere-NX/Atmosphere
synced 2024-11-12 16:16:35 +00:00
ams: globally prefer R_RETURN to return for ams::Result
This commit is contained in:
parent
dd78ede99f
commit
bbf22b4c60
325 changed files with 1955 additions and 1993 deletions
|
@ -52,7 +52,7 @@ namespace ams::secmon::fatal {
|
|||
}
|
||||
|
||||
Result CheckSdCardConnection(sdmmc::SpeedMode *out_sm, sdmmc::BusWidth *out_bw) {
|
||||
return sdmmc::CheckSdCardConnection(out_sm, out_bw, Port);
|
||||
R_RETURN(sdmmc::CheckSdCardConnection(out_sm, out_bw, Port));
|
||||
}
|
||||
|
||||
Result ReadSdCard(void *dst, size_t size, size_t sector_index, size_t sector_count) {
|
||||
|
|
|
@ -129,7 +129,7 @@ namespace ams::fs {
|
|||
}
|
||||
|
||||
Result CreateDirectory(const char *path) {
|
||||
return TranslateFatFsError(f_mkdir(path));
|
||||
R_RETURN(TranslateFatFsError(f_mkdir(path)));
|
||||
}
|
||||
|
||||
Result OpenFile(FileHandle *out_file, const char *path, int mode) {
|
||||
|
@ -168,7 +168,7 @@ namespace ams::fs {
|
|||
}
|
||||
|
||||
Result ReadFile(FileHandle handle, s64 offset, void *buffer, size_t size) {
|
||||
return ReadFile(handle, offset, buffer, size, fs::ReadOption::None);
|
||||
R_RETURN(ReadFile(handle, offset, buffer, size, fs::ReadOption::None));
|
||||
}
|
||||
|
||||
Result ReadFile(size_t *out, FileHandle handle, s64 offset, void *buffer, size_t size, const fs::ReadOption &option) {
|
||||
|
@ -189,7 +189,7 @@ namespace ams::fs {
|
|||
}
|
||||
|
||||
Result ReadFile(size_t *out, FileHandle handle, s64 offset, void *buffer, size_t size) {
|
||||
return ReadFile(out, handle, offset, buffer, size, fs::ReadOption::None);
|
||||
R_RETURN(ReadFile(out, handle, offset, buffer, size, fs::ReadOption::None));
|
||||
}
|
||||
|
||||
Result GetFileSize(s64 *out, FileHandle handle) {
|
||||
|
@ -199,7 +199,7 @@ namespace ams::fs {
|
|||
}
|
||||
|
||||
Result FlushFile(FileHandle handle) {
|
||||
return TranslateFatFsError(f_sync(GetInternalFile(handle)));
|
||||
R_RETURN(TranslateFatFsError(f_sync(GetInternalFile(handle))));
|
||||
}
|
||||
|
||||
Result WriteFile(FileHandle handle, s64 offset, const void *buffer, size_t size, const fs::WriteOption &option) {
|
||||
|
|
|
@ -156,7 +156,7 @@ namespace ams::fs {
|
|||
}
|
||||
|
||||
Result CreateDirectory(const char *path) {
|
||||
return TranslateFatFsError(f_mkdir(path));
|
||||
R_RETURN(TranslateFatFsError(f_mkdir(path)));
|
||||
}
|
||||
|
||||
Result OpenFile(FileHandle *out_file, const char *path, int mode) {
|
||||
|
@ -236,7 +236,7 @@ namespace ams::fs {
|
|||
}
|
||||
|
||||
Result ReadFile(FileHandle handle, s64 offset, void *buffer, size_t size) {
|
||||
return ReadFile(handle, offset, buffer, size, fs::ReadOption::None);
|
||||
R_RETURN(ReadFile(handle, offset, buffer, size, fs::ReadOption::None));
|
||||
}
|
||||
|
||||
Result ReadFile(size_t *out, FileHandle handle, s64 offset, void *buffer, size_t size, const fs::ReadOption &option) {
|
||||
|
@ -257,7 +257,7 @@ namespace ams::fs {
|
|||
}
|
||||
|
||||
Result ReadFile(size_t *out, FileHandle handle, s64 offset, void *buffer, size_t size) {
|
||||
return ReadFile(out, handle, offset, buffer, size, fs::ReadOption::None);
|
||||
R_RETURN(ReadFile(out, handle, offset, buffer, size, fs::ReadOption::None));
|
||||
}
|
||||
|
||||
Result GetFileSize(s64 *out, FileHandle handle) {
|
||||
|
@ -267,7 +267,7 @@ namespace ams::fs {
|
|||
}
|
||||
|
||||
Result FlushFile(FileHandle handle) {
|
||||
return TranslateFatFsError(f_sync(GetInternalFile(handle)));
|
||||
R_RETURN(TranslateFatFsError(f_sync(GetInternalFile(handle))));
|
||||
}
|
||||
|
||||
Result WriteFile(FileHandle handle, s64 offset, const void *buffer, size_t size, const fs::WriteOption &option) {
|
||||
|
|
|
@ -20,7 +20,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) {
|
||||
|
@ -36,7 +36,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) {
|
||||
|
@ -52,11 +52,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) {
|
||||
|
@ -67,7 +67,7 @@ namespace ams::fs {
|
|||
|
||||
Result FileHandleStorage::SetSize(s64 size) {
|
||||
m_size = InvalidSize;
|
||||
return SetFileSize(m_handle, size);
|
||||
R_RETURN(SetFileSize(m_handle, size));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -73,15 +73,15 @@ namespace ams::fs {
|
|||
ReadOnlyStorageAdapter(IStorage &s) : m_storage(s) { /* ... */ }
|
||||
|
||||
virtual Result Read(s64 offset, void *buffer, size_t size) override {
|
||||
return m_storage.Read(offset, buffer, size);
|
||||
R_RETURN(m_storage.Read(offset, buffer, size));
|
||||
}
|
||||
|
||||
virtual Result Flush() override {
|
||||
return m_storage.Flush();
|
||||
R_RETURN(m_storage.Flush());
|
||||
}
|
||||
|
||||
virtual Result GetSize(s64 *out) override {
|
||||
return m_storage.GetSize(out);
|
||||
R_RETURN(m_storage.GetSize(out));
|
||||
}
|
||||
|
||||
virtual Result Write(s64 offset, const void *buffer, size_t size) override {
|
||||
|
@ -108,7 +108,7 @@ namespace ams::fs {
|
|||
/* Validate arguments and read. */
|
||||
R_UNLESS(buffer != nullptr, fs::ResultNullptrArgument());
|
||||
R_TRY(IStorage::CheckAccessRange(offset, size, m_size));
|
||||
return m_storage.Read(m_offset + offset, buffer, size);
|
||||
R_RETURN(m_storage.Read(m_offset + offset, buffer, size));
|
||||
}
|
||||
|
||||
virtual Result Write(s64 offset, const void *buffer, size_t size) override{
|
||||
|
@ -118,11 +118,11 @@ namespace ams::fs {
|
|||
/* Validate arguments and write. */
|
||||
R_UNLESS(buffer != nullptr, fs::ResultNullptrArgument());
|
||||
R_TRY(IStorage::CheckAccessRange(offset, size, m_size));
|
||||
return m_storage.Write(m_offset + offset, buffer, size);
|
||||
R_RETURN(m_storage.Write(m_offset + offset, buffer, size));
|
||||
}
|
||||
|
||||
virtual Result Flush() override {
|
||||
return m_storage.Flush();
|
||||
R_RETURN(m_storage.Flush());
|
||||
}
|
||||
|
||||
virtual Result GetSize(s64 *out) override {
|
||||
|
|
|
@ -33,7 +33,7 @@ namespace ams::nxboot {
|
|||
ShowFatalError("SdCard: unaligned access to %" PRIx64 ", size=%" PRIx64"\n", static_cast<u64>(offset), static_cast<u64>(size));
|
||||
}
|
||||
|
||||
return ReadSdCard(buffer, size, offset / sdmmc::SectorSize, size / sdmmc::SectorSize);
|
||||
R_RETURN(ReadSdCard(buffer, size, offset / sdmmc::SectorSize, size / sdmmc::SectorSize));
|
||||
}
|
||||
|
||||
virtual Result Flush() override {
|
||||
|
@ -67,7 +67,7 @@ namespace ams::nxboot {
|
|||
ShowFatalError("SdCard: unaligned access to %" PRIx64 ", size=%" PRIx64"\n", static_cast<u64>(offset), static_cast<u64>(size));
|
||||
}
|
||||
|
||||
return ReadMmc(buffer, size, Partition, offset / sdmmc::SectorSize, size / sdmmc::SectorSize);
|
||||
R_RETURN(ReadMmc(buffer, size, Partition, offset / sdmmc::SectorSize, size / sdmmc::SectorSize));
|
||||
}
|
||||
|
||||
virtual Result Flush() override {
|
||||
|
@ -349,11 +349,11 @@ namespace ams::nxboot {
|
|||
}
|
||||
|
||||
Result ReadBoot0(s64 offset, void *dst, size_t size) {
|
||||
return g_boot0_storage->Read(offset, dst, size);
|
||||
R_RETURN(g_boot0_storage->Read(offset, dst, size));
|
||||
}
|
||||
|
||||
Result ReadPackage2(s64 offset, void *dst, size_t size) {
|
||||
return g_package2_storage->Read(offset, dst, size);
|
||||
R_RETURN(g_package2_storage->Read(offset, dst, size));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -47,29 +47,29 @@ namespace ams::nxboot {
|
|||
sdmmc::SetMmcWorkBuffer(MmcPort, g_mmc_work_buffer, sizeof(g_mmc_work_buffer));
|
||||
|
||||
/* Activate the mmc. */
|
||||
return sdmmc::Activate(MmcPort);
|
||||
R_RETURN(sdmmc::Activate(MmcPort));
|
||||
}
|
||||
|
||||
Result CheckMmcConnection(sdmmc::SpeedMode *out_sm, sdmmc::BusWidth *out_bw) {
|
||||
return sdmmc::CheckMmcConnection(out_sm, out_bw, MmcPort);
|
||||
R_RETURN(sdmmc::CheckMmcConnection(out_sm, out_bw, MmcPort));
|
||||
}
|
||||
|
||||
Result GetMmcMemoryCapacity(u32 *out_num_sectors, sdmmc::MmcPartition partition) {
|
||||
if (partition == sdmmc::MmcPartition_UserData) {
|
||||
return sdmmc::GetDeviceMemoryCapacity(out_num_sectors, MmcPort);
|
||||
R_RETURN(sdmmc::GetDeviceMemoryCapacity(out_num_sectors, MmcPort));
|
||||
} else {
|
||||
return sdmmc::GetMmcBootPartitionCapacity(out_num_sectors, MmcPort);
|
||||
R_RETURN(sdmmc::GetMmcBootPartitionCapacity(out_num_sectors, MmcPort));
|
||||
}
|
||||
}
|
||||
|
||||
Result ReadMmc(void *dst, size_t size, sdmmc::MmcPartition partition, size_t sector_index, size_t sector_count) {
|
||||
R_TRY(SelectMmcPartition(partition));
|
||||
return sdmmc::Read(dst, size, MmcPort, sector_index, sector_count);
|
||||
R_RETURN(sdmmc::Read(dst, size, MmcPort, sector_index, sector_count));
|
||||
}
|
||||
|
||||
Result WriteMmc(sdmmc::MmcPartition partition, size_t sector_index, size_t sector_count, const void *src, size_t size) {
|
||||
R_TRY(SelectMmcPartition(partition));
|
||||
return sdmmc::Write(MmcPort, sector_index, sector_count, src, size);
|
||||
R_RETURN(sdmmc::Write(MmcPort, sector_index, sector_count, src, size));
|
||||
}
|
||||
|
||||
}
|
|
@ -78,7 +78,7 @@ namespace ams::nxboot {
|
|||
sdmmc::SetSdCardWorkBuffer(SdCardPort, g_sd_work_buffer, sizeof(g_sd_work_buffer));
|
||||
|
||||
/* Activate the SD card. */
|
||||
return sdmmc::Activate(SdCardPort);
|
||||
R_RETURN(sdmmc::Activate(SdCardPort));
|
||||
}
|
||||
|
||||
void FinalizeSdCard() {
|
||||
|
@ -90,19 +90,19 @@ namespace ams::nxboot {
|
|||
}
|
||||
|
||||
Result CheckSdCardConnection(sdmmc::SpeedMode *out_sm, sdmmc::BusWidth *out_bw) {
|
||||
return sdmmc::CheckSdCardConnection(out_sm, out_bw, SdCardPort);
|
||||
R_RETURN(sdmmc::CheckSdCardConnection(out_sm, out_bw, SdCardPort));
|
||||
}
|
||||
|
||||
Result GetSdCardMemoryCapacity(u32 *out_num_sectors) {
|
||||
return sdmmc::GetDeviceMemoryCapacity(out_num_sectors, SdCardPort);
|
||||
R_RETURN(sdmmc::GetDeviceMemoryCapacity(out_num_sectors, SdCardPort));
|
||||
}
|
||||
|
||||
Result ReadSdCard(void *dst, size_t size, size_t sector_index, size_t sector_count) {
|
||||
return sdmmc::Read(dst, size, SdCardPort, sector_index, sector_count);
|
||||
R_RETURN(sdmmc::Read(dst, size, SdCardPort, sector_index, sector_count));
|
||||
}
|
||||
|
||||
Result WriteSdCard(size_t sector_index, size_t sector_count, const void *src, size_t size) {
|
||||
return sdmmc::Write(SdCardPort, sector_index, sector_count, src, size);
|
||||
R_RETURN(sdmmc::Write(SdCardPort, sector_index, sector_count, src, size));
|
||||
}
|
||||
|
||||
}
|
|
@ -113,12 +113,12 @@ namespace ams::ddsf {
|
|||
|
||||
template<typename F>
|
||||
Result ForEachSession(F f, bool return_on_fail) {
|
||||
return impl::ForEach(m_session_list_lock, m_session_list, f, return_on_fail);
|
||||
R_RETURN(impl::ForEach(m_session_list_lock, m_session_list, f, return_on_fail));
|
||||
}
|
||||
|
||||
template<typename F>
|
||||
Result ForEachSession(F f, bool return_on_fail) const {
|
||||
return impl::ForEach(m_session_list_lock, m_session_list, f, return_on_fail);
|
||||
R_RETURN(impl::ForEach(m_session_list_lock, m_session_list, f, return_on_fail));
|
||||
}
|
||||
|
||||
template<typename F>
|
||||
|
|
|
@ -76,12 +76,12 @@ namespace ams::ddsf {
|
|||
|
||||
template<typename F>
|
||||
Result ForEachDevice(F f, bool return_on_fail) {
|
||||
return impl::ForEach(m_device_list_lock, m_device_list, f, return_on_fail);
|
||||
R_RETURN(impl::ForEach(m_device_list_lock, m_device_list, f, return_on_fail));
|
||||
}
|
||||
|
||||
template<typename F>
|
||||
Result ForEachDevice(F f, bool return_on_fail) const {
|
||||
return impl::ForEach(m_device_list_lock, m_device_list, f, return_on_fail);
|
||||
R_RETURN(impl::ForEach(m_device_list_lock, m_device_list, f, return_on_fail));
|
||||
}
|
||||
|
||||
template<typename F>
|
||||
|
|
|
@ -26,13 +26,13 @@ namespace ams::ddsf::impl {
|
|||
for (auto && it : list) {
|
||||
if (const auto cur_result = f(std::addressof(it)); R_FAILED(cur_result)) {
|
||||
if (return_on_fail) {
|
||||
return cur_result;
|
||||
R_RETURN(cur_result);
|
||||
} else if (R_SUCCEEDED(result)) {
|
||||
result = cur_result;
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
R_RETURN(result);
|
||||
}
|
||||
|
||||
template<typename List, typename F, typename Lock>
|
||||
|
|
|
@ -81,23 +81,23 @@ namespace ams::fs {
|
|||
using Base = KeyValueRomStorageTemplate<ImplKeyType, ValueType, MaxKeyLength>;
|
||||
public:
|
||||
Result Add(Position *out, const ClientKeyType &key, const Value &value) {
|
||||
return Base::AddInternal(out, key.key, key.Hash(), key.name.path, key.name.length * sizeof(RomPathChar), value);
|
||||
R_RETURN(Base::AddInternal(out, key.key, key.Hash(), key.name.path, key.name.length * sizeof(RomPathChar), value));
|
||||
}
|
||||
|
||||
Result Get(Position *out_pos, Value *out_val, const ClientKeyType &key) {
|
||||
return Base::GetInternal(out_pos, out_val, key.key, key.Hash(), key.name.path, key.name.length * sizeof(RomPathChar));
|
||||
R_RETURN(Base::GetInternal(out_pos, out_val, key.key, key.Hash(), key.name.path, key.name.length * sizeof(RomPathChar)));
|
||||
}
|
||||
|
||||
Result GetByPosition(ImplKey *out_key, Value *out_val, Position pos) {
|
||||
return Base::GetByPosition(out_key, out_val, pos);
|
||||
R_RETURN(Base::GetByPosition(out_key, out_val, pos));
|
||||
}
|
||||
|
||||
Result GetByPosition(ImplKey *out_key, Value *out_val, void *out_aux, size_t *out_aux_size, Position pos) {
|
||||
return Base::GetByPosition(out_key, out_val, out_aux, out_aux_size, pos);
|
||||
R_RETURN(Base::GetByPosition(out_key, out_val, out_aux, out_aux_size, pos));
|
||||
}
|
||||
|
||||
Result SetByPosition(Position pos, const Value &value) {
|
||||
return Base::SetByPosition(pos, value);
|
||||
R_RETURN(Base::SetByPosition(pos, value));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -175,7 +175,7 @@ namespace ams::fs {
|
|||
Element elem;
|
||||
R_TRY(this->ReadKeyValue(std::addressof(elem), pos));
|
||||
elem.value = value;
|
||||
return this->WriteKeyValue(std::addressof(elem), pos, nullptr, 0);
|
||||
R_RETURN(this->WriteKeyValue(std::addressof(elem), pos, nullptr, 0));
|
||||
}
|
||||
private:
|
||||
BucketIndex HashToBucket(u32 hash_key) const {
|
||||
|
@ -259,14 +259,14 @@ namespace ams::fs {
|
|||
AMS_ASSERT(ind < m_bucket_count);
|
||||
|
||||
const s64 offset = ind * sizeof(Position);
|
||||
return m_bucket_storage.Read(offset, out, sizeof(*out));
|
||||
R_RETURN(m_bucket_storage.Read(offset, out, sizeof(*out)));
|
||||
}
|
||||
|
||||
Result WriteBucket(Position pos, BucketIndex ind) {
|
||||
AMS_ASSERT(ind < m_bucket_count);
|
||||
|
||||
const s64 offset = ind * sizeof(Position);
|
||||
return m_bucket_storage.Write(offset, std::addressof(pos), sizeof(pos));
|
||||
R_RETURN(m_bucket_storage.Write(offset, std::addressof(pos), sizeof(pos)));
|
||||
}
|
||||
|
||||
Result ReadKeyValue(Element *out, Position pos) {
|
||||
|
@ -276,7 +276,7 @@ namespace ams::fs {
|
|||
R_TRY(m_kv_storage.GetSize(std::addressof(kv_size)));
|
||||
AMS_ASSERT(pos < kv_size);
|
||||
|
||||
return m_kv_storage.Read(pos, out, sizeof(*out));
|
||||
R_RETURN(m_kv_storage.Read(pos, out, sizeof(*out)));
|
||||
}
|
||||
|
||||
Result ReadKeyValue(Element *out, void *out_aux, size_t *out_aux_size, Position pos) {
|
||||
|
|
|
@ -25,7 +25,7 @@ namespace ams::fs {
|
|||
|
||||
Result BindEvent(os::SystemEventType *out, os::EventClearMode clear_mode) {
|
||||
AMS_ASSERT(out != nullptr);
|
||||
return this->DoBindEvent(out, clear_mode);
|
||||
R_RETURN(this->DoBindEvent(out, clear_mode));
|
||||
}
|
||||
private:
|
||||
virtual Result DoBindEvent(os::SystemEventType *out, os::EventClearMode clear_mode) = 0;
|
||||
|
|
|
@ -95,19 +95,19 @@ namespace ams::fs {
|
|||
virtual ~ReadOnlyStorageAdapter() { /* ... */ }
|
||||
public:
|
||||
virtual Result Read(s64 offset, void *buffer, size_t size) override {
|
||||
return m_storage->Read(offset, buffer, size);
|
||||
R_RETURN(m_storage->Read(offset, buffer, size));
|
||||
}
|
||||
|
||||
virtual Result Flush() override {
|
||||
return m_storage->Flush();
|
||||
R_RETURN(m_storage->Flush());
|
||||
}
|
||||
|
||||
virtual Result GetSize(s64 *out) override {
|
||||
return m_storage->GetSize(out);
|
||||
R_RETURN(m_storage->GetSize(out));
|
||||
}
|
||||
|
||||
virtual Result OperateRange(void *dst, size_t dst_size, OperationId op_id, s64 offset, s64 size, const void *src, size_t src_size) override {
|
||||
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 Write(s64 offset, const void *buffer, size_t size) override {
|
||||
|
|
|
@ -205,7 +205,7 @@ namespace ams::fs {
|
|||
/* Check the path is valid. */
|
||||
R_UNLESS(path != nullptr, fs::ResultNullptrArgument());
|
||||
|
||||
return this->Initialize(path, std::strlen(path));
|
||||
R_RETURN(this->Initialize(path, std::strlen(path)));
|
||||
}
|
||||
|
||||
Result InitializeWithFormat(const char *fmt, ...) __attribute__((format (printf, 2, 3))) {
|
||||
|
|
|
@ -619,7 +619,7 @@ namespace ams::fs {
|
|||
}
|
||||
|
||||
static constexpr ALWAYS_INLINE Result SkipMountName(const char **out, size_t *out_len, const char *path) {
|
||||
return ParseMountName(out, out_len, nullptr, 0, path);
|
||||
R_RETURN(ParseMountName(out, out_len, nullptr, 0, path));
|
||||
}
|
||||
|
||||
static constexpr Result ParseMountName(const char **out, size_t *out_len, char *out_mount_name, size_t out_mount_name_buffer_size, const char *path) {
|
||||
|
@ -684,7 +684,7 @@ namespace ams::fs {
|
|||
}
|
||||
|
||||
static constexpr ALWAYS_INLINE Result SkipRelativeDotPath(const char **out, size_t *out_len, const char *path) {
|
||||
return ParseRelativeDotPath(out, out_len, nullptr, 0, path);
|
||||
R_RETURN(ParseRelativeDotPath(out, out_len, nullptr, 0, path));
|
||||
}
|
||||
|
||||
static constexpr Result ParseRelativeDotPath(const char **out, size_t *out_len, char *out_relative, size_t out_relative_buffer_size, const char *path) {
|
||||
|
|
|
@ -36,11 +36,11 @@ namespace ams::fs {
|
|||
virtual ~ReadOnlyFile() { /* ... */ }
|
||||
private:
|
||||
virtual Result DoRead(size_t *out, s64 offset, void *buffer, size_t size, const fs::ReadOption &option) override final {
|
||||
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 final {
|
||||
return m_base_file->GetSize(out);
|
||||
R_RETURN(m_base_file->GetSize(out));
|
||||
}
|
||||
|
||||
virtual Result DoFlush() override final {
|
||||
|
@ -66,7 +66,7 @@ namespace ams::fs {
|
|||
switch (op_id) {
|
||||
case OperationId::Invalidate:
|
||||
case OperationId::QueryRange:
|
||||
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));
|
||||
default:
|
||||
R_THROW(fs::ResultUnsupportedOperateRangeForReadOnlyFile());
|
||||
}
|
||||
|
@ -104,11 +104,11 @@ namespace ams::fs {
|
|||
}
|
||||
|
||||
virtual Result DoOpenDirectory(std::unique_ptr<fsa::IDirectory> *out_dir, const fs::Path &path, OpenDirectoryMode mode) override final {
|
||||
return m_base_fs->OpenDirectory(out_dir, path, mode);
|
||||
R_RETURN(m_base_fs->OpenDirectory(out_dir, path, mode));
|
||||
}
|
||||
|
||||
virtual Result DoGetEntryType(DirectoryEntryType *out, const fs::Path &path) override final {
|
||||
return m_base_fs->GetEntryType(out, path);
|
||||
R_RETURN(m_base_fs->GetEntryType(out, path));
|
||||
}
|
||||
|
||||
virtual Result DoCommit() override final {
|
||||
|
|
|
@ -35,23 +35,23 @@ namespace ams::fs {
|
|||
virtual ~RemoteFile() { fsFileClose(std::addressof(m_base_file)); }
|
||||
public:
|
||||
virtual Result DoRead(size_t *out, s64 offset, void *buffer, size_t size, const fs::ReadOption &option) override final {
|
||||
return fsFileRead(std::addressof(m_base_file), offset, buffer, size, option._value, out);
|
||||
R_RETURN(fsFileRead(std::addressof(m_base_file), offset, buffer, size, option._value, out));
|
||||
}
|
||||
|
||||
virtual Result DoGetSize(s64 *out) override final {
|
||||
return fsFileGetSize(std::addressof(m_base_file), out);
|
||||
R_RETURN(fsFileGetSize(std::addressof(m_base_file), out));
|
||||
}
|
||||
|
||||
virtual Result DoFlush() override final {
|
||||
return fsFileFlush(std::addressof(m_base_file));
|
||||
R_RETURN(fsFileFlush(std::addressof(m_base_file)));
|
||||
}
|
||||
|
||||
virtual Result DoWrite(s64 offset, const void *buffer, size_t size, const fs::WriteOption &option) override final {
|
||||
return fsFileWrite(std::addressof(m_base_file), offset, buffer, size, option._value);
|
||||
R_RETURN(fsFileWrite(std::addressof(m_base_file), offset, buffer, size, option._value));
|
||||
}
|
||||
|
||||
virtual Result DoSetSize(s64 size) override final {
|
||||
return fsFileSetSize(std::addressof(m_base_file), size);
|
||||
R_RETURN(fsFileSetSize(std::addressof(m_base_file), 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 final {
|
||||
|
@ -60,7 +60,7 @@ namespace ams::fs {
|
|||
R_UNLESS(op_id == OperationId::QueryRange, fs::ResultUnsupportedOperateRangeForFileServiceObjectAdapter());
|
||||
R_UNLESS(dst_size == sizeof(FileQueryRangeInfo), fs::ResultInvalidSize());
|
||||
|
||||
return fsFileOperateRange(std::addressof(m_base_file), static_cast<::FsOperationId>(op_id), offset, size, reinterpret_cast<::FsRangeInfo *>(dst));
|
||||
R_RETURN(fsFileOperateRange(std::addressof(m_base_file), static_cast<::FsOperationId>(op_id), offset, size, reinterpret_cast<::FsRangeInfo *>(dst)));
|
||||
}
|
||||
public:
|
||||
virtual sf::cmif::DomainObjectId GetDomainObjectId() const override final {
|
||||
|
@ -80,11 +80,11 @@ namespace ams::fs {
|
|||
public:
|
||||
virtual Result DoRead(s64 *out_count, DirectoryEntry *out_entries, s64 max_entries) override final {
|
||||
static_assert(sizeof(*out_entries) == sizeof(::FsDirectoryEntry));
|
||||
return fsDirRead(std::addressof(m_base_dir), out_count, max_entries, reinterpret_cast<::FsDirectoryEntry *>(out_entries));
|
||||
R_RETURN(fsDirRead(std::addressof(m_base_dir), out_count, max_entries, reinterpret_cast<::FsDirectoryEntry *>(out_entries)));
|
||||
}
|
||||
|
||||
virtual Result DoGetEntryCount(s64 *out) override final {
|
||||
return fsDirGetEntryCount(std::addressof(m_base_dir), out);
|
||||
R_RETURN(fsDirGetEntryCount(std::addressof(m_base_dir), out));
|
||||
}
|
||||
public:
|
||||
virtual sf::cmif::DomainObjectId GetDomainObjectId() const override final {
|
||||
|
@ -119,31 +119,31 @@ namespace ams::fs {
|
|||
virtual Result DoCreateFile(const fs::Path &path, s64 size, int flags) override final {
|
||||
fssrv::sf::Path sf_path;
|
||||
R_TRY(GetPathForServiceObject(std::addressof(sf_path), path));
|
||||
return fsFsCreateFile(std::addressof(m_base_fs), sf_path.str, size, flags);
|
||||
R_RETURN(fsFsCreateFile(std::addressof(m_base_fs), sf_path.str, size, flags));
|
||||
}
|
||||
|
||||
virtual Result DoDeleteFile(const fs::Path &path) override final {
|
||||
fssrv::sf::Path sf_path;
|
||||
R_TRY(GetPathForServiceObject(std::addressof(sf_path), path));
|
||||
return fsFsDeleteFile(std::addressof(m_base_fs), sf_path.str);
|
||||
R_RETURN(fsFsDeleteFile(std::addressof(m_base_fs), sf_path.str));
|
||||
}
|
||||
|
||||
virtual Result DoCreateDirectory(const fs::Path &path) override final {
|
||||
fssrv::sf::Path sf_path;
|
||||
R_TRY(GetPathForServiceObject(std::addressof(sf_path), path));
|
||||
return fsFsCreateDirectory(std::addressof(m_base_fs), sf_path.str);
|
||||
R_RETURN(fsFsCreateDirectory(std::addressof(m_base_fs), sf_path.str));
|
||||
}
|
||||
|
||||
virtual Result DoDeleteDirectory(const fs::Path &path) override final {
|
||||
fssrv::sf::Path sf_path;
|
||||
R_TRY(GetPathForServiceObject(std::addressof(sf_path), path));
|
||||
return fsFsDeleteDirectory(std::addressof(m_base_fs), sf_path.str);
|
||||
R_RETURN(fsFsDeleteDirectory(std::addressof(m_base_fs), sf_path.str));
|
||||
}
|
||||
|
||||
virtual Result DoDeleteDirectoryRecursively(const fs::Path &path) override final {
|
||||
fssrv::sf::Path sf_path;
|
||||
R_TRY(GetPathForServiceObject(std::addressof(sf_path), path));
|
||||
return fsFsDeleteDirectoryRecursively(std::addressof(m_base_fs), sf_path.str);
|
||||
R_RETURN(fsFsDeleteDirectoryRecursively(std::addressof(m_base_fs), sf_path.str));
|
||||
}
|
||||
|
||||
virtual Result DoRenameFile(const fs::Path &old_path, const fs::Path &new_path) override final {
|
||||
|
@ -151,7 +151,7 @@ namespace ams::fs {
|
|||
fssrv::sf::Path new_sf_path;
|
||||
R_TRY(GetPathForServiceObject(std::addressof(old_sf_path), old_path));
|
||||
R_TRY(GetPathForServiceObject(std::addressof(new_sf_path), new_path));
|
||||
return fsFsRenameFile(std::addressof(m_base_fs), old_sf_path.str, new_sf_path.str);
|
||||
R_RETURN(fsFsRenameFile(std::addressof(m_base_fs), old_sf_path.str, new_sf_path.str));
|
||||
}
|
||||
|
||||
virtual Result DoRenameDirectory(const fs::Path &old_path, const fs::Path &new_path) override final {
|
||||
|
@ -159,7 +159,7 @@ namespace ams::fs {
|
|||
fssrv::sf::Path new_sf_path;
|
||||
R_TRY(GetPathForServiceObject(std::addressof(old_sf_path), old_path));
|
||||
R_TRY(GetPathForServiceObject(std::addressof(new_sf_path), new_path));
|
||||
return fsFsRenameDirectory(std::addressof(m_base_fs), old_sf_path.str, new_sf_path.str);
|
||||
R_RETURN(fsFsRenameDirectory(std::addressof(m_base_fs), old_sf_path.str, new_sf_path.str));
|
||||
}
|
||||
|
||||
virtual Result DoGetEntryType(DirectoryEntryType *out, const fs::Path &path) override final {
|
||||
|
@ -167,7 +167,7 @@ namespace ams::fs {
|
|||
R_TRY(GetPathForServiceObject(std::addressof(sf_path), path));
|
||||
|
||||
static_assert(sizeof(::FsDirEntryType) == sizeof(DirectoryEntryType));
|
||||
return fsFsGetEntryType(std::addressof(m_base_fs), sf_path.str, reinterpret_cast<::FsDirEntryType *>(out));
|
||||
R_RETURN(fsFsGetEntryType(std::addressof(m_base_fs), sf_path.str, reinterpret_cast<::FsDirEntryType *>(out)));
|
||||
}
|
||||
|
||||
virtual Result DoOpenFile(std::unique_ptr<fsa::IFile> *out_file, const fs::Path &path, OpenMode mode) override final {
|
||||
|
@ -199,38 +199,38 @@ namespace ams::fs {
|
|||
}
|
||||
|
||||
virtual Result DoCommit() override final {
|
||||
return fsFsCommit(std::addressof(m_base_fs));
|
||||
R_RETURN(fsFsCommit(std::addressof(m_base_fs)));
|
||||
}
|
||||
|
||||
virtual Result DoGetFreeSpaceSize(s64 *out, const fs::Path &path) override final {
|
||||
fssrv::sf::Path sf_path;
|
||||
R_TRY(GetPathForServiceObject(std::addressof(sf_path), path));
|
||||
return fsFsGetFreeSpace(std::addressof(m_base_fs), sf_path.str, out);
|
||||
R_RETURN(fsFsGetFreeSpace(std::addressof(m_base_fs), sf_path.str, out));
|
||||
}
|
||||
|
||||
virtual Result DoGetTotalSpaceSize(s64 *out, const fs::Path &path) override final {
|
||||
fssrv::sf::Path sf_path;
|
||||
R_TRY(GetPathForServiceObject(std::addressof(sf_path), path));
|
||||
return fsFsGetTotalSpace(std::addressof(m_base_fs), sf_path.str, out);
|
||||
R_RETURN(fsFsGetTotalSpace(std::addressof(m_base_fs), sf_path.str, out));
|
||||
}
|
||||
|
||||
virtual Result DoCleanDirectoryRecursively(const fs::Path &path) override final {
|
||||
fssrv::sf::Path sf_path;
|
||||
R_TRY(GetPathForServiceObject(std::addressof(sf_path), path));
|
||||
return fsFsCleanDirectoryRecursively(std::addressof(m_base_fs), sf_path.str);
|
||||
R_RETURN(fsFsCleanDirectoryRecursively(std::addressof(m_base_fs), sf_path.str));
|
||||
}
|
||||
|
||||
virtual Result DoGetFileTimeStampRaw(FileTimeStampRaw *out, const fs::Path &path) override final {
|
||||
fssrv::sf::Path sf_path;
|
||||
R_TRY(GetPathForServiceObject(std::addressof(sf_path), path));
|
||||
static_assert(sizeof(FileTimeStampRaw) == sizeof(::FsTimeStampRaw));
|
||||
return fsFsGetFileTimeStampRaw(std::addressof(m_base_fs), sf_path.str, reinterpret_cast<::FsTimeStampRaw *>(out));
|
||||
R_RETURN(fsFsGetFileTimeStampRaw(std::addressof(m_base_fs), sf_path.str, reinterpret_cast<::FsTimeStampRaw *>(out)));
|
||||
}
|
||||
|
||||
virtual Result DoQueryEntry(char *dst, size_t dst_size, const char *src, size_t src_size, fsa::QueryId query, const fs::Path &path) override final {
|
||||
fssrv::sf::Path sf_path;
|
||||
R_TRY(GetPathForServiceObject(std::addressof(sf_path), path));
|
||||
return fsFsQueryEntry(std::addressof(m_base_fs), dst, dst_size, src, src_size, sf_path.str, static_cast<FsFileSystemQueryId>(query));
|
||||
R_RETURN(fsFsQueryEntry(std::addressof(m_base_fs), dst, dst_size, src, src_size, sf_path.str, static_cast<FsFileSystemQueryId>(query)));
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
|
|
@ -32,23 +32,23 @@ namespace ams::fs {
|
|||
virtual ~RemoteStorage() { fsStorageClose(std::addressof(m_base_storage)); }
|
||||
public:
|
||||
virtual Result Read(s64 offset, void *buffer, size_t size) override {
|
||||
return fsStorageRead(std::addressof(m_base_storage), offset, buffer, size);
|
||||
R_RETURN(fsStorageRead(std::addressof(m_base_storage), offset, buffer, size));
|
||||
};
|
||||
|
||||
virtual Result Write(s64 offset, const void *buffer, size_t size) override {
|
||||
return fsStorageWrite(std::addressof(m_base_storage), offset, buffer, size);
|
||||
R_RETURN(fsStorageWrite(std::addressof(m_base_storage), offset, buffer, size));
|
||||
};
|
||||
|
||||
virtual Result Flush() override {
|
||||
return fsStorageFlush(std::addressof(m_base_storage));
|
||||
R_RETURN(fsStorageFlush(std::addressof(m_base_storage)));
|
||||
};
|
||||
|
||||
virtual Result GetSize(s64 *out_size) override {
|
||||
return fsStorageGetSize(std::addressof(m_base_storage), out_size);
|
||||
R_RETURN(fsStorageGetSize(std::addressof(m_base_storage), out_size));
|
||||
};
|
||||
|
||||
virtual Result SetSize(s64 size) override {
|
||||
return fsStorageSetSize(std::addressof(m_base_storage), size);
|
||||
R_RETURN(fsStorageSetSize(std::addressof(m_base_storage), size));
|
||||
};
|
||||
|
||||
virtual Result OperateRange(void *dst, size_t dst_size, OperationId op_id, s64 offset, s64 size, const void *src, size_t src_size) override {
|
||||
|
|
|
@ -84,7 +84,7 @@ namespace ams::fs {
|
|||
/* Validate arguments and read. */
|
||||
R_UNLESS(buffer != nullptr, fs::ResultNullptrArgument());
|
||||
R_TRY(IStorage::CheckAccessRange(offset, size, m_size));
|
||||
return m_base_storage->Read(m_offset + offset, buffer, size);
|
||||
R_RETURN(m_base_storage->Read(m_offset + offset, buffer, size));
|
||||
}
|
||||
|
||||
virtual Result Write(s64 offset, const void *buffer, size_t size) override{
|
||||
|
@ -97,12 +97,12 @@ namespace ams::fs {
|
|||
/* Validate arguments and write. */
|
||||
R_UNLESS(buffer != nullptr, fs::ResultNullptrArgument());
|
||||
R_TRY(IStorage::CheckAccessRange(offset, size, m_size));
|
||||
return m_base_storage->Write(m_offset + offset, buffer, size);
|
||||
R_RETURN(m_base_storage->Write(m_offset + offset, buffer, size));
|
||||
}
|
||||
|
||||
virtual Result Flush() override {
|
||||
R_UNLESS(this->IsValid(), fs::ResultNotInitialized());
|
||||
return m_base_storage->Flush();
|
||||
R_RETURN(m_base_storage->Flush());
|
||||
}
|
||||
|
||||
virtual Result SetSize(s64 size) override {
|
||||
|
|
|
@ -135,28 +135,28 @@ namespace ams::fssrv::impl {
|
|||
virtual ~RemoteFile() { fsFileClose(std::addressof(m_base_file)); }
|
||||
public:
|
||||
Result Read(ams::sf::Out<s64> out, s64 offset, const ams::sf::OutNonSecureBuffer &buffer, s64 size, fs::ReadOption option) {
|
||||
return fsFileRead(std::addressof(m_base_file), offset, buffer.GetPointer(), size, option._value, reinterpret_cast<u64 *>(out.GetPointer()));
|
||||
R_RETURN(fsFileRead(std::addressof(m_base_file), offset, buffer.GetPointer(), size, option._value, reinterpret_cast<u64 *>(out.GetPointer())));
|
||||
}
|
||||
|
||||
Result Write(s64 offset, const ams::sf::InNonSecureBuffer &buffer, s64 size, fs::WriteOption option) {
|
||||
return fsFileWrite(std::addressof(m_base_file), offset, buffer.GetPointer(), size, option._value);
|
||||
R_RETURN(fsFileWrite(std::addressof(m_base_file), offset, buffer.GetPointer(), size, option._value));
|
||||
}
|
||||
|
||||
Result Flush(){
|
||||
return fsFileFlush(std::addressof(m_base_file));
|
||||
R_RETURN(fsFileFlush(std::addressof(m_base_file)));
|
||||
}
|
||||
|
||||
Result SetSize(s64 size) {
|
||||
return fsFileSetSize(std::addressof(m_base_file), size);
|
||||
R_RETURN(fsFileSetSize(std::addressof(m_base_file), size));
|
||||
}
|
||||
|
||||
Result GetSize(ams::sf::Out<s64> out) {
|
||||
return fsFileGetSize(std::addressof(m_base_file), out.GetPointer());
|
||||
R_RETURN(fsFileGetSize(std::addressof(m_base_file), out.GetPointer()));
|
||||
}
|
||||
|
||||
Result OperateRange(ams::sf::Out<fs::FileQueryRangeInfo> out, s32 op_id, s64 offset, s64 size) {
|
||||
static_assert(sizeof(::FsRangeInfo) == sizeof(fs::FileQueryRangeInfo));
|
||||
return fsFileOperateRange(std::addressof(m_base_file), static_cast<::FsOperationId>(op_id), offset, size, reinterpret_cast<::FsRangeInfo *>(out.GetPointer()));
|
||||
R_RETURN(fsFileOperateRange(std::addressof(m_base_file), static_cast<::FsOperationId>(op_id), offset, size, reinterpret_cast<::FsRangeInfo *>(out.GetPointer())));
|
||||
}
|
||||
|
||||
Result OperateRangeWithBuffer(const ams::sf::OutNonSecureBuffer &out_buf, const ams::sf::InNonSecureBuffer &in_buf, s32 op_id, s64 offset, s64 size) {
|
||||
|
@ -178,11 +178,11 @@ namespace ams::fssrv::impl {
|
|||
public:
|
||||
Result Read(ams::sf::Out<s64> out, const ams::sf::OutBuffer &out_entries) {
|
||||
static_assert(sizeof(::FsDirectoryEntry) == sizeof(fs::DirectoryEntry));
|
||||
return fsDirRead(std::addressof(m_base_dir), out.GetPointer(), out_entries.GetSize() / sizeof(fs::DirectoryEntry), reinterpret_cast<::FsDirectoryEntry *>(out_entries.GetPointer()));
|
||||
R_RETURN(fsDirRead(std::addressof(m_base_dir), out.GetPointer(), out_entries.GetSize() / sizeof(fs::DirectoryEntry), reinterpret_cast<::FsDirectoryEntry *>(out_entries.GetPointer())));
|
||||
}
|
||||
|
||||
Result GetEntryCount(ams::sf::Out<s64> out) {
|
||||
return fsDirGetEntryCount(std::addressof(m_base_dir), out.GetPointer());
|
||||
R_RETURN(fsDirGetEntryCount(std::addressof(m_base_dir), out.GetPointer()));
|
||||
}
|
||||
};
|
||||
static_assert(fssrv::sf::IsIDirectory<RemoteDirectory>);
|
||||
|
@ -199,61 +199,61 @@ namespace ams::fssrv::impl {
|
|||
public:
|
||||
/* Command API. */
|
||||
Result CreateFile(const fssrv::sf::Path &path, s64 size, s32 option) {
|
||||
return fsFsCreateFile(std::addressof(m_base_fs), path.str, size, option);
|
||||
R_RETURN(fsFsCreateFile(std::addressof(m_base_fs), path.str, size, option));
|
||||
}
|
||||
|
||||
Result DeleteFile(const fssrv::sf::Path &path) {
|
||||
return fsFsDeleteFile(std::addressof(m_base_fs), path.str);
|
||||
R_RETURN(fsFsDeleteFile(std::addressof(m_base_fs), path.str));
|
||||
}
|
||||
|
||||
Result CreateDirectory(const fssrv::sf::Path &path) {
|
||||
return fsFsCreateDirectory(std::addressof(m_base_fs), path.str);
|
||||
R_RETURN(fsFsCreateDirectory(std::addressof(m_base_fs), path.str));
|
||||
}
|
||||
|
||||
Result DeleteDirectory(const fssrv::sf::Path &path) {
|
||||
return fsFsDeleteDirectory(std::addressof(m_base_fs), path.str);
|
||||
R_RETURN(fsFsDeleteDirectory(std::addressof(m_base_fs), path.str));
|
||||
}
|
||||
|
||||
Result DeleteDirectoryRecursively(const fssrv::sf::Path &path) {
|
||||
return fsFsDeleteDirectoryRecursively(std::addressof(m_base_fs), path.str);
|
||||
R_RETURN(fsFsDeleteDirectoryRecursively(std::addressof(m_base_fs), path.str));
|
||||
}
|
||||
|
||||
Result RenameFile(const fssrv::sf::Path &old_path, const fssrv::sf::Path &new_path) {
|
||||
return fsFsRenameFile(std::addressof(m_base_fs), old_path.str, new_path.str);
|
||||
R_RETURN(fsFsRenameFile(std::addressof(m_base_fs), old_path.str, new_path.str));
|
||||
}
|
||||
|
||||
Result RenameDirectory(const fssrv::sf::Path &old_path, const fssrv::sf::Path &new_path) {
|
||||
return fsFsRenameDirectory(std::addressof(m_base_fs), old_path.str, new_path.str);
|
||||
R_RETURN(fsFsRenameDirectory(std::addressof(m_base_fs), old_path.str, new_path.str));
|
||||
}
|
||||
|
||||
Result GetEntryType(ams::sf::Out<u32> out, const fssrv::sf::Path &path) {
|
||||
static_assert(sizeof(::FsDirEntryType) == sizeof(u32));
|
||||
return fsFsGetEntryType(std::addressof(m_base_fs), path.str, reinterpret_cast<::FsDirEntryType *>(out.GetPointer()));
|
||||
R_RETURN(fsFsGetEntryType(std::addressof(m_base_fs), path.str, reinterpret_cast<::FsDirEntryType *>(out.GetPointer())));
|
||||
}
|
||||
|
||||
Result Commit() {
|
||||
return fsFsCommit(std::addressof(m_base_fs));
|
||||
R_RETURN(fsFsCommit(std::addressof(m_base_fs)));
|
||||
}
|
||||
|
||||
Result GetFreeSpaceSize(ams::sf::Out<s64> out, const fssrv::sf::Path &path) {
|
||||
return fsFsGetFreeSpace(std::addressof(m_base_fs), path.str, out.GetPointer());
|
||||
R_RETURN(fsFsGetFreeSpace(std::addressof(m_base_fs), path.str, out.GetPointer()));
|
||||
}
|
||||
|
||||
Result GetTotalSpaceSize(ams::sf::Out<s64> out, const fssrv::sf::Path &path) {
|
||||
return fsFsGetTotalSpace(std::addressof(m_base_fs), path.str, out.GetPointer());
|
||||
R_RETURN(fsFsGetTotalSpace(std::addressof(m_base_fs), path.str, out.GetPointer()));
|
||||
}
|
||||
|
||||
Result CleanDirectoryRecursively(const fssrv::sf::Path &path) {
|
||||
return fsFsCleanDirectoryRecursively(std::addressof(m_base_fs), path.str);
|
||||
R_RETURN(fsFsCleanDirectoryRecursively(std::addressof(m_base_fs), path.str));
|
||||
}
|
||||
|
||||
Result GetFileTimeStampRaw(ams::sf::Out<fs::FileTimeStampRaw> out, const fssrv::sf::Path &path) {
|
||||
static_assert(sizeof(fs::FileTimeStampRaw) == sizeof(::FsTimeStampRaw));
|
||||
return fsFsGetFileTimeStampRaw(std::addressof(m_base_fs), path.str, reinterpret_cast<::FsTimeStampRaw *>(out.GetPointer()));
|
||||
R_RETURN(fsFsGetFileTimeStampRaw(std::addressof(m_base_fs), path.str, reinterpret_cast<::FsTimeStampRaw *>(out.GetPointer())));
|
||||
}
|
||||
|
||||
Result QueryEntry(const ams::sf::OutBuffer &out_buf, const ams::sf::InBuffer &in_buf, s32 query_id, const fssrv::sf::Path &path) {
|
||||
return fsFsQueryEntry(std::addressof(m_base_fs), out_buf.GetPointer(), out_buf.GetSize(), in_buf.GetPointer(), in_buf.GetSize(), path.str, static_cast<FsFileSystemQueryId>(query_id));
|
||||
R_RETURN(fsFsQueryEntry(std::addressof(m_base_fs), out_buf.GetPointer(), out_buf.GetSize(), in_buf.GetPointer(), in_buf.GetSize(), path.str, static_cast<FsFileSystemQueryId>(query_id)));
|
||||
}
|
||||
|
||||
Result OpenFile(ams::sf::Out<ams::sf::SharedPointer<fssrv::sf::IFile>> out, const fssrv::sf::Path &path, u32 mode);
|
||||
|
|
|
@ -57,28 +57,28 @@ namespace ams::fssrv::impl {
|
|||
virtual ~RemoteStorage() { fsStorageClose(std::addressof(m_base_storage)); }
|
||||
public:
|
||||
Result Read(s64 offset, const ams::sf::OutNonSecureBuffer &buffer, s64 size) {
|
||||
return fsStorageRead(std::addressof(m_base_storage), offset, buffer.GetPointer(), size);
|
||||
R_RETURN(fsStorageRead(std::addressof(m_base_storage), offset, buffer.GetPointer(), size));
|
||||
}
|
||||
|
||||
Result Write(s64 offset, const ams::sf::InNonSecureBuffer &buffer, s64 size) {
|
||||
return fsStorageWrite(std::addressof(m_base_storage), offset, buffer.GetPointer(), size);
|
||||
R_RETURN(fsStorageWrite(std::addressof(m_base_storage), offset, buffer.GetPointer(), size));
|
||||
}
|
||||
|
||||
Result Flush(){
|
||||
return fsStorageFlush(std::addressof(m_base_storage));
|
||||
R_RETURN(fsStorageFlush(std::addressof(m_base_storage)));
|
||||
}
|
||||
|
||||
Result SetSize(s64 size) {
|
||||
return fsStorageSetSize(std::addressof(m_base_storage), size);
|
||||
R_RETURN(fsStorageSetSize(std::addressof(m_base_storage), size));
|
||||
}
|
||||
|
||||
Result GetSize(ams::sf::Out<s64> out) {
|
||||
return fsStorageGetSize(std::addressof(m_base_storage), out.GetPointer());
|
||||
R_RETURN(fsStorageGetSize(std::addressof(m_base_storage), out.GetPointer()));
|
||||
}
|
||||
|
||||
Result OperateRange(ams::sf::Out<fs::StorageQueryRangeInfo> out, s32 op_id, s64 offset, s64 size) {
|
||||
static_assert(sizeof(::FsRangeInfo) == sizeof(fs::StorageQueryRangeInfo));
|
||||
return fsStorageOperateRange(std::addressof(m_base_storage), static_cast<::FsOperationId>(op_id), offset, size, reinterpret_cast<::FsRangeInfo *>(out.GetPointer()));
|
||||
R_RETURN(fsStorageOperateRange(std::addressof(m_base_storage), static_cast<::FsOperationId>(op_id), offset, size, reinterpret_cast<::FsRangeInfo *>(out.GetPointer())));
|
||||
}
|
||||
};
|
||||
static_assert(fssrv::sf::IsIStorage<RemoteStorage>);
|
||||
|
|
|
@ -94,7 +94,7 @@ namespace ams::fssystem {
|
|||
Result Initialize(uintptr_t address, size_t size, size_t block_size, s32 order_max);
|
||||
|
||||
Result Initialize(uintptr_t address, size_t size, size_t block_size) {
|
||||
return this->Initialize(address, size, block_size, QueryOrderMax(size, block_size));
|
||||
R_RETURN(this->Initialize(address, size, block_size, QueryOrderMax(size, block_size)));
|
||||
}
|
||||
|
||||
Result Initialize(uintptr_t address, size_t size, size_t block_size, s32 order_max, void *work, size_t work_size) {
|
||||
|
@ -103,11 +103,11 @@ namespace ams::fssystem {
|
|||
|
||||
const auto aligned_work = util::AlignUp(reinterpret_cast<uintptr_t>(work), alignof(PageList));
|
||||
m_external_free_lists = reinterpret_cast<PageList *>(aligned_work);
|
||||
return this->Initialize(address, size, block_size, order_max);
|
||||
R_RETURN(this->Initialize(address, size, block_size, order_max));
|
||||
}
|
||||
|
||||
Result Initialize(uintptr_t address, size_t size, size_t block_size, void *work, size_t work_size) {
|
||||
return this->Initialize(address, size, block_size, QueryOrderMax(size, block_size), work, work_size);
|
||||
R_RETURN(this->Initialize(address, size, block_size, QueryOrderMax(size, block_size), work, work_size));
|
||||
}
|
||||
|
||||
void Finalize();
|
||||
|
|
|
@ -64,7 +64,7 @@ namespace ams::fssystem {
|
|||
R_TRY(this->GetSize(std::addressof(bs_size)));
|
||||
R_TRY(fs::IStorage::CheckAccessRange(offset, size, bs_size));
|
||||
|
||||
return AlignmentMatchingStorageImpl::Read(m_base_storage, work_buf, sizeof(work_buf), DataAlign, BufferAlign, offset, static_cast<char *>(buffer), size);
|
||||
R_RETURN(AlignmentMatchingStorageImpl::Read(m_base_storage, work_buf, sizeof(work_buf), DataAlign, BufferAlign, offset, static_cast<char *>(buffer), size));
|
||||
}
|
||||
|
||||
virtual Result Write(s64 offset, const void *buffer, size_t size) override {
|
||||
|
@ -82,16 +82,16 @@ namespace ams::fssystem {
|
|||
R_TRY(this->GetSize(std::addressof(bs_size)));
|
||||
R_TRY(fs::IStorage::CheckAccessRange(offset, size, bs_size));
|
||||
|
||||
return AlignmentMatchingStorageImpl::Write(m_base_storage, work_buf, sizeof(work_buf), DataAlign, BufferAlign, offset, static_cast<const char *>(buffer), size);
|
||||
R_RETURN(AlignmentMatchingStorageImpl::Write(m_base_storage, work_buf, sizeof(work_buf), DataAlign, BufferAlign, offset, static_cast<const char *>(buffer), size));
|
||||
}
|
||||
|
||||
virtual Result Flush() override {
|
||||
return m_base_storage->Flush();
|
||||
R_RETURN(m_base_storage->Flush());
|
||||
}
|
||||
|
||||
virtual Result SetSize(s64 size) override {
|
||||
ON_SCOPE_EXIT { m_is_base_storage_size_dirty = true; };
|
||||
return m_base_storage->SetSize(util::AlignUp(size, DataAlign));
|
||||
R_RETURN(m_base_storage->SetSize(util::AlignUp(size, DataAlign)));
|
||||
}
|
||||
|
||||
virtual Result GetSize(s64 *out) override {
|
||||
|
@ -111,7 +111,7 @@ 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 {
|
||||
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);
|
||||
|
@ -127,7 +127,7 @@ namespace ams::fssystem {
|
|||
const auto aligned_offset_end = util::AlignUp(offset + valid_size, DataAlign);
|
||||
const auto aligned_size = aligned_offset_end - aligned_offset;
|
||||
|
||||
return m_base_storage->OperateRange(dst, dst_size, op_id, aligned_offset, aligned_size, src, src_size);
|
||||
R_RETURN(m_base_storage->OperateRange(dst, dst_size, op_id, aligned_offset, aligned_size, src, src_size));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -166,7 +166,7 @@ namespace ams::fssystem {
|
|||
PooledBuffer pooled_buffer;
|
||||
pooled_buffer.AllocateParticularlyLarge(m_data_align, m_data_align);
|
||||
|
||||
return AlignmentMatchingStorageImpl::Read(m_base_storage, pooled_buffer.GetBuffer(), pooled_buffer.GetSize(), m_data_align, BufferAlign, offset, static_cast<char *>(buffer), size);
|
||||
R_RETURN(AlignmentMatchingStorageImpl::Read(m_base_storage, pooled_buffer.GetBuffer(), pooled_buffer.GetSize(), m_data_align, BufferAlign, offset, static_cast<char *>(buffer), size));
|
||||
}
|
||||
|
||||
virtual Result Write(s64 offset, const void *buffer, size_t size) override {
|
||||
|
@ -184,16 +184,16 @@ namespace ams::fssystem {
|
|||
PooledBuffer pooled_buffer;
|
||||
pooled_buffer.AllocateParticularlyLarge(m_data_align, m_data_align);
|
||||
|
||||
return AlignmentMatchingStorageImpl::Write(m_base_storage, pooled_buffer.GetBuffer(), pooled_buffer.GetSize(), m_data_align, BufferAlign, offset, static_cast<const char *>(buffer), size);
|
||||
R_RETURN(AlignmentMatchingStorageImpl::Write(m_base_storage, pooled_buffer.GetBuffer(), pooled_buffer.GetSize(), m_data_align, BufferAlign, offset, static_cast<const char *>(buffer), size));
|
||||
}
|
||||
|
||||
virtual Result Flush() override {
|
||||
return m_base_storage->Flush();
|
||||
R_RETURN(m_base_storage->Flush());
|
||||
}
|
||||
|
||||
virtual Result SetSize(s64 size) override {
|
||||
ON_SCOPE_EXIT { m_is_base_storage_size_dirty = true; };
|
||||
return m_base_storage->SetSize(util::AlignUp(size, m_data_align));
|
||||
R_RETURN(m_base_storage->SetSize(util::AlignUp(size, m_data_align)));
|
||||
}
|
||||
|
||||
virtual Result GetSize(s64 *out) override {
|
||||
|
@ -213,7 +213,7 @@ 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 {
|
||||
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);
|
||||
|
@ -229,7 +229,7 @@ namespace ams::fssystem {
|
|||
const auto aligned_offset_end = util::AlignUp(offset + valid_size, m_data_align);
|
||||
const auto aligned_size = aligned_offset_end - aligned_offset;
|
||||
|
||||
return m_base_storage->OperateRange(dst, dst_size, op_id, aligned_offset, aligned_size, src, src_size);
|
||||
R_RETURN(m_base_storage->OperateRange(dst, dst_size, op_id, aligned_offset, aligned_size, src, src_size));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -272,16 +272,16 @@ namespace ams::fssystem {
|
|||
|
||||
/* Allocate a pooled buffer. */
|
||||
PooledBuffer pooled_buffer(m_data_align, m_data_align);
|
||||
return AlignmentMatchingStorageImpl::Write(m_base_storage, pooled_buffer.GetBuffer(), pooled_buffer.GetSize(), m_data_align, BufferAlign, offset, static_cast<const char *>(buffer), size);
|
||||
R_RETURN(AlignmentMatchingStorageImpl::Write(m_base_storage, pooled_buffer.GetBuffer(), pooled_buffer.GetSize(), m_data_align, BufferAlign, offset, static_cast<const char *>(buffer), size));
|
||||
}
|
||||
|
||||
virtual Result Flush() override {
|
||||
return m_base_storage->Flush();
|
||||
R_RETURN(m_base_storage->Flush());
|
||||
}
|
||||
|
||||
virtual Result SetSize(s64 size) override {
|
||||
ON_SCOPE_EXIT { m_base_storage_size = -1; };
|
||||
return m_base_storage->SetSize(util::AlignUp(size, m_data_align));
|
||||
R_RETURN(m_base_storage->SetSize(util::AlignUp(size, m_data_align)));
|
||||
}
|
||||
|
||||
virtual Result GetSize(s64 *out) override {
|
||||
|
@ -300,7 +300,7 @@ 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 {
|
||||
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);
|
||||
|
@ -316,7 +316,7 @@ namespace ams::fssystem {
|
|||
const auto aligned_offset_end = util::AlignUp(offset + valid_size, m_data_align);
|
||||
const auto aligned_size = aligned_offset_end - aligned_offset;
|
||||
|
||||
return m_base_storage->OperateRange(dst, dst_size, op_id, aligned_offset, aligned_size, src, src_size);
|
||||
R_RETURN(m_base_storage->OperateRange(dst, dst_size, op_id, aligned_offset, aligned_size, src, src_size));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -26,11 +26,11 @@ namespace ams::fssystem {
|
|||
static Result Write(fs::IStorage *base_storage, char *work_buf, size_t work_buf_size, size_t data_alignment, size_t buffer_alignment, s64 offset, const char *buffer, size_t size);
|
||||
|
||||
static Result Read(std::shared_ptr<fs::IStorage> &base_storage, char *work_buf, size_t work_buf_size, size_t data_alignment, size_t buffer_alignment, s64 offset, char *buffer, size_t size) {
|
||||
return Read(base_storage.get(), work_buf, work_buf_size, data_alignment, buffer_alignment, offset, buffer, size);
|
||||
R_RETURN(Read(base_storage.get(), work_buf, work_buf_size, data_alignment, buffer_alignment, offset, buffer, size));
|
||||
}
|
||||
|
||||
static Result Write(std::shared_ptr<fs::IStorage> &base_storage, char *work_buf, size_t work_buf_size, size_t data_alignment, size_t buffer_alignment, s64 offset, const char *buffer, size_t size) {
|
||||
return Write(base_storage.get(), work_buf, work_buf_size, data_alignment, buffer_alignment, offset, buffer, size);
|
||||
R_RETURN(Write(base_storage.get(), work_buf, work_buf_size, data_alignment, buffer_alignment, offset, buffer, size));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -166,7 +166,7 @@ namespace ams::fssystem {
|
|||
std::memcpy(std::addressof(param.entry), m_entry, sizeof(EntryType));
|
||||
|
||||
/* Scan. */
|
||||
return m_tree->ScanContinuousReading<EntryType>(out_info, param);
|
||||
R_RETURN(m_tree->ScanContinuousReading<EntryType>(out_info, param));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -113,7 +113,7 @@ namespace ams::fssystem {
|
|||
bool IsInitialized() const { return m_table.IsInitialized(); }
|
||||
|
||||
Result Initialize(IAllocator *allocator, fs::SubStorage node_storage, fs::SubStorage entry_storage, s32 entry_count) {
|
||||
return m_table.Initialize(allocator, node_storage, entry_storage, NodeSize, sizeof(Entry), entry_count);
|
||||
R_RETURN(m_table.Initialize(allocator, node_storage, entry_storage, NodeSize, sizeof(Entry), entry_count));
|
||||
}
|
||||
|
||||
void SetStorage(s32 idx, fs::SubStorage storage) {
|
||||
|
|
|
@ -89,12 +89,12 @@ namespace ams::fssystem {
|
|||
template<impl::IterateDirectoryHandler OnEnterDir, impl::IterateDirectoryHandler OnExitDir, impl::IterateDirectoryHandler OnFile>
|
||||
Result IterateDirectoryRecursively(fs::fsa::IFileSystem *fs, const fs::Path &root_path, OnEnterDir on_enter_dir, OnExitDir on_exit_dir, OnFile on_file) {
|
||||
fs::DirectoryEntry dir_entry = {};
|
||||
return IterateDirectoryRecursively(fs, root_path, std::addressof(dir_entry), on_enter_dir, on_exit_dir, on_file);
|
||||
R_RETURN(IterateDirectoryRecursively(fs, root_path, std::addressof(dir_entry), on_enter_dir, on_exit_dir, on_file));
|
||||
}
|
||||
|
||||
template<impl::IterateDirectoryHandler OnEnterDir, impl::IterateDirectoryHandler OnExitDir, impl::IterateDirectoryHandler OnFile>
|
||||
Result IterateDirectoryRecursively(fs::fsa::IFileSystem *fs, OnEnterDir on_enter_dir, OnExitDir on_exit_dir, OnFile on_file) {
|
||||
return IterateDirectoryRecursively(fs, fs::MakeConstantPath("/"), on_enter_dir, on_exit_dir, on_file);
|
||||
R_RETURN(IterateDirectoryRecursively(fs, fs::MakeConstantPath("/"), on_enter_dir, on_exit_dir, on_file));
|
||||
}
|
||||
|
||||
/* TODO: Cleanup API */
|
||||
|
@ -103,13 +103,13 @@ namespace ams::fssystem {
|
|||
Result CopyFile(fs::fsa::IFileSystem *dst_fs, fs::fsa::IFileSystem *src_fs, const fs::Path &dst_path, const fs::Path &src_path, void *work_buf, size_t work_buf_size);
|
||||
|
||||
ALWAYS_INLINE Result CopyFile(fs::fsa::IFileSystem *fs, const fs::Path &dst_path, const fs::Path &src_path, void *work_buf, size_t work_buf_size) {
|
||||
return CopyFile(fs, fs, dst_path, src_path, work_buf, work_buf_size);
|
||||
R_RETURN(CopyFile(fs, fs, dst_path, src_path, work_buf, work_buf_size));
|
||||
}
|
||||
|
||||
Result CopyDirectoryRecursively(fs::fsa::IFileSystem *dst_fs, fs::fsa::IFileSystem *src_fs, const fs::Path &dst_path, const fs::Path &src_path, fs::DirectoryEntry *entry, void *work_buf, size_t work_buf_size);
|
||||
|
||||
ALWAYS_INLINE Result CopyDirectoryRecursively(fs::fsa::IFileSystem *fs, const fs::Path &dst_path, const fs::Path &src_path, fs::DirectoryEntry *entry, void *work_buf, size_t work_buf_size) {
|
||||
return CopyDirectoryRecursively(fs, fs, dst_path, src_path, entry, work_buf, work_buf_size);
|
||||
R_RETURN(CopyDirectoryRecursively(fs, fs, dst_path, src_path, entry, work_buf, work_buf_size));
|
||||
}
|
||||
|
||||
/* Semaphore adapter class. */
|
||||
|
@ -147,7 +147,7 @@ namespace ams::fssystem {
|
|||
}
|
||||
|
||||
ALWAYS_INLINE Result RetryToAvoidTargetLocked(auto f) {
|
||||
return RetryFinitelyForTargetLocked<2, 25>(f);
|
||||
R_RETURN((RetryFinitelyForTargetLocked<2, 25>(f)));
|
||||
}
|
||||
|
||||
void AddCounter(void *counter, size_t counter_size, u64 value);
|
||||
|
|
|
@ -227,11 +227,11 @@ namespace ams::kvdb {
|
|||
}
|
||||
|
||||
static Result DirectoryExists(bool *out, const char *path) {
|
||||
return Exists(out, path, fs::DirectoryEntryType_Directory);
|
||||
R_RETURN(Exists(out, path, fs::DirectoryEntryType_Directory));
|
||||
}
|
||||
|
||||
static Result FileExists(bool *out, const char *path) {
|
||||
return Exists(out, path, fs::DirectoryEntryType_File);
|
||||
R_RETURN(Exists(out, path, fs::DirectoryEntryType_File));
|
||||
}
|
||||
public:
|
||||
static Result CreateNewCache(const char *dir) {
|
||||
|
@ -298,18 +298,18 @@ namespace ams::kvdb {
|
|||
Result Get(size_t *out_size, void *out_value, size_t max_out_size, const Key &key) {
|
||||
/* Note that we accessed the key. */
|
||||
m_lru_list.Update(key);
|
||||
return m_kvs.Get(out_size, out_value, max_out_size, key);
|
||||
R_RETURN(m_kvs.Get(out_size, out_value, max_out_size, key));
|
||||
}
|
||||
|
||||
template<typename Value>
|
||||
Result Get(Value *out_value, const Key &key) {
|
||||
/* Note that we accessed the key. */
|
||||
m_lru_list.Update(key);
|
||||
return m_kvs.Get(out_value, key);
|
||||
R_RETURN(m_kvs.Get(out_value, key));
|
||||
}
|
||||
|
||||
Result GetSize(size_t *out_size, const Key &key) {
|
||||
return m_kvs.GetSize(out_size, key);
|
||||
R_RETURN(m_kvs.GetSize(out_size, key));
|
||||
}
|
||||
|
||||
Result Set(const Key &key, const void *value, size_t value_size) {
|
||||
|
@ -356,7 +356,7 @@ namespace ams::kvdb {
|
|||
|
||||
template<typename Value>
|
||||
Result Set(const Key &key, const Value &value) {
|
||||
return this->Set(key, &value, sizeof(Value));
|
||||
R_RETURN(this->Set(key, &value, sizeof(Value)));
|
||||
}
|
||||
|
||||
Result Remove(const Key &key) {
|
||||
|
|
|
@ -84,7 +84,7 @@ namespace ams::kvdb {
|
|||
template<typename Key>
|
||||
Result Get(size_t *out_size, void *out_value, size_t max_out_size, const Key &key) {
|
||||
static_assert(util::is_pod<Key>::value && sizeof(Key) <= MaxKeySize, "Invalid FileKeyValueStore Key!");
|
||||
return this->Get(out_size, out_value, max_out_size, std::addressof(key), sizeof(Key));
|
||||
R_RETURN(this->Get(out_size, out_value, max_out_size, std::addressof(key), sizeof(Key)));
|
||||
}
|
||||
|
||||
template<typename Key, typename Value>
|
||||
|
@ -98,24 +98,24 @@ namespace ams::kvdb {
|
|||
|
||||
template<typename Key>
|
||||
Result GetSize(size_t *out_size, const Key &key) {
|
||||
return this->GetSize(out_size, std::addressof(key), sizeof(Key));
|
||||
R_RETURN(this->GetSize(out_size, std::addressof(key), sizeof(Key)));
|
||||
}
|
||||
|
||||
template<typename Key>
|
||||
Result Set(const Key &key, const void *value, size_t value_size) {
|
||||
static_assert(util::is_pod<Key>::value && sizeof(Key) <= MaxKeySize, "Invalid FileKeyValueStore Key!");
|
||||
return this->Set(std::addressof(key), sizeof(Key), value, value_size);
|
||||
R_RETURN(this->Set(std::addressof(key), sizeof(Key), value, value_size));
|
||||
}
|
||||
|
||||
template<typename Key, typename Value>
|
||||
Result Set(const Key &key, const Value &value) {
|
||||
static_assert(util::is_pod<Value>::value && !std::is_pointer<Value>::value, "Invalid FileKeyValueStore Value!");
|
||||
return this->Set(key, std::addressof(value), sizeof(Value));
|
||||
R_RETURN(this->Set(key, std::addressof(value), sizeof(Value)));
|
||||
}
|
||||
|
||||
template<typename Key>
|
||||
Result Remove(const Key &key) {
|
||||
return this->Remove(std::addressof(key), sizeof(Key));
|
||||
R_RETURN(this->Remove(std::addressof(key), sizeof(Key)));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -355,25 +355,25 @@ namespace ams::kvdb {
|
|||
}
|
||||
|
||||
/* Save the buffer to disk. */
|
||||
return this->Commit(buffer, destructive);
|
||||
R_RETURN(this->Commit(buffer, destructive));
|
||||
}
|
||||
|
||||
Result Set(const Key &key, const void *value, size_t value_size) {
|
||||
return m_index.Set(key, value, value_size);
|
||||
R_RETURN(m_index.Set(key, value, value_size));
|
||||
}
|
||||
|
||||
template<typename Value>
|
||||
Result Set(const Key &key, const Value &value) {
|
||||
/* Only allow setting pod. */
|
||||
static_assert(util::is_pod<Value>::value, "KeyValueStore Values must be pod");
|
||||
return this->Set(key, std::addressof(value), sizeof(Value));
|
||||
R_RETURN(this->Set(key, std::addressof(value), sizeof(Value)));
|
||||
}
|
||||
|
||||
template<typename Value>
|
||||
Result Set(const Key &key, const Value *value) {
|
||||
/* Only allow setting pod. */
|
||||
static_assert(util::is_pod<Value>::value, "KeyValueStore Values must be pod");
|
||||
return this->Set(key, value, sizeof(Value));
|
||||
R_RETURN(this->Set(key, value, sizeof(Value)));
|
||||
}
|
||||
|
||||
Result Get(size_t *out_size, void *out_value, size_t max_out_size, const Key &key) {
|
||||
|
@ -427,7 +427,7 @@ namespace ams::kvdb {
|
|||
}
|
||||
|
||||
Result Remove(const Key &key) {
|
||||
return m_index.Remove(key);
|
||||
R_RETURN(m_index.Remove(key));
|
||||
}
|
||||
|
||||
Entry *begin() {
|
||||
|
|
|
@ -44,31 +44,31 @@ namespace ams::lr {
|
|||
/* Actual commands. */
|
||||
Result ResolveAddOnContentPath(Path *out, ncm::DataId id) {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->ResolveAddOnContentPath(out, id);
|
||||
R_RETURN(m_interface->ResolveAddOnContentPath(out, id));
|
||||
}
|
||||
|
||||
Result RegisterAddOnContentStorage(ncm::DataId id, ncm::ApplicationId application_id, ncm::StorageId storage_id) {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
if (hos::GetVersion() >= hos::Version_9_0_0) {
|
||||
return m_interface->RegisterAddOnContentStorage(id, application_id, storage_id);
|
||||
R_RETURN(m_interface->RegisterAddOnContentStorage(id, application_id, storage_id));
|
||||
} else {
|
||||
return m_interface->RegisterAddOnContentStorageDeprecated(id, storage_id);
|
||||
R_RETURN(m_interface->RegisterAddOnContentStorageDeprecated(id, storage_id));
|
||||
}
|
||||
}
|
||||
|
||||
Result UnregisterAllAddOnContentPath() {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->UnregisterAllAddOnContentPath();
|
||||
R_RETURN(m_interface->UnregisterAllAddOnContentPath());
|
||||
}
|
||||
|
||||
Result RefreshApplicationAddOnContent(const ncm::ApplicationId *ids, size_t num_ids) {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->RefreshApplicationAddOnContent(sf::InArray<ncm::ApplicationId>(ids, num_ids));
|
||||
R_RETURN(m_interface->RefreshApplicationAddOnContent(sf::InArray<ncm::ApplicationId>(ids, num_ids)));
|
||||
}
|
||||
|
||||
Result UnregisterApplicationAddOnContent(ncm::ApplicationId id) {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->UnregisterApplicationAddOnContent(id);
|
||||
R_RETURN(m_interface->UnregisterApplicationAddOnContent(id));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ namespace ams::lr {
|
|||
public:
|
||||
Result ResolveProgramPath(Path *out, ncm::ProgramId id) {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->ResolveProgramPath(out, id);
|
||||
R_RETURN(m_interface->ResolveProgramPath(out, id));
|
||||
}
|
||||
|
||||
void RedirectProgramPath(const Path &path, ncm::ProgramId id) {
|
||||
|
@ -53,17 +53,17 @@ namespace ams::lr {
|
|||
|
||||
Result ResolveApplicationControlPath(Path *out, ncm::ProgramId id) {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->ResolveApplicationControlPath(out, id);
|
||||
R_RETURN(m_interface->ResolveApplicationControlPath(out, id));
|
||||
}
|
||||
|
||||
Result ResolveApplicationHtmlDocumentPath(Path *out, ncm::ProgramId id) {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->ResolveApplicationHtmlDocumentPath(out, id);
|
||||
R_RETURN(m_interface->ResolveApplicationHtmlDocumentPath(out, id));
|
||||
}
|
||||
|
||||
Result ResolveDataPath(Path *out, ncm::DataId id) {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->ResolveDataPath(out, id);
|
||||
R_RETURN(m_interface->ResolveDataPath(out, id));
|
||||
}
|
||||
|
||||
void RedirectApplicationControlPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id) {
|
||||
|
@ -86,7 +86,7 @@ namespace ams::lr {
|
|||
|
||||
Result ResolveApplicationLegalInformationPath(Path *out, ncm::ProgramId id) {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->ResolveApplicationLegalInformationPath(out, id);
|
||||
R_RETURN(m_interface->ResolveApplicationLegalInformationPath(out, id));
|
||||
}
|
||||
|
||||
void RedirectApplicationLegalInformationPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id) {
|
||||
|
@ -100,7 +100,7 @@ namespace ams::lr {
|
|||
|
||||
Result Refresh() {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->Refresh();
|
||||
R_RETURN(m_interface->Refresh());
|
||||
}
|
||||
|
||||
void RedirectApplicationProgramPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id) {
|
||||
|
@ -115,41 +115,41 @@ namespace ams::lr {
|
|||
Result ClearApplicationRedirection() {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
AMS_ASSERT(hos::GetVersion() < hos::Version_9_0_0);
|
||||
return this->ClearApplicationRedirection(nullptr, 0);
|
||||
R_RETURN(this->ClearApplicationRedirection(nullptr, 0));
|
||||
}
|
||||
|
||||
Result ClearApplicationRedirection(const ncm::ProgramId *excluding_ids, size_t num_ids) {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
if (hos::GetVersion() >= hos::Version_9_0_0) {
|
||||
return m_interface->ClearApplicationRedirection(sf::InArray<ncm::ProgramId>(excluding_ids, num_ids));
|
||||
R_RETURN(m_interface->ClearApplicationRedirection(sf::InArray<ncm::ProgramId>(excluding_ids, num_ids)));
|
||||
} else {
|
||||
return m_interface->ClearApplicationRedirectionDeprecated();
|
||||
R_RETURN(m_interface->ClearApplicationRedirectionDeprecated());
|
||||
}
|
||||
}
|
||||
|
||||
Result EraseProgramRedirection(ncm::ProgramId id) {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->EraseProgramRedirection(id);
|
||||
R_RETURN(m_interface->EraseProgramRedirection(id));
|
||||
}
|
||||
|
||||
Result EraseApplicationControlRedirection(ncm::ProgramId id) {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->EraseApplicationControlRedirection(id);
|
||||
R_RETURN(m_interface->EraseApplicationControlRedirection(id));
|
||||
}
|
||||
|
||||
Result EraseApplicationHtmlDocumentRedirection(ncm::ProgramId id) {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->EraseApplicationHtmlDocumentRedirection(id);
|
||||
R_RETURN(m_interface->EraseApplicationHtmlDocumentRedirection(id));
|
||||
}
|
||||
|
||||
Result EraseApplicationLegalInformationRedirection(ncm::ProgramId id) {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->EraseApplicationLegalInformationRedirection(id);
|
||||
R_RETURN(m_interface->EraseApplicationLegalInformationRedirection(id));
|
||||
}
|
||||
|
||||
Result ResolveProgramPathForDebug(Path *out, ncm::ProgramId id) {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->ResolveProgramPathForDebug(out, id);
|
||||
R_RETURN(m_interface->ResolveProgramPathForDebug(out, id));
|
||||
}
|
||||
|
||||
void RedirectProgramPathForDebug(const Path &path, ncm::ProgramId id) {
|
||||
|
@ -168,7 +168,7 @@ namespace ams::lr {
|
|||
|
||||
Result EraseProgramRedirectionForDebug(ncm::ProgramId id) {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->EraseProgramRedirectionForDebug(id);
|
||||
R_RETURN(m_interface->EraseProgramRedirectionForDebug(id));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -44,21 +44,21 @@ namespace ams::lr {
|
|||
/* Actual commands. */
|
||||
Result ResolveProgramPath(Path *out, ncm::ProgramId id) {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->ResolveProgramPath(out, id);
|
||||
R_RETURN(m_interface->ResolveProgramPath(out, id));
|
||||
}
|
||||
|
||||
Result RegisterProgramPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id) {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
if (hos::GetVersion() >= hos::Version_9_0_0) {
|
||||
return m_interface->RegisterProgramPath(path, id, owner_id);
|
||||
R_RETURN(m_interface->RegisterProgramPath(path, id, owner_id));
|
||||
} else {
|
||||
return m_interface->RegisterProgramPathDeprecated(path, id);
|
||||
R_RETURN(m_interface->RegisterProgramPathDeprecated(path, id));
|
||||
}
|
||||
}
|
||||
|
||||
Result UnregisterProgramPath(ncm::ProgramId id) {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->UnregisterProgramPath(id);
|
||||
R_RETURN(m_interface->UnregisterProgramPath(id));
|
||||
}
|
||||
|
||||
void RedirectProgramPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id) {
|
||||
|
@ -72,21 +72,21 @@ namespace ams::lr {
|
|||
|
||||
Result ResolveHtmlDocumentPath(Path *out, ncm::ProgramId id) {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->ResolveHtmlDocumentPath(out, id);
|
||||
R_RETURN(m_interface->ResolveHtmlDocumentPath(out, id));
|
||||
}
|
||||
|
||||
Result RegisterHtmlDocumentPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id) {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
if (hos::GetVersion() >= hos::Version_9_0_0) {
|
||||
return m_interface->RegisterHtmlDocumentPath(path, id, owner_id);
|
||||
R_RETURN(m_interface->RegisterHtmlDocumentPath(path, id, owner_id));
|
||||
} else {
|
||||
return m_interface->RegisterHtmlDocumentPathDeprecated(path, id);
|
||||
R_RETURN(m_interface->RegisterHtmlDocumentPathDeprecated(path, id));
|
||||
}
|
||||
}
|
||||
|
||||
Result UnregisterHtmlDocumentPath(ncm::ProgramId id) {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->UnregisterHtmlDocumentPath(id);
|
||||
R_RETURN(m_interface->UnregisterHtmlDocumentPath(id));
|
||||
}
|
||||
|
||||
void RedirectHtmlDocumentPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id) {
|
||||
|
@ -100,12 +100,12 @@ namespace ams::lr {
|
|||
|
||||
Result Refresh() {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->Refresh();
|
||||
R_RETURN(m_interface->Refresh());
|
||||
}
|
||||
|
||||
Result RefreshExcluding(const ncm::ProgramId *excluding_ids, size_t num_ids) {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->RefreshExcluding(sf::InArray<ncm::ProgramId>(excluding_ids, num_ids));
|
||||
R_RETURN(m_interface->RefreshExcluding(sf::InArray<ncm::ProgramId>(excluding_ids, num_ids)));
|
||||
}
|
||||
|
||||
};
|
||||
|
|
|
@ -46,7 +46,7 @@ namespace ams::ncm {
|
|||
public:
|
||||
Result Set(const ContentMetaKey &key, const void *buf, size_t size) {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->Set(key, sf::InBuffer(buf, size));
|
||||
R_RETURN(m_interface->Set(key, sf::InBuffer(buf, size)));
|
||||
}
|
||||
|
||||
Result Get(size_t *out_size, void *dst, size_t dst_size, const ContentMetaKey &key) {
|
||||
|
@ -58,15 +58,15 @@ namespace ams::ncm {
|
|||
R_SUCCEED();
|
||||
}
|
||||
|
||||
#define AMS_NCM_DEFINE_GETTERS(Kind, IdType) \
|
||||
Result Get##Kind(ContentId *out, IdType##Id id, u32 version) { \
|
||||
return m_interface->GetContentIdByType(out, ContentMetaKey::MakeUnknownType(id.value, version), ContentType::Kind); \
|
||||
} \
|
||||
\
|
||||
Result GetLatest##Kind(ContentId *out, IdType##Id id) { \
|
||||
ContentMetaKey latest_key; \
|
||||
R_TRY(m_interface->GetLatestContentMetaKey(std::addressof(latest_key), id.value)); \
|
||||
return m_interface->GetContentIdByType(out, latest_key, ContentType::Kind); \
|
||||
#define AMS_NCM_DEFINE_GETTERS(Kind, IdType) \
|
||||
Result Get##Kind(ContentId *out, IdType##Id id, u32 version) { \
|
||||
R_RETURN(m_interface->GetContentIdByType(out, ContentMetaKey::MakeUnknownType(id.value, version), ContentType::Kind)); \
|
||||
} \
|
||||
\
|
||||
Result GetLatest##Kind(ContentId *out, IdType##Id id) { \
|
||||
ContentMetaKey latest_key; \
|
||||
R_TRY(m_interface->GetLatestContentMetaKey(std::addressof(latest_key), id.value)); \
|
||||
R_RETURN(m_interface->GetContentIdByType(out, latest_key, ContentType::Kind)); \
|
||||
}
|
||||
|
||||
AMS_NCM_DEFINE_GETTERS(Program, Program)
|
||||
|
@ -79,29 +79,29 @@ namespace ams::ncm {
|
|||
|
||||
Result Remove(const ContentMetaKey &key) {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->Remove(key);
|
||||
R_RETURN(m_interface->Remove(key));
|
||||
}
|
||||
|
||||
Result Remove(SystemProgramId id, u32 version) {
|
||||
return this->Remove(ContentMetaKey::Make(id, version));
|
||||
R_RETURN(this->Remove(ContentMetaKey::Make(id, version)));
|
||||
}
|
||||
|
||||
Result Remove(SystemDataId id, u32 version) {
|
||||
return this->Remove(ContentMetaKey::Make(id, version));
|
||||
R_RETURN(this->Remove(ContentMetaKey::Make(id, version)));
|
||||
}
|
||||
|
||||
Result Remove(ApplicationId id, u32 version) {
|
||||
return this->Remove(ContentMetaKey::Make(id, version));
|
||||
R_RETURN(this->Remove(ContentMetaKey::Make(id, version)));
|
||||
}
|
||||
|
||||
Result GetContentIdByType(ContentId *out_content_id, const ContentMetaKey &key, ContentType type) {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->GetContentIdByType(out_content_id, key, type);
|
||||
R_RETURN(m_interface->GetContentIdByType(out_content_id, key, type));
|
||||
}
|
||||
|
||||
Result GetContentIdByTypeAndIdOffset(ContentId *out_content_id, const ContentMetaKey &key, ContentType type, u8 id_offset) {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->GetContentIdByTypeAndIdOffset(out_content_id, key, type, id_offset);
|
||||
R_RETURN(m_interface->GetContentIdByTypeAndIdOffset(out_content_id, key, type, id_offset));
|
||||
}
|
||||
|
||||
ListCount ListApplication(ApplicationContentMetaKey *dst, size_t dst_size) {
|
||||
|
@ -118,32 +118,32 @@ namespace ams::ncm {
|
|||
|
||||
Result GetLatest(ContentMetaKey *out_key, u64 id) {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->GetLatestContentMetaKey(out_key, id);
|
||||
R_RETURN(m_interface->GetLatestContentMetaKey(out_key, id));
|
||||
}
|
||||
|
||||
Result ListContentInfo(s32 *out_count, ContentInfo *dst, size_t dst_size, const ContentMetaKey &key, s32 offset) {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->ListContentInfo(out_count, sf::OutArray<ContentInfo>(dst, dst_size), key, offset);
|
||||
R_RETURN(m_interface->ListContentInfo(out_count, sf::OutArray<ContentInfo>(dst, dst_size), key, offset));
|
||||
}
|
||||
|
||||
Result ListContentMetaInfo(s32 *out_count, ContentMetaInfo *dst, size_t dst_size, const ContentMetaKey &key, s32 offset) {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->ListContentMetaInfo(out_count, sf::OutArray<ContentMetaInfo>(dst, dst_size), key, offset);
|
||||
R_RETURN(m_interface->ListContentMetaInfo(out_count, sf::OutArray<ContentMetaInfo>(dst, dst_size), key, offset));
|
||||
}
|
||||
|
||||
Result Has(bool *out, const ContentMetaKey &key) {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->Has(out, key);
|
||||
R_RETURN(m_interface->Has(out, key));
|
||||
}
|
||||
|
||||
Result HasAll(bool *out, const ContentMetaKey *keys, size_t num_keys) {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->HasAll(out, sf::InArray<ContentMetaKey>(keys, num_keys));
|
||||
R_RETURN(m_interface->HasAll(out, sf::InArray<ContentMetaKey>(keys, num_keys)));
|
||||
}
|
||||
|
||||
Result HasContent(bool *out, const ContentMetaKey &key, const ContentId &content_id) {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->HasContent(out, key, content_id);
|
||||
R_RETURN(m_interface->HasContent(out, key, content_id));
|
||||
}
|
||||
|
||||
Result GetSize(size_t *out_size, const ContentMetaKey &key) {
|
||||
|
@ -157,37 +157,37 @@ namespace ams::ncm {
|
|||
|
||||
Result GetRequiredSystemVersion(u32 *out_version, const ContentMetaKey &key) {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->GetRequiredSystemVersion(out_version, key);
|
||||
R_RETURN(m_interface->GetRequiredSystemVersion(out_version, key));
|
||||
}
|
||||
|
||||
Result GetPatchId(PatchId *out_patch_id, const ContentMetaKey &key) {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->GetPatchId(out_patch_id, key);
|
||||
R_RETURN(m_interface->GetPatchId(out_patch_id, key));
|
||||
}
|
||||
|
||||
Result DisableForcibly() {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->DisableForcibly();
|
||||
R_RETURN(m_interface->DisableForcibly());
|
||||
}
|
||||
|
||||
Result LookupOrphanContent(bool *out_orphaned, ContentId *content_list, size_t count) {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->LookupOrphanContent(sf::OutArray<bool>(out_orphaned, count), sf::InArray<ContentId>(content_list, count));
|
||||
R_RETURN(m_interface->LookupOrphanContent(sf::OutArray<bool>(out_orphaned, count), sf::InArray<ContentId>(content_list, count)));
|
||||
}
|
||||
|
||||
Result Commit() {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->Commit();
|
||||
R_RETURN(m_interface->Commit());
|
||||
}
|
||||
|
||||
Result GetAttributes(u8 *out_attributes, const ContentMetaKey &key) {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->GetAttributes(out_attributes, key);
|
||||
R_RETURN(m_interface->GetAttributes(out_attributes, key));
|
||||
}
|
||||
|
||||
Result GetRequiredApplicationVersion(u32 *out_version, const ContentMetaKey &key) {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->GetRequiredApplicationVersion(out_version, key);
|
||||
R_RETURN(m_interface->GetRequiredApplicationVersion(out_version, key));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -520,8 +520,8 @@ namespace ams::ncm {
|
|||
public:
|
||||
using AccessorBase::AccessorBase;
|
||||
public:
|
||||
Result GetHeader(ReadableStructPin<PatchMetaExtendedDataHeader> *out) { return this->AcquireReadableStructPin(out, 0); }
|
||||
Result GetHeader(PatchMetaExtendedDataHeader *out) { return this->template ReadStruct<PatchMetaExtendedDataHeader>(out, 0); }
|
||||
Result GetHeader(ReadableStructPin<PatchMetaExtendedDataHeader> *out) { R_RETURN(this->AcquireReadableStructPin(out, 0)); }
|
||||
Result GetHeader(PatchMetaExtendedDataHeader *out) { R_RETURN(this->template ReadStruct<PatchMetaExtendedDataHeader>(out, 0)); }
|
||||
|
||||
Result GetHistoryHeader(ReadableStructPin<PatchHistoryHeader> *out, s32 index) {
|
||||
/* Ensure we have our header. */
|
||||
|
|
|
@ -49,37 +49,37 @@ namespace ams::ncm {
|
|||
|
||||
Result CreatePlaceHolder(PlaceHolderId placeholder_id, ContentId content_id, s64 size) {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->CreatePlaceHolder(placeholder_id, content_id, size);
|
||||
R_RETURN(m_interface->CreatePlaceHolder(placeholder_id, content_id, size));
|
||||
}
|
||||
|
||||
Result DeletePlaceHolder(PlaceHolderId placeholder_id) {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->DeletePlaceHolder(placeholder_id);
|
||||
R_RETURN(m_interface->DeletePlaceHolder(placeholder_id));
|
||||
}
|
||||
|
||||
Result HasPlaceHolder(bool *out, PlaceHolderId placeholder_id) {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->HasPlaceHolder(out, placeholder_id);
|
||||
R_RETURN(m_interface->HasPlaceHolder(out, placeholder_id));
|
||||
}
|
||||
|
||||
Result WritePlaceHolder(PlaceHolderId placeholder_id, s64 offset, const void *buf, size_t size) {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->WritePlaceHolder(placeholder_id, offset, sf::InBuffer(buf, size));
|
||||
R_RETURN(m_interface->WritePlaceHolder(placeholder_id, offset, sf::InBuffer(buf, size)));
|
||||
}
|
||||
|
||||
Result Register(PlaceHolderId placeholder_id, ContentId content_id) {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->Register(placeholder_id, content_id);
|
||||
R_RETURN(m_interface->Register(placeholder_id, content_id));
|
||||
}
|
||||
|
||||
Result Delete(ContentId content_id) {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->Delete(content_id);
|
||||
R_RETURN(m_interface->Delete(content_id));
|
||||
}
|
||||
|
||||
Result Has(bool *out, ContentId content_id) {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->Has(out, content_id);
|
||||
R_RETURN(m_interface->Has(out, content_id));
|
||||
}
|
||||
|
||||
void GetPath(Path *out, ContentId content_id) {
|
||||
|
@ -94,52 +94,52 @@ namespace ams::ncm {
|
|||
|
||||
Result CleanupAllPlaceHolder() {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->CleanupAllPlaceHolder();
|
||||
R_RETURN(m_interface->CleanupAllPlaceHolder());
|
||||
}
|
||||
|
||||
Result ListPlaceHolder(s32 *out_count, PlaceHolderId *out_list, size_t out_list_size) {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->ListPlaceHolder(out_count, sf::OutArray<PlaceHolderId>(out_list, out_list_size));
|
||||
R_RETURN(m_interface->ListPlaceHolder(out_count, sf::OutArray<PlaceHolderId>(out_list, out_list_size)));
|
||||
}
|
||||
|
||||
Result GetContentCount(s32 *out_count) {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->GetContentCount(out_count);
|
||||
R_RETURN(m_interface->GetContentCount(out_count));
|
||||
}
|
||||
|
||||
Result ListContentId(s32 *out_count, ContentId *out_list, size_t out_list_size, s32 offset) {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->ListContentId(out_count, sf::OutArray<ContentId>(out_list, out_list_size), offset);
|
||||
R_RETURN(m_interface->ListContentId(out_count, sf::OutArray<ContentId>(out_list, out_list_size), offset));
|
||||
}
|
||||
|
||||
Result GetSize(s64 *out_size, ContentId content_id) {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->GetSizeFromContentId(out_size, content_id);
|
||||
R_RETURN(m_interface->GetSizeFromContentId(out_size, content_id));
|
||||
}
|
||||
|
||||
Result GetSize(s64 *out_size, PlaceHolderId placeholder_id) {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->GetSizeFromPlaceHolderId(out_size, placeholder_id);
|
||||
R_RETURN(m_interface->GetSizeFromPlaceHolderId(out_size, placeholder_id));
|
||||
}
|
||||
|
||||
Result DisableForcibly() {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->DisableForcibly();
|
||||
R_RETURN(m_interface->DisableForcibly());
|
||||
}
|
||||
|
||||
Result RevertToPlaceHolder(PlaceHolderId placeholder_id, ContentId old_content_id, ContentId new_content_id) {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->RevertToPlaceHolder(placeholder_id, old_content_id, new_content_id);
|
||||
R_RETURN(m_interface->RevertToPlaceHolder(placeholder_id, old_content_id, new_content_id));
|
||||
}
|
||||
|
||||
Result SetPlaceHolderSize(PlaceHolderId placeholder_id, s64 size) {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->SetPlaceHolderSize(placeholder_id, size);
|
||||
R_RETURN(m_interface->SetPlaceHolderSize(placeholder_id, size));
|
||||
}
|
||||
|
||||
Result ReadContentIdFile(void *dst, size_t size, ContentId content_id, s64 offset) {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->ReadContentIdFile(sf::OutBuffer(dst, size), content_id, offset);
|
||||
R_RETURN(m_interface->ReadContentIdFile(sf::OutBuffer(dst, size), content_id, offset));
|
||||
}
|
||||
|
||||
Result GetRightsId(ncm::RightsId *out_rights_id, PlaceHolderId placeholder_id) {
|
||||
|
@ -147,11 +147,11 @@ namespace ams::ncm {
|
|||
|
||||
const auto vers = hos::GetVersion();
|
||||
if (vers >= hos::Version_3_0_0) {
|
||||
return m_interface->GetRightsIdFromPlaceHolderId(out_rights_id, placeholder_id);
|
||||
R_RETURN(m_interface->GetRightsIdFromPlaceHolderId(out_rights_id, placeholder_id));
|
||||
} else {
|
||||
AMS_ABORT_UNLESS(vers >= hos::Version_2_0_0);
|
||||
*out_rights_id = {};
|
||||
return m_interface->GetRightsIdFromPlaceHolderIdDeprecated(std::addressof(out_rights_id->id), placeholder_id);
|
||||
R_RETURN(m_interface->GetRightsIdFromPlaceHolderIdDeprecated(std::addressof(out_rights_id->id), placeholder_id));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -160,42 +160,42 @@ namespace ams::ncm {
|
|||
|
||||
const auto vers = hos::GetVersion();
|
||||
if (vers >= hos::Version_3_0_0) {
|
||||
return m_interface->GetRightsIdFromContentId(out_rights_id, content_id);
|
||||
R_RETURN(m_interface->GetRightsIdFromContentId(out_rights_id, content_id));
|
||||
} else {
|
||||
AMS_ABORT_UNLESS(vers >= hos::Version_2_0_0);
|
||||
*out_rights_id = {};
|
||||
return m_interface->GetRightsIdFromContentIdDeprecated(std::addressof(out_rights_id->id), content_id);
|
||||
R_RETURN(m_interface->GetRightsIdFromContentIdDeprecated(std::addressof(out_rights_id->id), content_id));
|
||||
}
|
||||
}
|
||||
|
||||
Result WriteContentForDebug(ContentId content_id, s64 offset, const void *buf, size_t size) {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->WriteContentForDebug(content_id, offset, sf::InBuffer(buf, size));
|
||||
R_RETURN(m_interface->WriteContentForDebug(content_id, offset, sf::InBuffer(buf, size)));
|
||||
}
|
||||
|
||||
Result GetFreeSpaceSize(s64 *out_size) {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->GetFreeSpaceSize(out_size);
|
||||
R_RETURN(m_interface->GetFreeSpaceSize(out_size));
|
||||
}
|
||||
|
||||
Result GetTotalSpaceSize(s64 *out_size) {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->GetTotalSpaceSize(out_size);
|
||||
R_RETURN(m_interface->GetTotalSpaceSize(out_size));
|
||||
}
|
||||
|
||||
Result FlushPlaceHolder() {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->FlushPlaceHolder();
|
||||
R_RETURN(m_interface->FlushPlaceHolder());
|
||||
}
|
||||
|
||||
Result RepairInvalidFileAttribute() {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->RepairInvalidFileAttribute();
|
||||
R_RETURN(m_interface->RepairInvalidFileAttribute());
|
||||
}
|
||||
|
||||
Result GetRightsIdFromPlaceHolderIdWithCache(ncm::RightsId *out_rights_id, PlaceHolderId placeholder_id, ContentId cache_content_id) {
|
||||
AMS_ASSERT(m_interface != nullptr);
|
||||
return m_interface->GetRightsIdFromPlaceHolderIdWithCache(out_rights_id, placeholder_id, cache_content_id);
|
||||
R_RETURN(m_interface->GetRightsIdFromPlaceHolderIdWithCache(out_rights_id, placeholder_id, cache_content_id));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -99,7 +99,7 @@ namespace ams::ncm {
|
|||
if (R_FAILED(result)) {
|
||||
this->SetLastResult(result);
|
||||
}
|
||||
return result;
|
||||
R_RETURN(result);
|
||||
}
|
||||
public:
|
||||
InstallTaskBase() : m_data(), m_progress(), m_progress_mutex(), m_cancel_mutex(), m_cancel_requested(), m_throughput_mutex() { /* ... */ }
|
||||
|
@ -113,12 +113,12 @@ namespace ams::ncm {
|
|||
Result CalculateRequiredSize(s64 *out_size);
|
||||
Result Cleanup();
|
||||
Result ListContentMetaKey(s32 *out_keys_written, StorageContentMetaKey *out_keys, s32 out_keys_count, s32 offset, ListContentMetaKeyFilter filter);
|
||||
Result ListContentMetaKey(s32 *out_keys_written, StorageContentMetaKey *out_keys, s32 out_keys_count, s32 offset) { return this->ListContentMetaKey(out_keys_written, out_keys, out_keys_count, offset, ListContentMetaKeyFilter::All); }
|
||||
Result ListContentMetaKey(s32 *out_keys_written, StorageContentMetaKey *out_keys, s32 out_keys_count, s32 offset) { R_RETURN(this->ListContentMetaKey(out_keys_written, out_keys, out_keys_count, offset, ListContentMetaKeyFilter::All)); }
|
||||
Result ListApplicationContentMetaKey(s32 *out_keys_written, ApplicationContentMetaKey *out_keys, s32 out_keys_count, s32 offset);
|
||||
Result Execute();
|
||||
Result PrepareAndExecute();
|
||||
Result Commit(const StorageContentMetaKey *keys, s32 num_keys);
|
||||
Result Commit() { return this->Commit(nullptr, 0); }
|
||||
Result Commit() { R_RETURN(this->Commit(nullptr, 0)); }
|
||||
virtual InstallProgress GetProgress();
|
||||
void ResetLastResult();
|
||||
Result IncludesExFatDriver(bool *out);
|
||||
|
|
|
@ -60,7 +60,7 @@ namespace ams::os {
|
|||
}
|
||||
|
||||
Result Map(void **out, MemoryPermission perm) {
|
||||
return MapIoRegion(out, std::addressof(m_io_region), perm);
|
||||
R_RETURN(MapIoRegion(out, std::addressof(m_io_region), perm));
|
||||
}
|
||||
|
||||
void Unmap() {
|
||||
|
|
|
@ -55,7 +55,7 @@ namespace ams::os {
|
|||
}
|
||||
|
||||
Result Map(void **out, MemoryPermission owner_perm) {
|
||||
return MapTransferMemory(out, std::addressof(m_tmem), owner_perm);
|
||||
R_RETURN(MapTransferMemory(out, std::addressof(m_tmem), owner_perm));
|
||||
}
|
||||
|
||||
void Unmap() {
|
||||
|
|
|
@ -56,7 +56,7 @@ namespace ams::pgl {
|
|||
}
|
||||
|
||||
virtual Result GetProcessEventInfo(pm::ProcessEventInfo *out) override {
|
||||
return m_cmif_interface->GetProcessEventInfo(out);
|
||||
R_RETURN(m_cmif_interface->GetProcessEventInfo(out));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -78,7 +78,7 @@ namespace ams::pgl {
|
|||
}
|
||||
|
||||
virtual Result GetProcessEventInfo(pm::ProcessEventInfo *out) override {
|
||||
return m_tipc_interface.GetProcessEventInfo(ams::tipc::Out<pm::ProcessEventInfo>(out));
|
||||
R_RETURN(m_tipc_interface.GetProcessEventInfo(ams::tipc::Out<pm::ProcessEventInfo>(out)));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -113,11 +113,11 @@ namespace ams::pgl {
|
|||
}
|
||||
public:
|
||||
Result GetSystemEvent(os::SystemEventType *out) {
|
||||
return m_impl->GetSystemEvent(out);
|
||||
R_RETURN(m_impl->GetSystemEvent(out));
|
||||
}
|
||||
|
||||
Result GetProcessEventInfo(pm::ProcessEventInfo *out) {
|
||||
return m_impl->GetProcessEventInfo(out);
|
||||
R_RETURN(m_impl->GetProcessEventInfo(out));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ namespace ams::scs {
|
|||
Result LaunchProgram(os::ProcessId *out, const ncm::ProgramLocation &loc, const void *args, size_t args_size, u32 process_flags);
|
||||
|
||||
inline Result LaunchProgram(os::ProcessId *out, ncm::ProgramId program_id, const void *args, size_t args_size, u32 process_flags) {
|
||||
return LaunchProgram(out, ncm::ProgramLocation::Make(program_id, ncm::StorageId::BuiltInSystem), args, args_size, process_flags);
|
||||
R_RETURN(LaunchProgram(out, ncm::ProgramLocation::Make(program_id, ncm::StorageId::BuiltInSystem), args, args_size, process_flags));
|
||||
}
|
||||
|
||||
Result SubscribeProcessEvent(s32 socket, bool is_register, u64 id);
|
||||
|
|
|
@ -95,13 +95,13 @@ namespace ams::sf::cmif {
|
|||
template<typename T>
|
||||
Result ProcessMessage(ServiceDispatchContext &ctx, const cmif::PointerAndSize &in_raw_data) const {
|
||||
static_assert(std::is_base_of<ServiceDispatchTableBase, T>::value, "ServiceDispatchTableBase::Process<T>");
|
||||
return static_cast<const T *>(this)->ProcessMessage(ctx, in_raw_data);
|
||||
R_RETURN(static_cast<const T *>(this)->ProcessMessage(ctx, in_raw_data));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
Result ProcessMessageForMitm(ServiceDispatchContext &ctx, const cmif::PointerAndSize &in_raw_data) const {
|
||||
static_assert(std::is_base_of<ServiceDispatchTableBase, T>::value, "ServiceDispatchTableBase::ProcessForMitm<T>");
|
||||
return static_cast<const T *>(this)->ProcessMessageForMitm(ctx, in_raw_data);
|
||||
R_RETURN(static_cast<const T *>(this)->ProcessMessageForMitm(ctx, in_raw_data));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -115,11 +115,11 @@ namespace ams::sf::cmif {
|
|||
explicit constexpr ServiceDispatchTableImpl(const std::array<ServiceCommandMeta, N> &e) : m_entries{e} { /* ... */ }
|
||||
|
||||
Result ProcessMessage(ServiceDispatchContext &ctx, const cmif::PointerAndSize &in_raw_data) const {
|
||||
return this->ProcessMessageImpl(ctx, in_raw_data, m_entries.data(), m_entries.size(), InterfaceIdForDebug);
|
||||
R_RETURN(this->ProcessMessageImpl(ctx, in_raw_data, m_entries.data(), m_entries.size(), InterfaceIdForDebug));
|
||||
}
|
||||
|
||||
Result ProcessMessageForMitm(ServiceDispatchContext &ctx, const cmif::PointerAndSize &in_raw_data) const {
|
||||
return this->ProcessMessageForMitmImpl(ctx, in_raw_data, m_entries.data(), m_entries.size(), InterfaceIdForDebug);
|
||||
R_RETURN(this->ProcessMessageForMitmImpl(ctx, in_raw_data, m_entries.data(), m_entries.size(), InterfaceIdForDebug));
|
||||
}
|
||||
|
||||
constexpr const std::array<ServiceCommandMeta, N> &GetEntries() const {
|
||||
|
|
|
@ -190,14 +190,14 @@ namespace ams::sf::hipc {
|
|||
|
||||
template<typename Interface>
|
||||
Result AcceptImpl(Server *server, SharedPointer<Interface> p) {
|
||||
return ServerSessionManager::AcceptSession(server->m_port_handle, std::move(p));
|
||||
R_RETURN(ServerSessionManager::AcceptSession(server->m_port_handle, std::move(p)));
|
||||
}
|
||||
|
||||
#if AMS_SF_MITM_SUPPORTED
|
||||
template<typename Interface>
|
||||
Result AcceptMitmImpl(Server *server, SharedPointer<Interface> p, std::shared_ptr<::Service> forward_service) {
|
||||
AMS_ABORT_UNLESS(this->CanManageMitmServers());
|
||||
return ServerSessionManager::AcceptMitmSession(server->m_port_handle, std::move(p), std::move(forward_service));
|
||||
R_RETURN(ServerSessionManager::AcceptMitmSession(server->m_port_handle, std::move(p), std::move(forward_service)));
|
||||
}
|
||||
|
||||
template<typename Interface>
|
||||
|
@ -269,7 +269,7 @@ namespace ams::sf::hipc {
|
|||
|
||||
template<typename Interface>
|
||||
Result RegisterObjectForServer(SharedPointer<Interface> static_object, sm::ServiceName service_name, size_t max_sessions) {
|
||||
return this->RegisterServerImpl(0, cmif::ServiceObjectHolder(std::move(static_object)), service_name, max_sessions);
|
||||
R_RETURN(this->RegisterServerImpl(0, cmif::ServiceObjectHolder(std::move(static_object)), service_name, max_sessions));
|
||||
}
|
||||
|
||||
void RegisterServer(int port_index, os::NativeHandle port_handle) {
|
||||
|
@ -277,7 +277,7 @@ namespace ams::sf::hipc {
|
|||
}
|
||||
|
||||
Result RegisterServer(int port_index, sm::ServiceName service_name, size_t max_sessions) {
|
||||
return this->RegisterServerImpl(port_index, cmif::ServiceObjectHolder(), service_name, max_sessions);
|
||||
R_RETURN(this->RegisterServerImpl(port_index, cmif::ServiceObjectHolder(), service_name, max_sessions));
|
||||
}
|
||||
|
||||
/* Processing. */
|
||||
|
@ -503,7 +503,7 @@ namespace ams::sf::hipc {
|
|||
template<typename Interface, bool Enable = ManagerOptions::CanManageMitmServers, typename = typename std::enable_if<Enable>::type>
|
||||
Result RegisterMitmServer(int port_index, sm::ServiceName service_name) {
|
||||
AMS_ABORT_UNLESS(this->CanManageMitmServers());
|
||||
return this->template RegisterMitmServerImpl<Interface>(port_index, cmif::ServiceObjectHolder(), service_name);
|
||||
R_RETURN(this->template RegisterMitmServerImpl<Interface>(port_index, cmif::ServiceObjectHolder(), service_name));
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
|
|
@ -140,36 +140,36 @@ namespace ams::sf::hipc {
|
|||
#endif
|
||||
|
||||
Result ReceiveRequest(ServerSession *session, const cmif::PointerAndSize &message) {
|
||||
return this->ReceiveRequestImpl(session, message);
|
||||
R_RETURN(this->ReceiveRequestImpl(session, message));
|
||||
}
|
||||
|
||||
Result RegisterSession(ServerSession **out, os::NativeHandle session_handle, cmif::ServiceObjectHolder &&obj) {
|
||||
auto ctor = [&](ServerSession *session_memory) -> Result {
|
||||
return this->RegisterSessionImpl(session_memory, session_handle, std::forward<cmif::ServiceObjectHolder>(obj));
|
||||
R_RETURN(this->RegisterSessionImpl(session_memory, session_handle, std::forward<cmif::ServiceObjectHolder>(obj)));
|
||||
};
|
||||
return this->CreateSessionImpl(out, ctor);
|
||||
R_RETURN(this->CreateSessionImpl(out, ctor));
|
||||
}
|
||||
|
||||
Result AcceptSession(ServerSession **out, os::NativeHandle port_handle, cmif::ServiceObjectHolder &&obj) {
|
||||
auto ctor = [&](ServerSession *session_memory) -> Result {
|
||||
return this->AcceptSessionImpl(session_memory, port_handle, std::forward<cmif::ServiceObjectHolder>(obj));
|
||||
R_RETURN(this->AcceptSessionImpl(session_memory, port_handle, std::forward<cmif::ServiceObjectHolder>(obj)));
|
||||
};
|
||||
return this->CreateSessionImpl(out, ctor);
|
||||
R_RETURN(this->CreateSessionImpl(out, ctor));
|
||||
}
|
||||
|
||||
#if AMS_SF_MITM_SUPPORTED
|
||||
Result RegisterMitmSession(ServerSession **out, os::NativeHandle mitm_session_handle, cmif::ServiceObjectHolder &&obj, std::shared_ptr<::Service> &&fsrv) {
|
||||
auto ctor = [&](ServerSession *session_memory) -> Result {
|
||||
return this->RegisterMitmSessionImpl(session_memory, mitm_session_handle, std::forward<cmif::ServiceObjectHolder>(obj), std::forward<std::shared_ptr<::Service>>(fsrv));
|
||||
R_RETURN(this->RegisterMitmSessionImpl(session_memory, mitm_session_handle, std::forward<cmif::ServiceObjectHolder>(obj), std::forward<std::shared_ptr<::Service>>(fsrv)));
|
||||
};
|
||||
return this->CreateSessionImpl(out, ctor);
|
||||
R_RETURN(this->CreateSessionImpl(out, ctor));
|
||||
}
|
||||
|
||||
Result AcceptMitmSession(ServerSession **out, os::NativeHandle mitm_port_handle, cmif::ServiceObjectHolder &&obj, std::shared_ptr<::Service> &&fsrv) {
|
||||
auto ctor = [&](ServerSession *session_memory) -> Result {
|
||||
return this->AcceptMitmSessionImpl(session_memory, mitm_port_handle, std::forward<cmif::ServiceObjectHolder>(obj), std::forward<std::shared_ptr<::Service>>(fsrv));
|
||||
R_RETURN(this->AcceptMitmSessionImpl(session_memory, mitm_port_handle, std::forward<cmif::ServiceObjectHolder>(obj), std::forward<std::shared_ptr<::Service>>(fsrv)));
|
||||
};
|
||||
return this->CreateSessionImpl(out, ctor);
|
||||
R_RETURN(this->CreateSessionImpl(out, ctor));
|
||||
}
|
||||
#endif
|
||||
public:
|
||||
|
@ -183,13 +183,13 @@ namespace ams::sf::hipc {
|
|||
|
||||
template<typename Interface>
|
||||
Result AcceptSession(os::NativeHandle port_handle, SharedPointer<Interface> obj) {
|
||||
return this->AcceptSession(port_handle, cmif::ServiceObjectHolder(std::move(obj)));
|
||||
R_RETURN(this->AcceptSession(port_handle, cmif::ServiceObjectHolder(std::move(obj))));
|
||||
}
|
||||
|
||||
#if AMS_SF_MITM_SUPPORTED
|
||||
template<typename Interface>
|
||||
Result AcceptMitmSession(os::NativeHandle mitm_port_handle, SharedPointer<Interface> obj, std::shared_ptr<::Service> &&fsrv) {
|
||||
return this->AcceptMitmSession(mitm_port_handle, cmif::ServiceObjectHolder(std::move(obj)), std::forward<std::shared_ptr<::Service>>(fsrv));
|
||||
R_RETURN(this->AcceptMitmSession(mitm_port_handle, cmif::ServiceObjectHolder(std::move(obj)), std::forward<std::shared_ptr<::Service>>(fsrv)));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1197,7 +1197,7 @@ namespace ams::sf::impl {
|
|||
|
||||
sf::IServiceObject * const this_ptr = ctx.srv_obj;
|
||||
command_result = [this_ptr, invoke_impl, &args_tuple]<size_t ...Ix>(std::index_sequence<Ix...>) ALWAYS_INLINE_LAMBDA {
|
||||
return invoke_impl(this_ptr, std::forward<typename std::tuple_element<Ix, TrueArgumentsTuple>::type>(std::get<Ix>(args_tuple))...);
|
||||
R_RETURN(invoke_impl(this_ptr, std::forward<typename std::tuple_element<Ix, TrueArgumentsTuple>::type>(std::get<Ix>(args_tuple))...));
|
||||
}(std::make_index_sequence<std::tuple_size<typename CommandMeta::ArgsTypeForInvoke>::value>());
|
||||
}
|
||||
|
||||
|
@ -1205,7 +1205,7 @@ namespace ams::sf::impl {
|
|||
cmif::PointerAndSize out_raw_data;
|
||||
ctx.processor->PrepareForErrorReply(ctx, out_raw_data, runtime_metadata);
|
||||
R_TRY(GetCmifOutHeaderPointer(out_header_ptr, out_raw_data));
|
||||
return command_result;
|
||||
R_RETURN(command_result);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1254,14 +1254,14 @@ namespace ams::sf::impl {
|
|||
constexpr bool ReturnsVoid = std::is_same<Return, void>::value;
|
||||
static_assert(ReturnsResult || ReturnsVoid, "Service Commands must return Result or void.");
|
||||
|
||||
return InvokeServiceCommandImplCommon<CommandMeta, Arguments...>(out_header_ptr, ctx, in_raw_data, +[](sf::IServiceObject *srv_obj, Arguments &&... args) -> Result {
|
||||
R_RETURN((InvokeServiceCommandImplCommon<CommandMeta, Arguments...>(out_header_ptr, ctx, in_raw_data, +[](sf::IServiceObject *srv_obj, Arguments &&... args) -> Result {
|
||||
if constexpr (ReturnsResult) {
|
||||
return (static_cast<ClassType *>(srv_obj)->*ServiceCommandImpl)(std::forward<Arguments>(args)...);
|
||||
R_RETURN((static_cast<ClassType *>(srv_obj)->*ServiceCommandImpl)(std::forward<Arguments>(args)...));
|
||||
} else {
|
||||
(static_cast<ClassType *>(srv_obj)->*ServiceCommandImpl)(std::forward<Arguments>(args)...);
|
||||
R_SUCCEED();
|
||||
}
|
||||
});
|
||||
})));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -72,7 +72,7 @@ namespace ams::spl {
|
|||
R_UNLESS(spl::ResultSecureMonitorError::Includes(converted), spl::ResultUnexpectedSecureMonitorResult());
|
||||
|
||||
/* Return the error. */
|
||||
return converted;
|
||||
R_RETURN(converted);
|
||||
}
|
||||
|
||||
enum class CipherMode {
|
||||
|
|
|
@ -23,32 +23,32 @@
|
|||
namespace aarch64::lp64 {
|
||||
|
||||
ALWAYS_INLINE Result SetHeapSize(::ams::svc::Address *out_address, ::ams::svc::Size size) {
|
||||
return ::svcSetHeapSize(reinterpret_cast<void **>(out_address), size);
|
||||
R_RETURN(::svcSetHeapSize(reinterpret_cast<void **>(out_address), size));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result SetHeapSize(uintptr_t *out_address, ::ams::svc::Size size) {
|
||||
static_assert(sizeof(::ams::svc::Address) == sizeof(uintptr_t));
|
||||
return ::svcSetHeapSize(reinterpret_cast<void **>(out_address), size);
|
||||
R_RETURN(::svcSetHeapSize(reinterpret_cast<void **>(out_address), size));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result SetMemoryPermission(::ams::svc::Address address, ::ams::svc::Size size, ::ams::svc::MemoryPermission perm) {
|
||||
return ::svcSetMemoryPermission(reinterpret_cast<void *>(static_cast<uintptr_t>(address)), size, static_cast<u32>(perm));
|
||||
R_RETURN(::svcSetMemoryPermission(reinterpret_cast<void *>(static_cast<uintptr_t>(address)), size, static_cast<u32>(perm)));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result SetMemoryAttribute(::ams::svc::Address address, ::ams::svc::Size size, uint32_t mask, uint32_t attr) {
|
||||
return ::svcSetMemoryAttribute(reinterpret_cast<void *>(static_cast<uintptr_t>(address)), size, mask, attr);
|
||||
R_RETURN(::svcSetMemoryAttribute(reinterpret_cast<void *>(static_cast<uintptr_t>(address)), size, mask, attr));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result MapMemory(::ams::svc::Address dst_address, ::ams::svc::Address src_address, ::ams::svc::Size size) {
|
||||
return ::svcMapMemory(reinterpret_cast<void *>(static_cast<uintptr_t>(dst_address)), reinterpret_cast<void *>(static_cast<uintptr_t>(src_address)), size);
|
||||
R_RETURN(::svcMapMemory(reinterpret_cast<void *>(static_cast<uintptr_t>(dst_address)), reinterpret_cast<void *>(static_cast<uintptr_t>(src_address)), size));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result UnmapMemory(::ams::svc::Address dst_address, ::ams::svc::Address src_address, ::ams::svc::Size size) {
|
||||
return ::svcUnmapMemory(reinterpret_cast<void *>(static_cast<uintptr_t>(dst_address)), reinterpret_cast<void *>(static_cast<uintptr_t>(src_address)), size);
|
||||
R_RETURN(::svcUnmapMemory(reinterpret_cast<void *>(static_cast<uintptr_t>(dst_address)), reinterpret_cast<void *>(static_cast<uintptr_t>(src_address)), size));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result QueryMemory(::ams::svc::UserPointer< ::ams::svc::lp64::MemoryInfo *> out_memory_info, ::ams::svc::PageInfo *out_page_info, ::ams::svc::Address address) {
|
||||
return ::svcQueryMemory(reinterpret_cast<::MemoryInfo *>(out_memory_info.GetPointerUnsafe()), reinterpret_cast<u32 *>(out_page_info), address);
|
||||
R_RETURN(::svcQueryMemory(reinterpret_cast<::MemoryInfo *>(out_memory_info.GetPointerUnsafe()), reinterpret_cast<u32 *>(out_page_info), address));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE void ExitProcess() {
|
||||
|
@ -56,11 +56,11 @@
|
|||
}
|
||||
|
||||
ALWAYS_INLINE Result CreateThread(::ams::svc::Handle *out_handle, ::ams::svc::ThreadFunc func, ::ams::svc::Address arg, ::ams::svc::Address stack_bottom, int32_t priority, int32_t core_id) {
|
||||
return ::svcCreateThread(out_handle, reinterpret_cast<void *>(static_cast<uintptr_t>(func)), reinterpret_cast<void *>(static_cast<uintptr_t>(arg)), reinterpret_cast<void *>(static_cast<uintptr_t>(stack_bottom)), priority, core_id);
|
||||
R_RETURN(::svcCreateThread(out_handle, reinterpret_cast<void *>(static_cast<uintptr_t>(func)), reinterpret_cast<void *>(static_cast<uintptr_t>(arg)), reinterpret_cast<void *>(static_cast<uintptr_t>(stack_bottom)), priority, core_id));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result StartThread(::ams::svc::Handle thread_handle) {
|
||||
return ::svcStartThread(thread_handle);
|
||||
R_RETURN(::svcStartThread(thread_handle));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE void ExitThread() {
|
||||
|
@ -72,19 +72,19 @@
|
|||
}
|
||||
|
||||
ALWAYS_INLINE Result GetThreadPriority(int32_t *out_priority, ::ams::svc::Handle thread_handle) {
|
||||
return ::svcGetThreadPriority(out_priority, thread_handle);
|
||||
R_RETURN(::svcGetThreadPriority(out_priority, thread_handle));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result SetThreadPriority(::ams::svc::Handle thread_handle, int32_t priority) {
|
||||
return ::svcSetThreadPriority(thread_handle, priority);
|
||||
R_RETURN(::svcSetThreadPriority(thread_handle, priority));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result GetThreadCoreMask(int32_t *out_core_id, uint64_t *out_affinity_mask, ::ams::svc::Handle thread_handle) {
|
||||
return ::svcGetThreadCoreMask(out_core_id, out_affinity_mask, thread_handle);
|
||||
R_RETURN(::svcGetThreadCoreMask(out_core_id, out_affinity_mask, thread_handle));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result SetThreadCoreMask(::ams::svc::Handle thread_handle, int32_t core_id, uint64_t affinity_mask) {
|
||||
return ::svcSetThreadCoreMask(thread_handle, core_id, affinity_mask);
|
||||
R_RETURN(::svcSetThreadCoreMask(thread_handle, core_id, affinity_mask));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE int32_t GetCurrentProcessorNumber() {
|
||||
|
@ -92,51 +92,51 @@
|
|||
}
|
||||
|
||||
ALWAYS_INLINE Result SignalEvent(::ams::svc::Handle event_handle) {
|
||||
return ::svcSignalEvent(event_handle);
|
||||
R_RETURN(::svcSignalEvent(event_handle));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result ClearEvent(::ams::svc::Handle event_handle) {
|
||||
return ::svcClearEvent(event_handle);
|
||||
R_RETURN(::svcClearEvent(event_handle));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result MapSharedMemory(::ams::svc::Handle shmem_handle, ::ams::svc::Address address, ::ams::svc::Size size, ::ams::svc::MemoryPermission map_perm) {
|
||||
return ::svcMapSharedMemory(shmem_handle, reinterpret_cast<void *>(static_cast<uintptr_t>(address)), size, static_cast<u32>(map_perm));
|
||||
R_RETURN(::svcMapSharedMemory(shmem_handle, reinterpret_cast<void *>(static_cast<uintptr_t>(address)), size, static_cast<u32>(map_perm)));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result UnmapSharedMemory(::ams::svc::Handle shmem_handle, ::ams::svc::Address address, ::ams::svc::Size size) {
|
||||
return ::svcUnmapSharedMemory(shmem_handle, reinterpret_cast<void *>(static_cast<uintptr_t>(address)), size);
|
||||
R_RETURN(::svcUnmapSharedMemory(shmem_handle, reinterpret_cast<void *>(static_cast<uintptr_t>(address)), size));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result CreateTransferMemory(::ams::svc::Handle *out_handle, ::ams::svc::Address address, ::ams::svc::Size size, ::ams::svc::MemoryPermission map_perm) {
|
||||
return ::svcCreateTransferMemory(out_handle, reinterpret_cast<void *>(static_cast<uintptr_t>(address)), size, static_cast<u32>(map_perm));
|
||||
R_RETURN(::svcCreateTransferMemory(out_handle, reinterpret_cast<void *>(static_cast<uintptr_t>(address)), size, static_cast<u32>(map_perm)));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result CloseHandle(::ams::svc::Handle handle) {
|
||||
return ::svcCloseHandle(handle);
|
||||
R_RETURN(::svcCloseHandle(handle));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result ResetSignal(::ams::svc::Handle handle) {
|
||||
return ::svcResetSignal(handle);
|
||||
R_RETURN(::svcResetSignal(handle));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result WaitSynchronization(int32_t *out_index, ::ams::svc::UserPointer<const ::ams::svc::Handle *> handles, int32_t num_handles, int64_t timeout_ns) {
|
||||
return ::svcWaitSynchronization(out_index, handles.GetPointerUnsafe(), num_handles, timeout_ns);
|
||||
R_RETURN(::svcWaitSynchronization(out_index, handles.GetPointerUnsafe(), num_handles, timeout_ns));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result CancelSynchronization(::ams::svc::Handle handle) {
|
||||
return ::svcCancelSynchronization(handle);
|
||||
R_RETURN(::svcCancelSynchronization(handle));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result ArbitrateLock(::ams::svc::Handle thread_handle, ::ams::svc::Address address, uint32_t tag) {
|
||||
return ::svcArbitrateLock(thread_handle, reinterpret_cast<u32 *>(static_cast<uintptr_t>(address)), tag);
|
||||
R_RETURN(::svcArbitrateLock(thread_handle, reinterpret_cast<u32 *>(static_cast<uintptr_t>(address)), tag));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result ArbitrateUnlock(::ams::svc::Address address) {
|
||||
return ::svcArbitrateUnlock(reinterpret_cast<u32 *>(static_cast<uintptr_t>(address)));
|
||||
R_RETURN(::svcArbitrateUnlock(reinterpret_cast<u32 *>(static_cast<uintptr_t>(address))));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result WaitProcessWideKeyAtomic(::ams::svc::Address address, ::ams::svc::Address cv_key, uint32_t tag, int64_t timeout_ns) {
|
||||
return ::svcWaitProcessWideKeyAtomic(reinterpret_cast<u32 *>(static_cast<uintptr_t>(address)), reinterpret_cast<u32 *>(static_cast<uintptr_t>(cv_key)), tag, timeout_ns);
|
||||
R_RETURN(::svcWaitProcessWideKeyAtomic(reinterpret_cast<u32 *>(static_cast<uintptr_t>(address)), reinterpret_cast<u32 *>(static_cast<uintptr_t>(cv_key)), tag, timeout_ns));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE void SignalProcessWideKey(::ams::svc::Address cv_key, int32_t count) {
|
||||
|
@ -148,31 +148,31 @@
|
|||
}
|
||||
|
||||
ALWAYS_INLINE Result ConnectToNamedPort(::ams::svc::Handle *out_handle, ::ams::svc::UserPointer<const char *> name) {
|
||||
return ::svcConnectToNamedPort(out_handle, name.GetPointerUnsafe());
|
||||
R_RETURN(::svcConnectToNamedPort(out_handle, name.GetPointerUnsafe()));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result SendSyncRequestLight(::ams::svc::Handle session_handle) {
|
||||
return ::svcSendSyncRequestLight(session_handle);
|
||||
R_RETURN(::svcSendSyncRequestLight(session_handle));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result SendSyncRequest(::ams::svc::Handle session_handle) {
|
||||
return ::svcSendSyncRequest(session_handle);
|
||||
R_RETURN(::svcSendSyncRequest(session_handle));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result SendSyncRequestWithUserBuffer(::ams::svc::Address message_buffer, ::ams::svc::Size message_buffer_size, ::ams::svc::Handle session_handle) {
|
||||
return ::svcSendSyncRequestWithUserBuffer(reinterpret_cast<void *>(static_cast<uintptr_t>(message_buffer)), message_buffer_size, session_handle);
|
||||
R_RETURN(::svcSendSyncRequestWithUserBuffer(reinterpret_cast<void *>(static_cast<uintptr_t>(message_buffer)), message_buffer_size, session_handle));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result SendAsyncRequestWithUserBuffer(::ams::svc::Handle *out_event_handle, ::ams::svc::Address message_buffer, ::ams::svc::Size message_buffer_size, ::ams::svc::Handle session_handle) {
|
||||
return ::svcSendAsyncRequestWithUserBuffer(out_event_handle, reinterpret_cast<void *>(static_cast<uintptr_t>(message_buffer)), message_buffer_size, session_handle);
|
||||
R_RETURN(::svcSendAsyncRequestWithUserBuffer(out_event_handle, reinterpret_cast<void *>(static_cast<uintptr_t>(message_buffer)), message_buffer_size, session_handle));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result GetProcessId(uint64_t *out_process_id, ::ams::svc::Handle process_handle) {
|
||||
return ::svcGetProcessId(out_process_id, process_handle);
|
||||
R_RETURN(::svcGetProcessId(out_process_id, process_handle));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result GetThreadId(uint64_t *out_thread_id, ::ams::svc::Handle thread_handle) {
|
||||
return ::svcGetThreadId(out_thread_id, thread_handle);
|
||||
R_RETURN(::svcGetThreadId(out_thread_id, thread_handle));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE void Break(::ams::svc::BreakReason break_reason, ::ams::svc::Address arg, ::ams::svc::Size size) {
|
||||
|
@ -180,7 +180,7 @@
|
|||
}
|
||||
|
||||
ALWAYS_INLINE Result OutputDebugString(::ams::svc::UserPointer<const char *> debug_str, ::ams::svc::Size len) {
|
||||
return ::svcOutputDebugString(debug_str.GetPointerUnsafe(), len);
|
||||
R_RETURN(::svcOutputDebugString(debug_str.GetPointerUnsafe(), len));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE void ReturnFromException(::ams::Result result) {
|
||||
|
@ -188,7 +188,7 @@
|
|||
}
|
||||
|
||||
ALWAYS_INLINE Result GetInfo(uint64_t *out, ::ams::svc::InfoType info_type, ::ams::svc::Handle handle, uint64_t info_subtype) {
|
||||
return ::svcGetInfo(out, static_cast<u32>(info_type), handle, info_subtype);
|
||||
R_RETURN(::svcGetInfo(out, static_cast<u32>(info_type), handle, info_subtype));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE void FlushEntireDataCache() {
|
||||
|
@ -196,47 +196,47 @@
|
|||
}
|
||||
|
||||
ALWAYS_INLINE Result FlushDataCache(::ams::svc::Address address, ::ams::svc::Size size) {
|
||||
return ::svcFlushDataCache(reinterpret_cast<void *>(static_cast<uintptr_t>(address)), size);
|
||||
R_RETURN(::svcFlushDataCache(reinterpret_cast<void *>(static_cast<uintptr_t>(address)), size));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result MapPhysicalMemory(::ams::svc::Address address, ::ams::svc::Size size) {
|
||||
return ::svcMapPhysicalMemory(reinterpret_cast<void *>(static_cast<uintptr_t>(address)), size);
|
||||
R_RETURN(::svcMapPhysicalMemory(reinterpret_cast<void *>(static_cast<uintptr_t>(address)), size));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result UnmapPhysicalMemory(::ams::svc::Address address, ::ams::svc::Size size) {
|
||||
return ::svcUnmapPhysicalMemory(reinterpret_cast<void *>(static_cast<uintptr_t>(address)), size);
|
||||
R_RETURN(::svcUnmapPhysicalMemory(reinterpret_cast<void *>(static_cast<uintptr_t>(address)), size));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result GetDebugFutureThreadInfo(::ams::svc::lp64::LastThreadContext *out_context, uint64_t *thread_id, ::ams::svc::Handle debug_handle, int64_t ns) {
|
||||
return ::svcGetDebugFutureThreadInfo(reinterpret_cast<::LastThreadContext *>(out_context), thread_id, debug_handle, ns);
|
||||
R_RETURN(::svcGetDebugFutureThreadInfo(reinterpret_cast<::LastThreadContext *>(out_context), thread_id, debug_handle, ns));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result GetLastThreadInfo(::ams::svc::lp64::LastThreadContext *out_context, ::ams::svc::Address *out_tls_address, uint32_t *out_flags) {
|
||||
return ::svcGetLastThreadInfo(reinterpret_cast<::LastThreadContext *>(out_context), reinterpret_cast<u64 *>(out_tls_address), out_flags);
|
||||
R_RETURN(::svcGetLastThreadInfo(reinterpret_cast<::LastThreadContext *>(out_context), reinterpret_cast<u64 *>(out_tls_address), out_flags));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result GetResourceLimitLimitValue(int64_t *out_limit_value, ::ams::svc::Handle resource_limit_handle, ::ams::svc::LimitableResource which) {
|
||||
return ::svcGetResourceLimitLimitValue(out_limit_value, resource_limit_handle, static_cast<::LimitableResource>(which));
|
||||
R_RETURN(::svcGetResourceLimitLimitValue(out_limit_value, resource_limit_handle, static_cast<::LimitableResource>(which)));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result GetResourceLimitCurrentValue(int64_t *out_current_value, ::ams::svc::Handle resource_limit_handle, ::ams::svc::LimitableResource which) {
|
||||
return ::svcGetResourceLimitCurrentValue(out_current_value, resource_limit_handle, static_cast<::LimitableResource>(which));
|
||||
R_RETURN(::svcGetResourceLimitCurrentValue(out_current_value, resource_limit_handle, static_cast<::LimitableResource>(which)));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result SetThreadActivity(::ams::svc::Handle thread_handle, ::ams::svc::ThreadActivity thread_activity) {
|
||||
return ::svcSetThreadActivity(thread_handle, static_cast<::ThreadActivity>(thread_activity));
|
||||
R_RETURN(::svcSetThreadActivity(thread_handle, static_cast<::ThreadActivity>(thread_activity)));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result GetThreadContext3(::ams::svc::UserPointer< ::ams::svc::ThreadContext *> out_context, ::ams::svc::Handle thread_handle) {
|
||||
return ::svcGetThreadContext3(reinterpret_cast<::ThreadContext *>(out_context.GetPointerUnsafe()), thread_handle);
|
||||
R_RETURN(::svcGetThreadContext3(reinterpret_cast<::ThreadContext *>(out_context.GetPointerUnsafe()), thread_handle));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result WaitForAddress(::ams::svc::Address address, ::ams::svc::ArbitrationType arb_type, int32_t value, int64_t timeout_ns) {
|
||||
return ::svcWaitForAddress(reinterpret_cast<void *>(static_cast<uintptr_t>(address)), arb_type, value, timeout_ns);
|
||||
R_RETURN(::svcWaitForAddress(reinterpret_cast<void *>(static_cast<uintptr_t>(address)), arb_type, value, timeout_ns));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result SignalToAddress(::ams::svc::Address address, ::ams::svc::SignalType signal_type, int32_t value, int32_t count) {
|
||||
return ::svcSignalToAddress(reinterpret_cast<void *>(static_cast<uintptr_t>(address)), signal_type, value, count);
|
||||
R_RETURN(::svcSignalToAddress(reinterpret_cast<void *>(static_cast<uintptr_t>(address)), signal_type, value, count));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE void SynchronizePreemptionState() {
|
||||
|
@ -244,7 +244,7 @@
|
|||
}
|
||||
|
||||
ALWAYS_INLINE Result GetResourceLimitPeakValue(int64_t *out_peak_value, ::ams::svc::Handle resource_limit_handle, ::ams::svc::LimitableResource which) {
|
||||
return ::svcGetResourceLimitPeakValue(out_peak_value, resource_limit_handle, static_cast<::LimitableResource>(which));
|
||||
R_RETURN(::svcGetResourceLimitPeakValue(out_peak_value, resource_limit_handle, static_cast<::LimitableResource>(which)));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE void KernelDebug(::ams::svc::KernelDebugType kern_debug_type, uint64_t arg0, uint64_t arg1, uint64_t arg2) {
|
||||
|
@ -256,47 +256,47 @@
|
|||
}
|
||||
|
||||
ALWAYS_INLINE Result CreateSession(::ams::svc::Handle *out_server_session_handle, ::ams::svc::Handle *out_client_session_handle, bool is_light, ::ams::svc::Address name) {
|
||||
return ::svcCreateSession(out_server_session_handle, out_client_session_handle, is_light, name);
|
||||
R_RETURN(::svcCreateSession(out_server_session_handle, out_client_session_handle, is_light, name));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result AcceptSession(::ams::svc::Handle *out_handle, ::ams::svc::Handle port) {
|
||||
return ::svcAcceptSession(out_handle, port);
|
||||
R_RETURN(::svcAcceptSession(out_handle, port));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result ReplyAndReceiveLight(::ams::svc::Handle handle) {
|
||||
return ::svcReplyAndReceiveLight(handle);
|
||||
R_RETURN(::svcReplyAndReceiveLight(handle));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result ReplyAndReceive(int32_t *out_index, ::ams::svc::UserPointer<const ::ams::svc::Handle *> handles, int32_t num_handles, ::ams::svc::Handle reply_target, int64_t timeout_ns) {
|
||||
return ::svcReplyAndReceive(out_index, handles.GetPointerUnsafe(), num_handles, reply_target, timeout_ns);
|
||||
R_RETURN(::svcReplyAndReceive(out_index, handles.GetPointerUnsafe(), num_handles, reply_target, timeout_ns));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result ReplyAndReceiveWithUserBuffer(int32_t *out_index, ::ams::svc::Address message_buffer, ::ams::svc::Size message_buffer_size, ::ams::svc::UserPointer<const ::ams::svc::Handle *> handles, int32_t num_handles, ::ams::svc::Handle reply_target, int64_t timeout_ns) {
|
||||
return ::svcReplyAndReceiveWithUserBuffer(out_index, reinterpret_cast<void *>(static_cast<uintptr_t>(message_buffer)), message_buffer_size, handles.GetPointerUnsafe(), num_handles, reply_target, timeout_ns);
|
||||
R_RETURN(::svcReplyAndReceiveWithUserBuffer(out_index, reinterpret_cast<void *>(static_cast<uintptr_t>(message_buffer)), message_buffer_size, handles.GetPointerUnsafe(), num_handles, reply_target, timeout_ns));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result CreateEvent(::ams::svc::Handle *out_write_handle, ::ams::svc::Handle *out_read_handle) {
|
||||
return ::svcCreateEvent(out_write_handle, out_read_handle);
|
||||
R_RETURN(::svcCreateEvent(out_write_handle, out_read_handle));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result MapPhysicalMemoryUnsafe(::ams::svc::Address address, ::ams::svc::Size size) {
|
||||
return ::svcMapPhysicalMemoryUnsafe(reinterpret_cast<void *>(static_cast<uintptr_t>(address)), size);
|
||||
R_RETURN(::svcMapPhysicalMemoryUnsafe(reinterpret_cast<void *>(static_cast<uintptr_t>(address)), size));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result UnmapPhysicalMemoryUnsafe(::ams::svc::Address address, ::ams::svc::Size size) {
|
||||
return ::svcUnmapPhysicalMemoryUnsafe(reinterpret_cast<void *>(static_cast<uintptr_t>(address)), size);
|
||||
R_RETURN(::svcUnmapPhysicalMemoryUnsafe(reinterpret_cast<void *>(static_cast<uintptr_t>(address)), size));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result SetUnsafeLimit(::ams::svc::Size limit) {
|
||||
return ::svcSetUnsafeLimit(limit);
|
||||
R_RETURN(::svcSetUnsafeLimit(limit));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result CreateCodeMemory(::ams::svc::Handle *out_handle, ::ams::svc::Address address, ::ams::svc::Size size) {
|
||||
return ::svcCreateCodeMemory(out_handle, reinterpret_cast<void *>(static_cast<uintptr_t>(address)), size);
|
||||
R_RETURN(::svcCreateCodeMemory(out_handle, reinterpret_cast<void *>(static_cast<uintptr_t>(address)), size));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result ControlCodeMemory(::ams::svc::Handle code_memory_handle, ::ams::svc::CodeMemoryOperation operation, uint64_t address, uint64_t size, ::ams::svc::MemoryPermission perm) {
|
||||
return ::svcControlCodeMemory(code_memory_handle, static_cast<::CodeMapOperation>(operation), reinterpret_cast<void *>(address), size, static_cast<u32>(perm));
|
||||
R_RETURN(::svcControlCodeMemory(code_memory_handle, static_cast<::CodeMapOperation>(operation), reinterpret_cast<void *>(address), size, static_cast<u32>(perm)));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE void SleepSystem() {
|
||||
|
@ -304,199 +304,199 @@
|
|||
}
|
||||
|
||||
ALWAYS_INLINE Result ReadWriteRegister(uint32_t *out_value, ::ams::svc::PhysicalAddress address, uint32_t mask, uint32_t value) {
|
||||
return ::svcReadWriteRegister(out_value, address, mask, value);
|
||||
R_RETURN(::svcReadWriteRegister(out_value, address, mask, value));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result SetProcessActivity(::ams::svc::Handle process_handle, ::ams::svc::ProcessActivity process_activity) {
|
||||
return ::svcSetProcessActivity(process_handle, static_cast<::ProcessActivity>(process_activity));
|
||||
R_RETURN(::svcSetProcessActivity(process_handle, static_cast<::ProcessActivity>(process_activity)));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result CreateSharedMemory(::ams::svc::Handle *out_handle, ::ams::svc::Size size, ::ams::svc::MemoryPermission owner_perm, ::ams::svc::MemoryPermission remote_perm) {
|
||||
return ::svcCreateSharedMemory(out_handle, size, static_cast<u32>(owner_perm), static_cast<u32>(remote_perm));
|
||||
R_RETURN(::svcCreateSharedMemory(out_handle, size, static_cast<u32>(owner_perm), static_cast<u32>(remote_perm)));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result MapTransferMemory(::ams::svc::Handle trmem_handle, ::ams::svc::Address address, ::ams::svc::Size size, ::ams::svc::MemoryPermission owner_perm) {
|
||||
return ::svcMapTransferMemory(trmem_handle, reinterpret_cast<void *>(static_cast<uintptr_t>(address)), size, static_cast<u32>(owner_perm));
|
||||
R_RETURN(::svcMapTransferMemory(trmem_handle, reinterpret_cast<void *>(static_cast<uintptr_t>(address)), size, static_cast<u32>(owner_perm)));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result UnmapTransferMemory(::ams::svc::Handle trmem_handle, ::ams::svc::Address address, ::ams::svc::Size size) {
|
||||
return ::svcUnmapTransferMemory(trmem_handle, reinterpret_cast<void *>(static_cast<uintptr_t>(address)), size);
|
||||
R_RETURN(::svcUnmapTransferMemory(trmem_handle, reinterpret_cast<void *>(static_cast<uintptr_t>(address)), size));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result CreateInterruptEvent(::ams::svc::Handle *out_read_handle, int32_t interrupt_id, ::ams::svc::InterruptType interrupt_type) {
|
||||
return ::svcCreateInterruptEvent(out_read_handle, interrupt_id, static_cast<u32>(interrupt_type));
|
||||
R_RETURN(::svcCreateInterruptEvent(out_read_handle, interrupt_id, static_cast<u32>(interrupt_type)));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result QueryPhysicalAddress(::ams::svc::lp64::PhysicalMemoryInfo *out_info, ::ams::svc::Address address) {
|
||||
return ::svcQueryPhysicalAddress(reinterpret_cast<::PhysicalMemoryInfo *>(out_info), address);
|
||||
R_RETURN(::svcQueryPhysicalAddress(reinterpret_cast<::PhysicalMemoryInfo *>(out_info), address));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result QueryIoMapping(::ams::svc::Address *out_address, ::ams::svc::Size *out_size, ::ams::svc::PhysicalAddress physical_address, ::ams::svc::Size size) {
|
||||
return ::svcQueryIoMapping(reinterpret_cast<u64 *>(out_address), reinterpret_cast<u64 *>(out_size), physical_address, size);
|
||||
R_RETURN(::svcQueryIoMapping(reinterpret_cast<u64 *>(out_address), reinterpret_cast<u64 *>(out_size), physical_address, size));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result LegacyQueryIoMapping(::ams::svc::Address *out_address, ::ams::svc::PhysicalAddress physical_address, ::ams::svc::Size size) {
|
||||
return ::svcLegacyQueryIoMapping(reinterpret_cast<u64 *>(out_address), physical_address, size);
|
||||
R_RETURN(::svcLegacyQueryIoMapping(reinterpret_cast<u64 *>(out_address), physical_address, size));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result CreateDeviceAddressSpace(::ams::svc::Handle *out_handle, uint64_t das_address, uint64_t das_size) {
|
||||
return ::svcCreateDeviceAddressSpace(out_handle, das_address, das_size);
|
||||
R_RETURN(::svcCreateDeviceAddressSpace(out_handle, das_address, das_size));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result AttachDeviceAddressSpace(::ams::svc::DeviceName device_name, ::ams::svc::Handle das_handle) {
|
||||
return ::svcAttachDeviceAddressSpace(static_cast<u64>(device_name), das_handle);
|
||||
R_RETURN(::svcAttachDeviceAddressSpace(static_cast<u64>(device_name), das_handle));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result DetachDeviceAddressSpace(::ams::svc::DeviceName device_name, ::ams::svc::Handle das_handle) {
|
||||
return ::svcDetachDeviceAddressSpace(static_cast<u64>(device_name), das_handle);
|
||||
R_RETURN(::svcDetachDeviceAddressSpace(static_cast<u64>(device_name), das_handle));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result MapDeviceAddressSpaceByForce(::ams::svc::Handle das_handle, ::ams::svc::Handle process_handle, uint64_t process_address, ::ams::svc::Size size, uint64_t device_address, ::ams::svc::MemoryPermission device_perm) {
|
||||
return ::svcMapDeviceAddressSpaceByForce(das_handle, process_handle, process_address, size, device_address, static_cast<u32>(device_perm));
|
||||
R_RETURN(::svcMapDeviceAddressSpaceByForce(das_handle, process_handle, process_address, size, device_address, static_cast<u32>(device_perm)));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result MapDeviceAddressSpaceAligned(::ams::svc::Handle das_handle, ::ams::svc::Handle process_handle, uint64_t process_address, ::ams::svc::Size size, uint64_t device_address, ::ams::svc::MemoryPermission device_perm) {
|
||||
return ::svcMapDeviceAddressSpaceAligned(das_handle, process_handle, process_address, size, device_address, static_cast<u32>(device_perm));
|
||||
R_RETURN(::svcMapDeviceAddressSpaceAligned(das_handle, process_handle, process_address, size, device_address, static_cast<u32>(device_perm)));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result UnmapDeviceAddressSpace(::ams::svc::Handle das_handle, ::ams::svc::Handle process_handle, uint64_t process_address, ::ams::svc::Size size, uint64_t device_address) {
|
||||
return ::svcUnmapDeviceAddressSpace(das_handle, process_handle, process_address, size, device_address);
|
||||
R_RETURN(::svcUnmapDeviceAddressSpace(das_handle, process_handle, process_address, size, device_address));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result InvalidateProcessDataCache(::ams::svc::Handle process_handle, uint64_t address, uint64_t size) {
|
||||
return ::svcInvalidateProcessDataCache(process_handle, address, size);
|
||||
R_RETURN(::svcInvalidateProcessDataCache(process_handle, address, size));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result StoreProcessDataCache(::ams::svc::Handle process_handle, uint64_t address, uint64_t size) {
|
||||
return ::svcStoreProcessDataCache(process_handle, address, size);
|
||||
R_RETURN(::svcStoreProcessDataCache(process_handle, address, size));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result FlushProcessDataCache(::ams::svc::Handle process_handle, uint64_t address, uint64_t size) {
|
||||
return ::svcFlushProcessDataCache(process_handle, address, size);
|
||||
R_RETURN(::svcFlushProcessDataCache(process_handle, address, size));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result DebugActiveProcess(::ams::svc::Handle *out_handle, uint64_t process_id) {
|
||||
return ::svcDebugActiveProcess(out_handle, process_id);
|
||||
R_RETURN(::svcDebugActiveProcess(out_handle, process_id));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result BreakDebugProcess(::ams::svc::Handle debug_handle) {
|
||||
return ::svcBreakDebugProcess(debug_handle);
|
||||
R_RETURN(::svcBreakDebugProcess(debug_handle));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result TerminateDebugProcess(::ams::svc::Handle debug_handle) {
|
||||
return ::svcTerminateDebugProcess(debug_handle);
|
||||
R_RETURN(::svcTerminateDebugProcess(debug_handle));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result GetDebugEvent(::ams::svc::UserPointer< ::ams::svc::lp64::DebugEventInfo *> out_info, ::ams::svc::Handle debug_handle) {
|
||||
return ::svcGetDebugEvent(out_info.GetPointerUnsafe(), debug_handle);
|
||||
R_RETURN(::svcGetDebugEvent(out_info.GetPointerUnsafe(), debug_handle));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result ContinueDebugEvent(::ams::svc::Handle debug_handle, uint32_t flags, ::ams::svc::UserPointer<const uint64_t *> thread_ids, int32_t num_thread_ids) {
|
||||
return ::svcContinueDebugEvent(debug_handle, flags, const_cast<u64 *>(thread_ids.GetPointerUnsafe()), num_thread_ids);
|
||||
R_RETURN(::svcContinueDebugEvent(debug_handle, flags, const_cast<u64 *>(thread_ids.GetPointerUnsafe()), num_thread_ids));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result LegacyContinueDebugEvent(::ams::svc::Handle debug_handle, uint32_t flags, uint64_t thread_id) {
|
||||
return ::svcLegacyContinueDebugEvent(debug_handle, flags, thread_id);
|
||||
R_RETURN(::svcLegacyContinueDebugEvent(debug_handle, flags, thread_id));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result GetProcessList(int32_t *out_num_processes, ::ams::svc::UserPointer<uint64_t *> out_process_ids, int32_t max_out_count) {
|
||||
return ::svcGetProcessList(out_num_processes, out_process_ids.GetPointerUnsafe(), max_out_count);
|
||||
R_RETURN(::svcGetProcessList(out_num_processes, out_process_ids.GetPointerUnsafe(), max_out_count));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result GetThreadList(int32_t *out_num_threads, ::ams::svc::UserPointer<uint64_t *> out_thread_ids, int32_t max_out_count, ::ams::svc::Handle debug_handle) {
|
||||
return ::svcGetThreadList(out_num_threads, out_thread_ids.GetPointerUnsafe(), max_out_count, debug_handle);
|
||||
R_RETURN(::svcGetThreadList(out_num_threads, out_thread_ids.GetPointerUnsafe(), max_out_count, debug_handle));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result GetDebugThreadContext(::ams::svc::UserPointer< ::ams::svc::ThreadContext *> out_context, ::ams::svc::Handle debug_handle, uint64_t thread_id, uint32_t context_flags) {
|
||||
return ::svcGetDebugThreadContext(reinterpret_cast<::ThreadContext *>(out_context.GetPointerUnsafe()), debug_handle, thread_id, context_flags);
|
||||
R_RETURN(::svcGetDebugThreadContext(reinterpret_cast<::ThreadContext *>(out_context.GetPointerUnsafe()), debug_handle, thread_id, context_flags));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result SetDebugThreadContext(::ams::svc::Handle debug_handle, uint64_t thread_id, ::ams::svc::UserPointer<const ::ams::svc::ThreadContext *> context, uint32_t context_flags) {
|
||||
return ::svcSetDebugThreadContext(debug_handle, thread_id, reinterpret_cast<const ::ThreadContext *>(context.GetPointerUnsafe()), context_flags);
|
||||
R_RETURN(::svcSetDebugThreadContext(debug_handle, thread_id, reinterpret_cast<const ::ThreadContext *>(context.GetPointerUnsafe()), context_flags));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result QueryDebugProcessMemory(::ams::svc::UserPointer< ::ams::svc::lp64::MemoryInfo *> out_memory_info, ::ams::svc::PageInfo *out_page_info, ::ams::svc::Handle process_handle, ::ams::svc::Address address) {
|
||||
return ::svcQueryDebugProcessMemory(reinterpret_cast<::MemoryInfo *>(out_memory_info.GetPointerUnsafe()), reinterpret_cast<u32 *>(out_page_info), process_handle, address);
|
||||
R_RETURN(::svcQueryDebugProcessMemory(reinterpret_cast<::MemoryInfo *>(out_memory_info.GetPointerUnsafe()), reinterpret_cast<u32 *>(out_page_info), process_handle, address));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result ReadDebugProcessMemory(::ams::svc::Address buffer, ::ams::svc::Handle debug_handle, ::ams::svc::Address address, ::ams::svc::Size size) {
|
||||
return ::svcReadDebugProcessMemory(reinterpret_cast<void *>(static_cast<uintptr_t>(buffer)), debug_handle, address, size);
|
||||
R_RETURN(::svcReadDebugProcessMemory(reinterpret_cast<void *>(static_cast<uintptr_t>(buffer)), debug_handle, address, size));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result WriteDebugProcessMemory(::ams::svc::Handle debug_handle, ::ams::svc::Address buffer, ::ams::svc::Address address, ::ams::svc::Size size) {
|
||||
return ::svcWriteDebugProcessMemory(debug_handle, reinterpret_cast<const void *>(static_cast<uintptr_t>(buffer)), address, size);
|
||||
R_RETURN(::svcWriteDebugProcessMemory(debug_handle, reinterpret_cast<const void *>(static_cast<uintptr_t>(buffer)), address, size));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result SetHardwareBreakPoint(::ams::svc::HardwareBreakPointRegisterName name, uint64_t flags, uint64_t value) {
|
||||
return ::svcSetHardwareBreakPoint(static_cast<u32>(name), flags, value);
|
||||
R_RETURN(::svcSetHardwareBreakPoint(static_cast<u32>(name), flags, value));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result GetDebugThreadParam(uint64_t *out_64, uint32_t *out_32, ::ams::svc::Handle debug_handle, uint64_t thread_id, ::ams::svc::DebugThreadParam param) {
|
||||
return ::svcGetDebugThreadParam(out_64, out_32, debug_handle, thread_id, static_cast<::DebugThreadParam>(param));
|
||||
R_RETURN(::svcGetDebugThreadParam(out_64, out_32, debug_handle, thread_id, static_cast<::DebugThreadParam>(param)));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result GetSystemInfo(uint64_t *out, ::ams::svc::SystemInfoType info_type, ::ams::svc::Handle handle, uint64_t info_subtype) {
|
||||
return ::svcGetSystemInfo(out, static_cast<u64>(info_type), handle, info_subtype);
|
||||
R_RETURN(::svcGetSystemInfo(out, static_cast<u64>(info_type), handle, info_subtype));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result CreatePort(::ams::svc::Handle *out_server_handle, ::ams::svc::Handle *out_client_handle, int32_t max_sessions, bool is_light, ::ams::svc::Address name) {
|
||||
return ::svcCreatePort(out_server_handle, out_client_handle, max_sessions, is_light, reinterpret_cast<const char *>(static_cast<uintptr_t>(name)));
|
||||
R_RETURN(::svcCreatePort(out_server_handle, out_client_handle, max_sessions, is_light, reinterpret_cast<const char *>(static_cast<uintptr_t>(name))));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result ManageNamedPort(::ams::svc::Handle *out_server_handle, ::ams::svc::UserPointer<const char *> name, int32_t max_sessions) {
|
||||
return ::svcManageNamedPort(out_server_handle, name.GetPointerUnsafe(), max_sessions);
|
||||
R_RETURN(::svcManageNamedPort(out_server_handle, name.GetPointerUnsafe(), max_sessions));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result ConnectToPort(::ams::svc::Handle *out_handle, ::ams::svc::Handle port) {
|
||||
return ::svcConnectToPort(out_handle, port);
|
||||
R_RETURN(::svcConnectToPort(out_handle, port));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result SetProcessMemoryPermission(::ams::svc::Handle process_handle, uint64_t address, uint64_t size, ::ams::svc::MemoryPermission perm) {
|
||||
return ::svcSetProcessMemoryPermission(process_handle, address, size, static_cast<u32>(perm));
|
||||
R_RETURN(::svcSetProcessMemoryPermission(process_handle, address, size, static_cast<u32>(perm)));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result MapProcessMemory(::ams::svc::Address dst_address, ::ams::svc::Handle process_handle, uint64_t src_address, ::ams::svc::Size size) {
|
||||
return ::svcMapProcessMemory(reinterpret_cast<void *>(static_cast<uintptr_t>(dst_address)), process_handle, src_address, size);
|
||||
R_RETURN(::svcMapProcessMemory(reinterpret_cast<void *>(static_cast<uintptr_t>(dst_address)), process_handle, src_address, size));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result UnmapProcessMemory(::ams::svc::Address dst_address, ::ams::svc::Handle process_handle, uint64_t src_address, ::ams::svc::Size size) {
|
||||
return ::svcUnmapProcessMemory(reinterpret_cast<void *>(static_cast<uintptr_t>(dst_address)), process_handle, src_address, size);
|
||||
R_RETURN(::svcUnmapProcessMemory(reinterpret_cast<void *>(static_cast<uintptr_t>(dst_address)), process_handle, src_address, size));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result QueryProcessMemory(::ams::svc::UserPointer< ::ams::svc::lp64::MemoryInfo *> out_memory_info, ::ams::svc::PageInfo *out_page_info, ::ams::svc::Handle process_handle, uint64_t address) {
|
||||
return ::svcQueryProcessMemory(reinterpret_cast<::MemoryInfo *>(out_memory_info.GetPointerUnsafe()), reinterpret_cast<u32 *>(out_page_info), process_handle, address);
|
||||
R_RETURN(::svcQueryProcessMemory(reinterpret_cast<::MemoryInfo *>(out_memory_info.GetPointerUnsafe()), reinterpret_cast<u32 *>(out_page_info), process_handle, address));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result MapProcessCodeMemory(::ams::svc::Handle process_handle, uint64_t dst_address, uint64_t src_address, uint64_t size) {
|
||||
return ::svcMapProcessCodeMemory(process_handle, dst_address, src_address, size);
|
||||
R_RETURN(::svcMapProcessCodeMemory(process_handle, dst_address, src_address, size));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result UnmapProcessCodeMemory(::ams::svc::Handle process_handle, uint64_t dst_address, uint64_t src_address, uint64_t size) {
|
||||
return ::svcUnmapProcessCodeMemory(process_handle, dst_address, src_address, size);
|
||||
R_RETURN(::svcUnmapProcessCodeMemory(process_handle, dst_address, src_address, size));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result CreateProcess(::ams::svc::Handle *out_handle, ::ams::svc::UserPointer<const ::ams::svc::lp64::CreateProcessParameter *> parameters, ::ams::svc::UserPointer<const uint32_t *> caps, int32_t num_caps) {
|
||||
return ::svcCreateProcess(out_handle, parameters.GetPointerUnsafe(), caps.GetPointerUnsafe(), num_caps);
|
||||
R_RETURN(::svcCreateProcess(out_handle, parameters.GetPointerUnsafe(), caps.GetPointerUnsafe(), num_caps));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result StartProcess(::ams::svc::Handle process_handle, int32_t priority, int32_t core_id, uint64_t main_thread_stack_size) {
|
||||
return ::svcStartProcess(process_handle, priority, core_id, main_thread_stack_size);
|
||||
R_RETURN(::svcStartProcess(process_handle, priority, core_id, main_thread_stack_size));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result TerminateProcess(::ams::svc::Handle process_handle) {
|
||||
return ::svcTerminateProcess(process_handle);
|
||||
R_RETURN(::svcTerminateProcess(process_handle));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result GetProcessInfo(int64_t *out_info, ::ams::svc::Handle process_handle, ::ams::svc::ProcessInfoType info_type) {
|
||||
return ::svcGetProcessInfo(out_info, process_handle, static_cast<::ProcessInfoType>(info_type));
|
||||
R_RETURN(::svcGetProcessInfo(out_info, process_handle, static_cast<::ProcessInfoType>(info_type)));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result CreateResourceLimit(::ams::svc::Handle *out_handle) {
|
||||
return ::svcCreateResourceLimit(out_handle);
|
||||
R_RETURN(::svcCreateResourceLimit(out_handle));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result SetResourceLimitLimitValue(::ams::svc::Handle resource_limit_handle, ::ams::svc::LimitableResource which, int64_t limit_value) {
|
||||
return ::svcSetResourceLimitLimitValue(resource_limit_handle, static_cast<::LimitableResource>(which), limit_value);
|
||||
R_RETURN(::svcSetResourceLimitLimitValue(resource_limit_handle, static_cast<::LimitableResource>(which), limit_value));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE void CallSecureMonitor(::ams::svc::lp64::SecureMonitorArguments *args) {
|
||||
|
|
|
@ -91,16 +91,16 @@ namespace ams::tipc::impl {
|
|||
|
||||
#define AMS_TIPC_IMPL_PROCESS_METHOD_REQUEST(CLASSNAME, CMD_ID, RETURN, NAME, ARGS, ARGNAMES, VERSION_MIN, VERSION_MAX) \
|
||||
else if (constexpr u16 TipcCommandId = CMD_ID + 0x10; tag == TipcCommandId) { \
|
||||
return this->ProcessMethodById<TipcCommandId, ImplType>(impl, message_buffer, fw_ver); \
|
||||
R_RETURN((this->ProcessMethodById<TipcCommandId, ImplType>(impl, message_buffer, fw_ver))); \
|
||||
}
|
||||
|
||||
#define AMS_TIPC_IMPL_PROCESS_METHOD_REQUEST_BY_ID(CLASSNAME, CMD_ID, RETURN, NAME, ARGS, ARGNAMES, VERSION_MIN, VERSION_MAX) \
|
||||
if constexpr (constexpr u16 TipcCommandId = CMD_ID + 0x10; CommandId == TipcCommandId) { \
|
||||
constexpr bool MinValid = VERSION_MIN == hos::Version_Min; \
|
||||
constexpr bool MaxValid = VERSION_MAX == hos::Version_Max; \
|
||||
if ((MinValid || VERSION_MIN <= fw_ver) && (MaxValid || fw_ver <= VERSION_MAX)) { \
|
||||
return ::ams::tipc::impl::InvokeServiceCommandImpl<TipcCommandId, &ImplType::NAME, ImplType>(impl, message_buffer); \
|
||||
} \
|
||||
#define AMS_TIPC_IMPL_PROCESS_METHOD_REQUEST_BY_ID(CLASSNAME, CMD_ID, RETURN, NAME, ARGS, ARGNAMES, VERSION_MIN, VERSION_MAX) \
|
||||
if constexpr (constexpr u16 TipcCommandId = CMD_ID + 0x10; CommandId == TipcCommandId) { \
|
||||
constexpr bool MinValid = VERSION_MIN == hos::Version_Min; \
|
||||
constexpr bool MaxValid = VERSION_MAX == hos::Version_Max; \
|
||||
if ((MinValid || VERSION_MIN <= fw_ver) && (MaxValid || fw_ver <= VERSION_MAX)) { \
|
||||
R_RETURN((::ams::tipc::impl::InvokeServiceCommandImpl<TipcCommandId, &ImplType::NAME, ImplType>(impl, message_buffer))); \
|
||||
} \
|
||||
}
|
||||
|
||||
#define AMS_TIPC_IMPL_IS_FIRMWARE_VERSION_ALWAYS_VALID(CLASSNAME, CMD_ID, RETURN, NAME, ARGS, ARGNAMES, VERSION_MIN, VERSION_MAX) \
|
||||
|
@ -133,9 +133,9 @@ namespace ams::tipc::impl {
|
|||
ALWAYS_INLINE Result ProcessDefaultMethod(ImplType *impl, const MessageBuffer &message_buffer) const { \
|
||||
/* Handle a default command. */ \
|
||||
if constexpr (HasDefaultServiceCommandProcessor<ImplType>) { \
|
||||
return impl->ProcessDefaultServiceCommand(message_buffer); \
|
||||
R_RETURN(impl->ProcessDefaultServiceCommand(message_buffer)); \
|
||||
} else { \
|
||||
R_THROW(tipc::ResultInvalidMethod()); \
|
||||
R_THROW(tipc::ResultInvalidMethod()); \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
|
@ -143,7 +143,7 @@ namespace ams::tipc::impl {
|
|||
ALWAYS_INLINE Result ProcessMethodById(ImplType *impl, const MessageBuffer &message_buffer, hos::Version fw_ver) const { \
|
||||
CMD_MACRO(ImplType, AMS_TIPC_IMPL_PROCESS_METHOD_REQUEST_BY_ID) \
|
||||
\
|
||||
return this->ProcessDefaultMethod<ImplType>(impl, message_buffer); \
|
||||
R_RETURN(this->ProcessDefaultMethod<ImplType>(impl, message_buffer)); \
|
||||
} \
|
||||
\
|
||||
static consteval bool IsFirmwareVersionAlwaysValid() { \
|
||||
|
@ -170,7 +170,7 @@ namespace ams::tipc::impl {
|
|||
if (false) { } \
|
||||
CMD_MACRO(ImplType, AMS_TIPC_IMPL_PROCESS_METHOD_REQUEST) \
|
||||
else { \
|
||||
return this->ProcessDefaultMethod<ImplType>(impl, message_buffer); \
|
||||
R_RETURN(this->ProcessDefaultMethod<ImplType>(impl, message_buffer)); \
|
||||
} \
|
||||
} \
|
||||
}; \
|
||||
|
|
|
@ -628,7 +628,7 @@ namespace ams::tipc::impl {
|
|||
typename Processor::OutHandleHolderType out_handles_holder;
|
||||
const Result command_result = [&]<size_t... Ix>(std::index_sequence<Ix...>) ALWAYS_INLINE_LAMBDA {
|
||||
if constexpr (ReturnsResult) {
|
||||
return (object->*ServiceCommandImpl)(Processor::template DeserializeArgument<Ix>(message_buffer, out_raw_holder, out_handles_holder)...);
|
||||
R_RETURN((object->*ServiceCommandImpl)(Processor::template DeserializeArgument<Ix>(message_buffer, out_raw_holder, out_handles_holder)...));
|
||||
} else {
|
||||
(object->*ServiceCommandImpl)(Processor::template DeserializeArgument<Ix>(message_buffer, out_raw_holder, out_handles_holder)...);
|
||||
R_SUCCEED();
|
||||
|
|
|
@ -34,15 +34,15 @@ namespace ams::tipc::impl {
|
|||
}
|
||||
|
||||
ALWAYS_INLINE Result CloseHandle(tipc::NativeHandle handle) {
|
||||
return svc::CloseHandle(handle);
|
||||
R_RETURN(svc::CloseHandle(handle));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result CreateSession(tipc::NativeHandle *out_server_session_handle, tipc::NativeHandle *out_client_session_handle, bool is_light, uintptr_t name) {
|
||||
return svc::CreateSession(out_server_session_handle, out_client_session_handle, is_light, name);
|
||||
R_RETURN(svc::CreateSession(out_server_session_handle, out_client_session_handle, is_light, name));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE Result AcceptSession(tipc::NativeHandle *out_handle, tipc::NativeHandle port) {
|
||||
return svc::AcceptSession(out_handle, port);
|
||||
R_RETURN(svc::AcceptSession(out_handle, port));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -74,11 +74,9 @@ namespace ams::tipc {
|
|||
|
||||
template<IsResumeKey ResumeKey, typename F>
|
||||
ALWAYS_INLINE Result RegisterRetryIfDeferred(ResumeKey key, F f) {
|
||||
const Result result = f();
|
||||
if (tipc::ResultRequestDeferred::Includes(result)) {
|
||||
this->RegisterRetry(key);
|
||||
}
|
||||
return result;
|
||||
ON_RESULT_INCLUDED(tipc::ResultRequestDeferred) { this->RegisterRetry(key); };
|
||||
|
||||
R_RETURN(f());
|
||||
}
|
||||
|
||||
template<typename PortManager>
|
||||
|
|
|
@ -120,7 +120,7 @@ namespace ams::tipc {
|
|||
*out_object = GetReference(entry->object);
|
||||
*out_holder = nullptr;
|
||||
|
||||
return result;
|
||||
R_RETURN(result);
|
||||
} else {
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
|
|
@ -319,7 +319,7 @@ namespace ams::tipc {
|
|||
const Result method_result = message_buffer.GetRaw<u32>(raw_data_offset);
|
||||
|
||||
/* Check that the result is the special deferral result. */
|
||||
R_THROW(tipc::ResultRequestDeferred::Includes(method_result));
|
||||
return tipc::ResultRequestDeferred::Includes(method_result);
|
||||
} else {
|
||||
/* If deferral isn't supported, requests are never deferred. */
|
||||
return false;
|
||||
|
|
|
@ -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) {
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue