Add file status (#3569)

* adding status for when Os::File should report no more resources

* formatting

* new enum values must also be added to the model fpp file
This commit is contained in:
kevin-f-ortega 2025-05-09 16:33:22 -07:00 committed by GitHub
parent 4ecc916dd9
commit d26b2382a2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 16 additions and 12 deletions

View File

@ -27,18 +27,19 @@ class FileInterface {
};
enum Status {
OP_OK, //!< Operation was successful
DOESNT_EXIST, //!< File doesn't exist (for read)
NO_SPACE, //!< No space left
NO_PERMISSION, //!< No permission to read/write file
BAD_SIZE, //!< Invalid size parameter
NOT_OPENED, //!< file hasn't been opened yet
FILE_EXISTS, //!< file already exist (for CREATE with O_EXCL enabled)
NOT_SUPPORTED, //!< Kernel or file system does not support operation
INVALID_MODE, //!< Mode for file access is invalid for current operation
INVALID_ARGUMENT, //!< Invalid argument passed in
OTHER_ERROR, //!< A catch-all for other errors. Have to look in implementation-specific code
MAX_STATUS //!< Maximum value of status
OP_OK, //!< Operation was successful
DOESNT_EXIST, //!< File doesn't exist (for read)
NO_SPACE, //!< No space left
NO_PERMISSION, //!< No permission to read/write file
BAD_SIZE, //!< Invalid size parameter
NOT_OPENED, //!< file hasn't been opened yet
FILE_EXISTS, //!< file already exist (for CREATE with O_EXCL enabled)
NOT_SUPPORTED, //!< Kernel or file system does not support operation
INVALID_MODE, //!< Mode for file access is invalid for current operation
INVALID_ARGUMENT, //!< Invalid argument passed in
NO_MORE_RESOURCES, //!< No more available resources
OTHER_ERROR, //!< A catch-all for other errors. Have to look in implementation-specific code
MAX_STATUS //!< Maximum value of status
};
enum OverwriteType {

View File

@ -16,6 +16,7 @@ enum FileStatus {
NOT_SUPPORTED, @< Kernel or file system does not support operation
INVALID_MODE, @< Mode for file access is invalid for current operation
INVALID_ARGUMENT, @< Invalid argument passed in
NO_MORE_RESOURCES,@< No more available resources
OTHER_ERROR, @< A catch-all for other errors. Have to look in implementation-specific code
}
@ FPP shadow-enum representing Os::File::Mode

View File

@ -46,6 +46,8 @@ static_assert(static_cast<Os::FileStatus::T>(Os::File::Status::INVALID_MODE) ==
"File status and FPP shadow enum do not match");
static_assert(static_cast<Os::FileStatus::T>(Os::File::Status::INVALID_ARGUMENT) == Os::FileStatus::T::INVALID_ARGUMENT,
"File status and FPP shadow enum do not match");
static_assert(static_cast<Os::FileStatus::T>(Os::File::Status::NO_MORE_RESOURCES) == Os::FileStatus::T::NO_MORE_RESOURCES,
"File status and FPP shadow enum do not match");
static_assert(static_cast<Os::FileStatus::T>(Os::File::Status::OTHER_ERROR) == Os::FileStatus::T::OTHER_ERROR,
"File status and FPP shadow enum do not match");