ams: use R_SUCCEED, R_THROW globally

This commit is contained in:
Michael Scire 2022-03-26 00:14:36 -07:00
parent e5b1739f65
commit dd78ede99f
370 changed files with 2107 additions and 2107 deletions

View file

@ -55,7 +55,7 @@ namespace ams::ddsf {
/* Attach the session. */
m_session_list.push_back(*session);
return ResultSuccess();
R_SUCCEED();
}
void DetachSession(ISession *session) {

View file

@ -67,7 +67,7 @@ namespace ams::fs {
for (s64 i = 0; i < count; i++) {
R_TRY(bucket.Write(i * sizeof(pos), std::addressof(pos), sizeof(pos)));
}
return ResultSuccess();
R_SUCCEED();
}
public:
KeyValueRomStorageTemplate() : m_bucket_count(), m_bucket_storage(), m_kv_storage(), m_total_entry_size(), m_entry_count() { /* ... */ }
@ -77,7 +77,7 @@ namespace ams::fs {
m_bucket_storage = bucket;
m_bucket_count = count;
m_kv_storage = kv;
return ResultSuccess();
R_SUCCEED();
}
void Finalize() {
@ -95,7 +95,7 @@ namespace ams::fs {
s64 kv_size = 0;
R_TRY(m_kv_storage.GetSize(std::addressof(kv_size)));
*out = kv_size - m_total_entry_size;
return ResultSuccess();
R_SUCCEED();
}
constexpr u32 GetEntryCount() const {
@ -128,7 +128,7 @@ namespace ams::fs {
*out = pos;
m_entry_count++;
return ResultSuccess();
R_SUCCEED();
}
Result GetInternal(Position *out_pos, Value *out_val, const Key &key, u32 hash_key, const void *aux, size_t aux_size) {
@ -142,7 +142,7 @@ namespace ams::fs {
*out_pos = pos;
*out_val = elem.value;
return ResultSuccess();
R_SUCCEED();
}
Result GetByPosition(Key *out_key, Value *out_val, Position pos) {
@ -154,7 +154,7 @@ namespace ams::fs {
*out_key = elem.key;
*out_val = elem.value;
return ResultSuccess();
R_SUCCEED();
}
Result GetByPosition(Key *out_key, Value *out_val, void *out_aux, size_t *out_aux_size, Position pos) {
@ -168,7 +168,7 @@ namespace ams::fs {
*out_key = elem.key;
*out_val = elem.value;
return ResultSuccess();
R_SUCCEED();
}
Result SetByPosition(Position pos, const Value &value) {
@ -213,7 +213,7 @@ namespace ams::fs {
if (key.IsEqual(out_elem->key, aux, aux_size, buf, cur_aux_size)) {
*out_pos = cur;
return ResultSuccess();
R_SUCCEED();
}
*out_prev = cur;
@ -233,7 +233,7 @@ namespace ams::fs {
*out = static_cast<Position>(m_total_entry_size);
m_total_entry_size = util::AlignUp(static_cast<s64>(end_pos), alignof(Position));
return ResultSuccess();
R_SUCCEED();
}
Result LinkEntry(Position *out, Position pos, u32 hash_key) {
@ -251,7 +251,7 @@ namespace ams::fs {
R_TRY(this->WriteBucket(pos, ind));
*out = next;
return ResultSuccess();
R_SUCCEED();
}
Result ReadBucket(Position *out, BucketIndex ind) {
@ -291,7 +291,7 @@ namespace ams::fs {
R_TRY(m_kv_storage.Read(pos + sizeof(*out), out_aux, out->size));
}
return ResultSuccess();
R_SUCCEED();
}
Result WriteKeyValue(const Element *elem, Position pos, const void *aux, size_t aux_size) {
@ -308,7 +308,7 @@ namespace ams::fs {
R_TRY(m_kv_storage.Write(pos + sizeof(*elem), aux, aux_size));
}
return ResultSuccess();
R_SUCCEED();
}
};

View file

@ -113,13 +113,13 @@ namespace ams::fs {
virtual Result Write(s64 offset, const void *buffer, size_t size) override {
/* TODO: Better result? Is it possible to get a more specific one? */
AMS_UNUSED(offset, buffer, size);
return fs::ResultUnsupportedOperation();
R_THROW(fs::ResultUnsupportedOperation());
}
virtual Result SetSize(s64 size) override {
/* TODO: Better result? Is it possible to get a more specific one? */
AMS_UNUSED(size);
return fs::ResultUnsupportedOperation();
R_THROW(fs::ResultUnsupportedOperation());
}
};

View file

@ -38,7 +38,7 @@ namespace ams::fs {
/* Copy from memory. */
std::memcpy(buffer, m_buf + offset, size);
return ResultSuccess();
R_SUCCEED();
}
virtual Result Write(s64 offset, const void *buffer, size_t size) override {
@ -51,21 +51,21 @@ namespace ams::fs {
/* Copy to memory. */
std::memcpy(m_buf + offset, buffer, size);
return ResultSuccess();
R_SUCCEED();
}
virtual Result Flush() override {
return ResultSuccess();
R_SUCCEED();
}
virtual Result GetSize(s64 *out) override {
*out = m_size;
return ResultSuccess();
R_SUCCEED();
}
virtual Result SetSize(s64 size) override {
AMS_UNUSED(size);
return fs::ResultUnsupportedSetSizeForMemoryStorage();
R_THROW(fs::ResultUnsupportedSetSizeForMemoryStorage());
}
virtual Result OperateRange(void *dst, size_t dst_size, OperationId op_id, s64 offset, s64 size, const void *src, size_t src_size) override {
@ -73,14 +73,14 @@ namespace ams::fs {
switch (op_id) {
case OperationId::Invalidate:
return ResultSuccess();
R_SUCCEED();
case OperationId::QueryRange:
R_UNLESS(dst != nullptr, fs::ResultNullptrArgument());
R_UNLESS(dst_size == sizeof(QueryRangeInfo), fs::ResultInvalidSize());
reinterpret_cast<QueryRangeInfo *>(dst)->Clear();
return ResultSuccess();
R_SUCCEED();
default:
return fs::ResultUnsupportedOperateRangeForMemoryStorage();
R_THROW(fs::ResultUnsupportedOperateRangeForMemoryStorage());
}
}
};

View file

@ -44,7 +44,7 @@ namespace ams::fs {
}
virtual Result DoFlush() override final {
return ResultSuccess();
R_SUCCEED();
}
virtual Result DoWrite(s64 offset, const void *buffer, size_t size, const fs::WriteOption &option) override final {
@ -54,12 +54,12 @@ namespace ams::fs {
AMS_ASSERT(!need_append);
AMS_UNUSED(buffer);
return fs::ResultUnsupportedWriteForReadOnlyFile();
R_THROW(fs::ResultUnsupportedWriteForReadOnlyFile());
}
virtual Result DoSetSize(s64 size) override final {
R_TRY(this->DrySetSize(size, fs::OpenMode_Read));
return fs::ResultUnsupportedWriteForReadOnlyFile();
R_THROW(fs::ResultUnsupportedWriteForReadOnlyFile());
}
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 {
@ -68,7 +68,7 @@ namespace ams::fs {
case OperationId::QueryRange:
return m_base_file->OperateRange(dst, dst_size, op_id, offset, size, src, src_size);
default:
return fs::ResultUnsupportedOperateRangeForReadOnlyFile();
R_THROW(fs::ResultUnsupportedOperateRangeForReadOnlyFile());
}
}
public:
@ -100,7 +100,7 @@ namespace ams::fs {
R_UNLESS(read_only_file != nullptr, fs::ResultAllocationMemoryFailedInReadOnlyFileSystemA());
*out_file = std::move(read_only_file);
return ResultSuccess();
R_SUCCEED();
}
virtual Result DoOpenDirectory(std::unique_ptr<fsa::IDirectory> *out_dir, const fs::Path &path, OpenDirectoryMode mode) override final {
@ -112,62 +112,62 @@ namespace ams::fs {
}
virtual Result DoCommit() override final {
return ResultSuccess();
R_SUCCEED();
}
virtual Result DoCreateFile(const fs::Path &path, s64 size, int flags) override final {
AMS_UNUSED(path, size, flags);
return fs::ResultUnsupportedWriteForReadOnlyFileSystem();
R_THROW(fs::ResultUnsupportedWriteForReadOnlyFileSystem());
}
virtual Result DoDeleteFile(const fs::Path &path) override final {
AMS_UNUSED(path);
return fs::ResultUnsupportedWriteForReadOnlyFileSystem();
R_THROW(fs::ResultUnsupportedWriteForReadOnlyFileSystem());
}
virtual Result DoCreateDirectory(const fs::Path &path) override final {
AMS_UNUSED(path);
return fs::ResultUnsupportedWriteForReadOnlyFileSystem();
R_THROW(fs::ResultUnsupportedWriteForReadOnlyFileSystem());
}
virtual Result DoDeleteDirectory(const fs::Path &path) override final {
AMS_UNUSED(path);
return fs::ResultUnsupportedWriteForReadOnlyFileSystem();
R_THROW(fs::ResultUnsupportedWriteForReadOnlyFileSystem());
}
virtual Result DoDeleteDirectoryRecursively(const fs::Path &path) override final {
AMS_UNUSED(path);
return fs::ResultUnsupportedWriteForReadOnlyFileSystem();
R_THROW(fs::ResultUnsupportedWriteForReadOnlyFileSystem());
}
virtual Result DoRenameFile(const fs::Path &old_path, const fs::Path &new_path) override final {
AMS_UNUSED(old_path, new_path);
return fs::ResultUnsupportedWriteForReadOnlyFileSystem();
R_THROW(fs::ResultUnsupportedWriteForReadOnlyFileSystem());
}
virtual Result DoRenameDirectory(const fs::Path &old_path, const fs::Path &new_path) override final {
AMS_UNUSED(old_path, new_path);
return fs::ResultUnsupportedWriteForReadOnlyFileSystem();
R_THROW(fs::ResultUnsupportedWriteForReadOnlyFileSystem());
}
virtual Result DoCleanDirectoryRecursively(const fs::Path &path) override final {
AMS_UNUSED(path);
return fs::ResultUnsupportedWriteForReadOnlyFileSystem();
R_THROW(fs::ResultUnsupportedWriteForReadOnlyFileSystem());
}
virtual Result DoGetFreeSpaceSize(s64 *out, const fs::Path &path) override final {
AMS_UNUSED(out, path);
return fs::ResultUnsupportedCommitProvisionallyForReadOnlyFileSystem();
R_THROW(fs::ResultUnsupportedCommitProvisionallyForReadOnlyFileSystem());
}
virtual Result DoGetTotalSpaceSize(s64 *out, const fs::Path &path) override final {
AMS_UNUSED(out, path);
return fs::ResultUnsupportedCommitProvisionallyForReadOnlyFileSystem();
R_THROW(fs::ResultUnsupportedCommitProvisionallyForReadOnlyFileSystem());
}
virtual Result DoCommitProvisionally(s64 counter) override final {
AMS_UNUSED(counter);
return fs::ResultUnsupportedGetTotalSpaceSizeForReadOnlyFileSystem();
R_THROW(fs::ResultUnsupportedGetTotalSpaceSizeForReadOnlyFileSystem());
}
};

View file

@ -181,7 +181,7 @@ namespace ams::fs {
R_UNLESS(file != nullptr, fs::ResultAllocationMemoryFailedNew());
*out_file = std::move(file);
return ResultSuccess();
R_SUCCEED();
}
virtual Result DoOpenDirectory(std::unique_ptr<fsa::IDirectory> *out_dir, const fs::Path &path, OpenDirectoryMode mode) override final {
@ -195,7 +195,7 @@ namespace ams::fs {
R_UNLESS(dir != nullptr, fs::ResultAllocationMemoryFailedNew());
*out_dir = std::move(dir);
return ResultSuccess();
R_SUCCEED();
}
virtual Result DoCommit() override final {

View file

@ -54,7 +54,7 @@ namespace ams::fs {
virtual Result OperateRange(void *dst, size_t dst_size, OperationId op_id, s64 offset, s64 size, const void *src, size_t src_size) override {
/* TODO: How to deal with this? */
AMS_UNUSED(dst, dst_size, op_id, offset, size, src, src_size);
return fs::ResultUnsupportedOperation();
R_THROW(fs::ResultUnsupportedOperation());
};
};
#endif

View file

@ -121,7 +121,7 @@ namespace ams::fs {
R_TRY(m_base_storage->SetSize(m_offset + size));
m_size = size;
return ResultSuccess();
R_SUCCEED();
}
virtual Result GetSize(s64 *out) override {
@ -129,7 +129,7 @@ namespace ams::fs {
R_UNLESS(this->IsValid(), fs::ResultNotInitialized());
*out = m_size;
return ResultSuccess();
R_SUCCEED();
}
virtual Result OperateRange(void *dst, size_t dst_size, OperationId op_id, s64 offset, s64 size, const void *src, size_t src_size) override {

View file

@ -29,7 +29,7 @@ namespace ams::fs::fsa {
R_UNLESS(out_count != nullptr, fs::ResultNullptrArgument());
if (max_entries == 0) {
*out_count = 0;
return ResultSuccess();
R_SUCCEED();
}
R_UNLESS(out_entries != nullptr, fs::ResultNullptrArgument());
R_UNLESS(max_entries > 0, fs::ResultInvalidArgument());

View file

@ -44,10 +44,10 @@ namespace ams::fs::impl {
case PriorityRaw_Realtime: *out = TlsIoPriority_Realtime; break;
case PriorityRaw_Low: *out = TlsIoPriority_Low; break;
case PriorityRaw_Background: *out = TlsIoPriority_Background; break;
default: return fs::ResultInvalidArgument();
default: R_THROW(fs::ResultInvalidArgument());
}
return ResultSuccess();
R_SUCCEED();
}
constexpr inline Result ConvertTlsIoPriorityToFsPriority(PriorityRaw *out, u8 tls_io) {
@ -58,10 +58,10 @@ namespace ams::fs::impl {
case TlsIoPriority_Realtime: *out = PriorityRaw_Realtime; break;
case TlsIoPriority_Low: *out = PriorityRaw_Low; break;
case TlsIoPriority_Background: *out = PriorityRaw_Background; break;
default: return fs::ResultInvalidArgument();
default: R_THROW(fs::ResultInvalidArgument());
}
return ResultSuccess();
R_SUCCEED();
}
inline u8 GetTlsIoPriority(os::ThreadType *thread) {

View file

@ -46,14 +46,14 @@ namespace ams::fssystem::buffers {
}
} R_END_TRY_CATCH;
return ResultSuccess();
R_SUCCEED();
}
}
template<typename F>
Result DoContinuouslyUntilBufferIsAllocated(F f, const char *function_name) {
R_TRY(DoContinuouslyUntilBufferIsAllocated(f, []() ALWAYS_INLINE_LAMBDA { return ResultSuccess(); }, function_name));
return ResultSuccess();
R_TRY(DoContinuouslyUntilBufferIsAllocated(f, []() ALWAYS_INLINE_LAMBDA { R_SUCCEED(); }, function_name));
R_SUCCEED();
}
/* ACCURATE_TO_VERSION: Unknown */
@ -110,10 +110,10 @@ namespace ams::fssystem::buffers {
if (buffer.first != 0) {
buffer_manager->DeallocateBuffer(buffer.first, buffer.second);
}
return fs::ResultBufferAllocationFailed();
R_THROW(fs::ResultBufferAllocationFailed());
}
*out = buffer;
return ResultSuccess();
R_SUCCEED();
};
if (context == nullptr || !context->IsNeedBlocking()) {
@ -125,7 +125,7 @@ namespace ams::fssystem::buffers {
}
AMS_ASSERT(out->first != 0);
return ResultSuccess();
R_SUCCEED();
}
}

View file

@ -155,7 +155,7 @@ namespace ams::fssystem {
m_external_attr_info_buffer = reinterpret_cast<char *>(aligned_attr_info_buf);
m_external_attr_info_count = static_cast<s32>((work_end - aligned_attr_info_buf) / sizeof(AttrInfo));
return ResultSuccess();
R_SUCCEED();
}
void Finalize();
@ -216,7 +216,7 @@ namespace ams::fssystem {
m_peak_free_size = m_total_size;
m_peak_total_allocatable_size = m_total_size;
return ResultSuccess();
R_SUCCEED();
}
Result Initialize(s32 max_cache_count, uintptr_t address, size_t buffer_size, size_t block_size, s32 max_order) {
@ -228,7 +228,7 @@ namespace ams::fssystem {
m_peak_free_size = m_total_size;
m_peak_total_allocatable_size = m_total_size;
return ResultSuccess();
R_SUCCEED();
}
Result Initialize(s32 max_cache_count, uintptr_t address, size_t buffer_size, size_t block_size, void *work, size_t work_size) {
@ -245,7 +245,7 @@ namespace ams::fssystem {
m_peak_free_size = m_total_size;
m_peak_total_allocatable_size = m_total_size;
return ResultSuccess();
R_SUCCEED();
}
Result Initialize(s32 max_cache_count, uintptr_t address, size_t buffer_size, size_t block_size, s32 max_order, void *work, size_t work_size) {
@ -262,7 +262,7 @@ namespace ams::fssystem {
m_peak_free_size = m_total_size;
m_peak_total_allocatable_size = m_total_size;
return ResultSuccess();
R_SUCCEED();
}
void Finalize() {

View file

@ -106,7 +106,7 @@ namespace ams::fssystem {
}
*out = m_base_storage_size;
return ResultSuccess();
R_SUCCEED();
}
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 {
@ -208,7 +208,7 @@ namespace ams::fssystem {
}
*out = m_base_storage_size;
return ResultSuccess();
R_SUCCEED();
}
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 {
@ -295,7 +295,7 @@ namespace ams::fssystem {
}
*out = m_base_storage_size;
return ResultSuccess();
R_SUCCEED();
}
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 {

View file

@ -110,7 +110,7 @@ namespace ams::fssystem {
/* Return the allocated object. */
*out = std::move(p);
return ResultSuccess();
R_SUCCEED();
}
}

View file

@ -40,13 +40,13 @@ namespace ams::fssystem {
virtual Result QueryAppropriateOffset(s64 *out, s64 offset, s64 access_size, s64 alignment_size) override {
/* Align the access. */
*out = util::AlignDown(offset + access_size, alignment_size);
return ResultSuccess();
R_SUCCEED();
}
virtual Result QueryInvocationCount(s64 *out, s64 start_offset, s64 end_offset, s64 access_size, s64 alignment_size) override {
/* Determine aligned access count. */
*out = util::DivideUp(end_offset - util::AlignDown(start_offset, alignment_size), access_size);
return ResultSuccess();
R_SUCCEED();
}
};

View file

@ -150,7 +150,7 @@ namespace ams::fssystem {
}
out_info->SetSkipCount(entry_index - param.entry_index);
return ResultSuccess();
R_SUCCEED();
}
template<typename EntryType>

View file

@ -144,7 +144,7 @@ namespace ams::fssystem {
cur_offset += cur_size;
}
return ResultSuccess();
R_SUCCEED();
}
}

View file

@ -58,7 +58,7 @@ namespace ams::fssystem {
virtual Result Read(s64 offset, void *buffer, size_t size) override;
virtual Result Write(s64 offset, const void *buffer, size_t size) override;
virtual Result SetSize(s64 size) override { AMS_UNUSED(size); return fs::ResultUnsupportedSetSizeForIntegrityVerificationStorage(); }
virtual Result SetSize(s64 size) override { AMS_UNUSED(size); R_THROW(fs::ResultUnsupportedSetSizeForIntegrityVerificationStorage()); }
virtual Result GetSize(s64 *out) override;
virtual Result Flush() override;

View file

@ -37,7 +37,7 @@ namespace ams::i2c {
R_TRY(i2c::ExecuteCommandList(out, sizeof(*out), session, cmd_list, formatter.GetCurrentLength()));
return ResultSuccess();
R_SUCCEED();
}
template<typename RegType> requires std::unsigned_integral<RegType>
@ -50,7 +50,7 @@ namespace ams::i2c {
constexpr i2c::TransactionOption StopOption = static_cast<i2c::TransactionOption>(i2c::TransactionOption_StartCondition | i2c::TransactionOption_StopCondition);
R_TRY(i2c::Send(session, buf, sizeof(buf), StopOption));
return ResultSuccess();
R_SUCCEED();
}
}

View file

@ -72,7 +72,7 @@ namespace ams::kvdb {
R_UNLESS(m_buffer != nullptr, kvdb::ResultAllocationFailed());
m_size = size;
return ResultSuccess();
R_SUCCEED();
}
Result Initialize(const void *buf, size_t size) {
@ -82,7 +82,7 @@ namespace ams::kvdb {
/* Copy the input data in. */
std::memcpy(m_buffer, buf, size);
return ResultSuccess();
R_SUCCEED();
}
};
}

View file

@ -51,7 +51,7 @@ namespace ams::kvdb {
LruHeader new_header = { .entry_count = 0, };
R_TRY(fs::WriteFile(file, 0, std::addressof(new_header), sizeof(new_header), fs::WriteOption::Flush));
return ResultSuccess();
R_SUCCEED();
}
private:
void RemoveIndex(size_t i) {
@ -91,7 +91,7 @@ namespace ams::kvdb {
/* Read entries. */
R_TRY(fs::ReadFile(file, sizeof(m_header), m_keys, BufferSize));
return ResultSuccess();
R_SUCCEED();
}
Result Save() {
@ -109,7 +109,7 @@ namespace ams::kvdb {
/* Flush. */
R_TRY(fs::FlushFile(file));
return ResultSuccess();
R_SUCCEED();
}
size_t GetCount() const {
@ -223,7 +223,7 @@ namespace ams::kvdb {
/* The entry exists and is the correct type. */
*out = true;
return ResultSuccess();
R_SUCCEED();
}
static Result DirectoryExists(bool *out, const char *path) {
@ -239,7 +239,7 @@ namespace ams::kvdb {
R_TRY(LeastRecentlyUsedList::CreateNewList(GetLeastRecentlyUsedListPath(dir)));
R_TRY(fs::CreateDirectory(dir));
return ResultSuccess();
R_SUCCEED();
}
static Result ValidateExistingCache(const char *dir) {
@ -254,7 +254,7 @@ namespace ams::kvdb {
/* If one exists but not the other, we have an invalid state. */
R_UNLESS(has_lru && has_kvs, kvdb::ResultInvalidFilesystemState());
return ResultSuccess();
R_SUCCEED();
}
private:
void RemoveOldestKey() {
@ -276,7 +276,7 @@ namespace ams::kvdb {
/* layout it can't really be fixed without breaking existing devices... */
R_TRY(m_kvs.Initialize(dir));
return ResultSuccess();
R_SUCCEED();
}
size_t GetCount() const {
@ -335,7 +335,7 @@ namespace ams::kvdb {
if (m_lru_list.GetCount() == 1) {
m_lru_list.Pop();
R_TRY(m_lru_list.Save());
return fs::ResultNotEnoughFreeSpace();
R_THROW(fs::ResultNotEnoughFreeSpace());
}
/* Otherwise, remove the oldest element from the cache and try again. */
@ -351,7 +351,7 @@ namespace ams::kvdb {
/* Save the list. */
R_TRY(m_lru_list.Save());
return ResultSuccess();
R_SUCCEED();
}
template<typename Value>
@ -365,7 +365,7 @@ namespace ams::kvdb {
R_TRY(m_kvs.Remove(key));
R_TRY(m_lru_list.Save());
return ResultSuccess();
R_SUCCEED();
}
Result RemoveAll() {
@ -375,7 +375,7 @@ namespace ams::kvdb {
}
R_TRY(m_lru_list.Save());
return ResultSuccess();
R_SUCCEED();
}
};

View file

@ -93,7 +93,7 @@ namespace ams::kvdb {
size_t size = 0;
R_TRY(this->Get(std::addressof(size), out_value, sizeof(Value), key));
AMS_ABORT_UNLESS(size >= sizeof(Value));
return ResultSuccess();
R_SUCCEED();
}
template<typename Key>

View file

@ -125,7 +125,7 @@ namespace ams::kvdb {
R_UNLESS(m_entries != nullptr, kvdb::ResultAllocationFailed());
m_capacity = capacity;
m_memory_resource = mr;
return ResultSuccess();
R_SUCCEED();
}
Result Set(const Key &key, const void *value, size_t value_size) {
@ -148,14 +148,14 @@ namespace ams::kvdb {
/* Save the new Entry in the map. */
*it = Entry(key, new_value, value_size);
return ResultSuccess();
R_SUCCEED();
}
Result AddUnsafe(const Key &key, void *value, size_t value_size) {
R_UNLESS(m_count < m_capacity, kvdb::ResultOutOfKeyResource());
m_entries[m_count++] = Entry(key, value, value_size);
return ResultSuccess();
R_SUCCEED();
}
Result Remove(const Key &key) {
@ -167,7 +167,7 @@ namespace ams::kvdb {
m_memory_resource->Deallocate(it->GetValuePointer(), it->GetValueSize());
std::memmove(it, it + 1, sizeof(*it) * (this->end() - (it + 1)));
m_count--;
return ResultSuccess();
R_SUCCEED();
}
Entry *begin() {
@ -276,7 +276,7 @@ namespace ams::kvdb {
R_TRY(m_index.Initialize(capacity, mr));
m_memory_resource = mr;
return ResultSuccess();
R_SUCCEED();
}
Result Initialize(size_t capacity, MemoryResource *mr) {
@ -288,7 +288,7 @@ namespace ams::kvdb {
/* Initialize our index. */
R_TRY(m_index.Initialize(capacity, mr));
m_memory_resource = mr;
return ResultSuccess();
R_SUCCEED();
}
size_t GetCount() const {
@ -384,7 +384,7 @@ namespace ams::kvdb {
size_t size = std::min(max_out_size, it->GetValueSize());
std::memcpy(out_value, it->GetValuePointer(), size);
*out_size = size;
return ResultSuccess();
R_SUCCEED();
}
template<typename Value = void>
@ -394,7 +394,7 @@ namespace ams::kvdb {
R_UNLESS(it != this->end(), kvdb::ResultKeyNotFound());
*out_value = it->template GetValuePointer<Value>();
return ResultSuccess();
R_SUCCEED();
}
template<typename Value = void>
@ -404,7 +404,7 @@ namespace ams::kvdb {
R_UNLESS(it != this->end(), kvdb::ResultKeyNotFound());
*out_value = it->template GetValuePointer<Value>();
return ResultSuccess();
R_SUCCEED();
}
template<typename Value>
@ -414,7 +414,7 @@ namespace ams::kvdb {
R_UNLESS(it != this->end(), kvdb::ResultKeyNotFound());
*out_value = it->template GetValue<Value>();
return ResultSuccess();
R_SUCCEED();
}
Result GetValueSize(size_t *out_size, const Key &key) const {
@ -423,7 +423,7 @@ namespace ams::kvdb {
R_UNLESS(it != this->end(), kvdb::ResultKeyNotFound());
*out_size = it->GetValueSize();
return ResultSuccess();
R_SUCCEED();
}
Result Remove(const Key &key) {
@ -485,7 +485,7 @@ namespace ams::kvdb {
R_TRY(fs::WriteFile(file, 0, buf, size, fs::WriteOption::Flush));
}
return ResultSuccess();
R_SUCCEED();
}
Result Commit(const AutoBuffer &buffer, bool destructive) {
@ -503,7 +503,7 @@ namespace ams::kvdb {
R_TRY(fs::RenameFile(m_temp_path.Get(), m_path.Get()));
}
return ResultSuccess();
R_SUCCEED();
}
size_t GetArchiveSize() const {
@ -530,7 +530,7 @@ namespace ams::kvdb {
R_TRY(dst->Initialize(static_cast<size_t>(archive_size)));
R_TRY(fs::ReadFile(file, 0, dst->Get(), dst->GetSize()));
return ResultSuccess();
R_SUCCEED();
}
};

View file

@ -72,7 +72,7 @@ namespace ams::ncm {
R_UNLESS(m_buffer != nullptr, ncm::ResultAllocationFailed());
m_size = size;
return ResultSuccess();
R_SUCCEED();
}
Result Initialize(const void *buf, size_t size) {
@ -82,7 +82,7 @@ namespace ams::ncm {
/* Copy the input data in. */
std::memcpy(m_buffer, buf, size);
return ResultSuccess();
R_SUCCEED();
}
};

View file

@ -55,7 +55,7 @@ namespace ams::ncm {
R_TRY(m_interface->Get(std::addressof(size), key, sf::OutBuffer(dst, dst_size)));
*out_size = size;
return ResultSuccess();
R_SUCCEED();
}
#define AMS_NCM_DEFINE_GETTERS(Kind, IdType) \
@ -152,7 +152,7 @@ namespace ams::ncm {
R_TRY(m_interface->GetSize(std::addressof(size), key));
*out_size = size;
return ResultSuccess();
R_SUCCEED();
}
Result GetRequiredSystemVersion(u32 *out_version, const ContentMetaKey &key) {

View file

@ -149,7 +149,7 @@ namespace ams::ncm {
StorageId GetInstallStorage() const { return m_install_storage; }
virtual Result OnPrepareComplete() { return ResultSuccess(); }
virtual Result OnPrepareComplete() { R_SUCCEED(); }
Result GetSystemUpdateTaskApplyInfo(SystemUpdateTaskApplyInfo *out);
@ -164,9 +164,9 @@ namespace ams::ncm {
Result VerifyAllNotCommitted(const StorageContentMetaKey *keys, s32 num_keys);
virtual Result PrepareInstallContentMetaData() = 0;
virtual Result GetLatestVersion(util::optional<u32> *out_version, u64 id) { AMS_UNUSED(out_version, id); return ncm::ResultContentMetaNotFound(); }
virtual Result GetLatestVersion(util::optional<u32> *out_version, u64 id) { AMS_UNUSED(out_version, id); R_THROW(ncm::ResultContentMetaNotFound()); }
virtual Result OnExecuteComplete() { return ResultSuccess(); }
virtual Result OnExecuteComplete() { R_SUCCEED(); }
Result WritePlaceHolder(const ContentMetaKey &key, InstallContentInfo *content_info);
virtual Result OnWritePlaceHolder(const ContentMetaKey &key, InstallContentInfo *content_info) = 0;
@ -194,7 +194,7 @@ namespace ams::ncm {
Result ReadContentMetaInfoList(s32 *out_count, std::unique_ptr<ContentMetaInfo[]> *out_meta_infos, const ContentMetaKey &key);
Result ListRightsIdsByInstallContentMeta(s32 *out_count, Span<RightsId> out_span, const InstallContentMeta &content_meta, s32 offset);
public:
virtual Result CheckInstallable() { return ResultSuccess(); }
virtual Result CheckInstallable() { R_SUCCEED(); }
void SetFirmwareVariationId(FirmwareVariationId id) { m_firmware_variation_id = id; }
Result ListRightsIds(s32 *out_count, Span<RightsId> out_span, const ContentMetaKey &key, s32 offset);

View file

@ -52,7 +52,7 @@ namespace ams::pgl {
os::AttachReadableHandleToSystemEvent(out, handle.GetOsHandle(), handle.IsManaged(), os::EventClearMode_AutoClear);
handle.Detach();
return ResultSuccess();
R_SUCCEED();
}
virtual Result GetProcessEventInfo(pm::ProcessEventInfo *out) override {
@ -74,7 +74,7 @@ namespace ams::pgl {
os::NativeHandle handle;
R_TRY(m_tipc_interface.GetProcessEventHandle(std::addressof(handle)));
os::AttachReadableHandleToSystemEvent(out, handle, true, os::EventClearMode_AutoClear);
return ResultSuccess();
R_SUCCEED();
}
virtual Result GetProcessEventInfo(pm::ProcessEventInfo *out) override {

View file

@ -174,7 +174,7 @@ namespace ams::sf::hipc {
this->RegisterServerImpl(server, port_handle, false);
return ResultSuccess();
R_SUCCEED();
}
#if AMS_SF_MITM_SUPPORTED
@ -220,7 +220,7 @@ namespace ams::sf::hipc {
this->RegisterServerImpl(server, port_handle, true);
return ResultSuccess();
R_SUCCEED();
}
#endif
public:

View file

@ -52,14 +52,14 @@ namespace ams::sf {
constexpr inline Result MarshalProcessId(ClientProcessId &client, const os::ProcessId &client_process_id) {
client.SetValue(client_process_id);
return ResultSuccess();
R_SUCCEED();
}
constexpr inline Result MarshalProcessId(ClientAppletResourceUserId &client, const os::ProcessId &client_process_id) {
if (client.GetValue() != client_process_id && client.GetValue() != os::ProcessId{}) {
return sf::ResultPreconditionViolation();
R_THROW(sf::ResultPreconditionViolation());
}
return ResultSuccess();
R_SUCCEED();
}
}
@ -727,7 +727,7 @@ namespace ams::sf::impl {
if constexpr (NumInObjects > 0) {
R_TRY(processor->GetInObjects(m_in_object_holders.data()));
}
return ResultSuccess();
R_SUCCEED();
}
template<typename ServiceImplTuple>
@ -749,7 +749,7 @@ namespace ams::sf::impl {
_SF_IN_OUT_HOLDER_VALIDATE_IN_OBJECT(6);
_SF_IN_OUT_HOLDER_VALIDATE_IN_OBJECT(7);
#undef _SF_IN_OUT_HOLDER_VALIDATE_IN_OBJECT
return ResultSuccess();
R_SUCCEED();
}
template<size_t Index, typename Interface>
@ -792,7 +792,7 @@ namespace ams::sf::impl {
virtual Result GetInObjects(cmif::ServiceObjectHolder *in_objects) const override final {
/* By default, InObjects aren't supported. */
AMS_UNUSED(in_objects);
return sf::ResultNotSupported();
R_THROW(sf::ResultNotSupported());
}
};
@ -820,7 +820,7 @@ namespace ams::sf::impl {
is_request_valid &= meta_raw_size >= command_raw_size;
R_UNLESS(is_request_valid, sf::hipc::ResultInvalidCmifRequest());
return ResultSuccess();
R_SUCCEED();
}
virtual HipcRequest PrepareForReply(const cmif::ServiceDispatchContext &ctx, cmif::PointerAndSize &out_raw_data, const cmif::ServerMessageRuntimeMetadata runtime_metadata) override final {
@ -1022,7 +1022,7 @@ namespace ams::sf::impl {
if constexpr (CommandMeta::NumOutHipcPointerBuffers > 0) {
R_UNLESS(pointer_buffer_tail <= pointer_buffer_head, sf::hipc::ResultPointerBufferTooSmall());
}
return ResultSuccess();
R_SUCCEED();
}
NX_CONSTEXPR void SetOutBuffers(const HipcRequest &response, const BufferArrayType &buffers, const std::array<bool, CommandMeta::NumBuffers> &is_buffer_map_alias) {
@ -1122,7 +1122,7 @@ namespace ams::sf::impl {
R_UNLESS(out_raw_data.GetSize() >= sizeof(*header), sf::cmif::ResultInvalidHeaderSize());
out_raw_data = cmif::PointerAndSize(out_raw_data.GetAddress() + sizeof(*header), out_raw_data.GetSize() - sizeof(*header));
*out_header_ptr = header;
return ResultSuccess();
R_SUCCEED();
}
template<typename CommandMeta, typename... Arguments>
@ -1242,7 +1242,7 @@ namespace ams::sf::impl {
#undef _SF_IMPL_PROCESSOR_MARSHAL_OUT_OBJECT
in_out_objects_holder.SetOutObjects(ctx, response);
return ResultSuccess();
R_SUCCEED();
}
template<auto ServiceCommandImpl, typename Return, typename ClassType, typename... Arguments>
@ -1259,7 +1259,7 @@ namespace ams::sf::impl {
return (static_cast<ClassType *>(srv_obj)->*ServiceCommandImpl)(std::forward<Arguments>(args)...);
} else {
(static_cast<ClassType *>(srv_obj)->*ServiceCommandImpl)(std::forward<Arguments>(args)...);
return ResultSuccess();
R_SUCCEED();
}
});
}

View file

@ -135,7 +135,7 @@ namespace ams::tipc::impl {
if constexpr (HasDefaultServiceCommandProcessor<ImplType>) { \
return impl->ProcessDefaultServiceCommand(message_buffer); \
} else { \
return tipc::ResultInvalidMethod(); \
R_THROW(tipc::ResultInvalidMethod()); \
} \
} \
\

View file

@ -572,7 +572,7 @@ namespace ams::tipc::impl {
R_UNLESS(message_buffer.Get32(SpecialHeaderIndex) == ExpectedSpecialHeader, tipc::ResultInvalidMessageFormat());
}
return ResultSuccess();
R_SUCCEED();
}
template<size_t Ix>
@ -631,14 +631,14 @@ namespace ams::tipc::impl {
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)...);
return ResultSuccess();
R_SUCCEED();
}
}(std::make_index_sequence<std::tuple_size<typename CommandMeta::ArgsType>::value>());
/* Serialize output. */
Processor::SerializeResults(message_buffer, command_result, out_raw_holder, out_handles_holder);
return ResultSuccess();
R_SUCCEED();
}
}

View file

@ -122,7 +122,7 @@ namespace ams::tipc {
return result;
} else {
return ResultSuccess();
R_SUCCEED();
}
}

View file

@ -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. */
return tipc::ResultRequestDeferred::Includes(method_result);
R_THROW(tipc::ResultRequestDeferred::Includes(method_result));
} else {
/* If deferral isn't supported, requests are never deferred. */
return false;
@ -501,7 +501,7 @@ namespace ams::tipc {
/* Add the session to the least burdened manager. */
best_manager->AddSession(session_handle, object);
return ResultSuccess();
R_SUCCEED();
}
private:
template<size_t Ix> requires (Ix < NumPorts)
@ -795,7 +795,7 @@ namespace ams::tipc {
/* Add the session to our manager. */
m_port_manager.AddSession(session_handle, object);
return ResultSuccess();
R_SUCCEED();
}
private:
void LoopProcess(PortManagerBase &port_manager) {