mirror of
https://github.com/Atmosphere-NX/Atmosphere
synced 2024-11-09 22:56:35 +00:00
ams: use R_SUCCEED, R_THROW globally
This commit is contained in:
parent
e5b1739f65
commit
dd78ede99f
370 changed files with 2107 additions and 2107 deletions
|
@ -62,7 +62,7 @@ namespace ams::secmon::fatal {
|
||||||
/* Write the context to the file. */
|
/* Write the context to the file. */
|
||||||
R_TRY(fs::WriteFile(file, 0, ctx, sizeof(*ctx), fs::WriteOption::Flush));
|
R_TRY(fs::WriteFile(file, 0, ctx, sizeof(*ctx), fs::WriteOption::Flush));
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ namespace ams::secmon::fatal {
|
||||||
//sdmmc::Deactivate(Port);
|
//sdmmc::Deactivate(Port);
|
||||||
R_TRY(sdmmc::Activate(Port));
|
R_TRY(sdmmc::Activate(Port));
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result CheckSdCardConnection(sdmmc::SpeedMode *out_sm, sdmmc::BusWidth *out_bw) {
|
Result CheckSdCardConnection(sdmmc::SpeedMode *out_sm, sdmmc::BusWidth *out_bw) {
|
||||||
|
@ -78,7 +78,7 @@ namespace ams::secmon::fatal {
|
||||||
sector_count -= cur_sectors;
|
sector_count -= cur_sectors;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result WriteSdCard(size_t sector_index, size_t sector_count, const void *src, size_t size) {
|
Result WriteSdCard(size_t sector_index, size_t sector_count, const void *src, size_t size) {
|
||||||
|
@ -104,7 +104,7 @@ namespace ams::secmon::fatal {
|
||||||
sector_count -= cur_sectors;
|
sector_count -= cur_sectors;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,45 +34,45 @@ namespace ams::fs {
|
||||||
Result TranslateFatFsError(FRESULT res) {
|
Result TranslateFatFsError(FRESULT res) {
|
||||||
switch (res) {
|
switch (res) {
|
||||||
case FR_OK:
|
case FR_OK:
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
case FR_DISK_ERR:
|
case FR_DISK_ERR:
|
||||||
return fs::ResultMmcAccessFailed();
|
R_THROW(fs::ResultMmcAccessFailed());
|
||||||
case FR_INT_ERR:
|
case FR_INT_ERR:
|
||||||
return fs::ResultPreconditionViolation();
|
R_THROW(fs::ResultPreconditionViolation());
|
||||||
case FR_NOT_READY:
|
case FR_NOT_READY:
|
||||||
return fs::ResultMmcAccessFailed();
|
R_THROW(fs::ResultMmcAccessFailed());
|
||||||
case FR_NO_FILE:
|
case FR_NO_FILE:
|
||||||
return fs::ResultPathNotFound();
|
R_THROW(fs::ResultPathNotFound());
|
||||||
case FR_NO_PATH:
|
case FR_NO_PATH:
|
||||||
return fs::ResultPathNotFound();
|
R_THROW(fs::ResultPathNotFound());
|
||||||
case FR_INVALID_NAME:
|
case FR_INVALID_NAME:
|
||||||
return fs::ResultInvalidPath();
|
R_THROW(fs::ResultInvalidPath());
|
||||||
case FR_DENIED:
|
case FR_DENIED:
|
||||||
return fs::ResultPermissionDenied();
|
R_THROW(fs::ResultPermissionDenied());
|
||||||
case FR_EXIST:
|
case FR_EXIST:
|
||||||
return fs::ResultPathAlreadyExists();
|
R_THROW(fs::ResultPathAlreadyExists());
|
||||||
case FR_INVALID_OBJECT:
|
case FR_INVALID_OBJECT:
|
||||||
return fs::ResultInvalidArgument();
|
R_THROW(fs::ResultInvalidArgument());
|
||||||
case FR_WRITE_PROTECTED:
|
case FR_WRITE_PROTECTED:
|
||||||
return fs::ResultWriteNotPermitted();
|
R_THROW(fs::ResultWriteNotPermitted());
|
||||||
case FR_INVALID_DRIVE:
|
case FR_INVALID_DRIVE:
|
||||||
return fs::ResultInvalidMountName();
|
R_THROW(fs::ResultInvalidMountName());
|
||||||
case FR_NOT_ENABLED:
|
case FR_NOT_ENABLED:
|
||||||
return fs::ResultInvalidMountName(); /* BAD/TODO */
|
R_THROW(fs::ResultInvalidMountName()); /* BAD/TODO */
|
||||||
case FR_NO_FILESYSTEM:
|
case FR_NO_FILESYSTEM:
|
||||||
return fs::ResultInvalidMountName(); /* BAD/TODO */
|
R_THROW(fs::ResultInvalidMountName()); /* BAD/TODO */
|
||||||
case FR_TIMEOUT:
|
case FR_TIMEOUT:
|
||||||
return fs::ResultTargetLocked(); /* BAD/TODO */
|
R_THROW(fs::ResultTargetLocked()); /* BAD/TODO */
|
||||||
case FR_LOCKED:
|
case FR_LOCKED:
|
||||||
return fs::ResultTargetLocked();
|
R_THROW(fs::ResultTargetLocked());
|
||||||
case FR_NOT_ENOUGH_CORE:
|
case FR_NOT_ENOUGH_CORE:
|
||||||
return fs::ResultPreconditionViolation(); /* BAD/TODO */
|
R_THROW(fs::ResultPreconditionViolation()); /* BAD/TODO */
|
||||||
case FR_TOO_MANY_OPEN_FILES:
|
case FR_TOO_MANY_OPEN_FILES:
|
||||||
return fs::ResultPreconditionViolation(); /* BAD/TODO */
|
R_THROW(fs::ResultPreconditionViolation()); /* BAD/TODO */
|
||||||
case FR_INVALID_PARAMETER:
|
case FR_INVALID_PARAMETER:
|
||||||
return fs::ResultInvalidArgument();
|
R_THROW(fs::ResultInvalidArgument());
|
||||||
default:
|
default:
|
||||||
return fs::ResultInternal();
|
R_THROW(fs::ResultInternal());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,7 +125,7 @@ namespace ams::fs {
|
||||||
/* Expand the file. */
|
/* Expand the file. */
|
||||||
R_TRY(TranslateFatFsError(f_expand(std::addressof(fp), size, 1)));
|
R_TRY(TranslateFatFsError(f_expand(std::addressof(fp), size, 1)));
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result CreateDirectory(const char *path) {
|
Result CreateDirectory(const char *path) {
|
||||||
|
@ -144,10 +144,10 @@ namespace ams::fs {
|
||||||
out_file->_handle = fp;
|
out_file->_handle = fp;
|
||||||
g_files_opened[i] = true;
|
g_files_opened[i] = true;
|
||||||
g_open_modes[i] = mode;
|
g_open_modes[i] = mode;
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return fs::ResultOpenCountLimit();
|
R_THROW(fs::ResultOpenCountLimit());
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ReadFile(FileHandle handle, s64 offset, void *buffer, size_t size, const fs::ReadOption &option) {
|
Result ReadFile(FileHandle handle, s64 offset, void *buffer, size_t size, const fs::ReadOption &option) {
|
||||||
|
@ -164,7 +164,7 @@ namespace ams::fs {
|
||||||
/* Check that we read the correct amount. */
|
/* Check that we read the correct amount. */
|
||||||
R_UNLESS(br == size, fs::ResultOutOfRange());
|
R_UNLESS(br == size, fs::ResultOutOfRange());
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ReadFile(FileHandle handle, s64 offset, void *buffer, size_t size) {
|
Result ReadFile(FileHandle handle, s64 offset, void *buffer, size_t size) {
|
||||||
|
@ -185,7 +185,7 @@ namespace ams::fs {
|
||||||
/* Set the output size. */
|
/* Set the output size. */
|
||||||
*out = br;
|
*out = br;
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ReadFile(size_t *out, FileHandle handle, s64 offset, void *buffer, size_t size) {
|
Result ReadFile(size_t *out, FileHandle handle, s64 offset, void *buffer, size_t size) {
|
||||||
|
@ -195,7 +195,7 @@ namespace ams::fs {
|
||||||
Result GetFileSize(s64 *out, FileHandle handle) {
|
Result GetFileSize(s64 *out, FileHandle handle) {
|
||||||
FIL *fp = GetInternalFile(handle);
|
FIL *fp = GetInternalFile(handle);
|
||||||
*out = f_size(fp);
|
*out = f_size(fp);
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result FlushFile(FileHandle handle) {
|
Result FlushFile(FileHandle handle) {
|
||||||
|
@ -218,7 +218,7 @@ namespace ams::fs {
|
||||||
R_TRY(FlushFile(handle));
|
R_TRY(FlushFile(handle));
|
||||||
}
|
}
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result SetFileSize(FileHandle handle, s64 size) {
|
Result SetFileSize(FileHandle handle, s64 size) {
|
||||||
|
@ -242,7 +242,7 @@ namespace ams::fs {
|
||||||
/* Check that our expansion succeeded. */
|
/* Check that our expansion succeeded. */
|
||||||
AMS_ASSERT(f_size(fp) == static_cast<FSIZE_t>(size));
|
AMS_ASSERT(f_size(fp) == static_cast<FSIZE_t>(size));
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
int GetFileOpenMode(FileHandle handle) {
|
int GetFileOpenMode(FileHandle handle) {
|
||||||
|
|
|
@ -39,45 +39,45 @@ namespace ams::fs {
|
||||||
Result TranslateFatFsError(FRESULT res) {
|
Result TranslateFatFsError(FRESULT res) {
|
||||||
switch (res) {
|
switch (res) {
|
||||||
case FR_OK:
|
case FR_OK:
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
case FR_DISK_ERR:
|
case FR_DISK_ERR:
|
||||||
return fs::ResultMmcAccessFailed();
|
R_THROW(fs::ResultMmcAccessFailed());
|
||||||
case FR_INT_ERR:
|
case FR_INT_ERR:
|
||||||
return fs::ResultPreconditionViolation();
|
R_THROW(fs::ResultPreconditionViolation());
|
||||||
case FR_NOT_READY:
|
case FR_NOT_READY:
|
||||||
return fs::ResultMmcAccessFailed();
|
R_THROW(fs::ResultMmcAccessFailed());
|
||||||
case FR_NO_FILE:
|
case FR_NO_FILE:
|
||||||
return fs::ResultPathNotFound();
|
R_THROW(fs::ResultPathNotFound());
|
||||||
case FR_NO_PATH:
|
case FR_NO_PATH:
|
||||||
return fs::ResultPathNotFound();
|
R_THROW(fs::ResultPathNotFound());
|
||||||
case FR_INVALID_NAME:
|
case FR_INVALID_NAME:
|
||||||
return fs::ResultInvalidPath();
|
R_THROW(fs::ResultInvalidPath());
|
||||||
case FR_DENIED:
|
case FR_DENIED:
|
||||||
return fs::ResultPermissionDenied();
|
R_THROW(fs::ResultPermissionDenied());
|
||||||
case FR_EXIST:
|
case FR_EXIST:
|
||||||
return fs::ResultPathAlreadyExists();
|
R_THROW(fs::ResultPathAlreadyExists());
|
||||||
case FR_INVALID_OBJECT:
|
case FR_INVALID_OBJECT:
|
||||||
return fs::ResultInvalidArgument();
|
R_THROW(fs::ResultInvalidArgument());
|
||||||
case FR_WRITE_PROTECTED:
|
case FR_WRITE_PROTECTED:
|
||||||
return fs::ResultWriteNotPermitted();
|
R_THROW(fs::ResultWriteNotPermitted());
|
||||||
case FR_INVALID_DRIVE:
|
case FR_INVALID_DRIVE:
|
||||||
return fs::ResultInvalidMountName();
|
R_THROW(fs::ResultInvalidMountName());
|
||||||
case FR_NOT_ENABLED:
|
case FR_NOT_ENABLED:
|
||||||
return fs::ResultInvalidMountName(); /* BAD/TODO */
|
R_THROW(fs::ResultInvalidMountName()); /* BAD/TODO */
|
||||||
case FR_NO_FILESYSTEM:
|
case FR_NO_FILESYSTEM:
|
||||||
return fs::ResultInvalidMountName(); /* BAD/TODO */
|
R_THROW(fs::ResultInvalidMountName()); /* BAD/TODO */
|
||||||
case FR_TIMEOUT:
|
case FR_TIMEOUT:
|
||||||
return fs::ResultTargetLocked(); /* BAD/TODO */
|
R_THROW(fs::ResultTargetLocked()); /* BAD/TODO */
|
||||||
case FR_LOCKED:
|
case FR_LOCKED:
|
||||||
return fs::ResultTargetLocked();
|
R_THROW(fs::ResultTargetLocked());
|
||||||
case FR_NOT_ENOUGH_CORE:
|
case FR_NOT_ENOUGH_CORE:
|
||||||
return fs::ResultPreconditionViolation(); /* BAD/TODO */
|
R_THROW(fs::ResultPreconditionViolation()); /* BAD/TODO */
|
||||||
case FR_TOO_MANY_OPEN_FILES:
|
case FR_TOO_MANY_OPEN_FILES:
|
||||||
return fs::ResultPreconditionViolation(); /* BAD/TODO */
|
R_THROW(fs::ResultPreconditionViolation()); /* BAD/TODO */
|
||||||
case FR_INVALID_PARAMETER:
|
case FR_INVALID_PARAMETER:
|
||||||
return fs::ResultInvalidArgument();
|
R_THROW(fs::ResultInvalidArgument());
|
||||||
default:
|
default:
|
||||||
return fs::ResultInternal();
|
R_THROW(fs::ResultInternal());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -138,7 +138,7 @@ namespace ams::fs {
|
||||||
*out_entry_type = (info.fattrib & AM_DIR) ? DirectoryEntryType_Directory : DirectoryEntryType_File;
|
*out_entry_type = (info.fattrib & AM_DIR) ? DirectoryEntryType_Directory : DirectoryEntryType_File;
|
||||||
*out_archive = (info.fattrib & AM_ARC);
|
*out_archive = (info.fattrib & AM_ARC);
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result CreateFile(const char *path, s64 size) {
|
Result CreateFile(const char *path, s64 size) {
|
||||||
|
@ -152,7 +152,7 @@ namespace ams::fs {
|
||||||
/* Expand the file. */
|
/* Expand the file. */
|
||||||
R_TRY(TranslateFatFsError(f_expand(std::addressof(fp), size, 1)));
|
R_TRY(TranslateFatFsError(f_expand(std::addressof(fp), size, 1)));
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result CreateDirectory(const char *path) {
|
Result CreateDirectory(const char *path) {
|
||||||
|
@ -171,10 +171,10 @@ namespace ams::fs {
|
||||||
out_file->_handle = fp;
|
out_file->_handle = fp;
|
||||||
g_files_opened[i] = true;
|
g_files_opened[i] = true;
|
||||||
g_open_modes[i] = mode;
|
g_open_modes[i] = mode;
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return fs::ResultOpenCountLimit();
|
R_THROW(fs::ResultOpenCountLimit());
|
||||||
}
|
}
|
||||||
|
|
||||||
Result OpenDirectory(DirectoryHandle *out_dir, const char *path) {
|
Result OpenDirectory(DirectoryHandle *out_dir, const char *path) {
|
||||||
|
@ -188,10 +188,10 @@ namespace ams::fs {
|
||||||
/* Set the output. */
|
/* Set the output. */
|
||||||
out_dir->_handle = dp;
|
out_dir->_handle = dp;
|
||||||
g_dirs_opened[i] = true;
|
g_dirs_opened[i] = true;
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return fs::ResultOpenCountLimit();
|
R_THROW(fs::ResultOpenCountLimit());
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ReadDirectory(s64 *out_count, DirectoryEntry *out_entries, DirectoryHandle handle, s64 max_entries) {
|
Result ReadDirectory(s64 *out_count, DirectoryEntry *out_entries, DirectoryHandle handle, s64 max_entries) {
|
||||||
|
@ -209,7 +209,7 @@ namespace ams::fs {
|
||||||
}
|
}
|
||||||
|
|
||||||
*out_count = count;
|
*out_count = count;
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CloseDirectory(DirectoryHandle handle) {
|
void CloseDirectory(DirectoryHandle handle) {
|
||||||
|
@ -232,7 +232,7 @@ namespace ams::fs {
|
||||||
/* Check that we read the correct amount. */
|
/* Check that we read the correct amount. */
|
||||||
R_UNLESS(br == size, fs::ResultOutOfRange());
|
R_UNLESS(br == size, fs::ResultOutOfRange());
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ReadFile(FileHandle handle, s64 offset, void *buffer, size_t size) {
|
Result ReadFile(FileHandle handle, s64 offset, void *buffer, size_t size) {
|
||||||
|
@ -253,7 +253,7 @@ namespace ams::fs {
|
||||||
/* Set the output size. */
|
/* Set the output size. */
|
||||||
*out = br;
|
*out = br;
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ReadFile(size_t *out, FileHandle handle, s64 offset, void *buffer, size_t size) {
|
Result ReadFile(size_t *out, FileHandle handle, s64 offset, void *buffer, size_t size) {
|
||||||
|
@ -263,7 +263,7 @@ namespace ams::fs {
|
||||||
Result GetFileSize(s64 *out, FileHandle handle) {
|
Result GetFileSize(s64 *out, FileHandle handle) {
|
||||||
FIL *fp = GetInternalFile(handle);
|
FIL *fp = GetInternalFile(handle);
|
||||||
*out = f_size(fp);
|
*out = f_size(fp);
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result FlushFile(FileHandle handle) {
|
Result FlushFile(FileHandle handle) {
|
||||||
|
@ -286,7 +286,7 @@ namespace ams::fs {
|
||||||
R_TRY(FlushFile(handle));
|
R_TRY(FlushFile(handle));
|
||||||
}
|
}
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result SetFileSize(FileHandle handle, s64 size) {
|
Result SetFileSize(FileHandle handle, s64 size) {
|
||||||
|
@ -310,7 +310,7 @@ namespace ams::fs {
|
||||||
/* Check that our expansion succeeded. */
|
/* Check that our expansion succeeded. */
|
||||||
AMS_ASSERT(f_size(fp) == static_cast<FSIZE_t>(size));
|
AMS_ASSERT(f_size(fp) == static_cast<FSIZE_t>(size));
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
int GetFileOpenMode(FileHandle handle) {
|
int GetFileOpenMode(FileHandle handle) {
|
||||||
|
|
|
@ -62,7 +62,7 @@ namespace ams::fs {
|
||||||
Result FileHandleStorage::GetSize(s64 *out_size) {
|
Result FileHandleStorage::GetSize(s64 *out_size) {
|
||||||
R_TRY(this->UpdateSize());
|
R_TRY(this->UpdateSize());
|
||||||
*out_size = m_size;
|
*out_size = m_size;
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result FileHandleStorage::SetSize(s64 size) {
|
Result FileHandleStorage::SetSize(s64 size) {
|
||||||
|
|
|
@ -85,11 +85,11 @@ namespace ams::fs {
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result Write(s64 offset, const void *buffer, size_t size) override {
|
virtual Result Write(s64 offset, const void *buffer, size_t size) override {
|
||||||
return fs::ResultUnsupportedOperation();
|
R_THROW(fs::ResultUnsupportedOperation());
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result SetSize(s64 size) override {
|
virtual Result SetSize(s64 size) override {
|
||||||
return fs::ResultUnsupportedOperation();
|
R_THROW(fs::ResultUnsupportedOperation());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -127,11 +127,11 @@ namespace ams::fs {
|
||||||
|
|
||||||
virtual Result GetSize(s64 *out) override {
|
virtual Result GetSize(s64 *out) override {
|
||||||
*out = m_size;
|
*out = m_size;
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result SetSize(s64 size) override {
|
virtual Result SetSize(s64 size) override {
|
||||||
return fs::ResultUnsupportedSetSizeForNotResizableSubStorage();
|
R_THROW(fs::ResultUnsupportedSetSizeForNotResizableSubStorage());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ namespace ams::nxboot {
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result Flush() override {
|
virtual Result Flush() override {
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result GetSize(s64 *out) override {
|
virtual Result GetSize(s64 *out) override {
|
||||||
|
@ -45,15 +45,15 @@ namespace ams::nxboot {
|
||||||
R_TRY(GetSdCardMemoryCapacity(std::addressof(num_sectors)));
|
R_TRY(GetSdCardMemoryCapacity(std::addressof(num_sectors)));
|
||||||
|
|
||||||
*out = static_cast<s64>(num_sectors) * static_cast<s64>(sdmmc::SectorSize);
|
*out = static_cast<s64>(num_sectors) * static_cast<s64>(sdmmc::SectorSize);
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result Write(s64 offset, const void *buffer, size_t size) override {
|
virtual Result Write(s64 offset, const void *buffer, size_t size) override {
|
||||||
return fs::ResultUnsupportedOperation();
|
R_THROW(fs::ResultUnsupportedOperation());
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result SetSize(s64 size) override {
|
virtual Result SetSize(s64 size) override {
|
||||||
return fs::ResultUnsupportedOperation();
|
R_THROW(fs::ResultUnsupportedOperation());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ namespace ams::nxboot {
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result Flush() override {
|
virtual Result Flush() override {
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result GetSize(s64 *out) override {
|
virtual Result GetSize(s64 *out) override {
|
||||||
|
@ -79,15 +79,15 @@ namespace ams::nxboot {
|
||||||
R_TRY(GetMmcMemoryCapacity(std::addressof(num_sectors), Partition));
|
R_TRY(GetMmcMemoryCapacity(std::addressof(num_sectors), Partition));
|
||||||
|
|
||||||
*out = num_sectors * sdmmc::SectorSize;
|
*out = num_sectors * sdmmc::SectorSize;
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result Write(s64 offset, const void *buffer, size_t size) override {
|
virtual Result Write(s64 offset, const void *buffer, size_t size) override {
|
||||||
return fs::ResultUnsupportedOperation();
|
R_THROW(fs::ResultUnsupportedOperation());
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result SetSize(s64 size) override {
|
virtual Result SetSize(s64 size) override {
|
||||||
return fs::ResultUnsupportedOperation();
|
R_THROW(fs::ResultUnsupportedOperation());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -153,23 +153,23 @@ namespace ams::nxboot {
|
||||||
subofs = 0;
|
subofs = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result Flush() override {
|
virtual Result Flush() override {
|
||||||
return fs::ResultUnsupportedOperation();
|
R_THROW(fs::ResultUnsupportedOperation());
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result GetSize(s64 *out) override {
|
virtual Result GetSize(s64 *out) override {
|
||||||
return fs::ResultUnsupportedOperation();
|
R_THROW(fs::ResultUnsupportedOperation());
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result Write(s64 offset, const void *buffer, size_t size) override {
|
virtual Result Write(s64 offset, const void *buffer, size_t size) override {
|
||||||
return fs::ResultUnsupportedOperation();
|
R_THROW(fs::ResultUnsupportedOperation());
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result SetSize(s64 size) override {
|
virtual Result SetSize(s64 size) override {
|
||||||
return fs::ResultUnsupportedOperation();
|
R_THROW(fs::ResultUnsupportedOperation());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ namespace ams::nxboot {
|
||||||
/* Write the context to the file. */
|
/* Write the context to the file. */
|
||||||
R_TRY(fs::WriteFile(file, 0, ctx, sizeof(*ctx), fs::WriteOption::Flush));
|
R_TRY(fs::WriteFile(file, 0, ctx, sizeof(*ctx), fs::WriteOption::Flush));
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ namespace ams::nxboot {
|
||||||
g_mmc_partition = partition;
|
g_mmc_partition = partition;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,7 +55,7 @@ namespace ams::ddsf {
|
||||||
|
|
||||||
/* Attach the session. */
|
/* Attach the session. */
|
||||||
m_session_list.push_back(*session);
|
m_session_list.push_back(*session);
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DetachSession(ISession *session) {
|
void DetachSession(ISession *session) {
|
||||||
|
|
|
@ -67,7 +67,7 @@ namespace ams::fs {
|
||||||
for (s64 i = 0; i < count; i++) {
|
for (s64 i = 0; i < count; i++) {
|
||||||
R_TRY(bucket.Write(i * sizeof(pos), std::addressof(pos), sizeof(pos)));
|
R_TRY(bucket.Write(i * sizeof(pos), std::addressof(pos), sizeof(pos)));
|
||||||
}
|
}
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
KeyValueRomStorageTemplate() : m_bucket_count(), m_bucket_storage(), m_kv_storage(), m_total_entry_size(), m_entry_count() { /* ... */ }
|
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_storage = bucket;
|
||||||
m_bucket_count = count;
|
m_bucket_count = count;
|
||||||
m_kv_storage = kv;
|
m_kv_storage = kv;
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Finalize() {
|
void Finalize() {
|
||||||
|
@ -95,7 +95,7 @@ namespace ams::fs {
|
||||||
s64 kv_size = 0;
|
s64 kv_size = 0;
|
||||||
R_TRY(m_kv_storage.GetSize(std::addressof(kv_size)));
|
R_TRY(m_kv_storage.GetSize(std::addressof(kv_size)));
|
||||||
*out = kv_size - m_total_entry_size;
|
*out = kv_size - m_total_entry_size;
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr u32 GetEntryCount() const {
|
constexpr u32 GetEntryCount() const {
|
||||||
|
@ -128,7 +128,7 @@ namespace ams::fs {
|
||||||
*out = pos;
|
*out = pos;
|
||||||
m_entry_count++;
|
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) {
|
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_pos = pos;
|
||||||
*out_val = elem.value;
|
*out_val = elem.value;
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result GetByPosition(Key *out_key, Value *out_val, Position pos) {
|
Result GetByPosition(Key *out_key, Value *out_val, Position pos) {
|
||||||
|
@ -154,7 +154,7 @@ namespace ams::fs {
|
||||||
|
|
||||||
*out_key = elem.key;
|
*out_key = elem.key;
|
||||||
*out_val = elem.value;
|
*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) {
|
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_key = elem.key;
|
||||||
*out_val = elem.value;
|
*out_val = elem.value;
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result SetByPosition(Position pos, const Value &value) {
|
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)) {
|
if (key.IsEqual(out_elem->key, aux, aux_size, buf, cur_aux_size)) {
|
||||||
*out_pos = cur;
|
*out_pos = cur;
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
*out_prev = cur;
|
*out_prev = cur;
|
||||||
|
@ -233,7 +233,7 @@ namespace ams::fs {
|
||||||
*out = static_cast<Position>(m_total_entry_size);
|
*out = static_cast<Position>(m_total_entry_size);
|
||||||
|
|
||||||
m_total_entry_size = util::AlignUp(static_cast<s64>(end_pos), alignof(Position));
|
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) {
|
Result LinkEntry(Position *out, Position pos, u32 hash_key) {
|
||||||
|
@ -251,7 +251,7 @@ namespace ams::fs {
|
||||||
R_TRY(this->WriteBucket(pos, ind));
|
R_TRY(this->WriteBucket(pos, ind));
|
||||||
|
|
||||||
*out = next;
|
*out = next;
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ReadBucket(Position *out, BucketIndex ind) {
|
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));
|
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) {
|
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));
|
R_TRY(m_kv_storage.Write(pos + sizeof(*elem), aux, aux_size));
|
||||||
}
|
}
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -113,13 +113,13 @@ namespace ams::fs {
|
||||||
virtual Result Write(s64 offset, const void *buffer, size_t size) override {
|
virtual Result Write(s64 offset, const void *buffer, size_t size) override {
|
||||||
/* TODO: Better result? Is it possible to get a more specific one? */
|
/* TODO: Better result? Is it possible to get a more specific one? */
|
||||||
AMS_UNUSED(offset, buffer, size);
|
AMS_UNUSED(offset, buffer, size);
|
||||||
return fs::ResultUnsupportedOperation();
|
R_THROW(fs::ResultUnsupportedOperation());
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result SetSize(s64 size) override {
|
virtual Result SetSize(s64 size) override {
|
||||||
/* TODO: Better result? Is it possible to get a more specific one? */
|
/* TODO: Better result? Is it possible to get a more specific one? */
|
||||||
AMS_UNUSED(size);
|
AMS_UNUSED(size);
|
||||||
return fs::ResultUnsupportedOperation();
|
R_THROW(fs::ResultUnsupportedOperation());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ namespace ams::fs {
|
||||||
|
|
||||||
/* Copy from memory. */
|
/* Copy from memory. */
|
||||||
std::memcpy(buffer, m_buf + offset, size);
|
std::memcpy(buffer, m_buf + offset, size);
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result Write(s64 offset, const void *buffer, size_t size) override {
|
virtual Result Write(s64 offset, const void *buffer, size_t size) override {
|
||||||
|
@ -51,21 +51,21 @@ namespace ams::fs {
|
||||||
|
|
||||||
/* Copy to memory. */
|
/* Copy to memory. */
|
||||||
std::memcpy(m_buf + offset, buffer, size);
|
std::memcpy(m_buf + offset, buffer, size);
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result Flush() override {
|
virtual Result Flush() override {
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result GetSize(s64 *out) override {
|
virtual Result GetSize(s64 *out) override {
|
||||||
*out = m_size;
|
*out = m_size;
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result SetSize(s64 size) override {
|
virtual Result SetSize(s64 size) override {
|
||||||
AMS_UNUSED(size);
|
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 {
|
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) {
|
switch (op_id) {
|
||||||
case OperationId::Invalidate:
|
case OperationId::Invalidate:
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
case OperationId::QueryRange:
|
case OperationId::QueryRange:
|
||||||
R_UNLESS(dst != nullptr, fs::ResultNullptrArgument());
|
R_UNLESS(dst != nullptr, fs::ResultNullptrArgument());
|
||||||
R_UNLESS(dst_size == sizeof(QueryRangeInfo), fs::ResultInvalidSize());
|
R_UNLESS(dst_size == sizeof(QueryRangeInfo), fs::ResultInvalidSize());
|
||||||
reinterpret_cast<QueryRangeInfo *>(dst)->Clear();
|
reinterpret_cast<QueryRangeInfo *>(dst)->Clear();
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
default:
|
default:
|
||||||
return fs::ResultUnsupportedOperateRangeForMemoryStorage();
|
R_THROW(fs::ResultUnsupportedOperateRangeForMemoryStorage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -44,7 +44,7 @@ namespace ams::fs {
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result DoFlush() override final {
|
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 {
|
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_ASSERT(!need_append);
|
||||||
|
|
||||||
AMS_UNUSED(buffer);
|
AMS_UNUSED(buffer);
|
||||||
return fs::ResultUnsupportedWriteForReadOnlyFile();
|
R_THROW(fs::ResultUnsupportedWriteForReadOnlyFile());
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result DoSetSize(s64 size) override final {
|
virtual Result DoSetSize(s64 size) override final {
|
||||||
R_TRY(this->DrySetSize(size, fs::OpenMode_Read));
|
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 {
|
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:
|
case OperationId::QueryRange:
|
||||||
return m_base_file->OperateRange(dst, dst_size, op_id, offset, size, src, src_size);
|
return m_base_file->OperateRange(dst, dst_size, op_id, offset, size, src, src_size);
|
||||||
default:
|
default:
|
||||||
return fs::ResultUnsupportedOperateRangeForReadOnlyFile();
|
R_THROW(fs::ResultUnsupportedOperateRangeForReadOnlyFile());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
|
@ -100,7 +100,7 @@ namespace ams::fs {
|
||||||
R_UNLESS(read_only_file != nullptr, fs::ResultAllocationMemoryFailedInReadOnlyFileSystemA());
|
R_UNLESS(read_only_file != nullptr, fs::ResultAllocationMemoryFailedInReadOnlyFileSystemA());
|
||||||
|
|
||||||
*out_file = std::move(read_only_file);
|
*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 {
|
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 {
|
virtual Result DoCommit() override final {
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result DoCreateFile(const fs::Path &path, s64 size, int flags) override final {
|
virtual Result DoCreateFile(const fs::Path &path, s64 size, int flags) override final {
|
||||||
AMS_UNUSED(path, size, flags);
|
AMS_UNUSED(path, size, flags);
|
||||||
return fs::ResultUnsupportedWriteForReadOnlyFileSystem();
|
R_THROW(fs::ResultUnsupportedWriteForReadOnlyFileSystem());
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result DoDeleteFile(const fs::Path &path) override final {
|
virtual Result DoDeleteFile(const fs::Path &path) override final {
|
||||||
AMS_UNUSED(path);
|
AMS_UNUSED(path);
|
||||||
return fs::ResultUnsupportedWriteForReadOnlyFileSystem();
|
R_THROW(fs::ResultUnsupportedWriteForReadOnlyFileSystem());
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result DoCreateDirectory(const fs::Path &path) override final {
|
virtual Result DoCreateDirectory(const fs::Path &path) override final {
|
||||||
AMS_UNUSED(path);
|
AMS_UNUSED(path);
|
||||||
return fs::ResultUnsupportedWriteForReadOnlyFileSystem();
|
R_THROW(fs::ResultUnsupportedWriteForReadOnlyFileSystem());
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result DoDeleteDirectory(const fs::Path &path) override final {
|
virtual Result DoDeleteDirectory(const fs::Path &path) override final {
|
||||||
AMS_UNUSED(path);
|
AMS_UNUSED(path);
|
||||||
return fs::ResultUnsupportedWriteForReadOnlyFileSystem();
|
R_THROW(fs::ResultUnsupportedWriteForReadOnlyFileSystem());
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result DoDeleteDirectoryRecursively(const fs::Path &path) override final {
|
virtual Result DoDeleteDirectoryRecursively(const fs::Path &path) override final {
|
||||||
AMS_UNUSED(path);
|
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 {
|
virtual Result DoRenameFile(const fs::Path &old_path, const fs::Path &new_path) override final {
|
||||||
AMS_UNUSED(old_path, new_path);
|
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 {
|
virtual Result DoRenameDirectory(const fs::Path &old_path, const fs::Path &new_path) override final {
|
||||||
AMS_UNUSED(old_path, new_path);
|
AMS_UNUSED(old_path, new_path);
|
||||||
return fs::ResultUnsupportedWriteForReadOnlyFileSystem();
|
R_THROW(fs::ResultUnsupportedWriteForReadOnlyFileSystem());
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result DoCleanDirectoryRecursively(const fs::Path &path) override final {
|
virtual Result DoCleanDirectoryRecursively(const fs::Path &path) override final {
|
||||||
AMS_UNUSED(path);
|
AMS_UNUSED(path);
|
||||||
return fs::ResultUnsupportedWriteForReadOnlyFileSystem();
|
R_THROW(fs::ResultUnsupportedWriteForReadOnlyFileSystem());
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result DoGetFreeSpaceSize(s64 *out, const fs::Path &path) override final {
|
virtual Result DoGetFreeSpaceSize(s64 *out, const fs::Path &path) override final {
|
||||||
AMS_UNUSED(out, path);
|
AMS_UNUSED(out, path);
|
||||||
return fs::ResultUnsupportedCommitProvisionallyForReadOnlyFileSystem();
|
R_THROW(fs::ResultUnsupportedCommitProvisionallyForReadOnlyFileSystem());
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result DoGetTotalSpaceSize(s64 *out, const fs::Path &path) override final {
|
virtual Result DoGetTotalSpaceSize(s64 *out, const fs::Path &path) override final {
|
||||||
AMS_UNUSED(out, path);
|
AMS_UNUSED(out, path);
|
||||||
return fs::ResultUnsupportedCommitProvisionallyForReadOnlyFileSystem();
|
R_THROW(fs::ResultUnsupportedCommitProvisionallyForReadOnlyFileSystem());
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result DoCommitProvisionally(s64 counter) override final {
|
virtual Result DoCommitProvisionally(s64 counter) override final {
|
||||||
AMS_UNUSED(counter);
|
AMS_UNUSED(counter);
|
||||||
return fs::ResultUnsupportedGetTotalSpaceSizeForReadOnlyFileSystem();
|
R_THROW(fs::ResultUnsupportedGetTotalSpaceSizeForReadOnlyFileSystem());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -181,7 +181,7 @@ namespace ams::fs {
|
||||||
R_UNLESS(file != nullptr, fs::ResultAllocationMemoryFailedNew());
|
R_UNLESS(file != nullptr, fs::ResultAllocationMemoryFailedNew());
|
||||||
|
|
||||||
*out_file = std::move(file);
|
*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 {
|
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());
|
R_UNLESS(dir != nullptr, fs::ResultAllocationMemoryFailedNew());
|
||||||
|
|
||||||
*out_dir = std::move(dir);
|
*out_dir = std::move(dir);
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result DoCommit() override final {
|
virtual Result DoCommit() override final {
|
||||||
|
|
|
@ -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 {
|
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? */
|
/* TODO: How to deal with this? */
|
||||||
AMS_UNUSED(dst, dst_size, op_id, offset, size, src, src_size);
|
AMS_UNUSED(dst, dst_size, op_id, offset, size, src, src_size);
|
||||||
return fs::ResultUnsupportedOperation();
|
R_THROW(fs::ResultUnsupportedOperation());
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -121,7 +121,7 @@ namespace ams::fs {
|
||||||
R_TRY(m_base_storage->SetSize(m_offset + size));
|
R_TRY(m_base_storage->SetSize(m_offset + size));
|
||||||
|
|
||||||
m_size = size;
|
m_size = size;
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result GetSize(s64 *out) override {
|
virtual Result GetSize(s64 *out) override {
|
||||||
|
@ -129,7 +129,7 @@ namespace ams::fs {
|
||||||
R_UNLESS(this->IsValid(), fs::ResultNotInitialized());
|
R_UNLESS(this->IsValid(), fs::ResultNotInitialized());
|
||||||
|
|
||||||
*out = m_size;
|
*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 {
|
virtual Result OperateRange(void *dst, size_t dst_size, OperationId op_id, s64 offset, s64 size, const void *src, size_t src_size) override {
|
||||||
|
|
|
@ -29,7 +29,7 @@ namespace ams::fs::fsa {
|
||||||
R_UNLESS(out_count != nullptr, fs::ResultNullptrArgument());
|
R_UNLESS(out_count != nullptr, fs::ResultNullptrArgument());
|
||||||
if (max_entries == 0) {
|
if (max_entries == 0) {
|
||||||
*out_count = 0;
|
*out_count = 0;
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
R_UNLESS(out_entries != nullptr, fs::ResultNullptrArgument());
|
R_UNLESS(out_entries != nullptr, fs::ResultNullptrArgument());
|
||||||
R_UNLESS(max_entries > 0, fs::ResultInvalidArgument());
|
R_UNLESS(max_entries > 0, fs::ResultInvalidArgument());
|
||||||
|
|
|
@ -44,10 +44,10 @@ namespace ams::fs::impl {
|
||||||
case PriorityRaw_Realtime: *out = TlsIoPriority_Realtime; break;
|
case PriorityRaw_Realtime: *out = TlsIoPriority_Realtime; break;
|
||||||
case PriorityRaw_Low: *out = TlsIoPriority_Low; break;
|
case PriorityRaw_Low: *out = TlsIoPriority_Low; break;
|
||||||
case PriorityRaw_Background: *out = TlsIoPriority_Background; 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) {
|
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_Realtime: *out = PriorityRaw_Realtime; break;
|
||||||
case TlsIoPriority_Low: *out = PriorityRaw_Low; break;
|
case TlsIoPriority_Low: *out = PriorityRaw_Low; break;
|
||||||
case TlsIoPriority_Background: *out = PriorityRaw_Background; 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) {
|
inline u8 GetTlsIoPriority(os::ThreadType *thread) {
|
||||||
|
|
|
@ -46,14 +46,14 @@ namespace ams::fssystem::buffers {
|
||||||
}
|
}
|
||||||
} R_END_TRY_CATCH;
|
} R_END_TRY_CATCH;
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename F>
|
template<typename F>
|
||||||
Result DoContinuouslyUntilBufferIsAllocated(F f, const char *function_name) {
|
Result DoContinuouslyUntilBufferIsAllocated(F f, const char *function_name) {
|
||||||
R_TRY(DoContinuouslyUntilBufferIsAllocated(f, []() ALWAYS_INLINE_LAMBDA { return ResultSuccess(); }, function_name));
|
R_TRY(DoContinuouslyUntilBufferIsAllocated(f, []() ALWAYS_INLINE_LAMBDA { R_SUCCEED(); }, function_name));
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ACCURATE_TO_VERSION: Unknown */
|
/* ACCURATE_TO_VERSION: Unknown */
|
||||||
|
@ -110,10 +110,10 @@ namespace ams::fssystem::buffers {
|
||||||
if (buffer.first != 0) {
|
if (buffer.first != 0) {
|
||||||
buffer_manager->DeallocateBuffer(buffer.first, buffer.second);
|
buffer_manager->DeallocateBuffer(buffer.first, buffer.second);
|
||||||
}
|
}
|
||||||
return fs::ResultBufferAllocationFailed();
|
R_THROW(fs::ResultBufferAllocationFailed());
|
||||||
}
|
}
|
||||||
*out = buffer;
|
*out = buffer;
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
};
|
};
|
||||||
|
|
||||||
if (context == nullptr || !context->IsNeedBlocking()) {
|
if (context == nullptr || !context->IsNeedBlocking()) {
|
||||||
|
@ -125,7 +125,7 @@ namespace ams::fssystem::buffers {
|
||||||
}
|
}
|
||||||
|
|
||||||
AMS_ASSERT(out->first != 0);
|
AMS_ASSERT(out->first != 0);
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -155,7 +155,7 @@ namespace ams::fssystem {
|
||||||
m_external_attr_info_buffer = reinterpret_cast<char *>(aligned_attr_info_buf);
|
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));
|
m_external_attr_info_count = static_cast<s32>((work_end - aligned_attr_info_buf) / sizeof(AttrInfo));
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Finalize();
|
void Finalize();
|
||||||
|
@ -216,7 +216,7 @@ namespace ams::fssystem {
|
||||||
m_peak_free_size = m_total_size;
|
m_peak_free_size = m_total_size;
|
||||||
m_peak_total_allocatable_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) {
|
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_free_size = m_total_size;
|
||||||
m_peak_total_allocatable_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) {
|
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_free_size = m_total_size;
|
||||||
m_peak_total_allocatable_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) {
|
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_free_size = m_total_size;
|
||||||
m_peak_total_allocatable_size = m_total_size;
|
m_peak_total_allocatable_size = m_total_size;
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Finalize() {
|
void Finalize() {
|
||||||
|
|
|
@ -106,7 +106,7 @@ namespace ams::fssystem {
|
||||||
}
|
}
|
||||||
|
|
||||||
*out = m_base_storage_size;
|
*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 {
|
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;
|
*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 {
|
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;
|
*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 {
|
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 {
|
||||||
|
|
|
@ -110,7 +110,7 @@ namespace ams::fssystem {
|
||||||
|
|
||||||
/* Return the allocated object. */
|
/* Return the allocated object. */
|
||||||
*out = std::move(p);
|
*out = std::move(p);
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,13 +40,13 @@ namespace ams::fssystem {
|
||||||
virtual Result QueryAppropriateOffset(s64 *out, s64 offset, s64 access_size, s64 alignment_size) override {
|
virtual Result QueryAppropriateOffset(s64 *out, s64 offset, s64 access_size, s64 alignment_size) override {
|
||||||
/* Align the access. */
|
/* Align the access. */
|
||||||
*out = util::AlignDown(offset + access_size, alignment_size);
|
*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 {
|
virtual Result QueryInvocationCount(s64 *out, s64 start_offset, s64 end_offset, s64 access_size, s64 alignment_size) override {
|
||||||
/* Determine aligned access count. */
|
/* Determine aligned access count. */
|
||||||
*out = util::DivideUp(end_offset - util::AlignDown(start_offset, alignment_size), access_size);
|
*out = util::DivideUp(end_offset - util::AlignDown(start_offset, alignment_size), access_size);
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -150,7 +150,7 @@ namespace ams::fssystem {
|
||||||
}
|
}
|
||||||
out_info->SetSkipCount(entry_index - param.entry_index);
|
out_info->SetSkipCount(entry_index - param.entry_index);
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename EntryType>
|
template<typename EntryType>
|
||||||
|
|
|
@ -144,7 +144,7 @@ namespace ams::fssystem {
|
||||||
cur_offset += cur_size;
|
cur_offset += cur_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,7 +58,7 @@ namespace ams::fssystem {
|
||||||
virtual Result Read(s64 offset, void *buffer, size_t size) override;
|
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 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 GetSize(s64 *out) override;
|
||||||
|
|
||||||
virtual Result Flush() override;
|
virtual Result Flush() override;
|
||||||
|
|
|
@ -37,7 +37,7 @@ namespace ams::i2c {
|
||||||
|
|
||||||
R_TRY(i2c::ExecuteCommandList(out, sizeof(*out), session, cmd_list, formatter.GetCurrentLength()));
|
R_TRY(i2c::ExecuteCommandList(out, sizeof(*out), session, cmd_list, formatter.GetCurrentLength()));
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename RegType> requires std::unsigned_integral<RegType>
|
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);
|
constexpr i2c::TransactionOption StopOption = static_cast<i2c::TransactionOption>(i2c::TransactionOption_StartCondition | i2c::TransactionOption_StopCondition);
|
||||||
R_TRY(i2c::Send(session, buf, sizeof(buf), StopOption));
|
R_TRY(i2c::Send(session, buf, sizeof(buf), StopOption));
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,7 +72,7 @@ namespace ams::kvdb {
|
||||||
R_UNLESS(m_buffer != nullptr, kvdb::ResultAllocationFailed());
|
R_UNLESS(m_buffer != nullptr, kvdb::ResultAllocationFailed());
|
||||||
|
|
||||||
m_size = size;
|
m_size = size;
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result Initialize(const void *buf, size_t size) {
|
Result Initialize(const void *buf, size_t size) {
|
||||||
|
@ -82,7 +82,7 @@ namespace ams::kvdb {
|
||||||
/* Copy the input data in. */
|
/* Copy the input data in. */
|
||||||
std::memcpy(m_buffer, buf, size);
|
std::memcpy(m_buffer, buf, size);
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
|
@ -51,7 +51,7 @@ namespace ams::kvdb {
|
||||||
LruHeader new_header = { .entry_count = 0, };
|
LruHeader new_header = { .entry_count = 0, };
|
||||||
R_TRY(fs::WriteFile(file, 0, std::addressof(new_header), sizeof(new_header), fs::WriteOption::Flush));
|
R_TRY(fs::WriteFile(file, 0, std::addressof(new_header), sizeof(new_header), fs::WriteOption::Flush));
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
void RemoveIndex(size_t i) {
|
void RemoveIndex(size_t i) {
|
||||||
|
@ -91,7 +91,7 @@ namespace ams::kvdb {
|
||||||
/* Read entries. */
|
/* Read entries. */
|
||||||
R_TRY(fs::ReadFile(file, sizeof(m_header), m_keys, BufferSize));
|
R_TRY(fs::ReadFile(file, sizeof(m_header), m_keys, BufferSize));
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result Save() {
|
Result Save() {
|
||||||
|
@ -109,7 +109,7 @@ namespace ams::kvdb {
|
||||||
/* Flush. */
|
/* Flush. */
|
||||||
R_TRY(fs::FlushFile(file));
|
R_TRY(fs::FlushFile(file));
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t GetCount() const {
|
size_t GetCount() const {
|
||||||
|
@ -223,7 +223,7 @@ namespace ams::kvdb {
|
||||||
|
|
||||||
/* The entry exists and is the correct type. */
|
/* The entry exists and is the correct type. */
|
||||||
*out = true;
|
*out = true;
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
static Result DirectoryExists(bool *out, const char *path) {
|
static Result DirectoryExists(bool *out, const char *path) {
|
||||||
|
@ -239,7 +239,7 @@ namespace ams::kvdb {
|
||||||
R_TRY(LeastRecentlyUsedList::CreateNewList(GetLeastRecentlyUsedListPath(dir)));
|
R_TRY(LeastRecentlyUsedList::CreateNewList(GetLeastRecentlyUsedListPath(dir)));
|
||||||
R_TRY(fs::CreateDirectory(dir));
|
R_TRY(fs::CreateDirectory(dir));
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
static Result ValidateExistingCache(const char *dir) {
|
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. */
|
/* If one exists but not the other, we have an invalid state. */
|
||||||
R_UNLESS(has_lru && has_kvs, kvdb::ResultInvalidFilesystemState());
|
R_UNLESS(has_lru && has_kvs, kvdb::ResultInvalidFilesystemState());
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
void RemoveOldestKey() {
|
void RemoveOldestKey() {
|
||||||
|
@ -276,7 +276,7 @@ namespace ams::kvdb {
|
||||||
/* layout it can't really be fixed without breaking existing devices... */
|
/* layout it can't really be fixed without breaking existing devices... */
|
||||||
R_TRY(m_kvs.Initialize(dir));
|
R_TRY(m_kvs.Initialize(dir));
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t GetCount() const {
|
size_t GetCount() const {
|
||||||
|
@ -335,7 +335,7 @@ namespace ams::kvdb {
|
||||||
if (m_lru_list.GetCount() == 1) {
|
if (m_lru_list.GetCount() == 1) {
|
||||||
m_lru_list.Pop();
|
m_lru_list.Pop();
|
||||||
R_TRY(m_lru_list.Save());
|
R_TRY(m_lru_list.Save());
|
||||||
return fs::ResultNotEnoughFreeSpace();
|
R_THROW(fs::ResultNotEnoughFreeSpace());
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Otherwise, remove the oldest element from the cache and try again. */
|
/* Otherwise, remove the oldest element from the cache and try again. */
|
||||||
|
@ -351,7 +351,7 @@ namespace ams::kvdb {
|
||||||
/* Save the list. */
|
/* Save the list. */
|
||||||
R_TRY(m_lru_list.Save());
|
R_TRY(m_lru_list.Save());
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Value>
|
template<typename Value>
|
||||||
|
@ -365,7 +365,7 @@ namespace ams::kvdb {
|
||||||
R_TRY(m_kvs.Remove(key));
|
R_TRY(m_kvs.Remove(key));
|
||||||
R_TRY(m_lru_list.Save());
|
R_TRY(m_lru_list.Save());
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result RemoveAll() {
|
Result RemoveAll() {
|
||||||
|
@ -375,7 +375,7 @@ namespace ams::kvdb {
|
||||||
}
|
}
|
||||||
R_TRY(m_lru_list.Save());
|
R_TRY(m_lru_list.Save());
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -93,7 +93,7 @@ namespace ams::kvdb {
|
||||||
size_t size = 0;
|
size_t size = 0;
|
||||||
R_TRY(this->Get(std::addressof(size), out_value, sizeof(Value), key));
|
R_TRY(this->Get(std::addressof(size), out_value, sizeof(Value), key));
|
||||||
AMS_ABORT_UNLESS(size >= sizeof(Value));
|
AMS_ABORT_UNLESS(size >= sizeof(Value));
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Key>
|
template<typename Key>
|
||||||
|
|
|
@ -125,7 +125,7 @@ namespace ams::kvdb {
|
||||||
R_UNLESS(m_entries != nullptr, kvdb::ResultAllocationFailed());
|
R_UNLESS(m_entries != nullptr, kvdb::ResultAllocationFailed());
|
||||||
m_capacity = capacity;
|
m_capacity = capacity;
|
||||||
m_memory_resource = mr;
|
m_memory_resource = mr;
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result Set(const Key &key, const void *value, size_t value_size) {
|
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. */
|
/* Save the new Entry in the map. */
|
||||||
*it = Entry(key, new_value, value_size);
|
*it = Entry(key, new_value, value_size);
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result AddUnsafe(const Key &key, void *value, size_t value_size) {
|
Result AddUnsafe(const Key &key, void *value, size_t value_size) {
|
||||||
R_UNLESS(m_count < m_capacity, kvdb::ResultOutOfKeyResource());
|
R_UNLESS(m_count < m_capacity, kvdb::ResultOutOfKeyResource());
|
||||||
|
|
||||||
m_entries[m_count++] = Entry(key, value, value_size);
|
m_entries[m_count++] = Entry(key, value, value_size);
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result Remove(const Key &key) {
|
Result Remove(const Key &key) {
|
||||||
|
@ -167,7 +167,7 @@ namespace ams::kvdb {
|
||||||
m_memory_resource->Deallocate(it->GetValuePointer(), it->GetValueSize());
|
m_memory_resource->Deallocate(it->GetValuePointer(), it->GetValueSize());
|
||||||
std::memmove(it, it + 1, sizeof(*it) * (this->end() - (it + 1)));
|
std::memmove(it, it + 1, sizeof(*it) * (this->end() - (it + 1)));
|
||||||
m_count--;
|
m_count--;
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Entry *begin() {
|
Entry *begin() {
|
||||||
|
@ -276,7 +276,7 @@ namespace ams::kvdb {
|
||||||
R_TRY(m_index.Initialize(capacity, mr));
|
R_TRY(m_index.Initialize(capacity, mr));
|
||||||
m_memory_resource = mr;
|
m_memory_resource = mr;
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result Initialize(size_t capacity, MemoryResource *mr) {
|
Result Initialize(size_t capacity, MemoryResource *mr) {
|
||||||
|
@ -288,7 +288,7 @@ namespace ams::kvdb {
|
||||||
/* Initialize our index. */
|
/* Initialize our index. */
|
||||||
R_TRY(m_index.Initialize(capacity, mr));
|
R_TRY(m_index.Initialize(capacity, mr));
|
||||||
m_memory_resource = mr;
|
m_memory_resource = mr;
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t GetCount() const {
|
size_t GetCount() const {
|
||||||
|
@ -384,7 +384,7 @@ namespace ams::kvdb {
|
||||||
size_t size = std::min(max_out_size, it->GetValueSize());
|
size_t size = std::min(max_out_size, it->GetValueSize());
|
||||||
std::memcpy(out_value, it->GetValuePointer(), size);
|
std::memcpy(out_value, it->GetValuePointer(), size);
|
||||||
*out_size = size;
|
*out_size = size;
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Value = void>
|
template<typename Value = void>
|
||||||
|
@ -394,7 +394,7 @@ namespace ams::kvdb {
|
||||||
R_UNLESS(it != this->end(), kvdb::ResultKeyNotFound());
|
R_UNLESS(it != this->end(), kvdb::ResultKeyNotFound());
|
||||||
|
|
||||||
*out_value = it->template GetValuePointer<Value>();
|
*out_value = it->template GetValuePointer<Value>();
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Value = void>
|
template<typename Value = void>
|
||||||
|
@ -404,7 +404,7 @@ namespace ams::kvdb {
|
||||||
R_UNLESS(it != this->end(), kvdb::ResultKeyNotFound());
|
R_UNLESS(it != this->end(), kvdb::ResultKeyNotFound());
|
||||||
|
|
||||||
*out_value = it->template GetValuePointer<Value>();
|
*out_value = it->template GetValuePointer<Value>();
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Value>
|
template<typename Value>
|
||||||
|
@ -414,7 +414,7 @@ namespace ams::kvdb {
|
||||||
R_UNLESS(it != this->end(), kvdb::ResultKeyNotFound());
|
R_UNLESS(it != this->end(), kvdb::ResultKeyNotFound());
|
||||||
|
|
||||||
*out_value = it->template GetValue<Value>();
|
*out_value = it->template GetValue<Value>();
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result GetValueSize(size_t *out_size, const Key &key) const {
|
Result GetValueSize(size_t *out_size, const Key &key) const {
|
||||||
|
@ -423,7 +423,7 @@ namespace ams::kvdb {
|
||||||
R_UNLESS(it != this->end(), kvdb::ResultKeyNotFound());
|
R_UNLESS(it != this->end(), kvdb::ResultKeyNotFound());
|
||||||
|
|
||||||
*out_size = it->GetValueSize();
|
*out_size = it->GetValueSize();
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result Remove(const Key &key) {
|
Result Remove(const Key &key) {
|
||||||
|
@ -485,7 +485,7 @@ namespace ams::kvdb {
|
||||||
R_TRY(fs::WriteFile(file, 0, buf, size, fs::WriteOption::Flush));
|
R_TRY(fs::WriteFile(file, 0, buf, size, fs::WriteOption::Flush));
|
||||||
}
|
}
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result Commit(const AutoBuffer &buffer, bool destructive) {
|
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()));
|
R_TRY(fs::RenameFile(m_temp_path.Get(), m_path.Get()));
|
||||||
}
|
}
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t GetArchiveSize() const {
|
size_t GetArchiveSize() const {
|
||||||
|
@ -530,7 +530,7 @@ namespace ams::kvdb {
|
||||||
R_TRY(dst->Initialize(static_cast<size_t>(archive_size)));
|
R_TRY(dst->Initialize(static_cast<size_t>(archive_size)));
|
||||||
R_TRY(fs::ReadFile(file, 0, dst->Get(), dst->GetSize()));
|
R_TRY(fs::ReadFile(file, 0, dst->Get(), dst->GetSize()));
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -72,7 +72,7 @@ namespace ams::ncm {
|
||||||
R_UNLESS(m_buffer != nullptr, ncm::ResultAllocationFailed());
|
R_UNLESS(m_buffer != nullptr, ncm::ResultAllocationFailed());
|
||||||
|
|
||||||
m_size = size;
|
m_size = size;
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result Initialize(const void *buf, size_t size) {
|
Result Initialize(const void *buf, size_t size) {
|
||||||
|
@ -82,7 +82,7 @@ namespace ams::ncm {
|
||||||
/* Copy the input data in. */
|
/* Copy the input data in. */
|
||||||
std::memcpy(m_buffer, buf, size);
|
std::memcpy(m_buffer, buf, size);
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,7 @@ namespace ams::ncm {
|
||||||
R_TRY(m_interface->Get(std::addressof(size), key, sf::OutBuffer(dst, dst_size)));
|
R_TRY(m_interface->Get(std::addressof(size), key, sf::OutBuffer(dst, dst_size)));
|
||||||
|
|
||||||
*out_size = size;
|
*out_size = size;
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
#define AMS_NCM_DEFINE_GETTERS(Kind, IdType) \
|
#define AMS_NCM_DEFINE_GETTERS(Kind, IdType) \
|
||||||
|
@ -152,7 +152,7 @@ namespace ams::ncm {
|
||||||
R_TRY(m_interface->GetSize(std::addressof(size), key));
|
R_TRY(m_interface->GetSize(std::addressof(size), key));
|
||||||
|
|
||||||
*out_size = size;
|
*out_size = size;
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result GetRequiredSystemVersion(u32 *out_version, const ContentMetaKey &key) {
|
Result GetRequiredSystemVersion(u32 *out_version, const ContentMetaKey &key) {
|
||||||
|
|
|
@ -149,7 +149,7 @@ namespace ams::ncm {
|
||||||
|
|
||||||
StorageId GetInstallStorage() const { return m_install_storage; }
|
StorageId GetInstallStorage() const { return m_install_storage; }
|
||||||
|
|
||||||
virtual Result OnPrepareComplete() { return ResultSuccess(); }
|
virtual Result OnPrepareComplete() { R_SUCCEED(); }
|
||||||
|
|
||||||
Result GetSystemUpdateTaskApplyInfo(SystemUpdateTaskApplyInfo *out);
|
Result GetSystemUpdateTaskApplyInfo(SystemUpdateTaskApplyInfo *out);
|
||||||
|
|
||||||
|
@ -164,9 +164,9 @@ namespace ams::ncm {
|
||||||
Result VerifyAllNotCommitted(const StorageContentMetaKey *keys, s32 num_keys);
|
Result VerifyAllNotCommitted(const StorageContentMetaKey *keys, s32 num_keys);
|
||||||
|
|
||||||
virtual Result PrepareInstallContentMetaData() = 0;
|
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);
|
Result WritePlaceHolder(const ContentMetaKey &key, InstallContentInfo *content_info);
|
||||||
virtual Result OnWritePlaceHolder(const ContentMetaKey &key, InstallContentInfo *content_info) = 0;
|
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 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);
|
Result ListRightsIdsByInstallContentMeta(s32 *out_count, Span<RightsId> out_span, const InstallContentMeta &content_meta, s32 offset);
|
||||||
public:
|
public:
|
||||||
virtual Result CheckInstallable() { return ResultSuccess(); }
|
virtual Result CheckInstallable() { R_SUCCEED(); }
|
||||||
|
|
||||||
void SetFirmwareVariationId(FirmwareVariationId id) { m_firmware_variation_id = id; }
|
void SetFirmwareVariationId(FirmwareVariationId id) { m_firmware_variation_id = id; }
|
||||||
Result ListRightsIds(s32 *out_count, Span<RightsId> out_span, const ContentMetaKey &key, s32 offset);
|
Result ListRightsIds(s32 *out_count, Span<RightsId> out_span, const ContentMetaKey &key, s32 offset);
|
||||||
|
|
|
@ -52,7 +52,7 @@ namespace ams::pgl {
|
||||||
os::AttachReadableHandleToSystemEvent(out, handle.GetOsHandle(), handle.IsManaged(), os::EventClearMode_AutoClear);
|
os::AttachReadableHandleToSystemEvent(out, handle.GetOsHandle(), handle.IsManaged(), os::EventClearMode_AutoClear);
|
||||||
handle.Detach();
|
handle.Detach();
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result GetProcessEventInfo(pm::ProcessEventInfo *out) override {
|
virtual Result GetProcessEventInfo(pm::ProcessEventInfo *out) override {
|
||||||
|
@ -74,7 +74,7 @@ namespace ams::pgl {
|
||||||
os::NativeHandle handle;
|
os::NativeHandle handle;
|
||||||
R_TRY(m_tipc_interface.GetProcessEventHandle(std::addressof(handle)));
|
R_TRY(m_tipc_interface.GetProcessEventHandle(std::addressof(handle)));
|
||||||
os::AttachReadableHandleToSystemEvent(out, handle, true, os::EventClearMode_AutoClear);
|
os::AttachReadableHandleToSystemEvent(out, handle, true, os::EventClearMode_AutoClear);
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result GetProcessEventInfo(pm::ProcessEventInfo *out) override {
|
virtual Result GetProcessEventInfo(pm::ProcessEventInfo *out) override {
|
||||||
|
|
|
@ -174,7 +174,7 @@ namespace ams::sf::hipc {
|
||||||
|
|
||||||
this->RegisterServerImpl(server, port_handle, false);
|
this->RegisterServerImpl(server, port_handle, false);
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if AMS_SF_MITM_SUPPORTED
|
#if AMS_SF_MITM_SUPPORTED
|
||||||
|
@ -220,7 +220,7 @@ namespace ams::sf::hipc {
|
||||||
|
|
||||||
this->RegisterServerImpl(server, port_handle, true);
|
this->RegisterServerImpl(server, port_handle, true);
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -52,14 +52,14 @@ namespace ams::sf {
|
||||||
|
|
||||||
constexpr inline Result MarshalProcessId(ClientProcessId &client, const os::ProcessId &client_process_id) {
|
constexpr inline Result MarshalProcessId(ClientProcessId &client, const os::ProcessId &client_process_id) {
|
||||||
client.SetValue(client_process_id);
|
client.SetValue(client_process_id);
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr inline Result MarshalProcessId(ClientAppletResourceUserId &client, const os::ProcessId &client_process_id) {
|
constexpr inline Result MarshalProcessId(ClientAppletResourceUserId &client, const os::ProcessId &client_process_id) {
|
||||||
if (client.GetValue() != client_process_id && client.GetValue() != os::ProcessId{}) {
|
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) {
|
if constexpr (NumInObjects > 0) {
|
||||||
R_TRY(processor->GetInObjects(m_in_object_holders.data()));
|
R_TRY(processor->GetInObjects(m_in_object_holders.data()));
|
||||||
}
|
}
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename ServiceImplTuple>
|
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(6);
|
||||||
_SF_IN_OUT_HOLDER_VALIDATE_IN_OBJECT(7);
|
_SF_IN_OUT_HOLDER_VALIDATE_IN_OBJECT(7);
|
||||||
#undef _SF_IN_OUT_HOLDER_VALIDATE_IN_OBJECT
|
#undef _SF_IN_OUT_HOLDER_VALIDATE_IN_OBJECT
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
template<size_t Index, typename Interface>
|
template<size_t Index, typename Interface>
|
||||||
|
@ -792,7 +792,7 @@ namespace ams::sf::impl {
|
||||||
virtual Result GetInObjects(cmif::ServiceObjectHolder *in_objects) const override final {
|
virtual Result GetInObjects(cmif::ServiceObjectHolder *in_objects) const override final {
|
||||||
/* By default, InObjects aren't supported. */
|
/* By default, InObjects aren't supported. */
|
||||||
AMS_UNUSED(in_objects);
|
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;
|
is_request_valid &= meta_raw_size >= command_raw_size;
|
||||||
|
|
||||||
R_UNLESS(is_request_valid, sf::hipc::ResultInvalidCmifRequest());
|
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 {
|
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) {
|
if constexpr (CommandMeta::NumOutHipcPointerBuffers > 0) {
|
||||||
R_UNLESS(pointer_buffer_tail <= pointer_buffer_head, sf::hipc::ResultPointerBufferTooSmall());
|
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) {
|
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());
|
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_raw_data = cmif::PointerAndSize(out_raw_data.GetAddress() + sizeof(*header), out_raw_data.GetSize() - sizeof(*header));
|
||||||
*out_header_ptr = header;
|
*out_header_ptr = header;
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename CommandMeta, typename... Arguments>
|
template<typename CommandMeta, typename... Arguments>
|
||||||
|
@ -1242,7 +1242,7 @@ namespace ams::sf::impl {
|
||||||
#undef _SF_IMPL_PROCESSOR_MARSHAL_OUT_OBJECT
|
#undef _SF_IMPL_PROCESSOR_MARSHAL_OUT_OBJECT
|
||||||
in_out_objects_holder.SetOutObjects(ctx, response);
|
in_out_objects_holder.SetOutObjects(ctx, response);
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
template<auto ServiceCommandImpl, typename Return, typename ClassType, typename... Arguments>
|
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)...);
|
return (static_cast<ClassType *>(srv_obj)->*ServiceCommandImpl)(std::forward<Arguments>(args)...);
|
||||||
} else {
|
} else {
|
||||||
(static_cast<ClassType *>(srv_obj)->*ServiceCommandImpl)(std::forward<Arguments>(args)...);
|
(static_cast<ClassType *>(srv_obj)->*ServiceCommandImpl)(std::forward<Arguments>(args)...);
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -135,7 +135,7 @@ namespace ams::tipc::impl {
|
||||||
if constexpr (HasDefaultServiceCommandProcessor<ImplType>) { \
|
if constexpr (HasDefaultServiceCommandProcessor<ImplType>) { \
|
||||||
return impl->ProcessDefaultServiceCommand(message_buffer); \
|
return impl->ProcessDefaultServiceCommand(message_buffer); \
|
||||||
} else { \
|
} else { \
|
||||||
return tipc::ResultInvalidMethod(); \
|
R_THROW(tipc::ResultInvalidMethod()); \
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
|
|
|
@ -572,7 +572,7 @@ namespace ams::tipc::impl {
|
||||||
R_UNLESS(message_buffer.Get32(SpecialHeaderIndex) == ExpectedSpecialHeader, tipc::ResultInvalidMessageFormat());
|
R_UNLESS(message_buffer.Get32(SpecialHeaderIndex) == ExpectedSpecialHeader, tipc::ResultInvalidMessageFormat());
|
||||||
}
|
}
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
template<size_t Ix>
|
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)...);
|
return (object->*ServiceCommandImpl)(Processor::template DeserializeArgument<Ix>(message_buffer, out_raw_holder, out_handles_holder)...);
|
||||||
} else {
|
} else {
|
||||||
(object->*ServiceCommandImpl)(Processor::template DeserializeArgument<Ix>(message_buffer, out_raw_holder, out_handles_holder)...);
|
(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>());
|
}(std::make_index_sequence<std::tuple_size<typename CommandMeta::ArgsType>::value>());
|
||||||
|
|
||||||
/* Serialize output. */
|
/* Serialize output. */
|
||||||
Processor::SerializeResults(message_buffer, command_result, out_raw_holder, out_handles_holder);
|
Processor::SerializeResults(message_buffer, command_result, out_raw_holder, out_handles_holder);
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,7 +122,7 @@ namespace ams::tipc {
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
} else {
|
} else {
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -319,7 +319,7 @@ namespace ams::tipc {
|
||||||
const Result method_result = message_buffer.GetRaw<u32>(raw_data_offset);
|
const Result method_result = message_buffer.GetRaw<u32>(raw_data_offset);
|
||||||
|
|
||||||
/* Check that the result is the special deferral result. */
|
/* Check that the result is the special deferral result. */
|
||||||
return tipc::ResultRequestDeferred::Includes(method_result);
|
R_THROW(tipc::ResultRequestDeferred::Includes(method_result));
|
||||||
} else {
|
} else {
|
||||||
/* If deferral isn't supported, requests are never deferred. */
|
/* If deferral isn't supported, requests are never deferred. */
|
||||||
return false;
|
return false;
|
||||||
|
@ -501,7 +501,7 @@ namespace ams::tipc {
|
||||||
/* Add the session to the least burdened manager. */
|
/* Add the session to the least burdened manager. */
|
||||||
best_manager->AddSession(session_handle, object);
|
best_manager->AddSession(session_handle, object);
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
template<size_t Ix> requires (Ix < NumPorts)
|
template<size_t Ix> requires (Ix < NumPorts)
|
||||||
|
@ -795,7 +795,7 @@ namespace ams::tipc {
|
||||||
/* Add the session to our manager. */
|
/* Add the session to our manager. */
|
||||||
m_port_manager.AddSession(session_handle, object);
|
m_port_manager.AddSession(session_handle, object);
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
void LoopProcess(PortManagerBase &port_manager) {
|
void LoopProcess(PortManagerBase &port_manager) {
|
||||||
|
|
|
@ -37,7 +37,7 @@ namespace ams::cal {
|
||||||
|
|
||||||
/* Write the output. */
|
/* Write the output. */
|
||||||
*out = battery_version[0];
|
*out = battery_version[0];
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result GetBatteryVendor(size_t *out_vendor_size, void *dst, size_t dst_size) {
|
Result GetBatteryVendor(size_t *out_vendor_size, void *dst, size_t dst_size) {
|
||||||
|
@ -47,7 +47,7 @@ namespace ams::cal {
|
||||||
|
|
||||||
/* Copy output. */
|
/* Copy output. */
|
||||||
*out_vendor_size = static_cast<size_t>(util::Strlcpy(static_cast<char *>(dst), battery_lot, std::min(dst_size, BatteryVendorSizeMax)));
|
*out_vendor_size = static_cast<size_t>(util::Strlcpy(static_cast<char *>(dst), battery_lot, std::min(dst_size, BatteryVendorSizeMax)));
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,7 @@ namespace ams::cal::impl {
|
||||||
const u16 crc = *reinterpret_cast<const u16 *>(reinterpret_cast<uintptr_t>(data) + size - sizeof(u16));
|
const u16 crc = *reinterpret_cast<const u16 *>(reinterpret_cast<uintptr_t>(data) + size - sizeof(u16));
|
||||||
R_UNLESS(CalculateCrc16(data, size - sizeof(u16)) == crc, cal::ResultCalibrationDataCrcError());
|
R_UNLESS(CalculateCrc16(data, size - sizeof(u16)) == crc, cal::ResultCalibrationDataCrcError());
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ namespace ams::cal::impl {
|
||||||
/* Validate the crc. */
|
/* Validate the crc. */
|
||||||
R_TRY(ValidateCalibrationCrc(dst, block_size));
|
R_TRY(ValidateCalibrationCrc(dst, block_size));
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,7 @@ namespace ams::capsrv {
|
||||||
*out_width = static_cast<s32>(width);
|
*out_width = static_cast<s32>(width);
|
||||||
*out_height = static_cast<s32>(height);
|
*out_height = static_cast<s32>(height);
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
#else
|
#else
|
||||||
AMS_UNUSED(out_data_size, out_width, out_height, layer_stack, timeout);
|
AMS_UNUSED(out_data_size, out_width, out_height, layer_stack, timeout);
|
||||||
AMS_ABORT("TODO");
|
AMS_ABORT("TODO");
|
||||||
|
@ -64,7 +64,7 @@ namespace ams::capsrv {
|
||||||
R_TRY(::capsscReadRawScreenShotReadStream(std::addressof(read_size), dst, dst_size, static_cast<u64>(offset)));
|
R_TRY(::capsscReadRawScreenShotReadStream(std::addressof(read_size), dst, dst_size, static_cast<u64>(offset)));
|
||||||
|
|
||||||
*out_read_size = static_cast<size_t>(read_size);
|
*out_read_size = static_cast<size_t>(read_size);
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
#else
|
#else
|
||||||
AMS_UNUSED(out_read_size, dst, dst_size, offset);
|
AMS_UNUSED(out_read_size, dst, dst_size, offset);
|
||||||
AMS_ABORT("TODO");
|
AMS_ABORT("TODO");
|
||||||
|
|
|
@ -39,7 +39,7 @@ namespace ams::capsrv::server {
|
||||||
|
|
||||||
/* We're initialized. */
|
/* We're initialized. */
|
||||||
g_initialized = true;
|
g_initialized = true;
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FinalizeForDecoderServer() {
|
void FinalizeForDecoderServer() {
|
||||||
|
|
|
@ -29,7 +29,7 @@ namespace ams::capsrv::server {
|
||||||
/* Initialize the idle event, we're idle initially. */
|
/* Initialize the idle event, we're idle initially. */
|
||||||
os::InitializeEvent(std::addressof(m_idle_event), true, os::EventClearMode_ManualClear);
|
os::InitializeEvent(std::addressof(m_idle_event), true, os::EventClearMode_ManualClear);
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DecoderControlServerManager::Finalize() {
|
void DecoderControlServerManager::Finalize() {
|
||||||
|
|
|
@ -64,7 +64,7 @@ namespace ams::capsrv::server {
|
||||||
|
|
||||||
/* We succeeded, so we shouldn't clear the output memory. */
|
/* We succeeded, so we shouldn't clear the output memory. */
|
||||||
clear_guard.Cancel();
|
clear_guard.Cancel();
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,9 +49,9 @@ namespace ams::capsrv::server::jpeg {
|
||||||
case JpegLibraryType::J_MESSAGE_CODE::JERR_TFILE_READ:
|
case JpegLibraryType::J_MESSAGE_CODE::JERR_TFILE_READ:
|
||||||
case JpegLibraryType::J_MESSAGE_CODE::JERR_TFILE_SEEK:
|
case JpegLibraryType::J_MESSAGE_CODE::JERR_TFILE_SEEK:
|
||||||
case JpegLibraryType::J_MESSAGE_CODE::JERR_TFILE_WRITE:
|
case JpegLibraryType::J_MESSAGE_CODE::JERR_TFILE_WRITE:
|
||||||
return capsrv::ResultInternalJpegWorkMemoryShortage();
|
R_THROW(capsrv::ResultInternalJpegWorkMemoryShortage());
|
||||||
default:
|
default:
|
||||||
return capsrv::ResultInternalJpegEncoderError();
|
R_THROW(capsrv::ResultInternalJpegEncoderError());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -51,7 +51,7 @@ namespace ams::capsrv::server::jpeg {
|
||||||
/* Return the output to the caller. */
|
/* Return the output to the caller. */
|
||||||
*out_size = rgb_size;
|
*out_size = rgb_size;
|
||||||
*out_stride = rgb_stride;
|
*out_stride = rgb_stride;
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -172,14 +172,14 @@ namespace ams::capsrv::server::jpeg {
|
||||||
R_UNLESS(jpeg_finish_decompress(std::addressof(cinfo)) == TRUE, capsrv::ResultAlbumInvalidFileData());
|
R_UNLESS(jpeg_finish_decompress(std::addressof(cinfo)) == TRUE, capsrv::ResultAlbumInvalidFileData());
|
||||||
} else {
|
} else {
|
||||||
/* Some unknown error was caught by our handler. */
|
/* Some unknown error was caught by our handler. */
|
||||||
return capsrv::ResultAlbumInvalidFileData();
|
R_THROW(capsrv::ResultAlbumInvalidFileData());
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Write the size we decoded to output. */
|
/* Write the size we decoded to output. */
|
||||||
*output.out_width = static_cast<s32>(cinfo.output_width);
|
*output.out_width = static_cast<s32>(cinfo.output_width);
|
||||||
*output.out_width = static_cast<s32>(cinfo.output_height);
|
*output.out_width = static_cast<s32>(cinfo.output_height);
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ namespace ams::dd {
|
||||||
|
|
||||||
/* We succeeded. */
|
/* We succeeded. */
|
||||||
state_guard.Cancel();
|
state_guard.Cancel();
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result CreateDeviceAddressSpace(DeviceAddressSpaceType *das, u64 size) {
|
Result CreateDeviceAddressSpace(DeviceAddressSpaceType *das, u64 size) {
|
||||||
|
|
|
@ -32,7 +32,7 @@ namespace ams::dd::impl {
|
||||||
} R_END_TRY_CATCH_WITH_ABORT_UNLESS;
|
} R_END_TRY_CATCH_WITH_ABORT_UNLESS;
|
||||||
|
|
||||||
*out = static_cast<DeviceAddressSpaceHandle>(handle);
|
*out = static_cast<DeviceAddressSpaceHandle>(handle);
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeviceAddressSpaceImplByHorizon::Close(DeviceAddressSpaceHandle handle) {
|
void DeviceAddressSpaceImplByHorizon::Close(DeviceAddressSpaceHandle handle) {
|
||||||
|
@ -55,7 +55,7 @@ namespace ams::dd::impl {
|
||||||
R_CONVERT(svc::ResultInvalidCurrentMemory, dd::ResultInvalidMemoryState())
|
R_CONVERT(svc::ResultInvalidCurrentMemory, dd::ResultInvalidMemoryState())
|
||||||
} R_END_TRY_CATCH_WITH_ABORT_UNLESS;
|
} R_END_TRY_CATCH_WITH_ABORT_UNLESS;
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result DeviceAddressSpaceImplByHorizon::MapNotAligned(DeviceAddressSpaceHandle handle, ProcessHandle process_handle, u64 process_address, size_t process_size, DeviceVirtualAddress device_address, dd::MemoryPermission device_perm) {
|
Result DeviceAddressSpaceImplByHorizon::MapNotAligned(DeviceAddressSpaceHandle handle, ProcessHandle process_handle, u64 process_address, size_t process_size, DeviceVirtualAddress device_address, dd::MemoryPermission device_perm) {
|
||||||
|
@ -66,7 +66,7 @@ namespace ams::dd::impl {
|
||||||
R_CONVERT(svc::ResultInvalidCurrentMemory, dd::ResultInvalidMemoryState())
|
R_CONVERT(svc::ResultInvalidCurrentMemory, dd::ResultInvalidMemoryState())
|
||||||
} R_END_TRY_CATCH_WITH_ABORT_UNLESS;
|
} R_END_TRY_CATCH_WITH_ABORT_UNLESS;
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeviceAddressSpaceImplByHorizon::Unmap(DeviceAddressSpaceHandle handle, ProcessHandle process_handle, u64 process_address, size_t process_size, DeviceVirtualAddress device_address) {
|
void DeviceAddressSpaceImplByHorizon::Unmap(DeviceAddressSpaceHandle handle, ProcessHandle process_handle, u64 process_address, size_t process_size, DeviceVirtualAddress device_address) {
|
||||||
|
@ -78,7 +78,7 @@ namespace ams::dd::impl {
|
||||||
R_CONVERT(svc::ResultOutOfMemory, dd::ResultOutOfMemory())
|
R_CONVERT(svc::ResultOutOfMemory, dd::ResultOutOfMemory())
|
||||||
} R_END_TRY_CATCH_WITH_ABORT_UNLESS;
|
} R_END_TRY_CATCH_WITH_ABORT_UNLESS;
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeviceAddressSpaceImplByHorizon::Detach(DeviceAddressSpaceType *das, DeviceName device_name) {
|
void DeviceAddressSpaceImplByHorizon::Detach(DeviceAddressSpaceType *das, DeviceName device_name) {
|
||||||
|
|
|
@ -43,7 +43,7 @@ namespace ams::ddsf {
|
||||||
/* Link the new holder. */
|
/* Link the new holder. */
|
||||||
holder->AddTo(m_entry_list);
|
holder->AddTo(m_entry_list);
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DeviceCodeEntryManager::Remove(DeviceCode device_code) {
|
bool DeviceCodeEntryManager::Remove(DeviceCode device_code) {
|
||||||
|
@ -90,7 +90,7 @@ namespace ams::ddsf {
|
||||||
/* Check that we found the device. */
|
/* Check that we found the device. */
|
||||||
R_UNLESS(found, ddsf::ResultDeviceCodeNotFound());
|
R_UNLESS(found, ddsf::ResultDeviceCodeNotFound());
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result DeviceCodeEntryManager::FindDeviceCodeEntry(const DeviceCodeEntry **out, DeviceCode device_code) const {
|
Result DeviceCodeEntryManager::FindDeviceCodeEntry(const DeviceCodeEntry **out, DeviceCode device_code) const {
|
||||||
|
@ -112,7 +112,7 @@ namespace ams::ddsf {
|
||||||
/* Check that we found the device. */
|
/* Check that we found the device. */
|
||||||
R_UNLESS(found, ddsf::ResultDeviceCodeNotFound());
|
R_UNLESS(found, ddsf::ResultDeviceCodeNotFound());
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result DeviceCodeEntryManager::FindDevice(IDevice **out, DeviceCode device_code) {
|
Result DeviceCodeEntryManager::FindDevice(IDevice **out, DeviceCode device_code) {
|
||||||
|
@ -128,7 +128,7 @@ namespace ams::ddsf {
|
||||||
*out = std::addressof(entry->GetDevice());
|
*out = std::addressof(entry->GetDevice());
|
||||||
}
|
}
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result DeviceCodeEntryManager::FindDevice(const IDevice **out, DeviceCode device_code) const {
|
Result DeviceCodeEntryManager::FindDevice(const IDevice **out, DeviceCode device_code) const {
|
||||||
|
@ -144,7 +144,7 @@ namespace ams::ddsf {
|
||||||
*out = std::addressof(entry->GetDevice());
|
*out = std::addressof(entry->GetDevice());
|
||||||
}
|
}
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ namespace ams::ddsf {
|
||||||
|
|
||||||
/* We succeeded. */
|
/* We succeeded. */
|
||||||
session_guard.Cancel();
|
session_guard.Cancel();
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CloseSession(ISession *session) {
|
void CloseSession(ISession *session) {
|
||||||
|
|
|
@ -48,7 +48,7 @@ namespace ams::erpt::srv {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case AttachmentOpenType_Create: return this->OpenStream(this->FileName().name, StreamMode_Write, AttachmentStreamBufferSize);
|
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_Read: return this->OpenStream(this->FileName().name, StreamMode_Read, AttachmentStreamBufferSize);
|
||||||
default: return erpt::ResultInvalidArgument();
|
default: R_THROW(erpt::ResultInvalidArgument());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ namespace ams::erpt::srv {
|
||||||
|
|
||||||
Result Attachment::GetFlags(AttachmentFlagSet *out) const {
|
Result Attachment::GetFlags(AttachmentFlagSet *out) const {
|
||||||
*out = m_record->m_info.flags;
|
*out = m_record->m_info.flags;
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result Attachment::SetFlags(AttachmentFlagSet flags) {
|
Result Attachment::SetFlags(AttachmentFlagSet flags) {
|
||||||
|
@ -74,7 +74,7 @@ namespace ams::erpt::srv {
|
||||||
m_record->m_info.flags |= flags;
|
m_record->m_info.flags |= flags;
|
||||||
return Journal::Commit();
|
return Journal::Commit();
|
||||||
}
|
}
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result Attachment::GetSize(s64 *out) const {
|
Result Attachment::GetSize(s64 *out) const {
|
||||||
|
|
|
@ -40,7 +40,7 @@ namespace ams::erpt::srv {
|
||||||
R_TRY(m_attachment->Open(AttachmentOpenType_Read));
|
R_TRY(m_attachment->Open(AttachmentOpenType_Read));
|
||||||
attachment_guard.Cancel();
|
attachment_guard.Cancel();
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result AttachmentImpl::Read(ams::sf::Out<u32> out_count, const ams::sf::OutBuffer &out_buffer) {
|
Result AttachmentImpl::Read(ams::sf::Out<u32> out_count, const ams::sf::OutBuffer &out_buffer) {
|
||||||
|
@ -67,7 +67,7 @@ namespace ams::erpt::srv {
|
||||||
delete m_attachment;
|
delete m_attachment;
|
||||||
m_attachment = nullptr;
|
m_attachment = nullptr;
|
||||||
}
|
}
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result AttachmentImpl::GetSize(ams::sf::Out<s64> out) {
|
Result AttachmentImpl::GetSize(ams::sf::Out<s64> out) {
|
||||||
|
|
|
@ -62,12 +62,12 @@ namespace ams::erpt::srv {
|
||||||
case FieldType_I8Array: R_TRY(Cipher::AddField(report, field->id, reinterpret_cast< s8 *>(arr_buf + field->value_array.start_idx), field->value_array.size / sizeof(s8))); break;
|
case FieldType_I8Array: R_TRY(Cipher::AddField(report, field->id, reinterpret_cast< s8 *>(arr_buf + field->value_array.start_idx), field->value_array.size / sizeof(s8))); break;
|
||||||
case FieldType_I32Array: R_TRY(Cipher::AddField(report, field->id, reinterpret_cast< s32 *>(arr_buf + field->value_array.start_idx), field->value_array.size / sizeof(s32))); break;
|
case FieldType_I32Array: R_TRY(Cipher::AddField(report, field->id, reinterpret_cast< s32 *>(arr_buf + field->value_array.start_idx), field->value_array.size / sizeof(s32))); break;
|
||||||
case FieldType_I64Array: R_TRY(Cipher::AddField(report, field->id, reinterpret_cast< s64 *>(arr_buf + field->value_array.start_idx), field->value_array.size / sizeof(s64))); break;
|
case FieldType_I64Array: R_TRY(Cipher::AddField(report, field->id, reinterpret_cast< s64 *>(arr_buf + field->value_array.start_idx), field->value_array.size / sizeof(s64))); break;
|
||||||
default: return erpt::ResultInvalidArgument();
|
default: R_THROW(erpt::ResultInvalidArgument());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result Context::AddContextToCategory(const ContextEntry *entry, const u8 *data, u32 data_size) {
|
Result Context::AddContextToCategory(const ContextEntry *entry, const u8 *data, u32 data_size) {
|
||||||
|
@ -77,7 +77,7 @@ namespace ams::erpt::srv {
|
||||||
R_TRY(record->Initialize(entry, data, data_size));
|
R_TRY(record->Initialize(entry, data, data_size));
|
||||||
|
|
||||||
this->AddContextRecordToCategory(std::move(record));
|
this->AddContextRecordToCategory(std::move(record));
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result Context::AddContextRecordToCategory(std::unique_ptr<ContextRecord> record) {
|
Result Context::AddContextRecordToCategory(std::unique_ptr<ContextRecord> record) {
|
||||||
|
@ -91,7 +91,7 @@ namespace ams::erpt::srv {
|
||||||
delete back;
|
delete back;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result Context::SubmitContext(const ContextEntry *entry, const u8 *data, u32 data_size) {
|
Result Context::SubmitContext(const ContextEntry *entry, const u8 *data, u32 data_size) {
|
||||||
|
@ -123,7 +123,7 @@ namespace ams::erpt::srv {
|
||||||
Cipher::End(report);
|
Cipher::End(report);
|
||||||
report->Close();
|
report->Close();
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result Context::ClearContext(CategoryId cat) {
|
Result Context::ClearContext(CategoryId cat) {
|
||||||
|
|
|
@ -54,7 +54,7 @@ namespace ams::erpt::srv {
|
||||||
|
|
||||||
ManagerImpl::NotifyAll();
|
ManagerImpl::NotifyAll();
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ContextImpl::CreateReportV0(ReportType report_type, const ams::sf::InBuffer &ctx_buffer, const ams::sf::InBuffer &data_buffer, const ams::sf::InBuffer &meta_buffer) {
|
Result ContextImpl::CreateReportV0(ReportType report_type, const ams::sf::InBuffer &ctx_buffer, const ams::sf::InBuffer &data_buffer, const ams::sf::InBuffer &meta_buffer) {
|
||||||
|
@ -63,22 +63,22 @@ namespace ams::erpt::srv {
|
||||||
|
|
||||||
Result ContextImpl::SetInitialLaunchSettingsCompletionTime(const time::SteadyClockTimePoint &time_point) {
|
Result ContextImpl::SetInitialLaunchSettingsCompletionTime(const time::SteadyClockTimePoint &time_point) {
|
||||||
Reporter::SetInitialLaunchSettingsCompletionTime(time_point);
|
Reporter::SetInitialLaunchSettingsCompletionTime(time_point);
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ContextImpl::ClearInitialLaunchSettingsCompletionTime() {
|
Result ContextImpl::ClearInitialLaunchSettingsCompletionTime() {
|
||||||
Reporter::ClearInitialLaunchSettingsCompletionTime();
|
Reporter::ClearInitialLaunchSettingsCompletionTime();
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ContextImpl::UpdatePowerOnTime() {
|
Result ContextImpl::UpdatePowerOnTime() {
|
||||||
/* NOTE: Prior to 12.0.0, this set the power on time, but now erpt does it during initialization. */
|
/* NOTE: Prior to 12.0.0, this set the power on time, but now erpt does it during initialization. */
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ContextImpl::UpdateAwakeTime() {
|
Result ContextImpl::UpdateAwakeTime() {
|
||||||
/* NOTE: Prior to 12.0.0, this set the power on time, but now erpt does it during initialization. */
|
/* NOTE: Prior to 12.0.0, this set the power on time, but now erpt does it during initialization. */
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ContextImpl::SubmitMultipleCategoryContext(const MultipleCategoryContextEntry &ctx_entry, const ams::sf::InBuffer &str_buffer) {
|
Result ContextImpl::SubmitMultipleCategoryContext(const MultipleCategoryContextEntry &ctx_entry, const ams::sf::InBuffer &str_buffer) {
|
||||||
|
@ -107,17 +107,17 @@ namespace ams::erpt::srv {
|
||||||
total_arr_count += ctx_entry.array_buf_counts[i];
|
total_arr_count += ctx_entry.array_buf_counts[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ContextImpl::UpdateApplicationLaunchTime() {
|
Result ContextImpl::UpdateApplicationLaunchTime() {
|
||||||
Reporter::UpdateApplicationLaunchTime();
|
Reporter::UpdateApplicationLaunchTime();
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ContextImpl::ClearApplicationLaunchTime() {
|
Result ContextImpl::ClearApplicationLaunchTime() {
|
||||||
Reporter::ClearApplicationLaunchTime();
|
Reporter::ClearApplicationLaunchTime();
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ContextImpl::SubmitAttachment(ams::sf::Out<AttachmentId> out, const ams::sf::InBuffer &attachment_name, const ams::sf::InBuffer &attachment_data) {
|
Result ContextImpl::SubmitAttachment(ams::sf::Out<AttachmentId> out, const ams::sf::InBuffer &attachment_name, const ams::sf::InBuffer &attachment_data) {
|
||||||
|
@ -154,7 +154,7 @@ namespace ams::erpt::srv {
|
||||||
|
|
||||||
ManagerImpl::NotifyAll();
|
ManagerImpl::NotifyAll();
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
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) {
|
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) {
|
||||||
|
@ -176,7 +176,7 @@ namespace ams::erpt::srv {
|
||||||
Result ContextImpl::InvalidateForcedShutdownDetection() {
|
Result ContextImpl::InvalidateForcedShutdownDetection() {
|
||||||
/* NOTE: Nintendo does not check the result here. */
|
/* NOTE: Nintendo does not check the result here. */
|
||||||
erpt::srv::InvalidateForcedShutdownDetection();
|
erpt::srv::InvalidateForcedShutdownDetection();
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,7 +106,7 @@ namespace ams::erpt::srv {
|
||||||
guard.Cancel();
|
guard.Cancel();
|
||||||
s_record_count += m_ctx.field_count;
|
s_record_count += m_ctx.field_count;
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ContextRecord::Add(FieldId field_id, bool value_bool) {
|
Result ContextRecord::Add(FieldId field_id, bool value_bool) {
|
||||||
|
@ -120,7 +120,7 @@ namespace ams::erpt::srv {
|
||||||
|
|
||||||
field.value_bool = value_bool;
|
field.value_bool = value_bool;
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ContextRecord::Add(FieldId field_id, u32 value_u32) {
|
Result ContextRecord::Add(FieldId field_id, u32 value_u32) {
|
||||||
|
@ -134,7 +134,7 @@ namespace ams::erpt::srv {
|
||||||
|
|
||||||
field.value_u32 = value_u32;
|
field.value_u32 = value_u32;
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ContextRecord::Add(FieldId field_id, u64 value_u64) {
|
Result ContextRecord::Add(FieldId field_id, u64 value_u64) {
|
||||||
|
@ -148,7 +148,7 @@ namespace ams::erpt::srv {
|
||||||
|
|
||||||
field.value_u64 = value_u64;
|
field.value_u64 = value_u64;
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ContextRecord::Add(FieldId field_id, s32 value_i32) {
|
Result ContextRecord::Add(FieldId field_id, s32 value_i32) {
|
||||||
|
@ -162,7 +162,7 @@ namespace ams::erpt::srv {
|
||||||
|
|
||||||
field.value_i32 = value_i32;
|
field.value_i32 = value_i32;
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ContextRecord::Add(FieldId field_id, s64 value_i64) {
|
Result ContextRecord::Add(FieldId field_id, s64 value_i64) {
|
||||||
|
@ -176,7 +176,7 @@ namespace ams::erpt::srv {
|
||||||
|
|
||||||
field.value_i64 = value_i64;
|
field.value_i64 = value_i64;
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ContextRecord::Add(FieldId field_id, const void *arr, u32 size, FieldType type) {
|
Result ContextRecord::Add(FieldId field_id, const void *arr, u32 size, FieldType type) {
|
||||||
|
@ -198,7 +198,7 @@ namespace ams::erpt::srv {
|
||||||
};
|
};
|
||||||
|
|
||||||
std::memcpy(m_ctx.array_buffer + start_idx, arr, size);
|
std::memcpy(m_ctx.array_buffer + start_idx, arr, size);
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ContextRecord::Add(FieldId field_id, const char *str, u32 str_size) {
|
Result ContextRecord::Add(FieldId field_id, const char *str, u32 str_size) {
|
||||||
|
|
|
@ -70,7 +70,7 @@ namespace ams::erpt::srv {
|
||||||
/* Commit the context. */
|
/* Commit the context. */
|
||||||
R_TRY(Stream::CommitStream());
|
R_TRY(Stream::CommitStream());
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result CreateReportForForcedShutdown() {
|
Result CreateReportForForcedShutdown() {
|
||||||
|
@ -88,7 +88,7 @@ namespace ams::erpt::srv {
|
||||||
/* Create report. */
|
/* Create report. */
|
||||||
R_TRY(Reporter::CreateReport(ReportType_Invisible, ResultSuccess(), std::move(record), nullptr, nullptr, 0));
|
R_TRY(Reporter::CreateReport(ReportType_Invisible, ResultSuccess(), std::move(record), nullptr, nullptr, 0));
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result LoadForcedShutdownContext() {
|
Result LoadForcedShutdownContext() {
|
||||||
|
@ -162,7 +162,7 @@ namespace ams::erpt::srv {
|
||||||
R_TRY(Context::SubmitContextRecord(std::move(record)));
|
R_TRY(Context::SubmitContextRecord(std::move(record)));
|
||||||
}
|
}
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 GetForcedShutdownContextCount() {
|
u32 GetForcedShutdownContextCount() {
|
||||||
|
@ -215,7 +215,7 @@ namespace ams::erpt::srv {
|
||||||
/* Commit the context. */
|
/* Commit the context. */
|
||||||
R_TRY(Stream::CommitStream());
|
R_TRY(Stream::CommitStream());
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -324,7 +324,7 @@ namespace ams::erpt::srv {
|
||||||
/* Commit the deletion. */
|
/* Commit the deletion. */
|
||||||
R_TRY(Stream::CommitStream());
|
R_TRY(Stream::CommitStream());
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ namespace ams::erpt::srv {
|
||||||
|
|
||||||
R_TRY(report->Write(str, str_len));
|
R_TRY(report->Write(str, str_len));
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
static Result AddId(Report *report, FieldId field_id) {
|
static Result AddId(Report *report, FieldId field_id) {
|
||||||
|
@ -64,7 +64,7 @@ namespace ams::erpt::srv {
|
||||||
|
|
||||||
R_TRY(AddStringValue(report, FieldString[field_id], strnlen(FieldString[field_id], MaxFieldStringSize)));
|
R_TRY(AddStringValue(report, FieldString[field_id], strnlen(FieldString[field_id], MaxFieldStringSize)));
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
|
@ -77,7 +77,7 @@ namespace ams::erpt::srv {
|
||||||
R_TRY(report->Write(tag));
|
R_TRY(report->Write(tag));
|
||||||
R_TRY(report->Write(reinterpret_cast<u8 *>(std::addressof(big_endian_value)), sizeof(big_endian_value)));
|
R_TRY(report->Write(reinterpret_cast<u8 *>(std::addressof(big_endian_value)), sizeof(big_endian_value)));
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
|
@ -98,21 +98,21 @@ namespace ams::erpt::srv {
|
||||||
R_TRY(AddValue(report, arr[i]));
|
R_TRY(AddValue(report, arr[i]));
|
||||||
}
|
}
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
static Result AddIdValuePair(Report *report, FieldId field_id, T value) {
|
static Result AddIdValuePair(Report *report, FieldId field_id, T value) {
|
||||||
R_TRY(AddId(report, field_id));
|
R_TRY(AddId(report, field_id));
|
||||||
R_TRY(AddValue(report, value));
|
R_TRY(AddValue(report, value));
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
static Result AddIdValueArray(Report *report, FieldId field_id, T *arr, u32 arr_size) {
|
static Result AddIdValueArray(Report *report, FieldId field_id, T *arr, u32 arr_size) {
|
||||||
R_TRY(AddId(report, field_id));
|
R_TRY(AddId(report, field_id));
|
||||||
R_TRY(AddValueArray(report, arr, arr_size));
|
R_TRY(AddValueArray(report, arr, arr_size));
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
static Result Begin(Report *report, u32 record_count) {
|
static Result Begin(Report *report, u32 record_count) {
|
||||||
|
@ -128,12 +128,12 @@ namespace ams::erpt::srv {
|
||||||
R_TRY(report->Write(be_count));
|
R_TRY(report->Write(be_count));
|
||||||
}
|
}
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
static Result End(Report *report) {
|
static Result End(Report *report) {
|
||||||
AMS_UNUSED(report);
|
AMS_UNUSED(report);
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
|
@ -149,7 +149,7 @@ namespace ams::erpt::srv {
|
||||||
static Result AddField(Report *report, FieldId field_id, bool value) {
|
static Result AddField(Report *report, FieldId field_id, bool value) {
|
||||||
R_TRY(AddId(report, field_id));
|
R_TRY(AddId(report, field_id));
|
||||||
R_TRY(report->Write(static_cast<u8>(value ? ValueTypeTag::True : ValueTypeTag::False)));
|
R_TRY(report->Write(static_cast<u8>(value ? ValueTypeTag::True : ValueTypeTag::False)));
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
static Result AddField(Report *report, FieldId field_id, char *str, u32 len) {
|
static Result AddField(Report *report, FieldId field_id, char *str, u32 len) {
|
||||||
|
@ -157,7 +157,7 @@ namespace ams::erpt::srv {
|
||||||
|
|
||||||
R_TRY(AddStringValue(report, str, len));
|
R_TRY(AddStringValue(report, str, len));
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
static Result AddField(Report *report, FieldId field_id, u8 *bin, u32 len) {
|
static Result AddField(Report *report, FieldId field_id, u8 *bin, u32 len) {
|
||||||
|
@ -177,7 +177,7 @@ namespace ams::erpt::srv {
|
||||||
|
|
||||||
R_TRY(report->Write(bin, len));
|
R_TRY(report->Write(bin, len));
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ namespace ams::erpt::srv {
|
||||||
stream.CloseStream();
|
stream.CloseStream();
|
||||||
stream.CommitStream();
|
stream.CommitStream();
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result Journal::Delete(ReportId report_id) {
|
Result Journal::Delete(ReportId report_id) {
|
||||||
|
@ -97,7 +97,7 @@ namespace ams::erpt::srv {
|
||||||
/* Restore the attachments. */
|
/* Restore the attachments. */
|
||||||
R_TRY(JournalForAttachments::RestoreJournal(std::addressof(stream)));
|
R_TRY(JournalForAttachments::RestoreJournal(std::addressof(stream)));
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
JournalRecord<ReportInfo> *Journal::Retrieve(ReportId report_id) {
|
JournalRecord<ReportInfo> *Journal::Retrieve(ReportId report_id) {
|
||||||
|
|
|
@ -50,7 +50,7 @@ namespace ams::erpt::srv {
|
||||||
for (auto it = s_attachment_list.crbegin(); it != s_attachment_list.crend(); it++) {
|
for (auto it = s_attachment_list.crbegin(); it != s_attachment_list.crend(); it++) {
|
||||||
R_TRY(stream->WriteStream(reinterpret_cast<const u8 *>(std::addressof(it->m_info)), sizeof(it->m_info)));
|
R_TRY(stream->WriteStream(reinterpret_cast<const u8 *>(std::addressof(it->m_info)), sizeof(it->m_info)));
|
||||||
}
|
}
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result JournalForAttachments::DeleteAttachments(ReportId report_id) {
|
Result JournalForAttachments::DeleteAttachments(ReportId report_id) {
|
||||||
|
@ -74,7 +74,7 @@ namespace ams::erpt::srv {
|
||||||
it++;
|
it++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result JournalForAttachments::GetAttachmentList(AttachmentList *out, ReportId report_id) {
|
Result JournalForAttachments::GetAttachmentList(AttachmentList *out, ReportId report_id) {
|
||||||
|
@ -85,7 +85,7 @@ namespace ams::erpt::srv {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
out->attachment_count = count;
|
out->attachment_count = count;
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 JournalForAttachments::GetUsedStorage() {
|
u32 JournalForAttachments::GetUsedStorage() {
|
||||||
|
@ -133,7 +133,7 @@ namespace ams::erpt::srv {
|
||||||
}
|
}
|
||||||
|
|
||||||
cleanup_guard.Cancel();
|
cleanup_guard.Cancel();
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
JournalRecord<AttachmentInfo> *JournalForAttachments::RetrieveRecord(AttachmentId attachment_id) {
|
JournalRecord<AttachmentInfo> *JournalForAttachments::RetrieveRecord(AttachmentId attachment_id) {
|
||||||
|
@ -153,10 +153,10 @@ namespace ams::erpt::srv {
|
||||||
|
|
||||||
record->m_info.owner_report_id = report_id;
|
record->m_info.owner_report_id = report_id;
|
||||||
record->m_info.flags.Set<AttachmentFlag::HasOwner>();
|
record->m_info.flags.Set<AttachmentFlag::HasOwner>();
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return erpt::ResultInvalidArgument();
|
R_THROW(erpt::ResultInvalidArgument());
|
||||||
}
|
}
|
||||||
|
|
||||||
Result JournalForAttachments::StoreRecord(JournalRecord<AttachmentInfo> *record) {
|
Result JournalForAttachments::StoreRecord(JournalRecord<AttachmentInfo> *record) {
|
||||||
|
@ -173,7 +173,7 @@ namespace ams::erpt::srv {
|
||||||
s_attachment_count++;
|
s_attachment_count++;
|
||||||
s_used_storage += static_cast<u32>(record->m_info.attachment_size);
|
s_used_storage += static_cast<u32>(record->m_info.attachment_size);
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result JournalForAttachments::SubmitAttachment(AttachmentId *out, char *name, const u8 *data, u32 data_size) {
|
Result JournalForAttachments::SubmitAttachment(AttachmentId *out, char *name, const u8 *data, u32 data_size) {
|
||||||
|
@ -217,7 +217,7 @@ namespace ams::erpt::srv {
|
||||||
|
|
||||||
*out = info.attachment_id;
|
*out = info.attachment_id;
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ namespace ams::erpt::srv {
|
||||||
if (R_FAILED(stream->ReadStream(std::addressof(size), reinterpret_cast<u8 *>(std::addressof(s_journal_meta)), sizeof(s_journal_meta))) || size != sizeof(s_journal_meta)) {
|
if (R_FAILED(stream->ReadStream(std::addressof(size), reinterpret_cast<u8 *>(std::addressof(s_journal_meta)), sizeof(s_journal_meta))) || size != sizeof(s_journal_meta)) {
|
||||||
InitializeJournal();
|
InitializeJournal();
|
||||||
}
|
}
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 JournalForMeta::GetTransmittedCount(ReportType type) {
|
u32 JournalForMeta::GetTransmittedCount(ReportType type) {
|
||||||
|
|
|
@ -46,7 +46,7 @@ namespace ams::erpt::srv {
|
||||||
for (auto it = s_record_list.crbegin(); it != s_record_list.crend(); it++) {
|
for (auto it = s_record_list.crbegin(); it != s_record_list.crend(); it++) {
|
||||||
R_TRY(stream->WriteStream(reinterpret_cast<const u8 *>(std::addressof(it->m_info)), sizeof(it->m_info)));
|
R_TRY(stream->WriteStream(reinterpret_cast<const u8 *>(std::addressof(it->m_info)), sizeof(it->m_info)));
|
||||||
}
|
}
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
void JournalForReports::EraseReportImpl(JournalRecord<ReportInfo> *record, bool increment_count, bool force_delete_attachments) {
|
void JournalForReports::EraseReportImpl(JournalRecord<ReportInfo> *record, bool increment_count, bool force_delete_attachments) {
|
||||||
|
@ -80,10 +80,10 @@ namespace ams::erpt::srv {
|
||||||
auto *record = std::addressof(*it);
|
auto *record = std::addressof(*it);
|
||||||
if (record->m_info.id == report_id) {
|
if (record->m_info.id == report_id) {
|
||||||
EraseReportImpl(record, false, false);
|
EraseReportImpl(record, false, false);
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return erpt::ResultInvalidArgument();
|
R_THROW(erpt::ResultInvalidArgument());
|
||||||
}
|
}
|
||||||
|
|
||||||
Result JournalForReports::DeleteReportWithAttachments() {
|
Result JournalForReports::DeleteReportWithAttachments() {
|
||||||
|
@ -91,10 +91,10 @@ namespace ams::erpt::srv {
|
||||||
auto *record = std::addressof(*it);
|
auto *record = std::addressof(*it);
|
||||||
if (record->m_info.flags.Test<ReportFlag::HasAttachment>()) {
|
if (record->m_info.flags.Test<ReportFlag::HasAttachment>()) {
|
||||||
EraseReportImpl(record, true, true);
|
EraseReportImpl(record, true, true);
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return erpt::ResultNotFound();
|
R_THROW(erpt::ResultNotFound());
|
||||||
}
|
}
|
||||||
|
|
||||||
s64 JournalForReports::GetMaxReportSize() {
|
s64 JournalForReports::GetMaxReportSize() {
|
||||||
|
@ -113,7 +113,7 @@ namespace ams::erpt::srv {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
out->report_count = count;
|
out->report_count = count;
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 JournalForReports::GetStoredReportCount(ReportType type) {
|
u32 JournalForReports::GetStoredReportCount(ReportType type) {
|
||||||
|
@ -169,7 +169,7 @@ namespace ams::erpt::srv {
|
||||||
}
|
}
|
||||||
|
|
||||||
cleanup_guard.Cancel();
|
cleanup_guard.Cancel();
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
JournalRecord<ReportInfo> *JournalForReports::RetrieveRecord(ReportId report_id) {
|
JournalRecord<ReportInfo> *JournalForReports::RetrieveRecord(ReportId report_id) {
|
||||||
|
@ -222,7 +222,7 @@ namespace ams::erpt::srv {
|
||||||
s_record_count_by_type[record->m_info.type]++;
|
s_record_count_by_type[record->m_info.type]++;
|
||||||
s_used_storage += static_cast<u32>(record->m_info.report_size);
|
s_used_storage += static_cast<u32>(record->m_info.report_size);
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,7 @@ namespace ams::erpt::srv {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result MountSystemSaveData() {
|
Result MountSystemSaveData() {
|
||||||
|
@ -66,7 +66,7 @@ namespace ams::erpt::srv {
|
||||||
}
|
}
|
||||||
} R_END_TRY_CATCH;
|
} R_END_TRY_CATCH;
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -115,7 +115,7 @@ namespace ams::erpt::srv {
|
||||||
Reporter::UpdatePowerOnTime();
|
Reporter::UpdatePowerOnTime();
|
||||||
Reporter::UpdateAwakeTime();
|
Reporter::UpdateAwakeTime();
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result InitializeAndStartService() {
|
Result InitializeAndStartService() {
|
||||||
|
@ -138,7 +138,7 @@ namespace ams::erpt::srv {
|
||||||
R_TRY(record->Add(FieldId_ProductModel, model, model_len));
|
R_TRY(record->Add(FieldId_ProductModel, model, model_len));
|
||||||
R_TRY(Context::SubmitContextRecord(std::move(record)));
|
R_TRY(Context::SubmitContextRecord(std::move(record)));
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result SetRegionSetting(const char *region, u32 region_len) {
|
Result SetRegionSetting(const char *region, u32 region_len) {
|
||||||
|
@ -149,17 +149,17 @@ namespace ams::erpt::srv {
|
||||||
R_TRY(record->Add(FieldId_RegionSetting, region, region_len));
|
R_TRY(record->Add(FieldId_RegionSetting, region, region_len));
|
||||||
R_TRY(Context::SubmitContextRecord(std::move(record)));
|
R_TRY(Context::SubmitContextRecord(std::move(record)));
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result SetRedirectNewReportsToSdCard(bool redirect) {
|
Result SetRedirectNewReportsToSdCard(bool redirect) {
|
||||||
Reporter::SetRedirectNewReportsToSdCard(redirect);
|
Reporter::SetRedirectNewReportsToSdCard(redirect);
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result SetEnabledAutomaticReportCleanup(bool en) {
|
Result SetEnabledAutomaticReportCleanup(bool en) {
|
||||||
g_automatic_report_cleanup_enabled = en;
|
g_automatic_report_cleanup_enabled = en;
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Wait() {
|
void Wait() {
|
||||||
|
|
|
@ -43,7 +43,7 @@ namespace ams::erpt::srv {
|
||||||
for (auto &manager : g_manager_list) {
|
for (auto &manager : g_manager_list) {
|
||||||
manager.NotifyOne();
|
manager.NotifyOne();
|
||||||
}
|
}
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ManagerImpl::GetReportList(const ams::sf::OutBuffer &out_list, ReportType type_filter) {
|
Result ManagerImpl::GetReportList(const ams::sf::OutBuffer &out_list, ReportType type_filter) {
|
||||||
|
@ -54,7 +54,7 @@ namespace ams::erpt::srv {
|
||||||
|
|
||||||
Result ManagerImpl::GetEvent(ams::sf::OutCopyHandle out) {
|
Result ManagerImpl::GetEvent(ams::sf::OutCopyHandle out) {
|
||||||
out.SetValue(m_system_event.GetReadableHandle(), false);
|
out.SetValue(m_system_event.GetReadableHandle(), false);
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ManagerImpl::CleanupReports() {
|
Result ManagerImpl::CleanupReports() {
|
||||||
|
@ -83,7 +83,7 @@ namespace ams::erpt::srv {
|
||||||
}
|
}
|
||||||
|
|
||||||
out.SetValue(stats);
|
out.SetValue(stats);
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ManagerImpl::GetAttachmentList(const ams::sf::OutBuffer &out_list, const ReportId &report_id) {
|
Result ManagerImpl::GetAttachmentList(const ams::sf::OutBuffer &out_list, const ReportId &report_id) {
|
||||||
|
|
|
@ -54,7 +54,7 @@ namespace ams::erpt::srv {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case ReportOpenType_Create: return this->OpenStream(this->FileName().name, StreamMode_Write, ReportStreamBufferSize);
|
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_Read: return this->OpenStream(this->FileName().name, StreamMode_Read, ReportStreamBufferSize);
|
||||||
default: return erpt::ResultInvalidArgument();
|
default: R_THROW(erpt::ResultInvalidArgument());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ namespace ams::erpt::srv {
|
||||||
|
|
||||||
Result Report::GetFlags(ReportFlagSet *out) const {
|
Result Report::GetFlags(ReportFlagSet *out) const {
|
||||||
*out = m_record->m_info.flags;
|
*out = m_record->m_info.flags;
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result Report::SetFlags(ReportFlagSet flags) {
|
Result Report::SetFlags(ReportFlagSet flags) {
|
||||||
|
@ -80,7 +80,7 @@ namespace ams::erpt::srv {
|
||||||
m_record->m_info.flags |= flags;
|
m_record->m_info.flags |= flags;
|
||||||
return Journal::Commit();
|
return Journal::Commit();
|
||||||
}
|
}
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result Report::GetSize(s64 *out) const {
|
Result Report::GetSize(s64 *out) const {
|
||||||
|
|
|
@ -40,7 +40,7 @@ namespace ams::erpt::srv {
|
||||||
R_TRY(m_report->Open(ReportOpenType_Read));
|
R_TRY(m_report->Open(ReportOpenType_Read));
|
||||||
report_guard.Cancel();
|
report_guard.Cancel();
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ReportImpl::Read(ams::sf::Out<u32> out_count, const ams::sf::OutBuffer &out_buffer) {
|
Result ReportImpl::Read(ams::sf::Out<u32> out_count, const ams::sf::OutBuffer &out_buffer) {
|
||||||
|
@ -67,7 +67,7 @@ namespace ams::erpt::srv {
|
||||||
delete m_report;
|
delete m_report;
|
||||||
m_report = nullptr;
|
m_report = nullptr;
|
||||||
}
|
}
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ReportImpl::GetSize(ams::sf::Out<s64> out) {
|
Result ReportImpl::GetSize(ams::sf::Out<s64> out) {
|
||||||
|
|
|
@ -96,7 +96,7 @@ namespace ams::erpt::srv {
|
||||||
|
|
||||||
*out_total_size = total_size;
|
*out_total_size = total_size;
|
||||||
*out_size = size;
|
*out_size = size;
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SubmitErrorContext(ContextRecord *record, Result result) {
|
void SubmitErrorContext(ContextRecord *record, Result result) {
|
||||||
|
@ -238,7 +238,7 @@ namespace ams::erpt::srv {
|
||||||
});
|
});
|
||||||
R_UNLESS(found_error_code, erpt::ResultRequiredFieldMissing());
|
R_UNLESS(found_error_code, erpt::ResultRequiredFieldMissing());
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result SubmitReportDefaults(const ContextEntry *ctx) {
|
Result SubmitReportDefaults(const ContextEntry *ctx) {
|
||||||
|
@ -270,7 +270,7 @@ namespace ams::erpt::srv {
|
||||||
|
|
||||||
R_TRY(Context::SubmitContextRecord(std::move(record)));
|
R_TRY(Context::SubmitContextRecord(std::move(record)));
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SaveSyslogReportIfRequired(const ContextEntry *ctx, const ReportId &report_id) {
|
void SaveSyslogReportIfRequired(const ContextEntry *ctx, const ReportId &report_id) {
|
||||||
|
@ -342,7 +342,7 @@ namespace ams::erpt::srv {
|
||||||
for (u32 i = 0; i < num_attachments; i++) {
|
for (u32 i = 0; i < num_attachments; i++) {
|
||||||
R_TRY(JournalForAttachments::SetOwner(attachments[i], report_id));
|
R_TRY(JournalForAttachments::SetOwner(attachments[i], report_id));
|
||||||
}
|
}
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result CreateReportFile(const ReportId &report_id, ReportType type, const ReportMetaData *meta, u32 num_attachments, const time::PosixTime ×tamp_user, const time::PosixTime ×tamp_network, bool redirect_new_reports) {
|
Result CreateReportFile(const ReportId &report_id, ReportType type, const ReportMetaData *meta, u32 num_attachments, const time::PosixTime ×tamp_user, const time::PosixTime ×tamp_network, bool redirect_new_reports) {
|
||||||
|
@ -393,24 +393,24 @@ namespace ams::erpt::srv {
|
||||||
R_TRY(Journal::Commit());
|
R_TRY(Journal::Commit());
|
||||||
|
|
||||||
report_guard.Cancel();
|
report_guard.Cancel();
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Result Reporter::RegisterRunningApplet(ncm::ProgramId program_id) {
|
Result Reporter::RegisterRunningApplet(ncm::ProgramId program_id) {
|
||||||
g_applet_active_time_info_list.Register(program_id);
|
g_applet_active_time_info_list.Register(program_id);
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result Reporter::UnregisterRunningApplet(ncm::ProgramId program_id) {
|
Result Reporter::UnregisterRunningApplet(ncm::ProgramId program_id) {
|
||||||
g_applet_active_time_info_list.Unregister(program_id);
|
g_applet_active_time_info_list.Unregister(program_id);
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result Reporter::UpdateAppletSuspendedDuration(ncm::ProgramId program_id, TimeSpan duration) {
|
Result Reporter::UpdateAppletSuspendedDuration(ncm::ProgramId program_id, TimeSpan duration) {
|
||||||
g_applet_active_time_info_list.UpdateSuspendedDuration(program_id, duration);
|
g_applet_active_time_info_list.UpdateSuspendedDuration(program_id, duration);
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result Reporter::CreateReport(ReportType type, Result ctx_result, const ContextEntry *ctx, const u8 *data, u32 data_size, const ReportMetaData *meta, const AttachmentId *attachments, u32 num_attachments) {
|
Result Reporter::CreateReport(ReportType type, Result ctx_result, const ContextEntry *ctx, const u8 *data, u32 data_size, const ReportMetaData *meta, const AttachmentId *attachments, u32 num_attachments) {
|
||||||
|
@ -465,7 +465,7 @@ namespace ams::erpt::srv {
|
||||||
/* Create the report file. */
|
/* Create the report file. */
|
||||||
R_TRY(CreateReportFile(report_id, type, meta, num_attachments, timestamp_user, timestamp_network, s_redirect_new_reports));
|
R_TRY(CreateReportFile(report_id, type, meta, num_attachments, timestamp_user, timestamp_network, s_redirect_new_reports));
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result Reporter::SubmitReportContexts(const ReportId &report_id, ReportType type, Result ctx_result, std::unique_ptr<ContextRecord> record, const time::PosixTime ×tamp_user, const time::PosixTime ×tamp_network) {
|
Result Reporter::SubmitReportContexts(const ReportId &report_id, ReportType type, Result ctx_result, std::unique_ptr<ContextRecord> record, const time::PosixTime ×tamp_user, const time::PosixTime ×tamp_network) {
|
||||||
|
@ -530,7 +530,7 @@ namespace ams::erpt::srv {
|
||||||
SubmitResourceLimitContexts();
|
SubmitResourceLimitContexts();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,7 @@ namespace ams::erpt::srv {
|
||||||
std::memcpy(s_serial_number, sn, sn_len);
|
std::memcpy(s_serial_number, sn, sn_len);
|
||||||
std::memcpy(s_os_version, os, os_len);
|
std::memcpy(s_os_version, os, os_len);
|
||||||
std::memcpy(s_private_os_version, os_priv, os_priv_len);
|
std::memcpy(s_private_os_version, os_priv, os_priv_len);
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
static Result RegisterRunningApplet(ncm::ProgramId program_id);
|
static Result RegisterRunningApplet(ncm::ProgramId program_id);
|
||||||
|
|
|
@ -71,7 +71,7 @@ namespace ams::erpt::srv {
|
||||||
case PortIndex_Context:
|
case PortIndex_Context:
|
||||||
return AcceptImpl(server, m_context_session_object.GetShared());
|
return AcceptImpl(server, m_context_session_object.GetShared());
|
||||||
default:
|
default:
|
||||||
return erpt::ResultNotSupported();
|
R_THROW(erpt::ResultNotSupported());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
|
@ -86,7 +86,7 @@ namespace ams::erpt::srv {
|
||||||
|
|
||||||
os::StartThread(std::addressof(m_thread));
|
os::StartThread(std::addressof(m_thread));
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Wait() {
|
void Wait() {
|
||||||
|
|
|
@ -33,7 +33,7 @@ namespace ams::erpt::srv {
|
||||||
|
|
||||||
/* Return it. */
|
/* Return it. */
|
||||||
out.SetValue(intf);
|
out.SetValue(intf);
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ namespace ams::erpt::srv {
|
||||||
std::scoped_lock lk(s_fs_commit_mutex);
|
std::scoped_lock lk(s_fs_commit_mutex);
|
||||||
|
|
||||||
fs::CommitSaveData(ReportStoragePath);
|
fs::CommitSaveData(ReportStoragePath);
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result Stream::GetStreamSize(s64 *out, const char *path) {
|
Result Stream::GetStreamSize(s64 *out, const char *path) {
|
||||||
|
@ -109,7 +109,7 @@ namespace ams::erpt::srv {
|
||||||
|
|
||||||
file_guard.Cancel();
|
file_guard.Cancel();
|
||||||
lock_guard.Cancel();
|
lock_guard.Cancel();
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result Stream::ReadStream(u32 *out, u8 *dst, u32 dst_size) {
|
Result Stream::ReadStream(u32 *out, u8 *dst, u32 dst_size) {
|
||||||
|
@ -153,7 +153,7 @@ namespace ams::erpt::srv {
|
||||||
read_count = static_cast<u32>(fs_read_size);
|
read_count = static_cast<u32>(fs_read_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result Stream::WriteStream(const u8 *src, u32 src_size) {
|
Result Stream::WriteStream(const u8 *src, u32 src_size) {
|
||||||
|
@ -180,7 +180,7 @@ namespace ams::erpt::srv {
|
||||||
m_file_position += src_size;
|
m_file_position += src_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Stream::CloseStream() {
|
void Stream::CloseStream() {
|
||||||
|
@ -217,7 +217,7 @@ namespace ams::erpt::srv {
|
||||||
|
|
||||||
m_file_position += m_buffer_count;
|
m_file_position += m_buffer_count;
|
||||||
m_buffer_count = 0;
|
m_buffer_count = 0;
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@ namespace ams::fs {
|
||||||
R_TRY(file_bucket.GetSize(std::addressof(file_bucket_size)));
|
R_TRY(file_bucket.GetSize(std::addressof(file_bucket_size)));
|
||||||
R_TRY(FileEntryMapTable::Format(file_bucket, FileEntryMapTable::QueryBucketCount(file_bucket_size)));
|
R_TRY(FileEntryMapTable::Format(file_bucket, FileEntryMapTable::QueryBucketCount(file_bucket_size)));
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
HierarchicalRomFileTable::HierarchicalRomFileTable() { /* ... */ }
|
HierarchicalRomFileTable::HierarchicalRomFileTable() { /* ... */ }
|
||||||
|
@ -56,7 +56,7 @@ namespace ams::fs {
|
||||||
R_TRY(file_bucket.GetSize(std::addressof(file_bucket_size)));
|
R_TRY(file_bucket.GetSize(std::addressof(file_bucket_size)));
|
||||||
R_TRY(m_file_table.Initialize(file_bucket, FileEntryMapTable::QueryBucketCount(file_bucket_size), file_entry));
|
R_TRY(m_file_table.Initialize(file_bucket, FileEntryMapTable::QueryBucketCount(file_bucket_size), file_entry));
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
void HierarchicalRomFileTable::Finalize() {
|
void HierarchicalRomFileTable::Finalize() {
|
||||||
|
@ -123,7 +123,7 @@ namespace ams::fs {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result HierarchicalRomFileTable::CreateFile(RomFileId *out, const RomPathChar *path, const FileInfo &info) {
|
Result HierarchicalRomFileTable::CreateFile(RomFileId *out, const RomPathChar *path, const FileInfo &info) {
|
||||||
|
@ -170,7 +170,7 @@ namespace ams::fs {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result HierarchicalRomFileTable::ConvertPathToDirectoryId(RomDirectoryId *out, const RomPathChar *path) {
|
Result HierarchicalRomFileTable::ConvertPathToDirectoryId(RomDirectoryId *out, const RomPathChar *path) {
|
||||||
|
@ -186,7 +186,7 @@ namespace ams::fs {
|
||||||
R_TRY(this->GetDirectoryEntry(std::addressof(pos), std::addressof(entry), key));
|
R_TRY(this->GetDirectoryEntry(std::addressof(pos), std::addressof(entry), key));
|
||||||
|
|
||||||
*out = PositionToDirectoryId(pos);
|
*out = PositionToDirectoryId(pos);
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result HierarchicalRomFileTable::ConvertPathToFileId(RomFileId *out, const RomPathChar *path) {
|
Result HierarchicalRomFileTable::ConvertPathToFileId(RomFileId *out, const RomPathChar *path) {
|
||||||
|
@ -202,7 +202,7 @@ namespace ams::fs {
|
||||||
R_TRY(this->GetFileEntry(std::addressof(pos), std::addressof(entry), key));
|
R_TRY(this->GetFileEntry(std::addressof(pos), std::addressof(entry), key));
|
||||||
|
|
||||||
*out = PositionToFileId(pos);
|
*out = PositionToFileId(pos);
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result HierarchicalRomFileTable::GetDirectoryInformation(DirectoryInfo *out, const RomPathChar *path) {
|
Result HierarchicalRomFileTable::GetDirectoryInformation(DirectoryInfo *out, const RomPathChar *path) {
|
||||||
|
@ -224,7 +224,7 @@ namespace ams::fs {
|
||||||
|
|
||||||
AMS_UNUSED(out);
|
AMS_UNUSED(out);
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result HierarchicalRomFileTable::OpenFile(FileInfo *out, const RomPathChar *path) {
|
Result HierarchicalRomFileTable::OpenFile(FileInfo *out, const RomPathChar *path) {
|
||||||
|
@ -245,7 +245,7 @@ namespace ams::fs {
|
||||||
R_TRY(this->GetFileEntry(std::addressof(entry), id));
|
R_TRY(this->GetFileEntry(std::addressof(entry), id));
|
||||||
|
|
||||||
*out = entry.info;
|
*out = entry.info;
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result HierarchicalRomFileTable::FindOpen(FindPosition *out, const RomPathChar *path) {
|
Result HierarchicalRomFileTable::FindOpen(FindPosition *out, const RomPathChar *path) {
|
||||||
|
@ -271,7 +271,7 @@ namespace ams::fs {
|
||||||
out->next_dir = entry.dir;
|
out->next_dir = entry.dir;
|
||||||
out->next_file = entry.file;
|
out->next_file = entry.file;
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result HierarchicalRomFileTable::FindNextDirectory(RomPathChar *out, FindPosition *find, size_t length) {
|
Result HierarchicalRomFileTable::FindNextDirectory(RomPathChar *out, FindPosition *find, size_t length) {
|
||||||
|
@ -291,7 +291,7 @@ namespace ams::fs {
|
||||||
out[aux_size / sizeof(RomPathChar)] = RomStringTraits::NullTerminator;
|
out[aux_size / sizeof(RomPathChar)] = RomStringTraits::NullTerminator;
|
||||||
|
|
||||||
find->next_dir = entry.next;
|
find->next_dir = entry.next;
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result HierarchicalRomFileTable::FindNextFile(RomPathChar *out, FindPosition *find, size_t length) {
|
Result HierarchicalRomFileTable::FindNextFile(RomPathChar *out, FindPosition *find, size_t length) {
|
||||||
|
@ -311,7 +311,7 @@ namespace ams::fs {
|
||||||
out[aux_size / sizeof(RomPathChar)] = RomStringTraits::NullTerminator;
|
out[aux_size / sizeof(RomPathChar)] = RomStringTraits::NullTerminator;
|
||||||
|
|
||||||
find->next_file = entry.next;
|
find->next_file = entry.next;
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result HierarchicalRomFileTable::QueryRomFileSystemSize(s64 *out_dir_entry_size, s64 *out_file_entry_size) {
|
Result HierarchicalRomFileTable::QueryRomFileSystemSize(s64 *out_dir_entry_size, s64 *out_file_entry_size) {
|
||||||
|
@ -320,7 +320,7 @@ namespace ams::fs {
|
||||||
|
|
||||||
*out_dir_entry_size = m_dir_table.GetTotalEntrySize();
|
*out_dir_entry_size = m_dir_table.GetTotalEntrySize();
|
||||||
*out_file_entry_size = m_file_table.GetTotalEntrySize();
|
*out_file_entry_size = m_file_table.GetTotalEntrySize();
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result HierarchicalRomFileTable::GetGrandParent(Position *out_pos, EntryKey *out_dir_key, RomDirectoryEntry *out_dir_entry, Position pos, RomPathTool::RomEntryName name, const RomPathChar *path) {
|
Result HierarchicalRomFileTable::GetGrandParent(Position *out_pos, EntryKey *out_dir_key, RomDirectoryEntry *out_dir_entry, Position pos, RomPathTool::RomEntryName name, const RomPathChar *path) {
|
||||||
|
@ -338,7 +338,7 @@ namespace ams::fs {
|
||||||
|
|
||||||
R_TRY(this->GetDirectoryEntry(out_pos, out_dir_entry, *out_dir_key));
|
R_TRY(this->GetDirectoryEntry(out_pos, out_dir_entry, *out_dir_key));
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result HierarchicalRomFileTable::FindParentDirectoryRecursive(Position *out_pos, EntryKey *out_dir_key, RomDirectoryEntry *out_dir_entry, RomPathTool::PathParser *parser, const RomPathChar *path) {
|
Result HierarchicalRomFileTable::FindParentDirectoryRecursive(Position *out_pos, EntryKey *out_dir_key, RomDirectoryEntry *out_dir_entry, RomPathTool::PathParser *parser, const RomPathChar *path) {
|
||||||
|
@ -382,7 +382,7 @@ namespace ams::fs {
|
||||||
*out_pos = parent_pos;
|
*out_pos = parent_pos;
|
||||||
*out_dir_key = dir_key;
|
*out_dir_key = dir_key;
|
||||||
*out_dir_entry = dir_entry;
|
*out_dir_entry = dir_entry;
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result HierarchicalRomFileTable::FindPathRecursive(EntryKey *out_key, RomDirectoryEntry *out_dir_entry, bool is_dir, const RomPathChar *path) {
|
Result HierarchicalRomFileTable::FindPathRecursive(EntryKey *out_key, RomDirectoryEntry *out_dir_entry, bool is_dir, const RomPathChar *path) {
|
||||||
|
@ -434,7 +434,7 @@ namespace ams::fs {
|
||||||
R_TRY(parser.GetAsFileName(std::addressof(out_key->name)));
|
R_TRY(parser.GetAsFileName(std::addressof(out_key->name)));
|
||||||
}
|
}
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result HierarchicalRomFileTable::FindDirectoryRecursive(EntryKey *out_key, RomDirectoryEntry *out_dir_entry, const RomPathChar *path) {
|
Result HierarchicalRomFileTable::FindDirectoryRecursive(EntryKey *out_key, RomDirectoryEntry *out_dir_entry, const RomPathChar *path) {
|
||||||
|
@ -475,7 +475,7 @@ namespace ams::fs {
|
||||||
return if_exists;
|
return if_exists;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result HierarchicalRomFileTable::GetDirectoryEntry(Position *out_pos, RomDirectoryEntry *out_entry, const EntryKey &key) {
|
Result HierarchicalRomFileTable::GetDirectoryEntry(Position *out_pos, RomDirectoryEntry *out_entry, const EntryKey &key) {
|
||||||
|
@ -551,7 +551,7 @@ namespace ams::fs {
|
||||||
|
|
||||||
AMS_UNUSED(out);
|
AMS_UNUSED(out);
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result HierarchicalRomFileTable::OpenFile(FileInfo *out, const EntryKey &key) {
|
Result HierarchicalRomFileTable::OpenFile(FileInfo *out, const EntryKey &key) {
|
||||||
|
@ -562,7 +562,7 @@ namespace ams::fs {
|
||||||
R_TRY(this->GetFileEntry(std::addressof(pos), std::addressof(entry), key));
|
R_TRY(this->GetFileEntry(std::addressof(pos), std::addressof(entry), key));
|
||||||
|
|
||||||
*out = entry.info;
|
*out = entry.info;
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result HierarchicalRomFileTable::FindOpen(FindPosition *out, const EntryKey &key) {
|
Result HierarchicalRomFileTable::FindOpen(FindPosition *out, const EntryKey &key) {
|
||||||
|
@ -578,7 +578,7 @@ namespace ams::fs {
|
||||||
out->next_dir = entry.dir;
|
out->next_dir = entry.dir;
|
||||||
out->next_file = entry.file;
|
out->next_file = entry.file;
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -32,7 +32,7 @@ namespace ams::fs::RomPathTool {
|
||||||
/* ... */
|
/* ... */
|
||||||
}
|
}
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PathParser::Finalize() {
|
void PathParser::Finalize() {
|
||||||
|
@ -97,7 +97,7 @@ namespace ams::fs::RomPathTool {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result PathParser::GetAsDirectoryName(RomEntryName *out) const {
|
Result PathParser::GetAsDirectoryName(RomEntryName *out) const {
|
||||||
|
@ -111,7 +111,7 @@ namespace ams::fs::RomPathTool {
|
||||||
|
|
||||||
out->length = len;
|
out->length = len;
|
||||||
out->path = m_prev_path_start;
|
out->path = m_prev_path_start;
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result PathParser::GetAsFileName(RomEntryName *out) const {
|
Result PathParser::GetAsFileName(RomEntryName *out) const {
|
||||||
|
@ -125,7 +125,7 @@ namespace ams::fs::RomPathTool {
|
||||||
|
|
||||||
out->length = len;
|
out->length = len;
|
||||||
out->path = m_prev_path_start;
|
out->path = m_prev_path_start;
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result GetParentDirectoryName(RomEntryName *out, const RomEntryName &cur, const RomPathChar *p) {
|
Result GetParentDirectoryName(RomEntryName *out, const RomEntryName &cur, const RomPathChar *p) {
|
||||||
|
@ -186,7 +186,7 @@ namespace ams::fs::RomPathTool {
|
||||||
out->length = end - start + 1;
|
out->length = end - start + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,7 +62,7 @@ namespace ams::fs {
|
||||||
Result FileStorage::GetSize(s64 *out_size) {
|
Result FileStorage::GetSize(s64 *out_size) {
|
||||||
R_TRY(this->UpdateSize());
|
R_TRY(this->UpdateSize());
|
||||||
*out_size = m_size;
|
*out_size = m_size;
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result FileStorage::SetSize(s64 size) {
|
Result FileStorage::SetSize(s64 size) {
|
||||||
|
@ -100,7 +100,7 @@ namespace ams::fs {
|
||||||
this->SetFile(std::move(base_file));
|
this->SetFile(std::move(base_file));
|
||||||
m_base_file_system = std::move(base_file_system);
|
m_base_file_system = std::move(base_file_system);
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result FileHandleStorage::UpdateSize() {
|
Result FileHandleStorage::UpdateSize() {
|
||||||
|
@ -153,7 +153,7 @@ namespace ams::fs {
|
||||||
Result FileHandleStorage::GetSize(s64 *out_size) {
|
Result FileHandleStorage::GetSize(s64 *out_size) {
|
||||||
R_TRY(this->UpdateSize());
|
R_TRY(this->UpdateSize());
|
||||||
*out_size = m_size;
|
*out_size = m_size;
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result FileHandleStorage::SetSize(s64 size) {
|
Result FileHandleStorage::SetSize(s64 size) {
|
||||||
|
@ -172,7 +172,7 @@ namespace ams::fs {
|
||||||
|
|
||||||
return QueryRange(static_cast<QueryRangeInfo *>(dst), m_handle, offset, size);
|
return QueryRange(static_cast<QueryRangeInfo *>(dst), m_handle, offset, size);
|
||||||
default:
|
default:
|
||||||
return fs::ResultUnsupportedOperateRangeForFileHandleStorage();
|
R_THROW(fs::ResultUnsupportedOperateRangeForFileHandleStorage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ namespace ams::fs {
|
||||||
AMS_ASSERT(static_cast<size_t>(size) == needed_size - 1);
|
AMS_ASSERT(static_cast<size_t>(size) == needed_size - 1);
|
||||||
AMS_UNUSED(size);
|
AMS_UNUSED(size);
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ namespace ams::fs {
|
||||||
AMS_ASSERT(static_cast<size_t>(size) == needed_size - 1);
|
AMS_ASSERT(static_cast<size_t>(size) == needed_size - 1);
|
||||||
AMS_UNUSED(size);
|
AMS_UNUSED(size);
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ namespace ams::fs::impl {
|
||||||
R_UNLESS(storage != nullptr, fs::ResultAllocationMemoryFailedInDataA());
|
R_UNLESS(storage != nullptr, fs::ResultAllocationMemoryFailedInDataA());
|
||||||
|
|
||||||
*out = std::move(storage);
|
*out = std::move(storage);
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result MountDataImpl(const char *name, ncm::DataId data_id, ncm::StorageId storage_id, void *cache_buffer, size_t cache_size, bool use_cache, bool use_data_cache, bool use_path_cache) {
|
Result MountDataImpl(const char *name, ncm::DataId data_id, ncm::StorageId storage_id, void *cache_buffer, size_t cache_size, bool use_cache, bool use_data_cache, bool use_path_cache) {
|
||||||
|
@ -66,7 +66,7 @@ namespace ams::fs::impl {
|
||||||
|
|
||||||
constexpr size_t MinimumCacheSize = 32;
|
constexpr size_t MinimumCacheSize = 32;
|
||||||
*out = std::max(size, MinimumCacheSize);
|
*out = std::max(size, MinimumCacheSize);
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result MountData(const char *name, ncm::DataId data_id, ncm::StorageId storage_id) {
|
Result MountData(const char *name, ncm::DataId data_id, ncm::StorageId storage_id) {
|
||||||
|
|
|
@ -48,7 +48,7 @@ namespace ams::fs {
|
||||||
AMS_ASSERT(static_cast<size_t>(size) == needed_size - 1);
|
AMS_ASSERT(static_cast<size_t>(size) == needed_size - 1);
|
||||||
AMS_UNUSED(size);
|
AMS_UNUSED(size);
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ namespace ams::fs {
|
||||||
/* Set allocators. */
|
/* Set allocators. */
|
||||||
g_allocate_func = allocator;
|
g_allocate_func = allocator;
|
||||||
g_deallocate_func = deallocator;
|
g_deallocate_func = deallocator;
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,7 +64,7 @@ namespace ams::fs {
|
||||||
|
|
||||||
/* Set output. */
|
/* Set output. */
|
||||||
*out = priority_raw;
|
*out = priority_raw;
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result GetPriorityImpl(fs::Priority *out, os::ThreadType *thread) {
|
Result GetPriorityImpl(fs::Priority *out, os::ThreadType *thread) {
|
||||||
|
@ -77,7 +77,7 @@ namespace ams::fs {
|
||||||
|
|
||||||
/* Set output. */
|
/* Set output. */
|
||||||
*out = ConvertPriorityRawToPriority(priority_raw);
|
*out = ConvertPriorityRawToPriority(priority_raw);
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result SetPriorityRawImpl(os::ThreadType *thread, fs::PriorityRaw priority_raw) {
|
Result SetPriorityRawImpl(os::ThreadType *thread, fs::PriorityRaw priority_raw) {
|
||||||
|
@ -91,7 +91,7 @@ namespace ams::fs {
|
||||||
|
|
||||||
/* Update the priority. */
|
/* Update the priority. */
|
||||||
UpdateTlsIoPriority(thread, tls_io);
|
UpdateTlsIoPriority(thread, tls_io);
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result SetPriorityImpl(os::ThreadType *thread, fs::Priority priority) {
|
Result SetPriorityImpl(os::ThreadType *thread, fs::Priority priority) {
|
||||||
|
@ -105,7 +105,7 @@ namespace ams::fs {
|
||||||
|
|
||||||
/* Update the priority. */
|
/* Update the priority. */
|
||||||
UpdateTlsIoPriority(thread, tls_io);
|
UpdateTlsIoPriority(thread, tls_io);
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ namespace ams::fs {
|
||||||
} R_END_TRY_CATCH;
|
} R_END_TRY_CATCH;
|
||||||
|
|
||||||
AMS_ASSERT(false);
|
AMS_ASSERT(false);
|
||||||
return fs::ResultNcaCorrupted();
|
R_THROW(fs::ResultNcaCorrupted());
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ConvertIntegrityVerificationStorageCorruptedResult(Result res) {
|
Result ConvertIntegrityVerificationStorageCorruptedResult(Result res) {
|
||||||
|
@ -60,7 +60,7 @@ namespace ams::fs {
|
||||||
} R_END_TRY_CATCH;
|
} R_END_TRY_CATCH;
|
||||||
|
|
||||||
AMS_ASSERT(false);
|
AMS_ASSERT(false);
|
||||||
return fs::ResultIntegrityVerificationStorageCorrupted();
|
R_THROW(fs::ResultIntegrityVerificationStorageCorrupted());
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ConvertBuiltInStorageCorruptedResult(Result res) {
|
Result ConvertBuiltInStorageCorruptedResult(Result res) {
|
||||||
|
@ -72,7 +72,7 @@ namespace ams::fs {
|
||||||
} R_END_TRY_CATCH;
|
} R_END_TRY_CATCH;
|
||||||
|
|
||||||
AMS_ASSERT(false);
|
AMS_ASSERT(false);
|
||||||
return fs::ResultBuiltInStorageCorrupted();
|
R_THROW(fs::ResultBuiltInStorageCorrupted());
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ConvertPartitionFileSystemCorruptedResult(Result res) {
|
Result ConvertPartitionFileSystemCorruptedResult(Result res) {
|
||||||
|
@ -89,7 +89,7 @@ namespace ams::fs {
|
||||||
} R_END_TRY_CATCH;
|
} R_END_TRY_CATCH;
|
||||||
|
|
||||||
AMS_ASSERT(false);
|
AMS_ASSERT(false);
|
||||||
return fs::ResultPartitionFileSystemCorrupted();
|
R_THROW(fs::ResultPartitionFileSystemCorrupted());
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ConvertFatFileSystemCorruptedResult(Result res) {
|
Result ConvertFatFileSystemCorruptedResult(Result res) {
|
||||||
|
@ -110,7 +110,7 @@ namespace ams::fs {
|
||||||
} R_END_TRY_CATCH;
|
} R_END_TRY_CATCH;
|
||||||
|
|
||||||
AMS_ASSERT(false);
|
AMS_ASSERT(false);
|
||||||
return fs::ResultHostFileSystemCorrupted();
|
R_THROW(fs::ResultHostFileSystemCorrupted());
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ConvertDatabaseCorruptedResult(Result res) {
|
Result ConvertDatabaseCorruptedResult(Result res) {
|
||||||
|
@ -123,7 +123,7 @@ namespace ams::fs {
|
||||||
} R_END_TRY_CATCH;
|
} R_END_TRY_CATCH;
|
||||||
|
|
||||||
AMS_ASSERT(false);
|
AMS_ASSERT(false);
|
||||||
return fs::ResultDatabaseCorrupted();
|
R_THROW(fs::ResultDatabaseCorrupted());
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ConvertRomFsResult(Result res) {
|
Result ConvertRomFsResult(Result res) {
|
||||||
|
@ -141,7 +141,7 @@ namespace ams::fs {
|
||||||
R_CONVERT(fs::ResultIncompatiblePath, fs::ResultPathNotFound())
|
R_CONVERT(fs::ResultIncompatiblePath, fs::ResultPathNotFound())
|
||||||
} R_END_TRY_CATCH;
|
} R_END_TRY_CATCH;
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ReadFile(IStorage *storage, s64 offset, void *buffer, size_t size) {
|
Result ReadFile(IStorage *storage, s64 offset, void *buffer, size_t size) {
|
||||||
|
@ -181,7 +181,7 @@ namespace ams::fs {
|
||||||
AMS_ASSERT(buf != nullptr || size == 0);
|
AMS_ASSERT(buf != nullptr || size == 0);
|
||||||
AMS_UNUSED(buf);
|
AMS_UNUSED(buf);
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ConvertResult(Result res) const {
|
Result ConvertResult(Result res) const {
|
||||||
|
@ -207,26 +207,26 @@ namespace ams::fs {
|
||||||
R_TRY(this->ConvertResult(this->GetStorage()->Read(offset + m_start, buffer, size)));
|
R_TRY(this->ConvertResult(this->GetStorage()->Read(offset + m_start, buffer, size)));
|
||||||
*out = read_size;
|
*out = read_size;
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result DoGetSize(s64 *out) override {
|
virtual Result DoGetSize(s64 *out) override {
|
||||||
*out = this->GetSize();
|
*out = this->GetSize();
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result DoFlush() override {
|
virtual Result DoFlush() override {
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result DoWrite(s64 offset, const void *buffer, size_t size, const fs::WriteOption &option) override {
|
virtual Result DoWrite(s64 offset, const void *buffer, size_t size, const fs::WriteOption &option) override {
|
||||||
AMS_UNUSED(offset, buffer, size, option);
|
AMS_UNUSED(offset, buffer, size, option);
|
||||||
return fs::ResultUnsupportedWriteForRomFsFile();
|
R_THROW(fs::ResultUnsupportedWriteForRomFsFile());
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result DoSetSize(s64 size) override {
|
virtual Result DoSetSize(s64 size) override {
|
||||||
AMS_UNUSED(size);
|
AMS_UNUSED(size);
|
||||||
return fs::ResultUnsupportedWriteForRomFsFile();
|
R_THROW(fs::ResultUnsupportedWriteForRomFsFile());
|
||||||
}
|
}
|
||||||
|
|
||||||
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 {
|
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 {
|
||||||
|
@ -245,7 +245,7 @@ namespace ams::fs {
|
||||||
return this->GetStorage()->OperateRange(dst, dst_size, op_id, m_start + offset, operate_size, src, src_size);
|
return this->GetStorage()->OperateRange(dst, dst_size, op_id, m_start + offset, operate_size, src, src_size);
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
return fs::ResultUnsupportedOperateRangeForRomFsFile();
|
R_THROW(fs::ResultUnsupportedOperateRangeForRomFsFile());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
|
@ -330,7 +330,7 @@ namespace ams::fs {
|
||||||
}
|
}
|
||||||
|
|
||||||
*out_count = i;
|
*out_count = i;
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
virtual sf::cmif::DomainObjectId GetDomainObjectId() const override {
|
virtual sf::cmif::DomainObjectId GetDomainObjectId() const override {
|
||||||
|
@ -354,7 +354,7 @@ namespace ams::fs {
|
||||||
R_TRY(ReadFileHeader(storage, std::addressof(header)));
|
R_TRY(ReadFileHeader(storage, std::addressof(header)));
|
||||||
|
|
||||||
*out = CalculateRequiredWorkingMemorySize(header);
|
*out = CalculateRequiredWorkingMemorySize(header);
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result RomFsFileSystem::Initialize(IStorage *base, void *work, size_t work_size, bool use_cache) {
|
Result RomFsFileSystem::Initialize(IStorage *base, void *work, size_t work_size, bool use_cache) {
|
||||||
|
@ -411,7 +411,7 @@ namespace ams::fs {
|
||||||
/* Set members. */
|
/* Set members. */
|
||||||
m_entry_size = header.body_offset;
|
m_entry_size = header.body_offset;
|
||||||
m_base_storage = base;
|
m_base_storage = base;
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result RomFsFileSystem::Initialize(std::unique_ptr<IStorage>&& base, void *work, size_t work_size, bool use_cache) {
|
Result RomFsFileSystem::Initialize(std::unique_ptr<IStorage>&& base, void *work, size_t work_size, bool use_cache) {
|
||||||
|
@ -424,7 +424,7 @@ namespace ams::fs {
|
||||||
R_CONVERT(fs::ResultDbmNotFound, fs::ResultPathNotFound());
|
R_CONVERT(fs::ResultDbmNotFound, fs::ResultPathNotFound());
|
||||||
R_CONVERT(fs::ResultDbmInvalidOperation, fs::ResultPathNotFound());
|
R_CONVERT(fs::ResultDbmInvalidOperation, fs::ResultPathNotFound());
|
||||||
} R_END_TRY_CATCH;
|
} R_END_TRY_CATCH;
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
IStorage *RomFsFileSystem::GetBaseStorage() {
|
IStorage *RomFsFileSystem::GetBaseStorage() {
|
||||||
|
@ -442,42 +442,42 @@ namespace ams::fs {
|
||||||
RomFileTable::FileInfo info;
|
RomFileTable::FileInfo info;
|
||||||
R_TRY(this->GetFileInfo(std::addressof(info), path));
|
R_TRY(this->GetFileInfo(std::addressof(info), path));
|
||||||
*out = m_entry_size + info.offset.Get();
|
*out = m_entry_size + info.offset.Get();
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result RomFsFileSystem::DoCreateFile(const fs::Path &path, s64 size, int flags) {
|
Result RomFsFileSystem::DoCreateFile(const fs::Path &path, s64 size, int flags) {
|
||||||
AMS_UNUSED(path, size, flags);
|
AMS_UNUSED(path, size, flags);
|
||||||
return fs::ResultUnsupportedWriteForRomFsFileSystem();
|
R_THROW(fs::ResultUnsupportedWriteForRomFsFileSystem());
|
||||||
}
|
}
|
||||||
|
|
||||||
Result RomFsFileSystem::DoDeleteFile(const fs::Path &path) {
|
Result RomFsFileSystem::DoDeleteFile(const fs::Path &path) {
|
||||||
AMS_UNUSED(path);
|
AMS_UNUSED(path);
|
||||||
return fs::ResultUnsupportedWriteForRomFsFileSystem();
|
R_THROW(fs::ResultUnsupportedWriteForRomFsFileSystem());
|
||||||
}
|
}
|
||||||
|
|
||||||
Result RomFsFileSystem::DoCreateDirectory(const fs::Path &path) {
|
Result RomFsFileSystem::DoCreateDirectory(const fs::Path &path) {
|
||||||
AMS_UNUSED(path);
|
AMS_UNUSED(path);
|
||||||
return fs::ResultUnsupportedWriteForRomFsFileSystem();
|
R_THROW(fs::ResultUnsupportedWriteForRomFsFileSystem());
|
||||||
}
|
}
|
||||||
|
|
||||||
Result RomFsFileSystem::DoDeleteDirectory(const fs::Path &path) {
|
Result RomFsFileSystem::DoDeleteDirectory(const fs::Path &path) {
|
||||||
AMS_UNUSED(path);
|
AMS_UNUSED(path);
|
||||||
return fs::ResultUnsupportedWriteForRomFsFileSystem();
|
R_THROW(fs::ResultUnsupportedWriteForRomFsFileSystem());
|
||||||
}
|
}
|
||||||
|
|
||||||
Result RomFsFileSystem::DoDeleteDirectoryRecursively(const fs::Path &path) {
|
Result RomFsFileSystem::DoDeleteDirectoryRecursively(const fs::Path &path) {
|
||||||
AMS_UNUSED(path);
|
AMS_UNUSED(path);
|
||||||
return fs::ResultUnsupportedWriteForRomFsFileSystem();
|
R_THROW(fs::ResultUnsupportedWriteForRomFsFileSystem());
|
||||||
}
|
}
|
||||||
|
|
||||||
Result RomFsFileSystem::DoRenameFile(const fs::Path &old_path, const fs::Path &new_path) {
|
Result RomFsFileSystem::DoRenameFile(const fs::Path &old_path, const fs::Path &new_path) {
|
||||||
AMS_UNUSED(old_path, new_path);
|
AMS_UNUSED(old_path, new_path);
|
||||||
return fs::ResultUnsupportedWriteForRomFsFileSystem();
|
R_THROW(fs::ResultUnsupportedWriteForRomFsFileSystem());
|
||||||
}
|
}
|
||||||
|
|
||||||
Result RomFsFileSystem::DoRenameDirectory(const fs::Path &old_path, const fs::Path &new_path) {
|
Result RomFsFileSystem::DoRenameDirectory(const fs::Path &old_path, const fs::Path &new_path) {
|
||||||
AMS_UNUSED(old_path, new_path);
|
AMS_UNUSED(old_path, new_path);
|
||||||
return fs::ResultUnsupportedWriteForRomFsFileSystem();
|
R_THROW(fs::ResultUnsupportedWriteForRomFsFileSystem());
|
||||||
}
|
}
|
||||||
|
|
||||||
Result RomFsFileSystem::DoGetEntryType(fs::DirectoryEntryType *out, const fs::Path &path) {
|
Result RomFsFileSystem::DoGetEntryType(fs::DirectoryEntryType *out, const fs::Path &path) {
|
||||||
|
@ -488,12 +488,12 @@ namespace ams::fs {
|
||||||
RomFileTable::FileInfo file_info;
|
RomFileTable::FileInfo file_info;
|
||||||
R_TRY(this->GetFileInfo(std::addressof(file_info), path.GetString()));
|
R_TRY(this->GetFileInfo(std::addressof(file_info), path.GetString()));
|
||||||
*out = fs::DirectoryEntryType_File;
|
*out = fs::DirectoryEntryType_File;
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
} R_END_TRY_CATCH;
|
} R_END_TRY_CATCH;
|
||||||
|
|
||||||
*out = fs::DirectoryEntryType_Directory;
|
*out = fs::DirectoryEntryType_Directory;
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result RomFsFileSystem::DoOpenFile(std::unique_ptr<fs::fsa::IFile> *out_file, const fs::Path &path, fs::OpenMode mode) {
|
Result RomFsFileSystem::DoOpenFile(std::unique_ptr<fs::fsa::IFile> *out_file, const fs::Path &path, fs::OpenMode mode) {
|
||||||
|
@ -508,7 +508,7 @@ namespace ams::fs {
|
||||||
R_UNLESS(file != nullptr, fs::ResultAllocationMemoryFailedInRomFsFileSystemB());
|
R_UNLESS(file != nullptr, fs::ResultAllocationMemoryFailedInRomFsFileSystemB());
|
||||||
|
|
||||||
*out_file = std::move(file);
|
*out_file = std::move(file);
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result RomFsFileSystem::DoOpenDirectory(std::unique_ptr<fs::fsa::IDirectory> *out_dir, const fs::Path &path, fs::OpenDirectoryMode mode) {
|
Result RomFsFileSystem::DoOpenDirectory(std::unique_ptr<fs::fsa::IDirectory> *out_dir, const fs::Path &path, fs::OpenDirectoryMode mode) {
|
||||||
|
@ -524,36 +524,36 @@ namespace ams::fs {
|
||||||
R_UNLESS(dir != nullptr, fs::ResultAllocationMemoryFailedInRomFsFileSystemC());
|
R_UNLESS(dir != nullptr, fs::ResultAllocationMemoryFailedInRomFsFileSystemC());
|
||||||
|
|
||||||
*out_dir = std::move(dir);
|
*out_dir = std::move(dir);
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result RomFsFileSystem::DoCommit() {
|
Result RomFsFileSystem::DoCommit() {
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result RomFsFileSystem::DoGetFreeSpaceSize(s64 *out, const fs::Path &path) {
|
Result RomFsFileSystem::DoGetFreeSpaceSize(s64 *out, const fs::Path &path) {
|
||||||
AMS_UNUSED(path);
|
AMS_UNUSED(path);
|
||||||
|
|
||||||
*out = 0;
|
*out = 0;
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result RomFsFileSystem::DoGetTotalSpaceSize(s64 *out, const fs::Path &path) {
|
Result RomFsFileSystem::DoGetTotalSpaceSize(s64 *out, const fs::Path &path) {
|
||||||
AMS_UNUSED(out, path);
|
AMS_UNUSED(out, path);
|
||||||
return fs::ResultUnsupportedGetTotalSpaceSizeForRomFsFileSystem();
|
R_THROW(fs::ResultUnsupportedGetTotalSpaceSizeForRomFsFileSystem());
|
||||||
}
|
}
|
||||||
|
|
||||||
Result RomFsFileSystem::DoCleanDirectoryRecursively(const fs::Path &path) {
|
Result RomFsFileSystem::DoCleanDirectoryRecursively(const fs::Path &path) {
|
||||||
AMS_UNUSED(path);
|
AMS_UNUSED(path);
|
||||||
return fs::ResultUnsupportedWriteForRomFsFileSystem();
|
R_THROW(fs::ResultUnsupportedWriteForRomFsFileSystem());
|
||||||
}
|
}
|
||||||
|
|
||||||
Result RomFsFileSystem::DoCommitProvisionally(s64 counter) {
|
Result RomFsFileSystem::DoCommitProvisionally(s64 counter) {
|
||||||
AMS_UNUSED(counter);
|
AMS_UNUSED(counter);
|
||||||
return fs::ResultUnsupportedCommitProvisionallyForRomFsFileSystem();
|
R_THROW(fs::ResultUnsupportedCommitProvisionallyForRomFsFileSystem());
|
||||||
}
|
}
|
||||||
|
|
||||||
Result RomFsFileSystem::DoRollback() {
|
Result RomFsFileSystem::DoRollback() {
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -124,7 +124,7 @@ namespace ams::fs {
|
||||||
R_TRY(impl::ReadSaveDataFileSystemExtraData(std::addressof(extra_data), id));
|
R_TRY(impl::ReadSaveDataFileSystemExtraData(std::addressof(extra_data), id));
|
||||||
|
|
||||||
*out = extra_data.flags;
|
*out = extra_data.flags;
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result GetSaveDataFlags(u32 *out, SaveDataSpaceId space_id, SaveDataId id) {
|
Result GetSaveDataFlags(u32 *out, SaveDataSpaceId space_id, SaveDataId id) {
|
||||||
|
@ -132,7 +132,7 @@ namespace ams::fs {
|
||||||
R_TRY(impl::ReadSaveDataFileSystemExtraData(std::addressof(extra_data), space_id, id));
|
R_TRY(impl::ReadSaveDataFileSystemExtraData(std::addressof(extra_data), space_id, id));
|
||||||
|
|
||||||
*out = extra_data.flags;
|
*out = extra_data.flags;
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result SetSaveDataFlags(SaveDataId id, SaveDataSpaceId space_id, u32 flags) {
|
Result SetSaveDataFlags(SaveDataId id, SaveDataSpaceId space_id, u32 flags) {
|
||||||
|
@ -147,7 +147,7 @@ namespace ams::fs {
|
||||||
R_TRY(impl::ReadSaveDataFileSystemExtraData(std::addressof(extra_data), id));
|
R_TRY(impl::ReadSaveDataFileSystemExtraData(std::addressof(extra_data), id));
|
||||||
|
|
||||||
*out = extra_data.available_size;
|
*out = extra_data.available_size;
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result GetSaveDataJournalSize(s64 *out, SaveDataId id) {
|
Result GetSaveDataJournalSize(s64 *out, SaveDataId id) {
|
||||||
|
@ -155,7 +155,7 @@ namespace ams::fs {
|
||||||
R_TRY(impl::ReadSaveDataFileSystemExtraData(std::addressof(extra_data), id));
|
R_TRY(impl::ReadSaveDataFileSystemExtraData(std::addressof(extra_data), id));
|
||||||
|
|
||||||
*out = extra_data.journal_size;
|
*out = extra_data.journal_size;
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ExtendSaveData(SaveDataSpaceId space_id, SaveDataId id, s64 available_size, s64 journal_size) {
|
Result ExtendSaveData(SaveDataSpaceId space_id, SaveDataId id, s64 available_size, s64 journal_size) {
|
||||||
|
|
|
@ -41,7 +41,7 @@ namespace ams::fs {
|
||||||
AMS_ASSERT(static_cast<size_t>(size) == needed_size - 1);
|
AMS_ASSERT(static_cast<size_t>(size) == needed_size - 1);
|
||||||
AMS_UNUSED(size);
|
AMS_UNUSED(size);
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ namespace ams::fs {
|
||||||
AMS_FS_R_UNLESS(adapter != nullptr, fs::ResultAllocationMemoryFailedInSdCardB());
|
AMS_FS_R_UNLESS(adapter != nullptr, fs::ResultAllocationMemoryFailedInSdCardB());
|
||||||
|
|
||||||
*out = std::move(adapter);
|
*out = std::move(adapter);
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsSdCardInserted() {
|
bool IsSdCardInserted() {
|
||||||
|
|
|
@ -82,7 +82,7 @@ namespace ams::fs::impl {
|
||||||
|
|
||||||
setter.Set(option.HasFlushFlag() ? WriteState::None : WriteState::NeedsFlush);
|
setter.Set(option.HasFlushFlag() ? WriteState::None : WriteState::NeedsFlush);
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result FileAccessor::Flush() {
|
Result FileAccessor::Flush() {
|
||||||
|
@ -93,7 +93,7 @@ namespace ams::fs::impl {
|
||||||
R_TRY(this->UpdateLastResult(m_impl->Flush()));
|
R_TRY(this->UpdateLastResult(m_impl->Flush()));
|
||||||
setter.Set(WriteState::None);
|
setter.Set(WriteState::None);
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result FileAccessor::SetSize(s64 size) {
|
Result FileAccessor::SetSize(s64 size) {
|
||||||
|
@ -110,7 +110,7 @@ namespace ams::fs::impl {
|
||||||
}
|
}
|
||||||
|
|
||||||
setter.Set(old_write_state);
|
setter.Set(old_write_state);
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result FileAccessor::GetSize(s64 *out) {
|
Result FileAccessor::GetSize(s64 *out) {
|
||||||
|
|
|
@ -41,7 +41,7 @@ namespace ams::fs::impl {
|
||||||
R_UNLESS(this->CanAcceptMountName(fs->GetName()), fs::ResultMountNameAlreadyExists());
|
R_UNLESS(this->CanAcceptMountName(fs->GetName()), fs::ResultMountNameAlreadyExists());
|
||||||
|
|
||||||
m_fs_list.push_back(*fs.release());
|
m_fs_list.push_back(*fs.release());
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result MountTable::Find(FileSystemAccessor **out, const char *name) {
|
Result MountTable::Find(FileSystemAccessor **out, const char *name) {
|
||||||
|
@ -50,11 +50,11 @@ namespace ams::fs::impl {
|
||||||
for (auto &fs : m_fs_list) {
|
for (auto &fs : m_fs_list) {
|
||||||
if (MatchesName(fs, name)) {
|
if (MatchesName(fs, name)) {
|
||||||
*out = std::addressof(fs);
|
*out = std::addressof(fs);
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return fs::ResultNotMounted();
|
R_THROW(fs::ResultNotMounted());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MountTable::Unmount(const char *name) {
|
void MountTable::Unmount(const char *name) {
|
||||||
|
|
|
@ -106,13 +106,13 @@ namespace ams::fs::impl {
|
||||||
Result CheckMountName(const char *name) {
|
Result CheckMountName(const char *name) {
|
||||||
R_TRY(CheckMountNameAllowingReserved(name));
|
R_TRY(CheckMountNameAllowingReserved(name));
|
||||||
R_UNLESS(!impl::IsReservedMountName(name), fs::ResultInvalidMountName());
|
R_UNLESS(!impl::IsReservedMountName(name), fs::ResultInvalidMountName());
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result CheckMountNameAllowingReserved(const char *name) {
|
Result CheckMountNameAllowingReserved(const char *name) {
|
||||||
R_UNLESS(name != nullptr, fs::ResultInvalidMountName());
|
R_UNLESS(name != nullptr, fs::ResultInvalidMountName());
|
||||||
R_UNLESS(impl::IsValidMountName(name), fs::ResultInvalidMountName());
|
R_UNLESS(impl::IsValidMountName(name), fs::ResultInvalidMountName());
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result FindFileSystem(FileSystemAccessor **out_accessor, const char **out_sub_path, const char *path) {
|
Result FindFileSystem(FileSystemAccessor **out_accessor, const char **out_sub_path, const char *path) {
|
||||||
|
@ -137,7 +137,7 @@ namespace ams::fs::impl {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl::Unregister(name);
|
impl::Unregister(name);
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -162,7 +162,7 @@ namespace ams::fs {
|
||||||
const auto common_path_len = util::SNPrintf(dst + mount_name_len, dst_size - mount_name_len, "%s", sub_path);
|
const auto common_path_len = util::SNPrintf(dst + mount_name_len, dst_size - mount_name_len, "%s", sub_path);
|
||||||
|
|
||||||
AMS_FS_R_UNLESS(static_cast<size_t>(common_path_len) < dst_size - mount_name_len, fs::ResultTooLongPath());
|
AMS_FS_R_UNLESS(static_cast<size_t>(common_path_len) < dst_size - mount_name_len, fs::ResultTooLongPath());
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Unmount(const char *mount_name) {
|
void Unmount(const char *mount_name) {
|
||||||
|
|
|
@ -29,12 +29,12 @@ namespace ams::fs {
|
||||||
|
|
||||||
Result ReadDirectory(s64 *out_count, DirectoryEntry *out_entries, DirectoryHandle handle, s64 max_entries) {
|
Result ReadDirectory(s64 *out_count, DirectoryEntry *out_entries, DirectoryHandle handle, s64 max_entries) {
|
||||||
AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG(Get(handle)->Read(out_count, out_entries, max_entries), handle, AMS_FS_IMPL_ACCESS_LOG_FORMAT_READ_DIRECTORY(out_count, max_entries)));
|
AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG(Get(handle)->Read(out_count, out_entries, max_entries), handle, AMS_FS_IMPL_ACCESS_LOG_FORMAT_READ_DIRECTORY(out_count, max_entries)));
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result GetDirectoryEntryCount(s64 *out, DirectoryHandle handle) {
|
Result GetDirectoryEntryCount(s64 *out, DirectoryHandle handle) {
|
||||||
AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG(Get(handle)->GetEntryCount(out), handle, AMS_FS_IMPL_ACCESS_LOG_FORMAT_GET_DIRECTORY_ENTRY_COUNT(out)));
|
AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG(Get(handle)->GetEntryCount(out), handle, AMS_FS_IMPL_ACCESS_LOG_FORMAT_GET_DIRECTORY_ENTRY_COUNT(out)));
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CloseDirectory(DirectoryHandle handle) {
|
void CloseDirectory(DirectoryHandle handle) {
|
||||||
|
|
|
@ -27,7 +27,7 @@ namespace ams::fs {
|
||||||
|
|
||||||
Result ReadFileImpl(size_t *out, FileHandle handle, s64 offset, void *buffer, size_t size, const fs::ReadOption &option) {
|
Result ReadFileImpl(size_t *out, FileHandle handle, s64 offset, void *buffer, size_t size, const fs::ReadOption &option) {
|
||||||
R_TRY(Get(handle)->Read(out, offset, buffer, size, option));
|
R_TRY(Get(handle)->Read(out, offset, buffer, size, option));
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -36,44 +36,44 @@ namespace ams::fs {
|
||||||
size_t read_size;
|
size_t read_size;
|
||||||
AMS_FS_R_TRY(ReadFileImpl(std::addressof(read_size), handle, offset, buffer, size, option));
|
AMS_FS_R_TRY(ReadFileImpl(std::addressof(read_size), handle, offset, buffer, size, option));
|
||||||
AMS_FS_R_UNLESS(read_size == size, fs::ResultOutOfRange());
|
AMS_FS_R_UNLESS(read_size == size, fs::ResultOutOfRange());
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ReadFile(FileHandle handle, s64 offset, void *buffer, size_t size) {
|
Result ReadFile(FileHandle handle, s64 offset, void *buffer, size_t size) {
|
||||||
size_t read_size;
|
size_t read_size;
|
||||||
AMS_FS_R_TRY(ReadFileImpl(std::addressof(read_size), handle, offset, buffer, size, ReadOption()));
|
AMS_FS_R_TRY(ReadFileImpl(std::addressof(read_size), handle, offset, buffer, size, ReadOption()));
|
||||||
AMS_FS_R_UNLESS(read_size == size, fs::ResultOutOfRange());
|
AMS_FS_R_UNLESS(read_size == size, fs::ResultOutOfRange());
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ReadFile(size_t *out, FileHandle handle, s64 offset, void *buffer, size_t size, const fs::ReadOption &option) {
|
Result ReadFile(size_t *out, FileHandle handle, s64 offset, void *buffer, size_t size, const fs::ReadOption &option) {
|
||||||
AMS_FS_R_TRY(ReadFileImpl(out, handle, offset, buffer, size, option));
|
AMS_FS_R_TRY(ReadFileImpl(out, handle, offset, buffer, size, option));
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ReadFile(size_t *out, FileHandle handle, s64 offset, void *buffer, size_t size) {
|
Result ReadFile(size_t *out, FileHandle handle, s64 offset, void *buffer, size_t size) {
|
||||||
AMS_FS_R_TRY(ReadFileImpl(out, handle, offset, buffer, size, ReadOption()));
|
AMS_FS_R_TRY(ReadFileImpl(out, handle, offset, buffer, size, ReadOption()));
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result GetFileSize(s64 *out, FileHandle handle) {
|
Result GetFileSize(s64 *out, FileHandle handle) {
|
||||||
AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG(Get(handle)->GetSize(out), handle, AMS_FS_IMPL_ACCESS_LOG_FORMAT_GET_FILE_SIZE(out)));
|
AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG(Get(handle)->GetSize(out), handle, AMS_FS_IMPL_ACCESS_LOG_FORMAT_GET_FILE_SIZE(out)));
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result FlushFile(FileHandle handle) {
|
Result FlushFile(FileHandle handle) {
|
||||||
AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG(Get(handle)->Flush(), handle, AMS_FS_IMPL_ACCESS_LOG_FORMAT_NONE));
|
AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG(Get(handle)->Flush(), handle, AMS_FS_IMPL_ACCESS_LOG_FORMAT_NONE));
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result WriteFile(FileHandle handle, s64 offset, const void *buffer, size_t size, const fs::WriteOption &option) {
|
Result WriteFile(FileHandle handle, s64 offset, const void *buffer, size_t size, const fs::WriteOption &option) {
|
||||||
AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG(Get(handle)->Write(offset, buffer, size, option), handle, AMS_FS_IMPL_ACCESS_LOG_FORMAT_WRITE_FILE(option), offset, size));
|
AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG(Get(handle)->Write(offset, buffer, size, option), handle, AMS_FS_IMPL_ACCESS_LOG_FORMAT_WRITE_FILE(option), offset, size));
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result SetFileSize(FileHandle handle, s64 size) {
|
Result SetFileSize(FileHandle handle, s64 size) {
|
||||||
AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG(Get(handle)->SetSize(size), handle, AMS_FS_IMPL_ACCESS_LOG_FORMAT_SIZE, size));
|
AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG(Get(handle)->SetSize(size), handle, AMS_FS_IMPL_ACCESS_LOG_FORMAT_SIZE, size));
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
int GetFileOpenMode(FileHandle handle) {
|
int GetFileOpenMode(FileHandle handle) {
|
||||||
|
@ -88,7 +88,7 @@ namespace ams::fs {
|
||||||
|
|
||||||
Result QueryRange(QueryRangeInfo *out, FileHandle handle, s64 offset, s64 size) {
|
Result QueryRange(QueryRangeInfo *out, FileHandle handle, s64 offset, s64 size) {
|
||||||
AMS_FS_R_TRY(Get(handle)->OperateRange(out, sizeof(*out), OperationId::QueryRange, offset, size, nullptr, 0));
|
AMS_FS_R_TRY(Get(handle)->OperateRange(out, sizeof(*out), OperationId::QueryRange, offset, size, nullptr, 0));
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ namespace ams::fs {
|
||||||
AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG_UNLESS_R_SUCCEEDED(impl::FindFileSystem(std::addressof(accessor), std::addressof(sub_path), path), AMS_FS_IMPL_ACCESS_LOG_FORMAT_PATH, path));
|
AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG_UNLESS_R_SUCCEEDED(impl::FindFileSystem(std::addressof(accessor), std::addressof(sub_path), path), AMS_FS_IMPL_ACCESS_LOG_FORMAT_PATH, path));
|
||||||
|
|
||||||
AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG_FILESYSTEM(accessor->CreateFile(sub_path, size, option), nullptr, accessor, AMS_FS_IMPL_ACCESS_LOG_FORMAT_PATH_AND_SIZE, path, size));
|
AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG_FILESYSTEM(accessor->CreateFile(sub_path, size, option), nullptr, accessor, AMS_FS_IMPL_ACCESS_LOG_FORMAT_PATH_AND_SIZE, path, size));
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result DeleteFile(const char *path) {
|
Result DeleteFile(const char *path) {
|
||||||
|
@ -41,7 +41,7 @@ namespace ams::fs {
|
||||||
AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG_UNLESS_R_SUCCEEDED(impl::FindFileSystem(std::addressof(accessor), std::addressof(sub_path), path), AMS_FS_IMPL_ACCESS_LOG_FORMAT_PATH, path));
|
AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG_UNLESS_R_SUCCEEDED(impl::FindFileSystem(std::addressof(accessor), std::addressof(sub_path), path), AMS_FS_IMPL_ACCESS_LOG_FORMAT_PATH, path));
|
||||||
|
|
||||||
AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG_FILESYSTEM(accessor->DeleteFile(sub_path), nullptr, accessor, AMS_FS_IMPL_ACCESS_LOG_FORMAT_PATH, path));
|
AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG_FILESYSTEM(accessor->DeleteFile(sub_path), nullptr, accessor, AMS_FS_IMPL_ACCESS_LOG_FORMAT_PATH, path));
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result CreateDirectory(const char *path) {
|
Result CreateDirectory(const char *path) {
|
||||||
|
@ -50,7 +50,7 @@ namespace ams::fs {
|
||||||
AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG_UNLESS_R_SUCCEEDED(impl::FindFileSystem(std::addressof(accessor), std::addressof(sub_path), path), AMS_FS_IMPL_ACCESS_LOG_FORMAT_PATH, path));
|
AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG_UNLESS_R_SUCCEEDED(impl::FindFileSystem(std::addressof(accessor), std::addressof(sub_path), path), AMS_FS_IMPL_ACCESS_LOG_FORMAT_PATH, path));
|
||||||
|
|
||||||
AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG_FILESYSTEM(accessor->CreateDirectory(sub_path), nullptr, accessor, AMS_FS_IMPL_ACCESS_LOG_FORMAT_PATH, path));
|
AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG_FILESYSTEM(accessor->CreateDirectory(sub_path), nullptr, accessor, AMS_FS_IMPL_ACCESS_LOG_FORMAT_PATH, path));
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result DeleteDirectory(const char *path) {
|
Result DeleteDirectory(const char *path) {
|
||||||
|
@ -59,7 +59,7 @@ namespace ams::fs {
|
||||||
AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG_UNLESS_R_SUCCEEDED(impl::FindFileSystem(std::addressof(accessor), std::addressof(sub_path), path), AMS_FS_IMPL_ACCESS_LOG_FORMAT_PATH, path));
|
AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG_UNLESS_R_SUCCEEDED(impl::FindFileSystem(std::addressof(accessor), std::addressof(sub_path), path), AMS_FS_IMPL_ACCESS_LOG_FORMAT_PATH, path));
|
||||||
|
|
||||||
AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG_FILESYSTEM(accessor->DeleteDirectory(sub_path), nullptr, accessor, AMS_FS_IMPL_ACCESS_LOG_FORMAT_PATH, path));
|
AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG_FILESYSTEM(accessor->DeleteDirectory(sub_path), nullptr, accessor, AMS_FS_IMPL_ACCESS_LOG_FORMAT_PATH, path));
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result DeleteDirectoryRecursively(const char *path) {
|
Result DeleteDirectoryRecursively(const char *path) {
|
||||||
|
@ -68,7 +68,7 @@ namespace ams::fs {
|
||||||
AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG_UNLESS_R_SUCCEEDED(impl::FindFileSystem(std::addressof(accessor), std::addressof(sub_path), path), AMS_FS_IMPL_ACCESS_LOG_FORMAT_PATH, path));
|
AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG_UNLESS_R_SUCCEEDED(impl::FindFileSystem(std::addressof(accessor), std::addressof(sub_path), path), AMS_FS_IMPL_ACCESS_LOG_FORMAT_PATH, path));
|
||||||
|
|
||||||
AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG_FILESYSTEM(accessor->DeleteDirectoryRecursively(sub_path), nullptr, accessor, AMS_FS_IMPL_ACCESS_LOG_FORMAT_PATH, path));
|
AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG_FILESYSTEM(accessor->DeleteDirectoryRecursively(sub_path), nullptr, accessor, AMS_FS_IMPL_ACCESS_LOG_FORMAT_PATH, path));
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result RenameFile(const char *old_path, const char *new_path) {
|
Result RenameFile(const char *old_path, const char *new_path) {
|
||||||
|
@ -82,11 +82,11 @@ namespace ams::fs {
|
||||||
auto rename_impl = [=]() -> Result {
|
auto rename_impl = [=]() -> Result {
|
||||||
R_UNLESS(old_accessor == new_accessor, fs::ResultRenameToOtherFileSystem());
|
R_UNLESS(old_accessor == new_accessor, fs::ResultRenameToOtherFileSystem());
|
||||||
R_TRY(old_accessor->RenameFile(old_sub_path, new_sub_path));
|
R_TRY(old_accessor->RenameFile(old_sub_path, new_sub_path));
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
};
|
};
|
||||||
|
|
||||||
AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG_FILESYSTEM(rename_impl(), nullptr, old_accessor, AMS_FS_IMPL_ACCESS_LOG_FORMAT_RENAME, old_path, new_path));
|
AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG_FILESYSTEM(rename_impl(), nullptr, old_accessor, AMS_FS_IMPL_ACCESS_LOG_FORMAT_RENAME, old_path, new_path));
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result RenameDirectory(const char *old_path, const char *new_path) {
|
Result RenameDirectory(const char *old_path, const char *new_path) {
|
||||||
|
@ -100,11 +100,11 @@ namespace ams::fs {
|
||||||
auto rename_impl = [=]() -> Result {
|
auto rename_impl = [=]() -> Result {
|
||||||
R_UNLESS(old_accessor == new_accessor, fs::ResultRenameToOtherFileSystem());
|
R_UNLESS(old_accessor == new_accessor, fs::ResultRenameToOtherFileSystem());
|
||||||
R_TRY(old_accessor->RenameDirectory(old_sub_path, new_sub_path));
|
R_TRY(old_accessor->RenameDirectory(old_sub_path, new_sub_path));
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
};
|
};
|
||||||
|
|
||||||
AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG_FILESYSTEM(rename_impl(), nullptr, old_accessor, AMS_FS_IMPL_ACCESS_LOG_FORMAT_RENAME, old_path, new_path));
|
AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG_FILESYSTEM(rename_impl(), nullptr, old_accessor, AMS_FS_IMPL_ACCESS_LOG_FORMAT_RENAME, old_path, new_path));
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result GetEntryType(DirectoryEntryType *out, const char *path) {
|
Result GetEntryType(DirectoryEntryType *out, const char *path) {
|
||||||
|
@ -113,7 +113,7 @@ namespace ams::fs {
|
||||||
AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG_UNLESS_R_SUCCEEDED(impl::FindFileSystem(std::addressof(accessor), std::addressof(sub_path), path), AMS_FS_IMPL_ACCESS_LOG_FORMAT_PATH, path));
|
AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG_UNLESS_R_SUCCEEDED(impl::FindFileSystem(std::addressof(accessor), std::addressof(sub_path), path), AMS_FS_IMPL_ACCESS_LOG_FORMAT_PATH, path));
|
||||||
|
|
||||||
AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG_FILESYSTEM(accessor->GetEntryType(out, sub_path), nullptr, accessor, AMS_FS_IMPL_ACCESS_LOG_FORMAT_GET_ENTRY_TYPE(out, path)));
|
AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG_FILESYSTEM(accessor->GetEntryType(out, sub_path), nullptr, accessor, AMS_FS_IMPL_ACCESS_LOG_FORMAT_GET_ENTRY_TYPE(out, path)));
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result OpenFile(FileHandle *out_file, const char *path, int mode) {
|
Result OpenFile(FileHandle *out_file, const char *path, int mode) {
|
||||||
|
@ -126,13 +126,13 @@ namespace ams::fs {
|
||||||
auto open_impl = [&]() -> Result {
|
auto open_impl = [&]() -> Result {
|
||||||
R_UNLESS(out_file != nullptr, fs::ResultNullptrArgument());
|
R_UNLESS(out_file != nullptr, fs::ResultNullptrArgument());
|
||||||
R_TRY(accessor->OpenFile(std::addressof(file_accessor), sub_path, static_cast<OpenMode>(mode)));
|
R_TRY(accessor->OpenFile(std::addressof(file_accessor), sub_path, static_cast<OpenMode>(mode)));
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
};
|
};
|
||||||
|
|
||||||
AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG_FILESYSTEM(open_impl(), nullptr, accessor, AMS_FS_IMPL_ACCESS_LOG_FORMAT_PATH_AND_OPEN_MODE, path, static_cast<u32>(mode)));
|
AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG_FILESYSTEM(open_impl(), nullptr, accessor, AMS_FS_IMPL_ACCESS_LOG_FORMAT_PATH_AND_OPEN_MODE, path, static_cast<u32>(mode)));
|
||||||
|
|
||||||
out_file->handle = file_accessor.release();
|
out_file->handle = file_accessor.release();
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result OpenDirectory(DirectoryHandle *out_dir, const char *path, int mode) {
|
Result OpenDirectory(DirectoryHandle *out_dir, const char *path, int mode) {
|
||||||
|
@ -145,13 +145,13 @@ namespace ams::fs {
|
||||||
auto open_impl = [&]() -> Result {
|
auto open_impl = [&]() -> Result {
|
||||||
R_UNLESS(out_dir != nullptr, fs::ResultNullptrArgument());
|
R_UNLESS(out_dir != nullptr, fs::ResultNullptrArgument());
|
||||||
R_TRY(accessor->OpenDirectory(std::addressof(dir_accessor), sub_path, static_cast<OpenDirectoryMode>(mode)));
|
R_TRY(accessor->OpenDirectory(std::addressof(dir_accessor), sub_path, static_cast<OpenDirectoryMode>(mode)));
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
};
|
};
|
||||||
|
|
||||||
AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG_FILESYSTEM(open_impl(), nullptr, accessor, AMS_FS_IMPL_ACCESS_LOG_FORMAT_PATH_AND_OPEN_MODE, path, static_cast<u32>(mode)));
|
AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG_FILESYSTEM(open_impl(), nullptr, accessor, AMS_FS_IMPL_ACCESS_LOG_FORMAT_PATH_AND_OPEN_MODE, path, static_cast<u32>(mode)));
|
||||||
|
|
||||||
out_dir->handle = dir_accessor.release();
|
out_dir->handle = dir_accessor.release();
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result CleanDirectoryRecursively(const char *path) {
|
Result CleanDirectoryRecursively(const char *path) {
|
||||||
|
@ -160,7 +160,7 @@ namespace ams::fs {
|
||||||
AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG_UNLESS_R_SUCCEEDED(impl::FindFileSystem(std::addressof(accessor), std::addressof(sub_path), path), AMS_FS_IMPL_ACCESS_LOG_FORMAT_PATH, path));
|
AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG_UNLESS_R_SUCCEEDED(impl::FindFileSystem(std::addressof(accessor), std::addressof(sub_path), path), AMS_FS_IMPL_ACCESS_LOG_FORMAT_PATH, path));
|
||||||
|
|
||||||
AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG_FILESYSTEM(accessor->CleanDirectoryRecursively(sub_path), nullptr, accessor, AMS_FS_IMPL_ACCESS_LOG_FORMAT_PATH, path));
|
AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG_FILESYSTEM(accessor->CleanDirectoryRecursively(sub_path), nullptr, accessor, AMS_FS_IMPL_ACCESS_LOG_FORMAT_PATH, path));
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result GetFreeSpaceSize(s64 *out, const char *path) {
|
Result GetFreeSpaceSize(s64 *out, const char *path) {
|
||||||
|
|
|
@ -31,7 +31,7 @@ namespace ams::fs {
|
||||||
|
|
||||||
R_TRY(accessor->GetFileTimeStampRaw(out, sub_path));
|
R_TRY(accessor->GetFileTimeStampRaw(out, sub_path));
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ namespace ams::fs::impl {
|
||||||
os::AttachReadableHandleToSystemEvent(out, handle.GetOsHandle(), handle.IsManaged(), clear_mode);
|
os::AttachReadableHandleToSystemEvent(out, handle.GetOsHandle(), handle.IsManaged(), clear_mode);
|
||||||
handle.Detach();
|
handle.Detach();
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ namespace ams::fssrv::fscreator {
|
||||||
|
|
||||||
/* Set the output. */
|
/* Set the output. */
|
||||||
*out = std::move(fs);
|
*out = std::move(fs);
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,7 +64,7 @@ namespace ams::fssrv::fscreator {
|
||||||
|
|
||||||
/* Set the output. */
|
/* Set the output. */
|
||||||
*out = std::move(fs);
|
*out = std::move(fs);
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ namespace ams::fssrv::fscreator {
|
||||||
/* Set the out storage. */
|
/* Set the out storage. */
|
||||||
*out = std::move(storage);
|
*out = std::move(storage);
|
||||||
*out_splitter = std::move(splitter);
|
*out_splitter = std::move(splitter);
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result StorageOnNcaCreator::CreateWithPatch(std::shared_ptr<fs::IStorage> *out, std::shared_ptr<fssystem::IAsynchronousAccessSplitter> *out_splitter, fssystem::NcaFsHeaderReader *out_header_reader, std::shared_ptr<fssystem::NcaReader> original_nca_reader, std::shared_ptr<fssystem::NcaReader> current_nca_reader, s32 index) {
|
Result StorageOnNcaCreator::CreateWithPatch(std::shared_ptr<fs::IStorage> *out, std::shared_ptr<fssystem::IAsynchronousAccessSplitter> *out_splitter, fssystem::NcaFsHeaderReader *out_header_reader, std::shared_ptr<fssystem::NcaReader> original_nca_reader, std::shared_ptr<fssystem::NcaReader> current_nca_reader, s32 index) {
|
||||||
|
@ -44,7 +44,7 @@ namespace ams::fssrv::fscreator {
|
||||||
/* Set the out storage. */
|
/* Set the out storage. */
|
||||||
*out = std::move(storage);
|
*out = std::move(storage);
|
||||||
*out_splitter = std::move(splitter);
|
*out_splitter = std::move(splitter);
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result StorageOnNcaCreator::CreateNcaReader(std::shared_ptr<fssystem::NcaReader> *out, std::shared_ptr<fs::IStorage> storage) {
|
Result StorageOnNcaCreator::CreateNcaReader(std::shared_ptr<fssystem::NcaReader> *out, std::shared_ptr<fs::IStorage> storage) {
|
||||||
|
@ -57,7 +57,7 @@ namespace ams::fssrv::fscreator {
|
||||||
|
|
||||||
/* Set the output. */
|
/* Set the output. */
|
||||||
*out = std::move(reader);
|
*out = std::move(reader);
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(ATMOSPHERE_BOARD_NINTENDO_NX)
|
#if !defined(ATMOSPHERE_BOARD_NINTENDO_NX)
|
||||||
|
@ -73,7 +73,7 @@ namespace ams::fssrv::fscreator {
|
||||||
/* Set the out storage. */
|
/* Set the out storage. */
|
||||||
*out = std::move(storage);
|
*out = std::move(storage);
|
||||||
*out_splitter = std::move(splitter);
|
*out_splitter = std::move(splitter);
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result StorageOnNcaCreator::CreateWithPatchWithContext(std::shared_ptr<fs::IStorage> *out, std::shared_ptr<fssystem::IAsynchronousAccessSplitter> *out_splitter, fssystem::NcaFsHeaderReader *out_header_reader, void *ctx, std::shared_ptr<fssystem::NcaReader> original_nca_reader, std::shared_ptr<fssystem::NcaReader> current_nca_reader, s32 index) {
|
Result StorageOnNcaCreator::CreateWithPatchWithContext(std::shared_ptr<fs::IStorage> *out, std::shared_ptr<fssystem::IAsynchronousAccessSplitter> *out_splitter, fssystem::NcaFsHeaderReader *out_header_reader, void *ctx, std::shared_ptr<fssystem::NcaReader> original_nca_reader, std::shared_ptr<fssystem::NcaReader> current_nca_reader, s32 index) {
|
||||||
|
@ -88,7 +88,7 @@ namespace ams::fssrv::fscreator {
|
||||||
/* Set the out storage. */
|
/* Set the out storage. */
|
||||||
*out = std::move(storage);
|
*out = std::move(storage);
|
||||||
*out_splitter = std::move(splitter);
|
*out_splitter = std::move(splitter);
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result StorageOnNcaCreator::CreateByRawStorage(std::shared_ptr<fs::IStorage> *out, std::shared_ptr<fssystem::IAsynchronousAccessSplitter> *out_splitter, const fssystem::NcaFsHeaderReader *header_reader, std::shared_ptr<fs::IStorage> raw_storage, void *ctx, std::shared_ptr<fssystem::NcaReader> nca_reader) {
|
Result StorageOnNcaCreator::CreateByRawStorage(std::shared_ptr<fs::IStorage> *out, std::shared_ptr<fssystem::IAsynchronousAccessSplitter> *out_splitter, const fssystem::NcaFsHeaderReader *header_reader, std::shared_ptr<fs::IStorage> raw_storage, void *ctx, std::shared_ptr<fssystem::NcaReader> nca_reader) {
|
||||||
|
|
|
@ -66,7 +66,7 @@ namespace ams::fssrv {
|
||||||
R_TRY(this->AcceptImpl(server, impl::GetInvalidProgramRegistryServiceObject()));
|
R_TRY(this->AcceptImpl(server, impl::GetInvalidProgramRegistryServiceObject()));
|
||||||
}
|
}
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PortIndex_FileSystemProxyForLoader:
|
case PortIndex_FileSystemProxyForLoader:
|
||||||
|
@ -81,7 +81,7 @@ namespace ams::fssrv {
|
||||||
R_TRY(this->AcceptImpl(server, impl::GetInvalidFileSystemProxyForLoaderServiceObject()));
|
R_TRY(this->AcceptImpl(server, impl::GetInvalidFileSystemProxyForLoaderServiceObject()));
|
||||||
}
|
}
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
AMS_UNREACHABLE_DEFAULT_CASE();
|
AMS_UNREACHABLE_DEFAULT_CASE();
|
||||||
|
|
|
@ -71,7 +71,7 @@ namespace ams::fssrv {
|
||||||
/* Set our process id. */
|
/* Set our process id. */
|
||||||
m_process_id = client_pid.GetValue().value;
|
m_process_id = client_pid.GetValue().value;
|
||||||
|
|
||||||
return ResultSuccess();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ProgramRegistryImpl::SetEnabledProgramVerification(bool en) {
|
Result ProgramRegistryImpl::SetEnabledProgramVerification(bool en) {
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue