ams: globally prefer R_RETURN to return for ams::Result

This commit is contained in:
Michael Scire
2022-03-26 14:48:33 -07:00
parent dd78ede99f
commit bbf22b4c60
325 changed files with 1955 additions and 1993 deletions

View File

@@ -55,19 +55,19 @@ namespace ams::ncm {
/* Service API. */
Result CreateContentStorage(StorageId storage_id) {
return g_content_manager->CreateContentStorage(storage_id);
R_RETURN(g_content_manager->CreateContentStorage(storage_id));
}
Result CreateContentMetaDatabase(StorageId storage_id) {
return g_content_manager->CreateContentMetaDatabase(storage_id);
R_RETURN(g_content_manager->CreateContentMetaDatabase(storage_id));
}
Result VerifyContentStorage(StorageId storage_id) {
return g_content_manager->VerifyContentStorage(storage_id);
R_RETURN(g_content_manager->VerifyContentStorage(storage_id));
}
Result VerifyContentMetaDatabase(StorageId storage_id) {
return g_content_manager->VerifyContentMetaDatabase(storage_id);
R_RETURN(g_content_manager->VerifyContentMetaDatabase(storage_id));
}
Result OpenContentStorage(ContentStorage *out, StorageId storage_id) {
@@ -87,41 +87,41 @@ namespace ams::ncm {
}
Result CleanupContentMetaDatabase(StorageId storage_id) {
return g_content_manager->CleanupContentMetaDatabase(storage_id);
R_RETURN(g_content_manager->CleanupContentMetaDatabase(storage_id));
}
Result ActivateContentStorage(StorageId storage_id) {
return g_content_manager->ActivateContentStorage(storage_id);
R_RETURN(g_content_manager->ActivateContentStorage(storage_id));
}
Result InactivateContentStorage(StorageId storage_id) {
return g_content_manager->InactivateContentStorage(storage_id);
R_RETURN(g_content_manager->InactivateContentStorage(storage_id));
}
Result ActivateContentMetaDatabase(StorageId storage_id) {
/* On < 2.0.0, this command doesn't exist, and databases are activated as needed on open. */
R_SUCCEED_IF(hos::GetVersion() < hos::Version_2_0_0);
return g_content_manager->ActivateContentMetaDatabase(storage_id);
R_RETURN(g_content_manager->ActivateContentMetaDatabase(storage_id));
}
Result InactivateContentMetaDatabase(StorageId storage_id) {
/* On < 2.0.0, this command doesn't exist. */
R_SUCCEED_IF(hos::GetVersion() < hos::Version_2_0_0);
return g_content_manager->InactivateContentMetaDatabase(storage_id);
R_RETURN(g_content_manager->InactivateContentMetaDatabase(storage_id));
}
Result InvalidateRightsIdCache() {
return g_content_manager->InvalidateRightsIdCache();
R_RETURN(g_content_manager->InvalidateRightsIdCache());
}
/* Deprecated API. */
Result CloseContentStorageForcibly(StorageId storage_id) {
AMS_ABORT_UNLESS(hos::GetVersion() == hos::Version_1_0_0);
return g_content_manager->CloseContentStorageForcibly(storage_id);
R_RETURN(g_content_manager->CloseContentStorageForcibly(storage_id));
}
Result CloseContentMetaDatabaseForcibly(StorageId storage_id) {
AMS_ABORT_UNLESS(hos::GetVersion() == hos::Version_1_0_0);
return g_content_manager->CloseContentMetaDatabaseForcibly(storage_id);
R_RETURN(g_content_manager->CloseContentMetaDatabaseForcibly(storage_id));
}
}

View File

@@ -28,7 +28,7 @@ namespace ams::ncm {
const size_t path_len = util::SNPrintf(package_path, sizeof(package_path), "%s%s", package_root_path, entry_path);
AMS_ABORT_UNLESS(path_len < MaxPackagePathLength);
return fs::ConvertToFsCommonPath(dst, dst_size, package_path);
R_RETURN(fs::ConvertToFsCommonPath(dst, dst_size, package_path));
}
Result LoadContentMeta(ncm::AutoBuffer *out, const char *package_root_path, const fs::DirectoryEntry &entry) {
@@ -37,7 +37,7 @@ namespace ams::ncm {
char path[MaxPackagePathLength];
R_TRY(ConvertToFsCommonPath(path, sizeof(path), package_root_path, entry.name));
return ncm::ReadContentMetaPathWithoutExtendedDataOrDigest(out, path);
R_RETURN(ncm::ReadContentMetaPathWithoutExtendedDataOrDigest(out, path));
}
template<typename F>
@@ -123,7 +123,7 @@ namespace ams::ncm {
}
/* Commit our changes. */
return m_db->Commit();
R_RETURN(m_db->Commit());
}
Result ContentMetaDatabaseBuilder::BuildFromPackage(const char *package_root_path) {
@@ -144,11 +144,11 @@ namespace ams::ncm {
R_UNLESS(content_id, ncm::ResultInvalidPackageFormat());
/* Build using the meta. */
return this->BuildFromPackageContentMeta(package_meta.Get(), package_meta.GetSize(), ContentInfo::Make(*content_id, entry.file_size, ContentType::Meta));
R_RETURN(this->BuildFromPackageContentMeta(package_meta.Get(), package_meta.GetSize(), ContentInfo::Make(*content_id, entry.file_size, ContentType::Meta)));
}));
/* Commit our changes. */
return m_db->Commit();
R_RETURN(m_db->Commit());
}
Result ContentMetaDatabaseBuilder::Cleanup() {
@@ -171,7 +171,7 @@ namespace ams::ncm {
}
/* Commit our deletions. */
return m_db->Commit();
R_RETURN(m_db->Commit());
}
Result ListApplicationPackage(s32 *out_count, ApplicationId *out_ids, size_t max_out_ids, const char *package_root_path) {

View File

@@ -272,7 +272,7 @@ namespace ams::ncm {
R_TRY(impl::CopyFile(savedata_db_path, bis_db_path));
/* Commit the import. */
return fs::CommitSaveData(root->mount_name);
R_RETURN(fs::CommitSaveData(root->mount_name));
}
Result ContentManagerImpl::BuildContentMetaDatabase(StorageId storage_id) {
@@ -289,10 +289,10 @@ namespace ams::ncm {
/* Create a builder, and build. */
ContentMetaDatabaseBuilder builder(std::addressof(meta_db));
return builder.BuildFromStorage(std::addressof(storage));
R_RETURN(builder.BuildFromStorage(std::addressof(storage)));
} else {
/* On 5.0.0+, building just performs an import. */
return this->ImportContentMetaDatabase(storage_id, false);
R_RETURN(this->ImportContentMetaDatabase(storage_id, false));
}
}
@@ -398,7 +398,7 @@ namespace ams::ncm {
R_TRY(fs::EnsureDirectory(root->path));
/* Initialize content and placeholder directories for the root. */
return ContentStorageImpl::InitializeBase(root->path);
R_RETURN(ContentStorageImpl::InitializeBase(root->path));
}
Result ContentManagerImpl::CreateContentMetaDatabase(StorageId storage_id) {
@@ -418,7 +418,7 @@ namespace ams::ncm {
R_TRY(fs::EnsureDirectory(root->path));
/* Commit our changes. */
return fs::CommitSaveData(root->mount_name);
R_RETURN(fs::CommitSaveData(root->mount_name));
}
Result ContentManagerImpl::VerifyContentStorage(StorageId storage_id) {
@@ -438,7 +438,7 @@ namespace ams::ncm {
ON_SCOPE_EXIT { fs::Unmount(mount_name.str); };
/* Ensure the root, content and placeholder directories exist for the storage. */
return ContentStorageImpl::VerifyBase(path);
R_RETURN(ContentStorageImpl::VerifyBase(path));
}
Result ContentManagerImpl::VerifyContentMetaDatabase(StorageId storage_id) {
@@ -509,11 +509,11 @@ namespace ams::ncm {
}
Result ContentManagerImpl::CloseContentStorageForcibly(StorageId storage_id) {
return this->InactivateContentStorage(storage_id);
R_RETURN(this->InactivateContentStorage(storage_id));
}
Result ContentManagerImpl::CloseContentMetaDatabaseForcibly(StorageId storage_id) {
return this->InactivateContentMetaDatabase(storage_id);
R_RETURN(this->InactivateContentMetaDatabase(storage_id));
}
Result ContentManagerImpl::CleanupContentMetaDatabase(StorageId storage_id) {
@@ -527,7 +527,7 @@ namespace ams::ncm {
R_TRY(this->GetContentMetaDatabaseRoot(std::addressof(root), storage_id));
/* Delete save data for the content meta database root. */
return fs::DeleteSaveData(root->info.space_id, root->info.id);
R_RETURN(fs::DeleteSaveData(root->info.space_id, root->info.id));
}
Result ContentManagerImpl::ActivateContentStorage(StorageId storage_id) {

View File

@@ -51,7 +51,7 @@ namespace ams::ncm {
Result ContentMetaDatabaseImpl::Set(const ContentMetaKey &key, const sf::InBuffer &value) {
R_TRY(this->EnsureEnabled());
return m_kvs->Set(key, value.GetPointer(), value.GetSize());
R_RETURN(m_kvs->Set(key, value.GetPointer(), value.GetSize()));
}
Result ContentMetaDatabaseImpl::Get(sf::Out<u64> out_size, const ContentMetaKey &key, const sf::OutBuffer &out_value) {
@@ -78,7 +78,7 @@ namespace ams::ncm {
}
Result ContentMetaDatabaseImpl::GetContentIdByType(sf::Out<ContentId> out_content_id, const ContentMetaKey &key, ContentType type) {
return this->GetContentIdImpl(out_content_id.GetPointer(), key, type, util::nullopt);
R_RETURN(this->GetContentIdImpl(out_content_id.GetPointer(), key, type, util::nullopt));
}
Result ContentMetaDatabaseImpl::ListContentInfo(sf::Out<s32> out_count, const sf::OutArray<ContentInfo> &out_info, const ContentMetaKey &key, s32 offset) {
@@ -340,7 +340,7 @@ namespace ams::ncm {
/* Save and commit. */
R_TRY(m_kvs->Save());
return fs::CommitSaveData(m_mount_name);
R_RETURN(fs::CommitSaveData(m_mount_name));
}
Result ContentMetaDatabaseImpl::HasContent(sf::Out<bool> out, const ContentMetaKey &key, const ContentId &content_id) {
@@ -435,7 +435,7 @@ namespace ams::ncm {
}
Result ContentMetaDatabaseImpl::GetContentIdByTypeAndIdOffset(sf::Out<ContentId> out_content_id, const ContentMetaKey &key, ContentType type, u8 id_offset) {
return this->GetContentIdImpl(out_content_id.GetPointer(), key, type, util::make_optional(id_offset));
R_RETURN(this->GetContentIdImpl(out_content_id.GetPointer(), key, type, util::make_optional(id_offset)));
}
Result ContentMetaDatabaseImpl::GetCount(sf::Out<u32> out_count) {

View File

@@ -50,7 +50,7 @@ namespace ams::ncm {
Result GetContentMetaPointer(const void **out_value_ptr, size_t *out_size, const ContentMetaKey &key) const {
R_TRY(this->GetContentMetaSize(out_size, key));
return m_kvs->GetValuePointer(reinterpret_cast<const ContentMetaHeader **>(out_value_ptr), key);
R_RETURN(m_kvs->GetValuePointer(reinterpret_cast<const ContentMetaHeader **>(out_value_ptr), key));
}
public:
/* Actual commands. */

View File

@@ -21,7 +21,7 @@ namespace ams::ncm {
namespace {
Result MountContentMetaByRemoteFileSystemProxy(const char *mount_name, const char *path) {
return fs::MountContent(mount_name, path, fs::ContentType_Meta);
R_RETURN(fs::MountContent(mount_name, path, fs::ContentType_Meta));
}
constinit MountContentMetaFunction g_mount_content_meta_func = MountContentMetaByRemoteFileSystemProxy;
@@ -219,7 +219,7 @@ namespace ams::ncm {
R_UNLESS(force_refer_to_base, ncm::ResultInvalidFirmwareVariation());
/* Force a referral to base. */
return ReadMetaInfoListFromBase();
R_RETURN(ReadMetaInfoListFromBase());
}
/* Obtain the variation info. */

View File

@@ -36,7 +36,7 @@ namespace ams::ncm {
Result EnsureContentDirectory(ContentId id, MakeContentPathFunction func, const char *root_path) {
PathString path;
MakeContentPath(std::addressof(path), id, func, root_path);
return fs::EnsureParentDirectory(path);
R_RETURN(fs::EnsureParentDirectory(path));
}
Result DeleteContentFile(ContentId id, MakeContentPathFunction func, const char *root_path) {
@@ -121,7 +121,7 @@ namespace ams::ncm {
template<typename F>
Result TraverseDirectory(const char *root_path, int max_level, F f) {
bool should_continue = false;
return TraverseDirectory(std::addressof(should_continue), root_path, max_level, f);
R_RETURN(TraverseDirectory(std::addressof(should_continue), root_path, max_level, f));
}
bool IsContentPath(const char *path) {
@@ -205,7 +205,7 @@ namespace ams::ncm {
m_path.Assign(dir);
/* Open the directory. */
return this->OpenCurrentDirectory();
R_RETURN(this->OpenCurrentDirectory());
}
Result ContentStorageImpl::ContentIterator::GetNext(util::optional<fs::DirectoryEntry> *out) {
@@ -291,7 +291,7 @@ namespace ams::ncm {
m_path = m_path.MakeSubString(0, i + 1);
/* Try to load again from the parent directory. */
return this->LoadEntries();
R_RETURN(this->LoadEntries());
}
ContentStorageImpl::~ContentStorageImpl() {
@@ -307,7 +307,7 @@ namespace ams::ncm {
/* Create the placeholder directory. */
PlaceHolderAccessor::MakeBaseDirectoryPath(std::addressof(path), root_path);
return fs::EnsureDirectory(path);
R_RETURN(fs::EnsureDirectory(path));
}
Result ContentStorageImpl::CleanupBase(const char *root_path) {
@@ -319,7 +319,7 @@ namespace ams::ncm {
/* Create the placeholder directory. */
PlaceHolderAccessor::MakeBaseDirectoryPath(std::addressof(path), root_path);
return CleanDirectoryRecursively(path);
R_RETURN(CleanDirectoryRecursively(path));
}
Result ContentStorageImpl::VerifyBase(const char *root_path) {
@@ -399,12 +399,12 @@ namespace ams::ncm {
Result ContentStorageImpl::CreatePlaceHolder(PlaceHolderId placeholder_id, ContentId content_id, s64 size) {
R_TRY(this->EnsureEnabled());
R_TRY(EnsureContentDirectory(content_id, m_make_content_path_func, m_root_path));
return m_placeholder_accessor.CreatePlaceHolderFile(placeholder_id, size);
R_RETURN(m_placeholder_accessor.CreatePlaceHolderFile(placeholder_id, size));
}
Result ContentStorageImpl::DeletePlaceHolder(PlaceHolderId placeholder_id) {
R_TRY(this->EnsureEnabled());
return m_placeholder_accessor.DeletePlaceHolderFile(placeholder_id);
R_RETURN(m_placeholder_accessor.DeletePlaceHolderFile(placeholder_id));
}
Result ContentStorageImpl::HasPlaceHolder(sf::Out<bool> out, PlaceHolderId placeholder_id) {
@@ -425,7 +425,7 @@ namespace ams::ncm {
/* Ensure offset is valid. */
R_UNLESS(offset >= 0, ncm::ResultInvalidOffset());
R_TRY(this->EnsureEnabled());
return m_placeholder_accessor.WritePlaceHolderFile(placeholder_id, offset, data.GetPointer(), data.GetSize());
R_RETURN(m_placeholder_accessor.WritePlaceHolderFile(placeholder_id, offset, data.GetPointer(), data.GetSize()));
}
Result ContentStorageImpl::Register(PlaceHolderId placeholder_id, ContentId content_id) {
@@ -452,7 +452,7 @@ namespace ams::ncm {
Result ContentStorageImpl::Delete(ContentId content_id) {
R_TRY(this->EnsureEnabled());
this->InvalidateFileCache();
return DeleteContentFile(content_id, m_make_content_path_func, m_root_path);
R_RETURN(DeleteContentFile(content_id, m_make_content_path_func, m_root_path));
}
Result ContentStorageImpl::Has(sf::Out<bool> out, ContentId content_id) {
@@ -692,7 +692,7 @@ namespace ams::ncm {
Result ContentStorageImpl::SetPlaceHolderSize(PlaceHolderId placeholder_id, s64 size) {
R_TRY(this->EnsureEnabled());
return m_placeholder_accessor.SetPlaceHolderFileSize(placeholder_id, size);
R_RETURN(m_placeholder_accessor.SetPlaceHolderFileSize(placeholder_id, size));
}
Result ContentStorageImpl::ReadContentIdFile(const sf::OutBuffer &buf, ContentId content_id, s64 offset) {
@@ -708,7 +708,7 @@ namespace ams::ncm {
R_TRY(this->OpenContentIdFile(content_id));
/* Read from the requested offset up to the requested size. */
return fs::ReadFile(m_cached_file_handle, offset, buf.GetPointer(), buf.GetSize());
R_RETURN(fs::ReadFile(m_cached_file_handle, offset, buf.GetPointer(), buf.GetSize()));
}
Result ContentStorageImpl::GetRightsIdFromPlaceHolderIdDeprecated(sf::Out<ams::fs::RightsId> out_rights_id, PlaceHolderId placeholder_id) {
@@ -729,7 +729,7 @@ namespace ams::ncm {
R_TRY(this->GetPlaceHolderPath(std::addressof(path), placeholder_id));
/* Get the rights id for the placeholder id. */
return GetRightsId(out_rights_id.GetPointer(), path);
R_RETURN(GetRightsId(out_rights_id.GetPointer(), path));
}
Result ContentStorageImpl::GetRightsIdFromContentIdDeprecated(sf::Out<ams::fs::RightsId> out_rights_id, ContentId content_id) {
@@ -786,15 +786,15 @@ namespace ams::ncm {
ON_SCOPE_EXIT { fs::CloseFile(file); };
/* Write the provided data to the file. */
return fs::WriteFile(file, offset, data.GetPointer(), data.GetSize(), fs::WriteOption::Flush);
R_RETURN(fs::WriteFile(file, offset, data.GetPointer(), data.GetSize(), fs::WriteOption::Flush));
}
Result ContentStorageImpl::GetFreeSpaceSize(sf::Out<s64> out_size) {
return fs::GetFreeSpaceSize(out_size.GetPointer(), m_root_path);
R_RETURN(fs::GetFreeSpaceSize(out_size.GetPointer(), m_root_path));
}
Result ContentStorageImpl::GetTotalSpaceSize(sf::Out<s64> out_size) {
return fs::GetTotalSpaceSize(out_size.GetPointer(), m_root_path);
R_RETURN(fs::GetTotalSpaceSize(out_size.GetPointer(), m_root_path));
}
Result ContentStorageImpl::FlushPlaceHolder() {

View File

@@ -72,7 +72,7 @@ namespace ams::ncm {
Result HostContentStorageImpl::GetPath(sf::Out<Path> out, ContentId content_id) {
R_TRY(this->EnsureEnabled());
return m_registered_content->GetPath(out.GetPointer(), content_id);
R_RETURN(m_registered_content->GetPath(out.GetPointer(), content_id));
}
Result HostContentStorageImpl::GetPlaceHolderPath(sf::Out<Path> out, PlaceHolderId placeholder_id) {
@@ -201,7 +201,7 @@ namespace ams::ncm {
Result HostContentStorageImpl::RegisterPath(const ContentId &content_id, const Path &path) {
AMS_ABORT_UNLESS(spl::IsDevelopment());
return m_registered_content->RegisterPath(content_id, path);
R_RETURN(m_registered_content->RegisterPath(content_id, path));
}
Result HostContentStorageImpl::ClearRegisteredPath() {

View File

@@ -74,7 +74,7 @@ namespace ams::ncm {
m_data = data;
m_config = config;
return data->GetProgress(std::addressof(m_progress));
R_RETURN(data->GetProgress(std::addressof(m_progress)));
}
Result InstallTaskBase::Prepare() {
@@ -173,7 +173,7 @@ namespace ams::ncm {
}
/* Signal prepare is completed. */
return this->OnPrepareComplete();
R_RETURN(this->OnPrepareComplete());
}
Result InstallTaskBase::Cleanup() {
@@ -960,11 +960,11 @@ namespace ams::ncm {
}
Result InstallTaskBase::CountInstallContentMetaData(s32 *out_count) {
return m_data->Count(out_count);
R_RETURN(m_data->Count(out_count));
}
Result InstallTaskBase::GetInstallContentMetaData(InstallContentMeta *out_content_meta, s32 index) {
return m_data->Get(out_content_meta, index);
R_RETURN(m_data->Get(out_content_meta, index));
}
Result InstallTaskBase::DeleteInstallContentMetaData(const ContentMetaKey *keys, s32 num_keys) {
@@ -985,7 +985,7 @@ namespace ams::ncm {
}
/* Delete the data if count < 1. */
return m_data->Delete(keys, num_keys);
R_RETURN(m_data->Delete(keys, num_keys));
}
Result InstallTaskBase::GetInstallContentMetaDataFromPath(AutoBuffer *out, const Path &path, const InstallContentInfo &content_info, util::optional<u32> source_version) {
@@ -1344,7 +1344,7 @@ namespace ams::ncm {
/* List rights ids if the reader's key matches ours. */
if (reader.GetKey() == key) {
return this->ListRightsIdsByInstallContentMeta(out_count, out_span, content_meta, offset);
R_RETURN(this->ListRightsIdsByInstallContentMeta(out_count, out_span, content_meta, offset));
}
}

View File

@@ -49,7 +49,7 @@ namespace ams::ncm {
}
Result InstallTaskDataBase::Update(const InstallContentMeta &content_meta, s32 index) {
return this->Update(index, content_meta.data.get(), content_meta.size);
R_RETURN(this->Update(index, content_meta.data.get(), content_meta.size));
}
Result InstallTaskDataBase::Has(bool *out, u64 id) {
@@ -223,13 +223,13 @@ namespace ams::ncm {
/* Create an initial header and write it to the file. */
const Header header = MakeInitialHeader(max_entries);
return fs::WriteFile(file, 0, std::addressof(header), sizeof(Header), fs::WriteOption::Flush);
R_RETURN(fs::WriteFile(file, 0, std::addressof(header), sizeof(Header), fs::WriteOption::Flush));
}
Result FileInstallTaskData::Initialize(const char *path) {
std::strncpy(m_path, path, sizeof(m_path));
m_path[sizeof(m_path) - 1] = '\x00';
return this->Read(std::addressof(m_header), sizeof(Header), 0);
R_RETURN(this->Read(std::addressof(m_header), sizeof(Header), 0));
}
Result FileInstallTaskData::GetProgress(InstallProgress *out_progress) {
@@ -267,17 +267,17 @@ namespace ams::ncm {
Result FileInstallTaskData::SetState(InstallProgressState state) {
m_header.progress_state = state;
return this->WriteHeader();
R_RETURN(this->WriteHeader());
}
Result FileInstallTaskData::SetLastResult(Result result) {
m_header.last_result = result;
return this->WriteHeader();
R_RETURN(this->WriteHeader());
}
Result FileInstallTaskData::SetSystemUpdateTaskApplyInfo(SystemUpdateTaskApplyInfo info) {
m_header.system_update_task_apply_info = info;
return this->WriteHeader();
R_RETURN(this->WriteHeader());
}
Result FileInstallTaskData::Push(const void *data, size_t data_size) {
@@ -297,7 +297,7 @@ namespace ams::ncm {
m_header.count++;
/* Write the updated header. */
return this->WriteHeader();
R_RETURN(this->WriteHeader());
}
Result FileInstallTaskData::Count(s32 *out) {
@@ -319,7 +319,7 @@ namespace ams::ncm {
/* Read the entry to the output buffer. */
R_UNLESS(entry_info.size <= static_cast<s64>(out_size), ncm::ResultBufferInsufficient());
return this->Read(out, out_size, entry_info.offset);
R_RETURN(this->Read(out, out_size, entry_info.offset));
}
Result FileInstallTaskData::Update(s32 index, const void *data, size_t data_size) {
@@ -329,7 +329,7 @@ namespace ams::ncm {
/* Data size must match existing data size. */
R_UNLESS(entry_info.size == static_cast<s64>(data_size), ncm::ResultBufferInsufficient());
return this->Write(data, data_size, entry_info.offset);
R_RETURN(this->Write(data, data_size, entry_info.offset));
}
Result FileInstallTaskData::Delete(const ContentMetaKey *keys, s32 num_keys) {
@@ -363,35 +363,35 @@ namespace ams::ncm {
/* Change from our current data to the new data. */
m_header = install_task_data.m_header;
R_TRY(fs::DeleteFile(m_path));
return fs::RenameFile(tmp_path, m_path);
R_RETURN(fs::RenameFile(tmp_path, m_path));
}
Result FileInstallTaskData::Cleanup() {
m_header = MakeInitialHeader(m_header.max_entries);
return this->WriteHeader();
R_RETURN(this->WriteHeader());
}
Result FileInstallTaskData::GetEntryInfo(EntryInfo *out_entry_info, s32 index) {
AMS_ABORT_UNLESS(static_cast<u32>(index) < m_header.count);
return this->Read(out_entry_info, sizeof(EntryInfo), GetEntryInfoOffset(index));
R_RETURN(this->Read(out_entry_info, sizeof(EntryInfo), GetEntryInfoOffset(index)));
}
Result FileInstallTaskData::Write(const void *data, size_t size, s64 offset) {
fs::FileHandle file;
R_TRY(fs::OpenFile(std::addressof(file), m_path, fs::OpenMode_Write | fs::OpenMode_AllowAppend));
ON_SCOPE_EXIT { fs::CloseFile(file); };
return fs::WriteFile(file, offset, data, size, fs::WriteOption::Flush);
R_RETURN(fs::WriteFile(file, offset, data, size, fs::WriteOption::Flush));
}
Result FileInstallTaskData::Read(void *out, size_t out_size, s64 offset) {
fs::FileHandle file;
R_TRY(fs::OpenFile(std::addressof(file), m_path, fs::OpenMode_Read));
ON_SCOPE_EXIT { fs::CloseFile(file); };
return fs::ReadFile(file, offset, out, out_size);
R_RETURN(fs::ReadFile(file, offset, out, out_size));
}
Result FileInstallTaskData::WriteHeader() {
return this->Write(std::addressof(m_header), sizeof(Header), 0);
R_RETURN(this->Write(std::addressof(m_header), sizeof(Header), 0));
}
}

View File

@@ -23,7 +23,7 @@ namespace ams::ncm {
}
Result PackageInstallTask::Initialize(const char *package_root, StorageId storage_id, void *buffer, size_t buffer_size, bool ignore_ticket) {
return PackageInstallTaskBase::Initialize(package_root, buffer, buffer_size, storage_id, std::addressof(m_data), ignore_ticket ? InstallConfig_IgnoreTicket : InstallConfig_None);
R_RETURN(PackageInstallTaskBase::Initialize(package_root, buffer, buffer_size, storage_id, std::addressof(m_data), ignore_ticket ? InstallConfig_IgnoreTicket : InstallConfig_None));
}
Result PackageInstallTask::GetInstallContentMetaInfo(InstallContentMetaInfo *out_info, const ContentMetaKey &key) {

View File

@@ -63,14 +63,14 @@ namespace ams::ncm {
Result PackageSystemDowngradeTask::Commit() {
R_TRY(this->PreCommit());
return InstallTaskBase::Commit();
R_RETURN(InstallTaskBase::Commit());
}
Result PackageSystemDowngradeTask::PrepareContentMetaIfLatest(const ContentMetaKey &key) {
/* Get and prepare install content meta info. We aren't concerned if our key is older. */
InstallContentMetaInfo install_content_meta_info;
R_TRY(this->GetInstallContentMetaInfo(std::addressof(install_content_meta_info), key));
return this->PrepareContentMeta(install_content_meta_info, key, util::nullopt);
R_RETURN(this->PrepareContentMeta(install_content_meta_info, key, util::nullopt));
}
}

View File

@@ -117,11 +117,11 @@ namespace ams::ncm {
R_TRY(this->GetContentInfoOfContentMeta(std::addressof(info), key));
/* Prepare the content meta. */
return this->PrepareContentMeta(InstallContentMetaInfo::MakeUnverifiable(info.GetId(), info.GetSize(), key), key, util::nullopt);
R_RETURN(this->PrepareContentMeta(InstallContentMetaInfo::MakeUnverifiable(info.GetId(), info.GetSize(), key), key, util::nullopt));
}
Result PackageSystemUpdateTask::PrepareDependency() {
return this->PrepareSystemUpdateDependency();
R_RETURN(this->PrepareSystemUpdateDependency());
}
Result PackageSystemUpdateTask::GetContentInfoOfContentMeta(ContentInfo *out, const ContentMetaKey &key) {

View File

@@ -52,7 +52,7 @@ namespace ams::ncm {
Result PlaceHolderAccessor::EnsurePlaceHolderDirectory(PlaceHolderId placeholder_id) {
PathString path;
this->MakePath(std::addressof(path), placeholder_id);
return fs::EnsureParentDirectory(path);
R_RETURN(fs::EnsureParentDirectory(path));
}
Result PlaceHolderAccessor::GetPlaceHolderIdFromFileName(PlaceHolderId *out, const char *name) {
@@ -84,7 +84,7 @@ namespace ams::ncm {
this->MakePath(std::addressof(placeholder_path), placeholder_id);
/* Open the placeholder file. */
return fs::OpenFile(out_handle, placeholder_path, fs::OpenMode_Write);
R_RETURN(fs::OpenFile(out_handle, placeholder_path, fs::OpenMode_Write));
}
bool PlaceHolderAccessor::LoadFromCache(fs::FileHandle *out_handle, PlaceHolderId placeholder_id) {
@@ -203,7 +203,7 @@ namespace ams::ncm {
ON_SCOPE_EXIT { this->StoreToCache(placeholder_id, file); };
/* Write data to the placeholder file. */
return fs::WriteFile(file, offset, buffer, size, m_delay_flush ? fs::WriteOption::Flush : fs::WriteOption::None);
R_RETURN(fs::WriteFile(file, offset, buffer, size, m_delay_flush ? fs::WriteOption::Flush : fs::WriteOption::None));
}
Result PlaceHolderAccessor::SetPlaceHolderFileSize(PlaceHolderId placeholder_id, s64 size) {
@@ -217,7 +217,7 @@ namespace ams::ncm {
ON_SCOPE_EXIT { fs::CloseFile(file); };
/* Set the size of the placeholder file. */
return fs::SetFileSize(file, size);
R_RETURN(fs::SetFileSize(file, size));
}
Result PlaceHolderAccessor::TryGetPlaceHolderFileSize(bool *found_in_cache, s64 *out_size, PlaceHolderId placeholder_id) {

View File

@@ -31,19 +31,19 @@ namespace ams::ncm {
~RemoteContentManagerImpl() { ::ncmExit(); }
public:
Result CreateContentStorage(StorageId storage_id) {
return ::ncmCreateContentStorage(static_cast<NcmStorageId>(storage_id));
R_RETURN(::ncmCreateContentStorage(static_cast<NcmStorageId>(storage_id)));
}
Result CreateContentMetaDatabase(StorageId storage_id) {
return ::ncmCreateContentMetaDatabase(static_cast<NcmStorageId>(storage_id));
R_RETURN(::ncmCreateContentMetaDatabase(static_cast<NcmStorageId>(storage_id)));
}
Result VerifyContentStorage(StorageId storage_id) {
return ::ncmVerifyContentStorage(static_cast<NcmStorageId>(storage_id));
R_RETURN(::ncmVerifyContentStorage(static_cast<NcmStorageId>(storage_id)));
}
Result VerifyContentMetaDatabase(StorageId storage_id) {
return ::ncmVerifyContentMetaDatabase(static_cast<NcmStorageId>(storage_id));
R_RETURN(::ncmVerifyContentMetaDatabase(static_cast<NcmStorageId>(storage_id)));
}
Result OpenContentStorage(sf::Out<sf::SharedPointer<IContentStorage>> out, StorageId storage_id) {
@@ -63,35 +63,35 @@ namespace ams::ncm {
}
Result CloseContentStorageForcibly(StorageId storage_id) {
return ::ncmCloseContentStorageForcibly(static_cast<NcmStorageId>(storage_id));
R_RETURN(::ncmCloseContentStorageForcibly(static_cast<NcmStorageId>(storage_id)));
}
Result CloseContentMetaDatabaseForcibly(StorageId storage_id) {
return ::ncmCloseContentMetaDatabaseForcibly(static_cast<NcmStorageId>(storage_id));
R_RETURN(::ncmCloseContentMetaDatabaseForcibly(static_cast<NcmStorageId>(storage_id)));
}
Result CleanupContentMetaDatabase(StorageId storage_id) {
return ::ncmCleanupContentMetaDatabase(static_cast<NcmStorageId>(storage_id));
R_RETURN(::ncmCleanupContentMetaDatabase(static_cast<NcmStorageId>(storage_id)));
}
Result ActivateContentStorage(StorageId storage_id) {
return ::ncmActivateContentStorage(static_cast<NcmStorageId>(storage_id));
R_RETURN(::ncmActivateContentStorage(static_cast<NcmStorageId>(storage_id)));
}
Result InactivateContentStorage(StorageId storage_id) {
return ::ncmInactivateContentStorage(static_cast<NcmStorageId>(storage_id));
R_RETURN(::ncmInactivateContentStorage(static_cast<NcmStorageId>(storage_id)));
}
Result ActivateContentMetaDatabase(StorageId storage_id) {
return ::ncmActivateContentMetaDatabase(static_cast<NcmStorageId>(storage_id));
R_RETURN(::ncmActivateContentMetaDatabase(static_cast<NcmStorageId>(storage_id)));
}
Result InactivateContentMetaDatabase(StorageId storage_id) {
return ::ncmInactivateContentMetaDatabase(static_cast<NcmStorageId>(storage_id));
R_RETURN(::ncmInactivateContentMetaDatabase(static_cast<NcmStorageId>(storage_id)));
}
Result InvalidateRightsIdCache() {
return ::ncmInvalidateRightsIdCache();
R_RETURN(::ncmInvalidateRightsIdCache());
}
Result GetMemoryReport(sf::Out<MemoryReport> out) {

View File

@@ -73,88 +73,88 @@ namespace ams::ncm {
}
public:
Result Set(const ContentMetaKey &key, const sf::InBuffer &value) {
return ncmContentMetaDatabaseSet(std::addressof(m_srv), Convert(key), value.GetPointer(), value.GetSize());
R_RETURN(ncmContentMetaDatabaseSet(std::addressof(m_srv), Convert(key), value.GetPointer(), value.GetSize()));
}
Result Get(sf::Out<u64> out_size, const ContentMetaKey &key, const sf::OutBuffer &out_value) {
return ncmContentMetaDatabaseGet(std::addressof(m_srv), Convert(key), out_size.GetPointer(), out_value.GetPointer(), out_value.GetSize());
R_RETURN(ncmContentMetaDatabaseGet(std::addressof(m_srv), Convert(key), out_size.GetPointer(), out_value.GetPointer(), out_value.GetSize()));
}
Result Remove(const ContentMetaKey &key) {
return ncmContentMetaDatabaseRemove(std::addressof(m_srv), Convert(key));
R_RETURN(ncmContentMetaDatabaseRemove(std::addressof(m_srv), Convert(key)));
}
Result GetContentIdByType(sf::Out<ContentId> out_content_id, const ContentMetaKey &key, ContentType type) {
return ncmContentMetaDatabaseGetContentIdByType(std::addressof(m_srv), Convert(out_content_id.GetPointer()), Convert(key), static_cast<::NcmContentType>(type));
R_RETURN(ncmContentMetaDatabaseGetContentIdByType(std::addressof(m_srv), Convert(out_content_id.GetPointer()), Convert(key), static_cast<::NcmContentType>(type)));
}
Result ListContentInfo(sf::Out<s32> out_entries_written, const sf::OutArray<ContentInfo> &out_info, const ContentMetaKey &key, s32 offset) {
return ncmContentMetaDatabaseListContentInfo(std::addressof(m_srv), out_entries_written.GetPointer(), Convert(out_info.GetPointer()), out_info.GetSize(), Convert(key), offset);
R_RETURN(ncmContentMetaDatabaseListContentInfo(std::addressof(m_srv), out_entries_written.GetPointer(), Convert(out_info.GetPointer()), out_info.GetSize(), Convert(key), offset));
}
Result List(sf::Out<s32> out_entries_total, sf::Out<s32> out_entries_written, const sf::OutArray<ContentMetaKey> &out_info, ContentMetaType meta_type, ApplicationId application_id, u64 min, u64 max, ContentInstallType install_type) {
return ncmContentMetaDatabaseList(std::addressof(m_srv), out_entries_total.GetPointer(), out_entries_written.GetPointer(), Convert(out_info.GetPointer()), out_info.GetSize(), static_cast<::NcmContentMetaType>(meta_type), application_id.value, min, max, static_cast<::NcmContentInstallType>(install_type));
R_RETURN(ncmContentMetaDatabaseList(std::addressof(m_srv), out_entries_total.GetPointer(), out_entries_written.GetPointer(), Convert(out_info.GetPointer()), out_info.GetSize(), static_cast<::NcmContentMetaType>(meta_type), application_id.value, min, max, static_cast<::NcmContentInstallType>(install_type)));
}
Result GetLatestContentMetaKey(sf::Out<ContentMetaKey> out_key, u64 id) {
return ncmContentMetaDatabaseGetLatestContentMetaKey(std::addressof(m_srv), Convert(out_key.GetPointer()), static_cast<u64>(id));
R_RETURN(ncmContentMetaDatabaseGetLatestContentMetaKey(std::addressof(m_srv), Convert(out_key.GetPointer()), static_cast<u64>(id)));
}
Result ListApplication(sf::Out<s32> out_entries_total, sf::Out<s32> out_entries_written, const sf::OutArray<ApplicationContentMetaKey> &out_keys, ContentMetaType meta_type) {
return ncmContentMetaDatabaseListApplication(std::addressof(m_srv), out_entries_total.GetPointer(), out_entries_written.GetPointer(), Convert(out_keys.GetPointer()), out_keys.GetSize(), static_cast<::NcmContentMetaType>(meta_type));
R_RETURN(ncmContentMetaDatabaseListApplication(std::addressof(m_srv), out_entries_total.GetPointer(), out_entries_written.GetPointer(), Convert(out_keys.GetPointer()), out_keys.GetSize(), static_cast<::NcmContentMetaType>(meta_type)));
}
Result Has(sf::Out<bool> out, const ContentMetaKey &key) {
return ncmContentMetaDatabaseHas(std::addressof(m_srv), out.GetPointer(), Convert(key));
R_RETURN(ncmContentMetaDatabaseHas(std::addressof(m_srv), out.GetPointer(), Convert(key)));
}
Result HasAll(sf::Out<bool> out, const sf::InArray<ContentMetaKey> &keys) {
return ncmContentMetaDatabaseHasAll(std::addressof(m_srv), out.GetPointer(), Convert(keys.GetPointer()), keys.GetSize());
R_RETURN(ncmContentMetaDatabaseHasAll(std::addressof(m_srv), out.GetPointer(), Convert(keys.GetPointer()), keys.GetSize()));
}
Result GetSize(sf::Out<u64> out_size, const ContentMetaKey &key) {
return ncmContentMetaDatabaseGetSize(std::addressof(m_srv), out_size.GetPointer(), Convert(key));
R_RETURN(ncmContentMetaDatabaseGetSize(std::addressof(m_srv), out_size.GetPointer(), Convert(key)));
}
Result GetRequiredSystemVersion(sf::Out<u32> out_version, const ContentMetaKey &key) {
return ncmContentMetaDatabaseGetRequiredSystemVersion(std::addressof(m_srv), out_version.GetPointer(), Convert(key));
R_RETURN(ncmContentMetaDatabaseGetRequiredSystemVersion(std::addressof(m_srv), out_version.GetPointer(), Convert(key)));
}
Result GetPatchId(sf::Out<PatchId> out_patch_id, const ContentMetaKey &key) {
return ncmContentMetaDatabaseGetPatchId(std::addressof(m_srv), reinterpret_cast<u64 *>(out_patch_id.GetPointer()), Convert(key));
R_RETURN(ncmContentMetaDatabaseGetPatchId(std::addressof(m_srv), reinterpret_cast<u64 *>(out_patch_id.GetPointer()), Convert(key)));
}
Result DisableForcibly() {
return ncmContentMetaDatabaseDisableForcibly(std::addressof(m_srv));
R_RETURN(ncmContentMetaDatabaseDisableForcibly(std::addressof(m_srv)));
}
Result LookupOrphanContent(const sf::OutArray<bool> &out_orphaned, const sf::InArray<ContentId> &content_ids) {
return ncmContentMetaDatabaseLookupOrphanContent(std::addressof(m_srv), out_orphaned.GetPointer(), Convert(content_ids.GetPointer()), std::min(out_orphaned.GetSize(), content_ids.GetSize()));
R_RETURN(ncmContentMetaDatabaseLookupOrphanContent(std::addressof(m_srv), out_orphaned.GetPointer(), Convert(content_ids.GetPointer()), std::min(out_orphaned.GetSize(), content_ids.GetSize())));
}
Result Commit() {
return ncmContentMetaDatabaseCommit(std::addressof(m_srv));
R_RETURN(ncmContentMetaDatabaseCommit(std::addressof(m_srv)));
}
Result HasContent(sf::Out<bool> out, const ContentMetaKey &key, const ContentId &content_id) {
return ncmContentMetaDatabaseHasContent(std::addressof(m_srv), out.GetPointer(), Convert(key), Convert(content_id));
R_RETURN(ncmContentMetaDatabaseHasContent(std::addressof(m_srv), out.GetPointer(), Convert(key), Convert(content_id)));
}
Result ListContentMetaInfo(sf::Out<s32> out_entries_written, const sf::OutArray<ContentMetaInfo> &out_meta_info, const ContentMetaKey &key, s32 offset) {
return ncmContentMetaDatabaseListContentMetaInfo(std::addressof(m_srv), out_entries_written.GetPointer(), out_meta_info.GetPointer(), out_meta_info.GetSize(), Convert(key), offset);
R_RETURN(ncmContentMetaDatabaseListContentMetaInfo(std::addressof(m_srv), out_entries_written.GetPointer(), out_meta_info.GetPointer(), out_meta_info.GetSize(), Convert(key), offset));
}
Result GetAttributes(sf::Out<u8> out_attributes, const ContentMetaKey &key) {
static_assert(sizeof(ContentMetaAttribute) == sizeof(u8));
return ncmContentMetaDatabaseGetAttributes(std::addressof(m_srv), Convert(key), out_attributes.GetPointer());
R_RETURN(ncmContentMetaDatabaseGetAttributes(std::addressof(m_srv), Convert(key), out_attributes.GetPointer()));
}
Result GetRequiredApplicationVersion(sf::Out<u32> out_version, const ContentMetaKey &key) {
return ncmContentMetaDatabaseGetRequiredApplicationVersion(std::addressof(m_srv), out_version.GetPointer(), Convert(key));
R_RETURN(ncmContentMetaDatabaseGetRequiredApplicationVersion(std::addressof(m_srv), out_version.GetPointer(), Convert(key)));
}
Result GetContentIdByTypeAndIdOffset(sf::Out<ContentId> out_content_id, const ContentMetaKey &key, ContentType type, u8 id_offset) {
return ncmContentMetaDatabaseGetContentIdByTypeAndIdOffset(std::addressof(m_srv), Convert(out_content_id.GetPointer()), Convert(key), static_cast<::NcmContentType>(type), id_offset);
R_RETURN(ncmContentMetaDatabaseGetContentIdByTypeAndIdOffset(std::addressof(m_srv), Convert(out_content_id.GetPointer()), Convert(key), static_cast<::NcmContentType>(type), id_offset));
}
Result GetCount(sf::Out<u32> out_count) {

View File

@@ -58,81 +58,81 @@ namespace ams::ncm {
}
public:
Result GeneratePlaceHolderId(sf::Out<PlaceHolderId> out) {
return ncmContentStorageGeneratePlaceHolderId(std::addressof(m_srv), Convert(out.GetPointer()));
R_RETURN(ncmContentStorageGeneratePlaceHolderId(std::addressof(m_srv), Convert(out.GetPointer())));
}
Result CreatePlaceHolder(PlaceHolderId placeholder_id, ContentId content_id, s64 size) {
static_assert(alignof(ContentId) < alignof(PlaceHolderId));
return ncmContentStorageCreatePlaceHolder(std::addressof(m_srv), Convert(content_id), Convert(placeholder_id), size);
R_RETURN(ncmContentStorageCreatePlaceHolder(std::addressof(m_srv), Convert(content_id), Convert(placeholder_id), size));
}
Result DeletePlaceHolder(PlaceHolderId placeholder_id) {
return ncmContentStorageDeletePlaceHolder(std::addressof(m_srv), Convert(placeholder_id));
R_RETURN(ncmContentStorageDeletePlaceHolder(std::addressof(m_srv), Convert(placeholder_id)));
}
Result HasPlaceHolder(sf::Out<bool> out, PlaceHolderId placeholder_id) {
return ncmContentStorageHasPlaceHolder(std::addressof(m_srv), out.GetPointer(), Convert(placeholder_id));
R_RETURN(ncmContentStorageHasPlaceHolder(std::addressof(m_srv), out.GetPointer(), Convert(placeholder_id)));
}
Result WritePlaceHolder(PlaceHolderId placeholder_id, s64 offset, const sf::InBuffer &data) {
return ncmContentStorageWritePlaceHolder(std::addressof(m_srv), Convert(placeholder_id), offset, data.GetPointer(), data.GetSize());
R_RETURN(ncmContentStorageWritePlaceHolder(std::addressof(m_srv), Convert(placeholder_id), offset, data.GetPointer(), data.GetSize()));
}
Result Register(PlaceHolderId placeholder_id, ContentId content_id) {
static_assert(alignof(ContentId) < alignof(PlaceHolderId));
return ncmContentStorageRegister(std::addressof(m_srv), Convert(content_id), Convert(placeholder_id));
R_RETURN(ncmContentStorageRegister(std::addressof(m_srv), Convert(content_id), Convert(placeholder_id)));
}
Result Delete(ContentId content_id) {
return ncmContentStorageDelete(std::addressof(m_srv), Convert(content_id));
R_RETURN(ncmContentStorageDelete(std::addressof(m_srv), Convert(content_id)));
}
Result Has(sf::Out<bool> out, ContentId content_id) {
return ncmContentStorageHas(std::addressof(m_srv), out.GetPointer(), Convert(content_id));
R_RETURN(ncmContentStorageHas(std::addressof(m_srv), out.GetPointer(), Convert(content_id)));
}
Result GetPath(sf::Out<Path> out, ContentId content_id) {
return ncmContentStorageGetPath(std::addressof(m_srv), out.GetPointer()->str, sizeof(out.GetPointer()->str), Convert(content_id));
R_RETURN(ncmContentStorageGetPath(std::addressof(m_srv), out.GetPointer()->str, sizeof(out.GetPointer()->str), Convert(content_id)));
}
Result GetPlaceHolderPath(sf::Out<Path> out, PlaceHolderId placeholder_id) {
return ncmContentStorageGetPlaceHolderPath(std::addressof(m_srv), out.GetPointer()->str, sizeof(out.GetPointer()->str), Convert(placeholder_id));
R_RETURN(ncmContentStorageGetPlaceHolderPath(std::addressof(m_srv), out.GetPointer()->str, sizeof(out.GetPointer()->str), Convert(placeholder_id)));
}
Result CleanupAllPlaceHolder() {
return ncmContentStorageCleanupAllPlaceHolder(std::addressof(m_srv));
R_RETURN(ncmContentStorageCleanupAllPlaceHolder(std::addressof(m_srv)));
}
Result ListPlaceHolder(sf::Out<s32> out_count, const sf::OutArray<PlaceHolderId> &out_buf) {
return ncmContentStorageListPlaceHolder(std::addressof(m_srv), Convert(out_buf.GetPointer()), out_buf.GetSize(), out_count.GetPointer());
R_RETURN(ncmContentStorageListPlaceHolder(std::addressof(m_srv), Convert(out_buf.GetPointer()), out_buf.GetSize(), out_count.GetPointer()));
}
Result GetContentCount(sf::Out<s32> out_count) {
return ncmContentStorageGetContentCount(std::addressof(m_srv), out_count.GetPointer());
R_RETURN(ncmContentStorageGetContentCount(std::addressof(m_srv), out_count.GetPointer()));
}
Result ListContentId(sf::Out<s32> out_count, const sf::OutArray<ContentId> &out_buf, s32 offset) {
return ncmContentStorageListContentId(std::addressof(m_srv), Convert(out_buf.GetPointer()), out_buf.GetSize(), out_count.GetPointer(), offset);
R_RETURN(ncmContentStorageListContentId(std::addressof(m_srv), Convert(out_buf.GetPointer()), out_buf.GetSize(), out_count.GetPointer(), offset));
}
Result GetSizeFromContentId(sf::Out<s64> out_size, ContentId content_id) {
return ncmContentStorageGetSizeFromContentId(std::addressof(m_srv), out_size.GetPointer(), Convert(content_id));
R_RETURN(ncmContentStorageGetSizeFromContentId(std::addressof(m_srv), out_size.GetPointer(), Convert(content_id)));
}
Result DisableForcibly() {
return ncmContentStorageDisableForcibly(std::addressof(m_srv));
R_RETURN(ncmContentStorageDisableForcibly(std::addressof(m_srv)));
}
Result RevertToPlaceHolder(PlaceHolderId placeholder_id, ContentId old_content_id, ContentId new_content_id) {
return ncmContentStorageRevertToPlaceHolder(std::addressof(m_srv), Convert(placeholder_id), Convert(old_content_id), Convert(new_content_id));
R_RETURN(ncmContentStorageRevertToPlaceHolder(std::addressof(m_srv), Convert(placeholder_id), Convert(old_content_id), Convert(new_content_id)));
}
Result SetPlaceHolderSize(PlaceHolderId placeholder_id, s64 size) {
return ncmContentStorageSetPlaceHolderSize(std::addressof(m_srv), Convert(placeholder_id), size);
R_RETURN(ncmContentStorageSetPlaceHolderSize(std::addressof(m_srv), Convert(placeholder_id), size));
}
Result ReadContentIdFile(const sf::OutBuffer &buf, ContentId content_id, s64 offset) {
return ncmContentStorageReadContentIdFile(std::addressof(m_srv), buf.GetPointer(), buf.GetSize(), Convert(content_id), offset);
R_RETURN(ncmContentStorageReadContentIdFile(std::addressof(m_srv), buf.GetPointer(), buf.GetSize(), Convert(content_id), offset));
}
Result GetRightsIdFromPlaceHolderIdDeprecated(sf::Out<ams::fs::RightsId> out_rights_id, PlaceHolderId placeholder_id) {
@@ -172,41 +172,41 @@ namespace ams::ncm {
}
Result WriteContentForDebug(ContentId content_id, s64 offset, const sf::InBuffer &data) {
return ncmContentStorageWriteContentForDebug(std::addressof(m_srv), Convert(content_id), offset, data.GetPointer(), data.GetSize());
R_RETURN(ncmContentStorageWriteContentForDebug(std::addressof(m_srv), Convert(content_id), offset, data.GetPointer(), data.GetSize()));
}
Result GetFreeSpaceSize(sf::Out<s64> out_size) {
return ncmContentStorageGetFreeSpaceSize(std::addressof(m_srv), out_size.GetPointer());
R_RETURN(ncmContentStorageGetFreeSpaceSize(std::addressof(m_srv), out_size.GetPointer()));
}
Result GetTotalSpaceSize(sf::Out<s64> out_size) {
return ncmContentStorageGetTotalSpaceSize(std::addressof(m_srv), out_size.GetPointer());
R_RETURN(ncmContentStorageGetTotalSpaceSize(std::addressof(m_srv), out_size.GetPointer()));
}
Result FlushPlaceHolder() {
return ncmContentStorageFlushPlaceHolder(std::addressof(m_srv));
R_RETURN(ncmContentStorageFlushPlaceHolder(std::addressof(m_srv)));
}
Result GetSizeFromPlaceHolderId(sf::Out<s64> out_size, PlaceHolderId placeholder_id) {
return ncmContentStorageGetSizeFromPlaceHolderId(std::addressof(m_srv), out_size.GetPointer(), Convert(placeholder_id));
R_RETURN(ncmContentStorageGetSizeFromPlaceHolderId(std::addressof(m_srv), out_size.GetPointer(), Convert(placeholder_id)));
}
Result RepairInvalidFileAttribute() {
return ncmContentStorageRepairInvalidFileAttribute(std::addressof(m_srv));
R_RETURN(ncmContentStorageRepairInvalidFileAttribute(std::addressof(m_srv)));
}
Result GetRightsIdFromPlaceHolderIdWithCache(sf::Out<ncm::RightsId> out_rights_id, PlaceHolderId placeholder_id, ContentId cache_content_id) {
static_assert(sizeof(::NcmRightsId) == sizeof(ncm::RightsId));
::NcmRightsId *out = reinterpret_cast<::NcmRightsId *>(out_rights_id.GetPointer());
return ncmContentStorageGetRightsIdFromPlaceHolderIdWithCache(std::addressof(m_srv), out, Convert(placeholder_id), Convert(cache_content_id));
R_RETURN(ncmContentStorageGetRightsIdFromPlaceHolderIdWithCache(std::addressof(m_srv), out, Convert(placeholder_id), Convert(cache_content_id)));
}
Result RegisterPath(const ContentId &content_id, const Path &path) {
return ncmContentStorageRegisterPath(std::addressof(m_srv), Convert(content_id), path.str);
R_RETURN(ncmContentStorageRegisterPath(std::addressof(m_srv), Convert(content_id), path.str));
}
Result ClearRegisteredPath() {
return ncmContentStorageClearRegisteredPath(std::addressof(m_srv));
R_RETURN(ncmContentStorageClearRegisteredPath(std::addressof(m_srv)));
}
};
static_assert(ncm::IsIContentStorage<RemoteContentStorageImpl>);