file_sys/errors: Extract FS-related error codes to file_sys/errors.h
Keeps filesystem-related error codes in one spot.
This commit is contained in:
parent
87eca5b209
commit
b725d1fdf7
|
@ -11,9 +11,11 @@ namespace FileSys {
|
||||||
namespace ErrCodes {
|
namespace ErrCodes {
|
||||||
enum {
|
enum {
|
||||||
NotFound = 1,
|
NotFound = 1,
|
||||||
TitleNotFound = 1002,
|
EntityNotFound = 1002,
|
||||||
SdCardNotFound = 2001,
|
SdCardNotFound = 2001,
|
||||||
RomFSNotFound = 2520,
|
RomFSNotFound = 2520,
|
||||||
|
InvalidOffset = 6061,
|
||||||
|
InvalidSize = 6062,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,4 +31,9 @@ constexpr ResultCode ERROR_DIRECTORY_ALREADY_EXISTS(-1);
|
||||||
constexpr ResultCode ERROR_FILE_ALREADY_EXISTS(-1);
|
constexpr ResultCode ERROR_FILE_ALREADY_EXISTS(-1);
|
||||||
constexpr ResultCode ERROR_DIRECTORY_NOT_EMPTY(-1);
|
constexpr ResultCode ERROR_DIRECTORY_NOT_EMPTY(-1);
|
||||||
|
|
||||||
|
constexpr ResultCode ERROR_ENTITY_NOT_FOUND{ErrorModule::FS, ErrCodes::EntityNotFound};
|
||||||
|
constexpr ResultCode ERROR_SD_CARD_NOT_FOUND{ErrorModule::FS, ErrCodes::SdCardNotFound};
|
||||||
|
constexpr ResultCode ERROR_INVALID_OFFSET{ErrorModule::FS, ErrCodes::InvalidOffset};
|
||||||
|
constexpr ResultCode ERROR_INVALID_SIZE{ErrorModule::FS, ErrCodes::InvalidSize};
|
||||||
|
|
||||||
} // namespace FileSys
|
} // namespace FileSys
|
||||||
|
|
|
@ -19,8 +19,6 @@
|
||||||
enum class ErrorDescription : u32 {
|
enum class ErrorDescription : u32 {
|
||||||
Success = 0,
|
Success = 0,
|
||||||
RemoteProcessDead = 301,
|
RemoteProcessDead = 301,
|
||||||
InvalidOffset = 6061,
|
|
||||||
InvalidLength = 6062,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -303,7 +303,7 @@ ResultVal<FileSys::VirtualDir> OpenSaveData(FileSys::SaveDataSpaceId space,
|
||||||
static_cast<u8>(space), save_struct.DebugInfo());
|
static_cast<u8>(space), save_struct.DebugInfo());
|
||||||
|
|
||||||
if (save_data_factory == nullptr) {
|
if (save_data_factory == nullptr) {
|
||||||
return ResultCode(ErrorModule::FS, FileSys::ErrCodes::TitleNotFound);
|
return FileSys::ERROR_ENTITY_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
return save_data_factory->Open(space, save_struct);
|
return save_data_factory->Open(space, save_struct);
|
||||||
|
@ -313,7 +313,7 @@ ResultVal<FileSys::VirtualDir> OpenSaveDataSpace(FileSys::SaveDataSpaceId space)
|
||||||
LOG_TRACE(Service_FS, "Opening Save Data Space for space_id={:01X}", static_cast<u8>(space));
|
LOG_TRACE(Service_FS, "Opening Save Data Space for space_id={:01X}", static_cast<u8>(space));
|
||||||
|
|
||||||
if (save_data_factory == nullptr) {
|
if (save_data_factory == nullptr) {
|
||||||
return ResultCode(ErrorModule::FS, FileSys::ErrCodes::TitleNotFound);
|
return FileSys::ERROR_ENTITY_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
return MakeResult(save_data_factory->GetSaveDataSpaceDirectory(space));
|
return MakeResult(save_data_factory->GetSaveDataSpaceDirectory(space));
|
||||||
|
@ -323,7 +323,7 @@ ResultVal<FileSys::VirtualDir> OpenSDMC() {
|
||||||
LOG_TRACE(Service_FS, "Opening SDMC");
|
LOG_TRACE(Service_FS, "Opening SDMC");
|
||||||
|
|
||||||
if (sdmc_factory == nullptr) {
|
if (sdmc_factory == nullptr) {
|
||||||
return ResultCode(ErrorModule::FS, FileSys::ErrCodes::SdCardNotFound);
|
return FileSys::ERROR_SD_CARD_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
return sdmc_factory->Open();
|
return sdmc_factory->Open();
|
||||||
|
|
|
@ -63,12 +63,12 @@ private:
|
||||||
// Error checking
|
// Error checking
|
||||||
if (length < 0) {
|
if (length < 0) {
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
rb.Push(ResultCode(ErrorModule::FS, ErrorDescription::InvalidLength));
|
rb.Push(FileSys::ERROR_INVALID_SIZE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (offset < 0) {
|
if (offset < 0) {
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
rb.Push(ResultCode(ErrorModule::FS, ErrorDescription::InvalidOffset));
|
rb.Push(FileSys::ERROR_INVALID_OFFSET);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,12 +108,12 @@ private:
|
||||||
// Error checking
|
// Error checking
|
||||||
if (length < 0) {
|
if (length < 0) {
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
rb.Push(ResultCode(ErrorModule::FS, ErrorDescription::InvalidLength));
|
rb.Push(FileSys::ERROR_INVALID_SIZE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (offset < 0) {
|
if (offset < 0) {
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
rb.Push(ResultCode(ErrorModule::FS, ErrorDescription::InvalidOffset));
|
rb.Push(FileSys::ERROR_INVALID_OFFSET);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -139,12 +139,12 @@ private:
|
||||||
// Error checking
|
// Error checking
|
||||||
if (length < 0) {
|
if (length < 0) {
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
rb.Push(ResultCode(ErrorModule::FS, ErrorDescription::InvalidLength));
|
rb.Push(FileSys::ERROR_INVALID_SIZE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (offset < 0) {
|
if (offset < 0) {
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
rb.Push(ResultCode(ErrorModule::FS, ErrorDescription::InvalidOffset));
|
rb.Push(FileSys::ERROR_INVALID_OFFSET);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -744,7 +744,7 @@ void FSP_SRV::MountSaveData(Kernel::HLERequestContext& ctx) {
|
||||||
|
|
||||||
if (dir.Failed()) {
|
if (dir.Failed()) {
|
||||||
IPC::ResponseBuilder rb{ctx, 2, 0, 0};
|
IPC::ResponseBuilder rb{ctx, 2, 0, 0};
|
||||||
rb.Push(ResultCode(ErrorModule::FS, FileSys::ErrCodes::TitleNotFound));
|
rb.Push(FileSys::ERROR_ENTITY_NOT_FOUND);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -836,7 +836,7 @@ void FSP_SRV::OpenRomStorage(Kernel::HLERequestContext& ctx) {
|
||||||
static_cast<u8>(storage_id), title_id);
|
static_cast<u8>(storage_id), title_id);
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
rb.Push(ResultCode(ErrorModule::FS, FileSys::ErrCodes::TitleNotFound));
|
rb.Push(FileSys::ERROR_ENTITY_NOT_FOUND);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Service::FileSystem
|
} // namespace Service::FileSystem
|
||||||
|
|
Reference in New Issue