erpt: SubmitFileSystemProxyErrorInfo

This commit is contained in:
Michael Scire 2023-10-25 14:21:27 -07:00
parent 60974a5f4e
commit 2ed8450446
8 changed files with 125 additions and 14 deletions

View file

@ -23,7 +23,7 @@ namespace ams::fat {
struct FatError { struct FatError {
int error; int error;
int extra_error; int extra_error;
int device_id; int drive_id;
char name[FatErrorNameMaxLength]; char name[FatErrorNameMaxLength];
u8 reserved[4]; u8 reserved[4];
}; };
@ -31,15 +31,15 @@ namespace ams::fat {
static_assert(util::is_pod<FatError>::value); static_assert(util::is_pod<FatError>::value);
struct FatReportInfo1 { struct FatReportInfo1 {
u16 file_peak_open_count; u16 open_file_peak_count;
u16 directory_peak_open_count; u16 open_directory_peak_count;
}; };
static_assert(sizeof(FatReportInfo1) == 4); static_assert(sizeof(FatReportInfo1) == 4);
static_assert(util::is_pod<FatReportInfo1>::value); static_assert(util::is_pod<FatReportInfo1>::value);
struct FatReportInfo2 { struct FatReportInfo2 {
u16 unique_file_entry_peak_open_count; u16 open_unique_file_entry_peak_count;
u16 unique_directory_entry_peak_open_count; u16 open_unique_directory_entry_peak_count;
}; };
static_assert(sizeof(FatReportInfo2) == 4); static_assert(sizeof(FatReportInfo2) == 4);
static_assert(util::is_pod<FatReportInfo2>::value); static_assert(util::is_pod<FatReportInfo2>::value);

View file

@ -29,17 +29,17 @@ namespace ams::fs {
static_assert(util::is_pod<StorageErrorInfo>::value); static_assert(util::is_pod<StorageErrorInfo>::value);
struct FileSystemProxyErrorInfo { struct FileSystemProxyErrorInfo {
u32 rom_fs_remont_for_data_corruption_count; u32 rom_fs_remount_for_data_corruption_count;
u32 rom_fs_unrecoverable_data_corruption_by_remount_count; u32 rom_fs_unrecoverable_data_corruption_by_remount_count;
fat::FatError fat_fs_error; fat::FatError fat_fs_error;
u32 rom_fs_recovered_by_invalidate_cache_count; u32 rom_fs_recovered_by_invalidate_cache_count;
u32 save_data_index_count; u32 save_data_index_count;
fat::FatReportInfo1 bis_system_report1; fat::FatReportInfo1 bis_system_fat_report_info_1;
fat::FatReportInfo1 bis_user_report1; fat::FatReportInfo1 bis_user_fat_report_info_1;
fat::FatReportInfo1 sd_card_report1; fat::FatReportInfo1 sd_card_fat_report_info_1;
fat::FatReportInfo2 bis_system_report2; fat::FatReportInfo2 bis_system_fat_report_info_2;
fat::FatReportInfo2 bis_user_report2; fat::FatReportInfo2 bis_user_fat_report_info_2;
fat::FatReportInfo2 sd_card_report2; fat::FatReportInfo2 sd_card_fat_report_info_2;
u32 rom_fs_deep_retry_start_count; u32 rom_fs_deep_retry_start_count;
u32 rom_fs_unrecoverable_by_game_card_access_failed_count; u32 rom_fs_unrecoverable_by_game_card_access_failed_count;
fat::FatSafeInfo bis_system_fat_safe_info; fat::FatSafeInfo bis_system_fat_safe_info;

View file

@ -121,6 +121,7 @@ namespace ams::fssrv {
Result IsSignedSystemPartitionOnSdCardValid(ams::sf::Out<bool> out); Result IsSignedSystemPartitionOnSdCardValid(ams::sf::Out<bool> out);
Result OpenAccessFailureDetectionEventNotifier(); Result OpenAccessFailureDetectionEventNotifier();
/* ... */ /* ... */
Result GetAndClearErrorInfo(ams::sf::Out<fs::FileSystemProxyErrorInfo> out);
Result RegisterProgramIndexMapInfo(const ams::sf::InBuffer &buffer, s32 count); Result RegisterProgramIndexMapInfo(const ams::sf::InBuffer &buffer, s32 count);
Result SetBisRootForHost(u32 id, const fssrv::sf::FspPath &path); Result SetBisRootForHost(u32 id, const fssrv::sf::FspPath &path);
Result SetSaveDataSize(s64 size, s64 journal_size); Result SetSaveDataSize(s64 size, s64 journal_size);

View file

@ -20,6 +20,7 @@
#include <stratosphere/fssrv/sf/fssrv_sf_istorage.hpp> #include <stratosphere/fssrv/sf/fssrv_sf_istorage.hpp>
#include <stratosphere/fssrv/sf/fssrv_sf_i_device_operator.hpp> #include <stratosphere/fssrv/sf/fssrv_sf_i_device_operator.hpp>
#include <stratosphere/fssrv/sf/fssrv_sf_i_event_notifier.hpp> #include <stratosphere/fssrv/sf/fssrv_sf_i_event_notifier.hpp>
#include <stratosphere/fs/fs_error_info.hpp>
/* ACCURATE_TO_VERSION: 13.4.0.0 */ /* ACCURATE_TO_VERSION: 13.4.0.0 */
#define AMS_FSSRV_I_FILE_SYSTEM_PROXY_INTERFACE_INFO(C, H) \ #define AMS_FSSRV_I_FILE_SYSTEM_PROXY_INTERFACE_INFO(C, H) \
@ -125,7 +126,7 @@
/* AMS_SF_METHOD_INFO(C, H, 702, Result, IsAccessFailureDetected, (), (), hos::Version_5_0_0) */ \ /* AMS_SF_METHOD_INFO(C, H, 702, Result, IsAccessFailureDetected, (), (), hos::Version_5_0_0) */ \
/* AMS_SF_METHOD_INFO(C, H, 710, Result, ResolveAccessFailure, (), (), hos::Version_5_0_0) */ \ /* AMS_SF_METHOD_INFO(C, H, 710, Result, ResolveAccessFailure, (), (), hos::Version_5_0_0) */ \
/* AMS_SF_METHOD_INFO(C, H, 720, Result, AbandonAccessFailure, (), (), hos::Version_5_0_0) */ \ /* AMS_SF_METHOD_INFO(C, H, 720, Result, AbandonAccessFailure, (), (), hos::Version_5_0_0) */ \
/* AMS_SF_METHOD_INFO(C, H, 800, Result, GetAndClearErrorInfo, (), (), hos::Version_2_0_0) */ \ AMS_SF_METHOD_INFO(C, H, 800, Result, GetAndClearErrorInfo, (ams::sf::Out<fs::FileSystemProxyErrorInfo> out), (out), hos::Version_2_0_0) \
AMS_SF_METHOD_INFO(C, H, 810, Result, RegisterProgramIndexMapInfo, (const ams::sf::InBuffer &buffer, s32 count), (buffer, count), hos::Version_7_0_0) \ AMS_SF_METHOD_INFO(C, H, 810, Result, RegisterProgramIndexMapInfo, (const ams::sf::InBuffer &buffer, s32 count), (buffer, count), hos::Version_7_0_0) \
AMS_SF_METHOD_INFO(C, H, 1000, Result, SetBisRootForHost, (u32 id, const fssrv::sf::FspPath &path), (id, path), hos::Version_Min, hos::Version_9_2_0) \ AMS_SF_METHOD_INFO(C, H, 1000, Result, SetBisRootForHost, (u32 id, const fssrv::sf::FspPath &path), (id, path), hos::Version_Min, hos::Version_9_2_0) \
AMS_SF_METHOD_INFO(C, H, 1001, Result, SetSaveDataSize, (s64 size, s64 journal_size), (size, journal_size)) \ AMS_SF_METHOD_INFO(C, H, 1001, Result, SetSaveDataSize, (s64 size, s64 journal_size), (size, journal_size)) \

View file

@ -318,7 +318,72 @@ namespace ams::erpt::srv {
} }
Result SubmitFileSystemErrorInfo() { Result SubmitFileSystemErrorInfo() {
/* TODO */ /* Get the fsp error info. */
fs::FileSystemProxyErrorInfo ei = {};
if (R_SUCCEEDED(fs::GetAndClearFileSystemProxyErrorInfo(std::addressof(ei)))) {
/* Submit FsProxyErrorInfo. */
{
/* Create a record. */
auto record = std::make_unique<ContextRecord>(CategoryId_FsProxyErrorInfo, fat::FatErrorNameMaxLength);
R_UNLESS(record != nullptr, erpt::ResultOutOfMemory());
/* Add fields. */
R_ABORT_UNLESS(record->Add(FieldId_FsRemountForDataCorruptCount, ei.rom_fs_remount_for_data_corruption_count));
R_ABORT_UNLESS(record->Add(FieldId_FsRemountForDataCorruptRetryOutCount, ei.rom_fs_unrecoverable_data_corruption_by_remount_count));
R_ABORT_UNLESS(record->Add(FieldId_FatFsError, ei.fat_fs_error.error));
R_ABORT_UNLESS(record->Add(FieldId_FatFsExtraError, ei.fat_fs_error.extra_error));
R_ABORT_UNLESS(record->Add(FieldId_FatFsErrorDrive, ei.fat_fs_error.drive_id));
R_ABORT_UNLESS(record->Add(FieldId_FatFsErrorName, ei.fat_fs_error.name, fat::FatErrorNameMaxLength));
R_ABORT_UNLESS(record->Add(FieldId_FsRecoveredByInvalidateCacheCount, ei.rom_fs_recovered_by_invalidate_cache_count));
R_ABORT_UNLESS(record->Add(FieldId_FsSaveDataIndexCount, ei.save_data_index_count));
R_ABORT_UNLESS(record->Add(FieldId_FatFsBisSystemFilePeakOpenCount, ei.bis_system_fat_report_info_1.open_file_peak_count));
R_ABORT_UNLESS(record->Add(FieldId_FatFsBisSystemDirectoryPeakOpenCount, ei.bis_system_fat_report_info_1.open_directory_peak_count));
R_ABORT_UNLESS(record->Add(FieldId_FatFsBisUserFilePeakOpenCount, ei.bis_user_fat_report_info_1.open_file_peak_count));
R_ABORT_UNLESS(record->Add(FieldId_FatFsBisUserDirectoryPeakOpenCount, ei.bis_user_fat_report_info_1.open_directory_peak_count));
R_ABORT_UNLESS(record->Add(FieldId_FatFsSdCardFilePeakOpenCount, ei.sd_card_fat_report_info_1.open_file_peak_count));
R_ABORT_UNLESS(record->Add(FieldId_FatFsSdCardDirectoryPeakOpenCount, ei.sd_card_fat_report_info_1.open_directory_peak_count));
R_ABORT_UNLESS(record->Add(FieldId_FatFsBisSystemUniqueFileEntryPeakOpenCount, ei.bis_system_fat_report_info_2.open_unique_file_entry_peak_count));
R_ABORT_UNLESS(record->Add(FieldId_FatFsBisSystemUniqueDirectoryEntryPeakOpenCount, ei.bis_system_fat_report_info_2.open_unique_directory_entry_peak_count));
R_ABORT_UNLESS(record->Add(FieldId_FatFsBisUserUniqueFileEntryPeakOpenCount, ei.bis_user_fat_report_info_2.open_unique_file_entry_peak_count));
R_ABORT_UNLESS(record->Add(FieldId_FatFsBisUserUniqueDirectoryEntryPeakOpenCount, ei.bis_user_fat_report_info_2.open_unique_directory_entry_peak_count));
R_ABORT_UNLESS(record->Add(FieldId_FatFsSdCardUniqueFileEntryPeakOpenCount, ei.sd_card_fat_report_info_2.open_unique_file_entry_peak_count));
R_ABORT_UNLESS(record->Add(FieldId_FatFsSdCardUniqueDirectoryEntryPeakOpenCount, ei.sd_card_fat_report_info_2.open_unique_directory_entry_peak_count));
/* Submit the record. */
R_ABORT_UNLESS(Context::SubmitContextRecord(std::move(record)));
}
/* Submit FsProxyErrorInfo2. */
{
/* Create a record. */
auto record = std::make_unique<ContextRecord>(CategoryId_FsProxyErrorInfo2, 0);
R_UNLESS(record != nullptr, erpt::ResultOutOfMemory());
/* Add fields. */
R_ABORT_UNLESS(record->Add(FieldId_FsDeepRetryStartCount, ei.rom_fs_deep_retry_start_count));
R_ABORT_UNLESS(record->Add(FieldId_FsUnrecoverableByGameCardAccessFailedCount, ei.rom_fs_unrecoverable_by_game_card_access_failed_count));
R_ABORT_UNLESS(record->Add(FieldId_FatFsBisSystemFatSafeControlResult, static_cast<u8>(ei.bis_system_fat_safe_info.result)));
R_ABORT_UNLESS(record->Add(FieldId_FatFsBisSystemFatErrorNumber, ei.bis_system_fat_safe_info.error_number));
R_ABORT_UNLESS(record->Add(FieldId_FatFsBisSystemFatSafeErrorNumber, ei.bis_system_fat_safe_info.safe_error_number));
R_ABORT_UNLESS(record->Add(FieldId_FatFsBisUserFatSafeControlResult, static_cast<u8>(ei.bis_user_fat_safe_info.result)));
R_ABORT_UNLESS(record->Add(FieldId_FatFsBisUserFatErrorNumber, ei.bis_user_fat_safe_info.error_number));
R_ABORT_UNLESS(record->Add(FieldId_FatFsBisUserFatSafeErrorNumber, ei.bis_user_fat_safe_info.safe_error_number));
/* Submit the record. */
R_ABORT_UNLESS(Context::SubmitContextRecord(std::move(record)));
}
}
R_SUCCEED(); R_SUCCEED();
} }

View file

@ -0,0 +1,35 @@
/*
* Copyright (c) Atmosphère-NX
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stratosphere.hpp>
#include "fsa/fs_mount_utils.hpp"
#include "impl/fs_file_system_proxy_service_object.hpp"
#include "impl/fs_file_system_service_object_adapter.hpp"
namespace ams::fs {
Result GetAndClearFileSystemProxyErrorInfo(FileSystemProxyErrorInfo *out) {
/* Check pre-conditions. */
AMS_FS_R_UNLESS(out != nullptr, fs::ResultNullptrArgument());
auto fsp = impl::GetFileSystemProxyServiceObject();
/* Get the error info. */
AMS_FS_R_TRY(fsp->GetAndClearErrorInfo(out));
R_SUCCEED();
}
}

View file

@ -389,6 +389,11 @@ namespace ams::fs {
/* ... */ /* ... */
Result GetAndClearErrorInfo(ams::sf::Out<fs::FileSystemProxyErrorInfo> out) {
static_assert(sizeof(fs::FileSystemProxyErrorInfo) == sizeof(::FsFileSystemProxyErrorInfo));
R_RETURN(::fsGetAndClearErrorInfo(reinterpret_cast<::FsFileSystemProxyErrorInfo *>(out.GetPointer())));
}
Result RegisterProgramIndexMapInfo(const ams::sf::InBuffer &buffer, s32 count) { Result RegisterProgramIndexMapInfo(const ams::sf::InBuffer &buffer, s32 count) {
AMS_ABORT("TODO"); AMS_ABORT("TODO");
} }

View file

@ -373,6 +373,10 @@ namespace ams::fssrv {
/* ... */ /* ... */
Result FileSystemProxyImpl::GetAndClearErrorInfo(ams::sf::Out<fs::FileSystemProxyErrorInfo> out) {
AMS_ABORT("TODO");
}
Result FileSystemProxyImpl::RegisterProgramIndexMapInfo(const ams::sf::InBuffer &buffer, s32 count) { Result FileSystemProxyImpl::RegisterProgramIndexMapInfo(const ams::sf::InBuffer &buffer, s32 count) {
AMS_ABORT("TODO"); AMS_ABORT("TODO");
} }