From 1795f8cca52c9ecd3b59464f09078e018f50b188 Mon Sep 17 00:00:00 2001 From: nakst <> Date: Thu, 10 Feb 2022 12:18:26 +0000 Subject: [PATCH] api: cleanup error codes --- apps/file_manager/commands.cpp | 2 +- apps/file_manager/ui.cpp | 2 +- apps/script_console.cpp | 2 +- arch/x86_64/kernel.cpp | 2 +- desktop/api.cpp | 22 ++++--- desktop/api_tests.cpp | 4 +- desktop/desktop.cpp | 4 +- desktop/files.cpp | 2 +- desktop/os.header | 105 +++++++++++++++------------------ desktop/posix.cpp | 18 +++--- drivers/acpi.cpp | 6 +- drivers/esfs2.cpp | 38 ++++++------ drivers/ext2.cpp | 8 +-- kernel/elf.cpp | 32 +++++----- kernel/files.cpp | 22 +++---- shared/strings.cpp | 4 +- 16 files changed, 132 insertions(+), 141 deletions(-) diff --git a/apps/file_manager/commands.cpp b/apps/file_manager/commands.cpp index 2ae0af4..74ed64d 100644 --- a/apps/file_manager/commands.cpp +++ b/apps/file_manager/commands.cpp @@ -250,7 +250,7 @@ EsError CommandPasteFile(String source, String destinationBase, void **copyBuffe } else { destination.allocated = destination.bytes; StringDestroy(&destination); - return ES_ERROR_FILE_ALREADY_EXISTS; + return ES_ERROR_ALREADY_EXISTS; } } diff --git a/apps/file_manager/ui.cpp b/apps/file_manager/ui.cpp index f6f04d9..4079178 100644 --- a/apps/file_manager/ui.cpp +++ b/apps/file_manager/ui.cpp @@ -1214,7 +1214,7 @@ void InstanceReportError(Instance *instance, int error, EsError code) { const char *message = interfaceString_FileManagerGenericError; - if (code == ES_ERROR_FILE_ALREADY_EXISTS) { + if (code == ES_ERROR_ALREADY_EXISTS) { message = interfaceString_FileManagerItemAlreadyExistsError; } else if (code == ES_ERROR_FILE_DOES_NOT_EXIST) { message = interfaceString_FileManagerItemDoesNotExistError; diff --git a/apps/script_console.cpp b/apps/script_console.cpp index 35894a9..389d606 100644 --- a/apps/script_console.cpp +++ b/apps/script_console.cpp @@ -214,7 +214,7 @@ int ExternalPathCreateDirectory(ExecutionContext *context, Value *returnValue) { (void) returnValue; STACK_POP_STRING(entryText, entryBytes); EsError error = EsPathCreate(entryText, entryBytes, ES_NODE_DIRECTORY, false); - returnValue->i = error == ES_SUCCESS || error == ES_ERROR_FILE_ALREADY_EXISTS; + returnValue->i = error == ES_SUCCESS || error == ES_ERROR_ALREADY_EXISTS; return 2; } diff --git a/arch/x86_64/kernel.cpp b/arch/x86_64/kernel.cpp index 6b6557e..f4fba79 100644 --- a/arch/x86_64/kernel.cpp +++ b/arch/x86_64/kernel.cpp @@ -669,7 +669,7 @@ EsError ArchApplyRelocation(uintptr_t type, uint8_t *buffer, uintptr_t offset, u else if (type == 2 /* R_X86_64_PC32 */) *((uint32_t *) (buffer + offset)) = result - ((uint64_t) buffer + offset); else if (type == 24 /* R_X86_64_PC64 */) *((uint64_t *) (buffer + offset)) = result - ((uint64_t) buffer + offset); else if (type == 4 /* R_X86_64_PLT32 */) *((uint32_t *) (buffer + offset)) = result - ((uint64_t) buffer + offset); - else return ES_ERROR_UNSUPPORTED_FEATURE; + else return ES_ERROR_UNSUPPORTED; return ES_SUCCESS; } diff --git a/desktop/api.cpp b/desktop/api.cpp index 411db3c..158ba89 100644 --- a/desktop/api.cpp +++ b/desktop/api.cpp @@ -1067,17 +1067,17 @@ EsMessage *EsMessageReceive() { case ES_ERROR_INCORRECT_NODE_TYPE: errorMessage = interfaceString_FileSaveErrorFileDeleted; break; - case ES_ERROR_DRIVE_ERROR_FILE_DAMAGED: + case ES_ERROR_CORRUPT_DATA: errorMessage = interfaceString_FileSaveErrorCorrupt; break; - case ES_ERROR_DRIVE_CONTROLLER_REPORTED: + case ES_ERROR_HARDWARE_FAILURE: errorMessage = interfaceString_FileSaveErrorDrive; break; case ES_ERROR_INSUFFICIENT_RESOURCES: errorMessage = interfaceString_FileSaveErrorResourcesLow; break; - case ES_ERROR_FILE_ALREADY_EXISTS: { + case ES_ERROR_ALREADY_EXISTS: { errorMessage = buffer; errorMessageBytes = EsStringFormat(buffer, sizeof(buffer), interfaceString_FileSaveErrorAlreadyExists, apiInstance->newNameBytes, apiInstance->newName); @@ -1195,10 +1195,10 @@ void EsInstanceOpenComplete(EsInstance *instance, EsFileStore *file, bool succes const char *errorMessage = interfaceString_FileLoadErrorUnknown; switch (file->error) { - case ES_ERROR_DRIVE_ERROR_FILE_DAMAGED: + case ES_ERROR_CORRUPT_DATA: errorMessage = interfaceString_FileLoadErrorCorrupt; break; - case ES_ERROR_DRIVE_CONTROLLER_REPORTED: + case ES_ERROR_HARDWARE_FAILURE: errorMessage = interfaceString_FileLoadErrorDrive; break; case ES_ERROR_INSUFFICIENT_RESOURCES: @@ -1274,19 +1274,17 @@ void EsInstanceSaveComplete(EsInstance *instance, EsFileStore *file, bool succes case ES_ERROR_INCORRECT_NODE_TYPE: errorMessage = interfaceString_FileSaveErrorFileDeleted; break; - case ES_ERROR_DRIVE_ERROR_FILE_DAMAGED: + case ES_ERROR_CORRUPT_DATA: errorMessage = interfaceString_FileSaveErrorCorrupt; break; - case ES_ERROR_DRIVE_CONTROLLER_REPORTED: + case ES_ERROR_HARDWARE_FAILURE: errorMessage = interfaceString_FileSaveErrorDrive; break; case ES_ERROR_COULD_NOT_RESIZE_FILE: - case ES_ERROR_FILE_TOO_FRAGMENTED: + case ES_ERROR_FILE_TOO_LARGE: errorMessage = interfaceString_FileSaveErrorTooLarge; break; - case ES_ERROR_FILE_IN_EXCLUSIVE_USE: - case ES_ERROR_FILE_CANNOT_GET_EXCLUSIVE_USE: - case ES_ERROR_FILE_HAS_WRITERS: + case ES_ERROR_OPERATION_BLOCKED: errorMessage = interfaceString_FileSaveErrorConcurrentAccess; break; case ES_ERROR_DRIVE_FULL: @@ -1299,7 +1297,7 @@ void EsInstanceSaveComplete(EsInstance *instance, EsFileStore *file, bool succes errorMessage = interfaceString_FileSaveErrorTooManyFiles; break; - case ES_ERROR_FILE_ALREADY_EXISTS: { + case ES_ERROR_ALREADY_EXISTS: { errorMessage = buffer; errorMessageBytes = EsStringFormat(buffer, sizeof(buffer), interfaceString_FileSaveErrorAlreadyExists, apiInstance->newNameBytes, apiInstance->newName); diff --git a/desktop/api_tests.cpp b/desktop/api_tests.cpp index e4aa627..5d10856 100644 --- a/desktop/api_tests.cpp +++ b/desktop/api_tests.cpp @@ -630,8 +630,8 @@ bool OldTests2018() { CHECK(!EsPathExists(EsLiteral("|Settings:/TestFolder/b.txt"))); CHECK(EsPathExists(EsLiteral("|Settings:/a.txt"))); CHECK(ES_ERROR_FILE_DOES_NOT_EXIST == EsPathMove(EsLiteral("|Settings:/TestFolder/a.txt"), EsLiteral("|Settings:/a.txt"), ES_FLAGS_DEFAULT)); - CHECK(ES_ERROR_FILE_ALREADY_EXISTS == EsPathMove(EsLiteral("|Settings:/a.txt"), EsLiteral("|Settings:/b.txt"), ES_FLAGS_DEFAULT)); - CHECK(ES_ERROR_FILE_ALREADY_EXISTS == EsPathMove(EsLiteral("|Settings:/a.txt"), EsLiteral("|Settings:/a.txt"), ES_FLAGS_DEFAULT)); + CHECK(ES_ERROR_ALREADY_EXISTS == EsPathMove(EsLiteral("|Settings:/a.txt"), EsLiteral("|Settings:/b.txt"), ES_FLAGS_DEFAULT)); + CHECK(ES_ERROR_ALREADY_EXISTS == EsPathMove(EsLiteral("|Settings:/a.txt"), EsLiteral("|Settings:/a.txt"), ES_FLAGS_DEFAULT)); CHECK(ES_ERROR_TARGET_WITHIN_SOURCE == EsPathMove(EsLiteral("|Settings:/"), EsLiteral("|Settings:/TestFolder/TargetWithinSource"), ES_FLAGS_DEFAULT)); CHECK(!EsPathExists(EsLiteral("|Settings:/TestFolder/a.txt"))); CHECK(EsPathExists(EsLiteral("|Settings:/b.txt"))); diff --git a/desktop/desktop.cpp b/desktop/desktop.cpp index 1edae13..adff8f6 100644 --- a/desktop/desktop.cpp +++ b/desktop/desktop.cpp @@ -2252,7 +2252,7 @@ void ApplicationInstanceRequestSave(ApplicationInstance *instance, const char *n if (!nameBytes || (failIfAlreadyExists && nameBytes != folderBytes + newNameBytes)) { EsHeapFree(name); - m.tabOperation.error = nameBytes ? ES_ERROR_FILE_ALREADY_EXISTS : ES_ERROR_TOO_MANY_FILES_WITH_NAME; + m.tabOperation.error = nameBytes ? ES_ERROR_ALREADY_EXISTS : ES_ERROR_TOO_MANY_FILES_WITH_NAME; EsMessagePostRemote(instance->process->handle, &m); return; } @@ -2296,7 +2296,7 @@ void ApplicationInstanceRequestSave(ApplicationInstance *instance, const char *n } if (document->currentWriter) { - m.tabOperation.error = ES_ERROR_FILE_CANNOT_GET_EXCLUSIVE_USE; + m.tabOperation.error = ES_ERROR_OPERATION_BLOCKED; } else { EsHeapFree(document->temporarySavePath); document->temporarySavePath = nullptr; diff --git a/desktop/files.cpp b/desktop/files.cpp index 1bd6f5d..749dff7 100644 --- a/desktop/files.cpp +++ b/desktop/files.cpp @@ -282,7 +282,7 @@ EsError MountPointAdd(const char *prefix, size_t prefixBytes, EsHandle base, boo EsError error = ES_SUCCESS; if (duplicate) { - error = ES_ERROR_MOUNT_POINT_ALREADY_EXISTS; + error = ES_ERROR_ALREADY_EXISTS; } else { EsMountPoint mountPoint = {}; EsAssert(prefixBytes < sizeof(mountPoint.prefix)); diff --git a/desktop/os.header b/desktop/os.header index cdeb5ff..2a12cfb 100644 --- a/desktop/os.header +++ b/desktop/os.header @@ -284,62 +284,55 @@ private define ES_PROCESS_STATE_PAUSED_FROM_CRASH (1 << 4) define ES_FLAGS_DEFAULT (0) define ES_SUCCESS (-1) -// TODO Cleanup. -define ES_ERROR_BUFFER_TOO_SMALL (-2) -define ES_ERROR_UNKNOWN (-7) -define ES_ERROR_NO_MESSAGES_AVAILABLE (-9) -define ES_ERROR_MESSAGE_QUEUE_FULL (-10) -define ES_ERROR_PATH_NOT_WITHIN_MOUNTED_VOLUME (-14) -define ES_ERROR_PATH_NOT_TRAVERSABLE (-15) -define ES_ERROR_FILE_ALREADY_EXISTS (-19) -define ES_ERROR_FILE_DOES_NOT_EXIST (-20) -define ES_ERROR_DRIVE_ERROR_FILE_DAMAGED (-21) -define ES_ERROR_ACCESS_NOT_WITHIN_FILE_BOUNDS (-22) -define ES_ERROR_PERMISSION_NOT_GRANTED (-23) -define ES_ERROR_FILE_IN_EXCLUSIVE_USE (-24) -define ES_ERROR_FILE_CANNOT_GET_EXCLUSIVE_USE (-25) -define ES_ERROR_INCORRECT_NODE_TYPE (-26) -define ES_ERROR_EVENT_NOT_SET (-27) -define ES_ERROR_FILE_HAS_WRITERS (-28) -define ES_ERROR_TIMEOUT_REACHED (-29) -define ES_ERROR_FILE_ON_READ_ONLY_VOLUME (-32) -define ES_ERROR_INVALID_DIMENSIONS (-34) -define ES_ERROR_DRIVE_CONTROLLER_REPORTED (-35) -define ES_ERROR_COULD_NOT_ISSUE_PACKET (-36) -define ES_ERROR_HANDLE_TABLE_FULL (-37) -define ES_ERROR_COULD_NOT_RESIZE_FILE (-38) -define ES_ERROR_DIRECTORY_NOT_EMPTY (-39) -define ES_ERROR_NODE_DELETED (-41) -define ES_ERROR_VOLUME_MISMATCH (-43) -define ES_ERROR_TARGET_WITHIN_SOURCE (-44) -define ES_ERROR_TARGET_INVALID_TYPE (-45) -define ES_ERROR_MALFORMED_NODE_PATH (-47) -define ES_ERROR_TARGET_IS_SOURCE (-49) -define ES_ERROR_INVALID_NAME (-50) -define ES_ERROR_CORRUPT_DATA (-51) -define ES_ERROR_INSUFFICIENT_RESOURCES (-52) -define ES_ERROR_UNSUPPORTED_FEATURE (-53) -define ES_ERROR_FILE_TOO_FRAGMENTED (-54) -define ES_ERROR_DRIVE_FULL (-55) -define ES_ERROR_COULD_NOT_RESOLVE_SYMBOL (-56) -define ES_ERROR_ALREADY_EMBEDDED (-57) -define ES_ERROR_UNSUPPORTED_CONVERSION (-60) -define ES_ERROR_SOURCE_EMPTY (-61) -define ES_ERROR_UNSUPPORTED_EXECUTABLE (-62) -define ES_ERROR_NO_ADDRESS_FOR_DOMAIN_NAME (-63) -define ES_ERROR_NO_CONNECTED_NETWORK_INTERFACES (-64) -define ES_ERROR_BAD_DOMAIN_NAME (-65) -define ES_ERROR_LOST_IP_ADDRESS (-66) -define ES_ERROR_CONNECTION_RESET (-67) -define ES_ERROR_CONNECTION_REFUSED (-68) -define ES_ERROR_ILLEGAL_PATH (-69) -define ES_ERROR_NODE_NOT_LOADED (-71) -define ES_ERROR_DIRECTORY_ENTRY_BEING_REMOVED (-72) -define ES_ERROR_CANCELLED (-73) -define ES_ERROR_BLOCK_ACCESS_INVALID (-74) -define ES_ERROR_DEVICE_REMOVED (-75) -define ES_ERROR_TOO_MANY_FILES_WITH_NAME (-76) -define ES_ERROR_MOUNT_POINT_ALREADY_EXISTS (-77) +// Networking errors: +define ES_ERROR_NO_ADDRESS_FOR_DOMAIN_NAME (-1000) +define ES_ERROR_NO_CONNECTED_NETWORK_INTERFACES (-1001) +define ES_ERROR_BAD_DOMAIN_NAME (-1002) +define ES_ERROR_LOST_IP_ADDRESS (-1003) +define ES_ERROR_CONNECTION_RESET (-1004) +define ES_ERROR_CONNECTION_REFUSED (-1005) +define ES_ERROR_BUFFER_TOO_SMALL (-1006) + +// File system errors: +define ES_ERROR_OPERATION_BLOCKED (-2000) // Somebody else has opened the node with flags blocking this operation. +define ES_ERROR_ACCESS_NOT_WITHIN_FILE_BOUNDS (-2001) +define ES_ERROR_DIRECTORY_NOT_EMPTY (-2004) +define ES_ERROR_NODE_DELETED (-2005) +define ES_ERROR_FILE_TOO_LARGE (-2006) // Errors caused by the file being too large. For example, the file system might impose a maximum size limit on files, or it might impose a limit on how fragmented a file may become. +define ES_ERROR_DRIVE_FULL (-2007) +define ES_ERROR_CORRUPT_DATA (-2008) +define ES_ERROR_INVALID_NAME (-2009) +define ES_ERROR_FILE_ON_READ_ONLY_VOLUME (-2011) +define ES_ERROR_PATH_NOT_WITHIN_MOUNTED_VOLUME (-2013) +define ES_ERROR_PATH_NOT_TRAVERSABLE (-2014) +define ES_ERROR_DEVICE_REMOVED (-2015) +define ES_ERROR_INCORRECT_NODE_TYPE (-2016) +define ES_ERROR_FILE_DOES_NOT_EXIST (-2017) +define ES_ERROR_COULD_NOT_RESIZE_FILE (-2018) // TODO Replace with ES_ERROR_HARDWARE_FAILURE/ES_ERROR_CORRUPT_DATA/ES_ERROR_DRIVE_FULL/ES_ERROR_FILE_TOO_LARGE. +define ES_ERROR_VOLUME_MISMATCH (-2019) +define ES_ERROR_TARGET_WITHIN_SOURCE (-2020) + +// General errors: +define ES_ERROR_UNKNOWN (-3000) +define ES_ERROR_ALREADY_EXISTS (-3001) +define ES_ERROR_CANCELLED (-3002) +define ES_ERROR_INSUFFICIENT_RESOURCES (-3003) +define ES_ERROR_PERMISSION_NOT_GRANTED (-3004) +define ES_ERROR_UNSUPPORTED (-3005) +define ES_ERROR_HARDWARE_FAILURE (-3006) + +// Internal errors (not be returned by any API function): +define ES_ERROR_NODE_NOT_LOADED (-4001) +define ES_ERROR_DIRECTORY_ENTRY_BEING_REMOVED (-4002) +define ES_ERROR_COULD_NOT_RESOLVE_SYMBOL (-4003) +define ES_ERROR_NO_MESSAGES_AVAILABLE (-4004) +define ES_ERROR_INVALID_DIMENSIONS (-4005) +define ES_ERROR_TOO_MANY_FILES_WITH_NAME (-4006) + +// Errors specific to a single function: +define ES_ERROR_MESSAGE_QUEUE_FULL (-5000) // EsMessagePost. +define ES_ERROR_TIMEOUT_REACHED (-5001) // EsWait. +define ES_ERROR_BLOCK_ACCESS_INVALID (-5002) // ES_DEVICE_CONTROL_BLOCK_READ/ES_DEVICE_CONTROL_BLOCK_WRITE. define ES_INVALID_HANDLE ((EsHandle) (0)) define ES_CURRENT_THREAD ((EsHandle) (0x10)) diff --git a/desktop/posix.cpp b/desktop/posix.cpp index 2485852..f8138fb 100644 --- a/desktop/posix.cpp +++ b/desktop/posix.cpp @@ -328,13 +328,13 @@ long EsPOSIXSystemCall(long n, long a1, long a2, long a3, long a4, long a5, long EsHeapFree(path); if (error == ES_ERROR_FILE_DOES_NOT_EXIST) returnValue = -ENOENT; else if (error == ES_ERROR_PATH_NOT_TRAVERSABLE) returnValue = -ENOTDIR; - else if (error == ES_ERROR_FILE_IN_EXCLUSIVE_USE) returnValue = -EBUSY; - else if (error == ES_ERROR_DRIVE_CONTROLLER_REPORTED || error == ES_ERROR_CORRUPT_DATA) returnValue = -EIO; + else if (error == ES_ERROR_OPERATION_BLOCKED) returnValue = -EBUSY; + else if (error == ES_ERROR_HARDWARE_FAILURE || error == ES_ERROR_CORRUPT_DATA) returnValue = -EIO; else if (error != ES_SUCCESS) returnValue = -EACCES; else { error = EsSyscall(ES_SYSCALL_NODE_DELETE, node.handle, 0, 0, 0); EsHandleClose(node.handle); - if (error == ES_ERROR_DRIVE_CONTROLLER_REPORTED || error == ES_ERROR_CORRUPT_DATA) returnValue = -EIO; + if (error == ES_ERROR_HARDWARE_FAILURE || error == ES_ERROR_CORRUPT_DATA) returnValue = -EIO; else if (error != ES_SUCCESS) returnValue = -EACCES; } } break; @@ -348,14 +348,14 @@ long EsPOSIXSystemCall(long n, long a1, long a2, long a3, long a4, long a5, long EsHeapFree(path); if (error == ES_ERROR_FILE_DOES_NOT_EXIST) returnValue = -ENOENT; else if (error == ES_ERROR_PATH_NOT_TRAVERSABLE) returnValue = -ENOTDIR; - else if (error == ES_ERROR_FILE_IN_EXCLUSIVE_USE) returnValue = -EBUSY; - else if (error == ES_ERROR_DRIVE_CONTROLLER_REPORTED || error == ES_ERROR_CORRUPT_DATA) returnValue = -EIO; + else if (error == ES_ERROR_OPERATION_BLOCKED) returnValue = -EBUSY; + else if (error == ES_ERROR_HARDWARE_FAILURE || error == ES_ERROR_CORRUPT_DATA) returnValue = -EIO; else if (error != ES_SUCCESS) returnValue = -EACCES; else if (node.type == ES_NODE_DIRECTORY) { returnValue = -EISDIR; EsHandleClose(node.handle); } else { EsError error = EsFileResize(node.handle, a2); EsHandleClose(node.handle); - if (error == ES_ERROR_DRIVE_CONTROLLER_REPORTED || error == ES_ERROR_CORRUPT_DATA) returnValue = -EIO; + if (error == ES_ERROR_HARDWARE_FAILURE || error == ES_ERROR_CORRUPT_DATA) returnValue = -EIO; else if (error != ES_SUCCESS) returnValue = -EACCES; } } break; @@ -656,7 +656,7 @@ long EsPOSIXSystemCall(long n, long a1, long a2, long a3, long a4, long a5, long char *path = EsPOSIXConvertPath((const char *) a1, &pathBytes, true); EsError error = EsPathCreate(path, pathBytes, ES_NODE_DIRECTORY, false); if (error == ES_ERROR_INSUFFICIENT_RESOURCES) returnValue = -ENOMEM; - else if (error == ES_ERROR_FILE_ALREADY_EXISTS) returnValue = -EEXIST; + else if (error == ES_ERROR_ALREADY_EXISTS) returnValue = -EEXIST; else if (error == ES_ERROR_PATH_NOT_TRAVERSABLE) returnValue = -ENOENT; else if (error == ES_ERROR_PATH_NOT_WITHIN_MOUNTED_VOLUME) returnValue = -ENOENT; else if (error == ES_ERROR_FILE_ON_READ_ONLY_VOLUME) returnValue = -EPERM; @@ -698,8 +698,8 @@ long EsPOSIXSystemCall(long n, long a1, long a2, long a3, long a4, long a5, long // TODO More return values. if (error == ES_ERROR_FILE_DOES_NOT_EXIST) returnValue = -ENOENT; else if (error == ES_ERROR_PATH_NOT_TRAVERSABLE) returnValue = -ENOTDIR; - else if (error == ES_ERROR_FILE_IN_EXCLUSIVE_USE) returnValue = -EBUSY; - else if (error == ES_ERROR_DRIVE_CONTROLLER_REPORTED || error == ES_ERROR_CORRUPT_DATA) returnValue = -EIO; + else if (error == ES_ERROR_OPERATION_BLOCKED) returnValue = -EBUSY; + else if (error == ES_ERROR_HARDWARE_FAILURE || error == ES_ERROR_CORRUPT_DATA) returnValue = -EIO; else if (error != ES_SUCCESS) returnValue = -EACCES; } break; diff --git a/drivers/acpi.cpp b/drivers/acpi.cpp index 69e1ea6..aaaedae 100644 --- a/drivers/acpi.cpp +++ b/drivers/acpi.cpp @@ -337,15 +337,15 @@ void ArchShutdown() { } EsError KACPIObjectSetDeviceNotificationHandler(KACPIObject *, KACPINotificationHandler, EsGeneric) { - return ES_ERROR_UNSUPPORTED_FEATURE; + return ES_ERROR_UNSUPPORTED; } EsError KACPIObjectEvaluateInteger(KACPIObject *, const char *, uint64_t *) { - return ES_ERROR_UNSUPPORTED_FEATURE; + return ES_ERROR_UNSUPPORTED; } EsError KACPIObjectEvaluateMethodWithInteger(KACPIObject *, const char *, uint64_t) { - return ES_ERROR_UNSUPPORTED_FEATURE; + return ES_ERROR_UNSUPPORTED; } #endif diff --git a/drivers/esfs2.cpp b/drivers/esfs2.cpp index 0f8c893..f597624 100644 --- a/drivers/esfs2.cpp +++ b/drivers/esfs2.cpp @@ -73,7 +73,7 @@ static EsError FindDirectoryEntryReferenceFromIndex(Volume *volume, uint8_t *buf IndexVertex *vertex = (IndexVertex *) buffer; if (!AccessBlock(volume, rootBlock, 1, vertex, FS_BLOCK_ACCESS_CACHED, K_ACCESS_READ)) { - return ES_ERROR_DRIVE_CONTROLLER_REPORTED; + return ES_ERROR_HARDWARE_FAILURE; } int depth = 0; @@ -89,7 +89,7 @@ static EsError FindDirectoryEntryReferenceFromIndex(Volume *volume, uint8_t *buf if (i == vertex->count || keys[i].value > nameHash) { if (keys[i].child) { // The directory is in the child. - if (!AccessBlock(volume, keys[i].child, 1, vertex, FS_BLOCK_ACCESS_CACHED, K_ACCESS_READ)) return ES_ERROR_DRIVE_CONTROLLER_REPORTED; + if (!AccessBlock(volume, keys[i].child, 1, vertex, FS_BLOCK_ACCESS_CACHED, K_ACCESS_READ)) return ES_ERROR_HARDWARE_FAILURE; else goto nextVertex; } else { // We couldn't find the entry. @@ -708,7 +708,7 @@ static uint64_t ResizeInternal(FSNode *file, uint64_t newSize, EsError *error, u if (entry->fileSize) { if (!ReadWrite(file, 0, superblock->blockSize, blockBuffer, false, false)) { - return *error = ES_ERROR_DRIVE_ERROR_FILE_DAMAGED, entry->fileSize; + return *error = ES_ERROR_HARDWARE_FAILURE, entry->fileSize; } } @@ -729,7 +729,7 @@ static uint64_t ResizeInternal(FSNode *file, uint64_t newSize, EsError *error, u if (!FreeExtent(volume, previousExtentStart, extentCount)) { file->corrupt = true; entry->fileSize = 0; - *error = ES_ERROR_DRIVE_ERROR_FILE_DAMAGED; + *error = ES_ERROR_HARDWARE_FAILURE; return (entry->fileSize = 0); } } @@ -738,7 +738,7 @@ static uint64_t ResizeInternal(FSNode *file, uint64_t newSize, EsError *error, u EsMemoryCopy(dataBuffer, blockBuffer, newSize); } else { - *error = ES_ERROR_UNSUPPORTED_FEATURE; + *error = ES_ERROR_UNSUPPORTED; return entry->fileSize; // Unrecognised indirection. } @@ -754,7 +754,7 @@ static uint64_t ResizeInternal(FSNode *file, uint64_t newSize, EsError *error, u if (data->indirection == ESFS_INDIRECTION_DIRECT) { if (!ReadWrite(file, 0, entry->fileSize, blockBuffer, false, false)) { - *error = ES_ERROR_DRIVE_ERROR_FILE_DAMAGED; + *error = ES_ERROR_HARDWARE_FAILURE; return entry->fileSize; } @@ -763,7 +763,7 @@ static uint64_t ResizeInternal(FSNode *file, uint64_t newSize, EsError *error, u oldBlocks = 0; entry->fileSize = 0; } else if (data->indirection != ESFS_INDIRECTION_L1) { - *error = ES_ERROR_UNSUPPORTED_FEATURE; + *error = ES_ERROR_UNSUPPORTED; return entry->fileSize; // Unrecognised indirection. } @@ -800,7 +800,7 @@ static uint64_t ResizeInternal(FSNode *file, uint64_t newSize, EsError *error, u &allocatedStart, &allocatedCount, true /* Zero the blocks */); if (!success) { - *error = ES_ERROR_DRIVE_ERROR_FILE_DAMAGED; + *error = ES_ERROR_HARDWARE_FAILURE; return entry->fileSize; } @@ -821,7 +821,7 @@ static uint64_t ResizeInternal(FSNode *file, uint64_t newSize, EsError *error, u if (length + position > newDataBufferSize) { // The data buffer is full. - *error = ES_ERROR_FILE_TOO_FRAGMENTED; + *error = ES_ERROR_FILE_TOO_LARGE; return entry->fileSize; } else { EsMemoryCopy(dataBuffer + position, encode, length); @@ -839,7 +839,7 @@ static uint64_t ResizeInternal(FSNode *file, uint64_t newSize, EsError *error, u file->corrupt = true; entry->fileSize = 0; - *error = ES_ERROR_DRIVE_ERROR_FILE_DAMAGED; + *error = ES_ERROR_HARDWARE_FAILURE; // Free the removed extents. @@ -907,7 +907,7 @@ static uint64_t ResizeInternal(FSNode *file, uint64_t newSize, EsError *error, u data->indirection = ESFS_INDIRECTION_DIRECT; data->count = entry->fileSize = oldSize; EsMemoryCopy(dataBuffer, blockBuffer, data->count); - *error = ES_ERROR_DRIVE_ERROR_FILE_DAMAGED; + *error = ES_ERROR_HARDWARE_FAILURE; return (entry->fileSize = oldSize); } } @@ -1426,17 +1426,17 @@ static EsError RemoveDirectoryEntry(FSNode *file, uint8_t *blockBuffers /* super // EsPrint("\tpositionOfLastEntry = %d\n\tThis node Reference = %d/%d\n", positionOfLastEntry, file->reference.block, file->reference.offsetIntoBlock); ESFS_CHECK_TO_ERROR(AccessBlock(volume, file->reference.block, 1, blockBuffers, FS_BLOCK_ACCESS_CACHED, K_ACCESS_READ), - "Remove - Could not load the container block.", ES_ERROR_DRIVE_CONTROLLER_REPORTED); + "Remove - Could not load the container block.", ES_ERROR_HARDWARE_FAILURE); ESFS_CHECK_TO_ERROR(ReadWrite(directory, positionOfLastEntry & ~(superblock->blockSize - 1), superblock->blockSize, - blockBuffers + superblock->blockSize, false, false), "Remove - Could not load the last block.", ES_ERROR_DRIVE_CONTROLLER_REPORTED); + blockBuffers + superblock->blockSize, false, false), "Remove - Could not load the last block.", ES_ERROR_HARDWARE_FAILURE); ESFS_CHECK_TO_ERROR(0 == EsMemoryCompare(blockBuffers + file->reference.offsetIntoBlock, &file->entry, sizeof(DirectoryEntry)), - "Remove - Inconsistent file entry.", ES_ERROR_DRIVE_CONTROLLER_REPORTED); + "Remove - Inconsistent file entry.", ES_ERROR_HARDWARE_FAILURE); DirectoryEntry *movedEntry = (DirectoryEntry *) (blockBuffers + superblock->blockSize + (positionOfLastEntry & (superblock->blockSize - 1))); DirectoryEntry *deletedEntry = (DirectoryEntry *) (blockBuffers + file->reference.offsetIntoBlock); EsMemoryCopy(deletedEntry, movedEntry, sizeof(DirectoryEntry)); ESFS_CHECK_TO_ERROR(AccessBlock(volume, file->reference.block, 1, blockBuffers, FS_BLOCK_ACCESS_CACHED, K_ACCESS_WRITE), - "Remove - Could not save the container block.", ES_ERROR_DRIVE_CONTROLLER_REPORTED); + "Remove - Could not save the container block.", ES_ERROR_HARDWARE_FAILURE); // Step 2: Update the node for the moved entry. @@ -1456,7 +1456,7 @@ static EsError RemoveDirectoryEntry(FSNode *file, uint8_t *blockBuffers /* super uint64_t key = CalculateCRC64(filename->filename, filename->length, 0); // EsPrint("\tModify index key for %s\n", filename->length, filename->filename); ESFS_CHECK_TO_ERROR(IndexModifyKey(volume, key, file->reference, directoryAttribute->indexRootBlock, blockBuffers + superblock->blockSize), - "Remove - Could not update index (2).", ES_ERROR_DRIVE_CONTROLLER_REPORTED); + "Remove - Could not update index (2).", ES_ERROR_HARDWARE_FAILURE); } } @@ -1466,7 +1466,7 @@ static EsError RemoveDirectoryEntry(FSNode *file, uint8_t *blockBuffers /* super if (!(directoryAttribute->childNodes % superblock->directoryEntriesPerBlock)) { uint64_t newSize = directory->entry.fileSize - superblock->blockSize; - ESFS_CHECK_TO_ERROR(newSize == ResizeInternal(directory, newSize, &error), "Remove - Could not resize directory.", ES_ERROR_DRIVE_CONTROLLER_REPORTED); + ESFS_CHECK_TO_ERROR(newSize == ResizeInternal(directory, newSize, &error), "Remove - Could not resize directory.", ES_ERROR_HARDWARE_FAILURE); } // Step 4: Remove the entry from the index. @@ -1476,7 +1476,7 @@ static EsError RemoveDirectoryEntry(FSNode *file, uint8_t *blockBuffers /* super if (filename) { uint64_t removeKey = CalculateCRC64(filename->filename, filename->length, 0); - ESFS_CHECK_TO_ERROR(IndexRemoveKey(volume, removeKey, &directoryAttribute->indexRootBlock), "Remove - Could not update index.", ES_ERROR_DRIVE_CONTROLLER_REPORTED); + ESFS_CHECK_TO_ERROR(IndexRemoveKey(volume, removeKey, &directoryAttribute->indexRootBlock), "Remove - Could not update index.", ES_ERROR_HARDWARE_FAILURE); } return ES_SUCCESS; @@ -1504,7 +1504,7 @@ static EsError Remove(KNode *_directory, KNode *node) { if (attribute->indexRootBlock) { IndexVertex *vertex = (IndexVertex *) blockBuffers; ESFS_CHECK_TO_ERROR(AccessBlock(volume, attribute->indexRootBlock, 1, vertex, FS_BLOCK_ACCESS_CACHED, K_ACCESS_READ), - "Remove - Could not access index root.", ES_ERROR_DRIVE_CONTROLLER_REPORTED); + "Remove - Could not access index root.", ES_ERROR_HARDWARE_FAILURE); ESFS_CHECK_TO_ERROR(!vertex->count, "Remove - Index was not empty (although it should be as the directory is empty).", ES_ERROR_CORRUPT_DATA); KWriterLockTake(&volume->blockBitmapLock, K_LOCK_EXCLUSIVE); EsDefer(KWriterLockReturn(&volume->blockBitmapLock, K_LOCK_EXCLUSIVE)); diff --git a/drivers/ext2.cpp b/drivers/ext2.cpp index 075cb42..f3eb7d1 100644 --- a/drivers/ext2.cpp +++ b/drivers/ext2.cpp @@ -318,7 +318,7 @@ static EsError Enumerate(KNode *node) { uint32_t block = GetDataBlock(volume, &directory->inode, i, blockBuffer); if (!block) { - return ES_ERROR_DRIVE_CONTROLLER_REPORTED; + return ES_ERROR_HARDWARE_FAILURE; } EsError error = volume->Access((uint64_t) block * volume->blockBytes, volume->blockBytes, K_ACCESS_READ, blockBuffer, ES_FLAGS_DEFAULT); @@ -387,7 +387,7 @@ static EsError Scan(const char *name, size_t nameBytes, KNode *_directory) { uint32_t block = GetDataBlock(volume, &directory->inode, i, blockBuffer); if (!block) { - return ES_ERROR_DRIVE_CONTROLLER_REPORTED; + return ES_ERROR_HARDWARE_FAILURE; } EsError error = volume->Access((uint64_t) block * volume->blockBytes, volume->blockBytes, K_ACCESS_READ, blockBuffer, ES_FLAGS_DEFAULT); @@ -428,7 +428,7 @@ static EsError Scan(const char *name, size_t nameBytes, KNode *_directory) { } else if (entry->type == DIRENT_TYPE_REGULAR) { metadata.type = ES_NODE_FILE; } else { - SCAN_FAILURE("Unsupported file type.\n", ES_ERROR_UNSUPPORTED_FEATURE); + SCAN_FAILURE("Unsupported file type.\n", ES_ERROR_UNSUPPORTED); } return FSDirectoryEntryFound(_directory, &metadata, &inode, name, nameBytes, false); @@ -581,7 +581,7 @@ static size_t Read(KNode *node, void *_buffer, EsFileOffset offset, EsFileOffset bool success = dispatchGroup.Read(); if (!success) { - READ_FAILURE("Could not read blocks from drive.\n", ES_ERROR_DRIVE_CONTROLLER_REPORTED); + READ_FAILURE("Could not read blocks from drive.\n", ES_ERROR_HARDWARE_FAILURE); } return count; diff --git a/kernel/elf.cpp b/kernel/elf.cpp index 360e1b0..89131a1 100644 --- a/kernel/elf.cpp +++ b/kernel/elf.cpp @@ -133,7 +133,7 @@ EsError KLoadELF(KNode *node, KLoadedExecutable *executable) { if (bytesRead != sizeof(BundleHeader)) { KernelLog(LOG_ERROR, "ELF", "executable load error", "Could not read the bundle header.\n"); - return ES_ERROR_UNSUPPORTED_EXECUTABLE; + return ES_ERROR_UNSUPPORTED; } if (header.signature == BUNDLE_SIGNATURE @@ -149,12 +149,12 @@ EsError KLoadELF(KNode *node, KLoadedExecutable *executable) { if (ArchCheckBundleHeader() || header.mapAddress & (K_PAGE_SIZE - 1)) { KernelLog(LOG_ERROR, "ELF", "executable load error", "Invalid bundle mapping addresses.\n"); - return ES_ERROR_UNSUPPORTED_EXECUTABLE; + return ES_ERROR_UNSUPPORTED; } if (header.version != 1) { KernelLog(LOG_ERROR, "ELF", "executable load error", "Invalid bundle version.\n"); - return ES_ERROR_UNSUPPORTED_EXECUTABLE; + return ES_ERROR_UNSUPPORTED; } // Map the bundle file. @@ -183,7 +183,7 @@ EsError KLoadELF(KNode *node, KLoadedExecutable *executable) { if (executableOffset >= fileSize || !found) { KernelLog(LOG_ERROR, "ELF", "executable load error", "Could not find the executable section for the current architecture.\n"); - return ES_ERROR_UNSUPPORTED_EXECUTABLE; + return ES_ERROR_UNSUPPORTED; } executable->isBundle = true; @@ -197,39 +197,39 @@ EsError KLoadELF(KNode *node, KLoadedExecutable *executable) { if (bytesRead != sizeof(ElfHeader)) { KernelLog(LOG_ERROR, "ELF", "executable load error", "Could not read the ELF header.\n"); - return ES_ERROR_UNSUPPORTED_EXECUTABLE; + return ES_ERROR_UNSUPPORTED; } size_t programHeaderEntrySize = header.programHeaderEntrySize; if (header.magicNumber != 0x464C457F) { KernelLog(LOG_ERROR, "ELF", "executable load error", "Incorrect executable magic number.\n"); - return ES_ERROR_UNSUPPORTED_EXECUTABLE; + return ES_ERROR_UNSUPPORTED; } if (header.bits != 2) { KernelLog(LOG_ERROR, "ELF", "executable load error", "Incorrect executable bits.\n"); - return ES_ERROR_UNSUPPORTED_EXECUTABLE; + return ES_ERROR_UNSUPPORTED; } if (header.endianness != 1) { KernelLog(LOG_ERROR, "ELF", "executable load error", "Incorrect executable endianness.\n"); - return ES_ERROR_UNSUPPORTED_EXECUTABLE; + return ES_ERROR_UNSUPPORTED; } if (header.abi != 0) { KernelLog(LOG_ERROR, "ELF", "executable load error", "Incorrect executable ABI.\n"); - return ES_ERROR_UNSUPPORTED_EXECUTABLE; + return ES_ERROR_UNSUPPORTED; } if (header.type != 2) { KernelLog(LOG_ERROR, "ELF", "executable load error", "Incorrect executable type.\n"); - return ES_ERROR_UNSUPPORTED_EXECUTABLE; + return ES_ERROR_UNSUPPORTED; } if (header.instructionSet != 0x3E) { KernelLog(LOG_ERROR, "ELF", "executable load error", "Incorrect executable instruction set.\n"); - return ES_ERROR_UNSUPPORTED_EXECUTABLE; + return ES_ERROR_UNSUPPORTED; } ElfProgramHeader *programHeaders = (ElfProgramHeader *) EsHeapAllocate(programHeaderEntrySize * header.programHeaderEntries, false, K_PAGED); @@ -245,7 +245,7 @@ EsError KLoadELF(KNode *node, KLoadedExecutable *executable) { if (bytesRead != programHeaderEntrySize * header.programHeaderEntries) { KernelLog(LOG_ERROR, "ELF", "executable load error", "Could not read the program headers.\n"); - return ES_ERROR_UNSUPPORTED_EXECUTABLE; + return ES_ERROR_UNSUPPORTED; } for (uintptr_t i = 0; i < header.programHeaderEntries; i++) { @@ -254,7 +254,7 @@ EsError KLoadELF(KNode *node, KLoadedExecutable *executable) { if (header->type == 1 /* PT_LOAD */) { if (ArchCheckELFHeader()) { KernelLog(LOG_ERROR, "ELF", "executable load error", "Rejected ELF program header.\n"); - return ES_ERROR_UNSUPPORTED_EXECUTABLE; + return ES_ERROR_UNSUPPORTED; } #if 0 @@ -270,7 +270,7 @@ EsError KLoadELF(KNode *node, KLoadedExecutable *executable) { if (success) { bytesRead = FSFileReadSync(node, (void *) header->virtualAddress, executableOffset + header->fileOffset, header->dataInFile, 0); - if (bytesRead != header->dataInFile) return ES_ERROR_UNSUPPORTED_EXECUTABLE; + if (bytesRead != header->dataInFile) return ES_ERROR_UNSUPPORTED; } #else uintptr_t fileStart = RoundDown(header->virtualAddress, K_PAGE_SIZE); @@ -451,13 +451,13 @@ EsError KLoadELFModule(KModule *module) { if (!getVersion || getVersion() != KERNEL_VERSION) { KernelLog(LOG_ERROR, "Modules", "invalid module kernel version", "KLoadELFModule - Attempted to load module '%s' for invalid kernel version.\n", module->pathBytes, module->path); - return ES_ERROR_UNSUPPORTED_FEATURE; + return ES_ERROR_UNSUPPORTED; } return ES_SUCCESS; #else (void) module; - return ES_ERROR_UNSUPPORTED_FEATURE; + return ES_ERROR_UNSUPPORTED; #endif } diff --git a/kernel/files.cpp b/kernel/files.cpp index c22b636..594cdf9 100644 --- a/kernel/files.cpp +++ b/kernel/files.cpp @@ -346,7 +346,7 @@ EsError FSFileResize(KNode *node, EsFileOffset newSize) { KWriterLockTake(&file->resizeLock, K_LOCK_EXCLUSIVE); if (file->blockResize) { - error = ES_ERROR_FILE_IN_EXCLUSIVE_USE; + error = ES_ERROR_OPERATION_BLOCKED; } else if (!file->fileSystem->resize) { error = ES_ERROR_FILE_ON_READ_ONLY_VOLUME; } else { @@ -446,7 +446,7 @@ EsError FSNodeDelete(KNode *node) { if (file->blockResize) { KWriterLockReturn(&file->resizeLock, K_LOCK_EXCLUSIVE); - return ES_ERROR_FILE_IN_EXCLUSIVE_USE; + return ES_ERROR_OPERATION_BLOCKED; } _FSFileResize(file, 0); @@ -483,7 +483,7 @@ EsError FSNodeMove(KNode *node, KNode *_newParent, const char *newName, size_t n if (fs.shutdown) KernelPanic("FSNodeMove - Attempting to move a file after FSShutdown called.\n"); if (!FSCheckPathForIllegalCharacters(newName, newNameBytes)) { - return ES_ERROR_ILLEGAL_PATH; + return ES_ERROR_INVALID_NAME; } FSDirectoryEntry *entry = node->directoryEntry; @@ -493,7 +493,7 @@ EsError FSNodeMove(KNode *node, KNode *_newParent, const char *newName, size_t n // Check the move is valid. if (newParent->directoryEntry->type != ES_NODE_DIRECTORY) { - return ES_ERROR_TARGET_INVALID_TYPE; + return ES_ERROR_INCORRECT_NODE_TYPE; } if (!oldParent || oldParent->fileSystem != newParent->fileSystem || oldParent->fileSystem != node->fileSystem) { @@ -561,7 +561,7 @@ EsError FSNodeMove(KNode *node, KNode *_newParent, const char *newName, size_t n } if (alreadyExists) { - error = ES_ERROR_FILE_ALREADY_EXISTS; + error = ES_ERROR_ALREADY_EXISTS; goto fail; } @@ -1093,7 +1093,7 @@ EsError FSNodeOpenHandle(KNode *node, uint32_t flags, uint8_t mode) { FSFile *file = (FSFile *) node; if (flags & ES_FILE_READ) { - if (file->countWrite > 0) return ES_ERROR_FILE_HAS_WRITERS; + if (file->countWrite > 0) return ES_ERROR_OPERATION_BLOCKED; } else if (flags & ES_FILE_WRITE) { if (flags & _ES_NODE_FROM_WRITE_EXCLUSIVE) { if (!file->countWrite || (~file->flags & NODE_HAS_EXCLUSIVE_WRITER)) { @@ -1101,11 +1101,11 @@ EsError FSNodeOpenHandle(KNode *node, uint32_t flags, uint8_t mode) { } } else { if (file->countWrite) { - return ES_ERROR_FILE_CANNOT_GET_EXCLUSIVE_USE; + return ES_ERROR_OPERATION_BLOCKED; } } } else if (flags & ES_FILE_WRITE_SHARED) { - if ((file->flags & NODE_HAS_EXCLUSIVE_WRITER) || file->countWrite < 0) return ES_ERROR_FILE_IN_EXCLUSIVE_USE; + if ((file->flags & NODE_HAS_EXCLUSIVE_WRITER) || file->countWrite < 0) return ES_ERROR_OPERATION_BLOCKED; } if (flags & (ES_FILE_WRITE_SHARED | ES_FILE_WRITE)) { @@ -1389,7 +1389,7 @@ KNodeInformation FSNodeOpen(const char *path, size_t pathBytes, uint32_t flags, if (pathBytes && path[pathBytes - 1] == '/') pathBytes--; if (!FSCheckPathForIllegalCharacters(path, pathBytes)) { - return { ES_ERROR_ILLEGAL_PATH }; + return { ES_ERROR_INVALID_NAME }; } KFileSystem *fileSystem = nullptr; @@ -1430,7 +1430,7 @@ KNodeInformation FSNodeOpen(const char *path, size_t pathBytes, uint32_t flags, } if ((flags & ES_NODE_FAIL_IF_FOUND) && !createdNode) { - error = ES_ERROR_FILE_ALREADY_EXISTS; + error = ES_ERROR_ALREADY_EXISTS; } else { error = FSNodeOpenHandle(node, flags, FS_NODE_OPEN_HANDLE_STANDARD); } @@ -1609,7 +1609,7 @@ EsError FSBlockDeviceAccess(KBlockDeviceAccessRequest request) { } if (request.dispatchGroup == &fakeDispatchGroup) { - return fakeDispatchGroup.Wait() ? ES_SUCCESS : ES_ERROR_DRIVE_CONTROLLER_REPORTED; + return fakeDispatchGroup.Wait() ? ES_SUCCESS : ES_ERROR_HARDWARE_FAILURE; } else { return ES_SUCCESS; } diff --git a/shared/strings.cpp b/shared/strings.cpp index 5865347..bcec63d 100644 --- a/shared/strings.cpp +++ b/shared/strings.cpp @@ -193,8 +193,8 @@ DEFINE_INTERFACE_STRING(FileRenameSuccess, "Renamed"); DEFINE_INTERFACE_STRING(FileSaveAnnouncement, "Saved to %s"); DEFINE_INTERFACE_STRING(FileSaveErrorFileDeleted, "Another application deleted the file."); -DEFINE_INTERFACE_STRING(FileSaveErrorCorrupt, "The file has been corrupted, and it cannot be modified."); -DEFINE_INTERFACE_STRING(FileSaveErrorDrive, "The drive containing the file was unable to modify it."); +DEFINE_INTERFACE_STRING(FileSaveErrorCorrupt, "The file has been corrupted, and it cannot be accessed."); +DEFINE_INTERFACE_STRING(FileSaveErrorDrive, "The drive containing the file was unable to access it."); DEFINE_INTERFACE_STRING(FileSaveErrorTooLarge, "The drive does not support files large enough to store this document."); DEFINE_INTERFACE_STRING(FileSaveErrorConcurrentAccess, "Another application is modifying the file."); DEFINE_INTERFACE_STRING(FileSaveErrorDriveFull, "The drive is full. Try deleting some files to free up space.");