88 virtual void close() = 0;
317 void close()
override;
507 PRIVATE :
static const U32 INITIAL_CRC = 0xFFFFFFFF;
508 Mode m_mode = Mode::OPEN_NO_MODE;
509 const CHAR* m_path =
nullptr;
511 U32 m_crc = File::INITIAL_CRC;
virtual Status open(const char *path, Mode mode, OverwriteType overwrite)=0
open file with supplied path and mode
Status incrementalCrc(FwSizeType &size)
calculate the CRC32 of the next section of data
base implementation of FileHandle
Status calculateCrc(U32 &crc)
calculate the CRC32 of the entire file
PlatformSizeType FwSizeType
File mode not yet selected.
No more available resources.
Status preallocate(FwSizeType offset, FwSizeType length) override
pre-allocate file storage
Status position(FwSizeType &position_result) override
get file pointer position of the currently open file
Open file for writing; writes don't return until data is on disk.
Status seek_absolute(FwSizeType offset_unsigned)
seek the file pointer to the given offset absolutely with the full range
virtual void close()=0
close the file, if not opened then do nothing
Status size(FwSizeType &size_result) override
get size of currently open file
No permission to read/write file.
Overwrite file when it exists and creation was requested.
PlatformSignedSizeType FwSignedSizeType
Os::FileInterface::Status open(const char *path, Mode mode)
open file with supplied path and mode
virtual FileHandle * getHandle()=0
returns the raw file handle
#define FW_HANDLE_ALIGNMENT
Alignment of handle storage.
virtual ~FileInterface()=default
#define FW_FILE_CHUNK_SIZE
Chunk size for working with files in the OSAL layer.
virtual Status size(FwSizeType &size_result)=0
get size of currently open file
virtual Status flush()=0
flush file contents to storage
virtual Status seek(FwSignedSizeType offset, SeekType seekType)=0
seek the file pointer to the given offset
Do not wait for read/write operation to finish.
Do wait for read/write operation to finish.
Invalid argument passed in.
Absolute seek from beginning of file.
Status seek(FwSignedSizeType offset, SeekType seekType) override
seek the file pointer to the given offset
File doesn't exist (for read)
FileHandle * getHandle() override
returns the raw file handle
Mode for file access is invalid for current operation.
Kernel or file system does not support operation.
void close() override
close the file, if not opened then do nothing
Status write(const U8 *buffer, FwSizeType &size)
write data to this file from the supplied buffer bounded by size
Relative seek from current file offset.
uint8_t U8
8-bit unsigned integer
Status read(U8 *buffer, FwSizeType &size)
read data from this file into supplied buffer bounded by size
Status flush() override
flush file contents to storage
U8 FileHandleStorage[FW_FILE_HANDLE_MAX_SIZE]
Do NOT overwrite existing files.
virtual Status write(const U8 *buffer, FwSizeType &size, WaitType wait)=0
read data from this file into supplied buffer bounded by size
Status readline(U8 *buffer, FwSizeType &size, WaitType wait)
read a line from the file using \n as the delimiter
file hasn't been opened yet
Operation was successful.
A catch-all for other errors. Have to look in implementation-specific code.
Status finalizeCrc(U32 &crc)
finalize and retrieve the CRC value
static FileInterface * getDelegate(FileHandleStorage &aligned_placement_new_memory, const FileInterface *to_copy=nullptr)
provide a pointer to a file delegate object
virtual Status preallocate(FwSizeType offset, FwSizeType length)=0
pre-allocate file storage
file already exist (for CREATE with O_EXCL enabled)
File & operator=(const File &other)
assignment operator that copies the internal representation
virtual Status position(FwSizeType &position_result)=0
get file pointer position of the currently open file
bool isOpen() const
determine if the file is open
virtual Status read(U8 *buffer, FwSizeType &size, WaitType wait)=0
read data from this file into supplied buffer bounded by size
Open file for writing and truncates file if it exists, ie same flags as creat()