F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
Os::Posix::FileSystem::PosixFileSystem Class Reference

Posix implementation of Os::FileSystem. More...

#include <Os/Posix/FileSystem.hpp>

Inheritance diagram for Os::Posix::FileSystem::PosixFileSystem:
Os::FileSystemInterface

Public Member Functions

 PosixFileSystem ()=default
 constructor More...
 
 ~PosixFileSystem () override=default
 destructor More...
 
Status _removeDirectory (const char *path) override
 Remove a directory at the specified path. More...
 
Status _removeFile (const char *path) override
 Remove a file at the specified path. More...
 
Status _rename (const char *sourcePath, const char *destPath) override
 Rename a file from source to destination. More...
 
Status _getFreeSpace (const char *path, FwSizeType &totalBytes, FwSizeType &freeBytes) override
 Get filesystem free and total space in bytes on the filesystem containing the specified path. More...
 
Status _getWorkingDirectory (char *path, FwSizeType bufferSize) override
 Get the current working directory. More...
 
Status _changeWorkingDirectory (const char *path) override
 Change the current working directory to the specified path. More...
 
FileSystemHandlegetHandle () override
 Get the raw FileSystem handle. More...
 
- Public Member Functions inherited from Os::FileSystemInterface
 FileSystemInterface ()=default
 default constructor More...
 
virtual ~FileSystemInterface ()=default
 default virtual destructor More...
 
 FileSystemInterface (const FileSystemInterface &other)=delete
 copy constructor is forbidden More...
 
FileSystemInterfaceoperator= (const FileSystemInterface &other)=delete
 assignment operator is forbidden More...
 

Additional Inherited Members

- Public Types inherited from Os::FileSystemInterface
enum  Status {
  OP_OK, ALREADY_EXISTS, NO_SPACE, NO_PERMISSION,
  NOT_DIR, IS_DIR, NOT_EMPTY, INVALID_PATH,
  DOESNT_EXIST, FILE_LIMIT, BUSY, NO_MORE_FILES,
  BUFFER_TOO_SMALL, EXDEV_ERROR, OVERFLOW_ERROR, NOT_SUPPORTED,
  OTHER_ERROR
}
 
enum  PathType { FILE, DIRECTORY, NOT_EXIST }
 
- Static Public Member Functions inherited from Os::FileSystemInterface
static FileSystemInterfacegetDelegate (FileSystemHandleStorage &aligned_new_memory)
 provide a pointer to a FileSystem delegate object More...
 
- Static Public Attributes inherited from Os::FileSystemInterface
static constexpr FwSignedSizeType FILE_SYSTEM_FILE_CHUNK_SIZE = FW_FILE_CHUNK_SIZE
 Size of file system chunk. More...
 

Detailed Description

Posix implementation of Os::FileSystem.

Posix implementation of FileSystemInterface for use as a delegate class handling error-only fileSystem operations.

Definition at line 20 of file FileSystem.hpp.

Constructor & Destructor Documentation

◆ PosixFileSystem()

Os::Posix::FileSystem::PosixFileSystem::PosixFileSystem ( )
default

constructor

◆ ~PosixFileSystem()

Os::Posix::FileSystem::PosixFileSystem::~PosixFileSystem ( )
overridedefault

destructor

Member Function Documentation

◆ _changeWorkingDirectory()

PosixFileSystem::Status Os::Posix::FileSystem::PosixFileSystem::_changeWorkingDirectory ( const char *  path)
overridevirtual

Change the current working directory to the specified path.

It is invalid to pass nullptr as the path.

Parameters
pathThe path of the new working directory
Returns
Status of the operation

Implements Os::FileSystemInterface.

Definition at line 54 of file FileSystem.cpp.

◆ _getFreeSpace()

PosixFileSystem::Status Os::Posix::FileSystem::PosixFileSystem::_getFreeSpace ( const char *  path,
FwSizeType totalBytes,
FwSizeType freeBytes 
)
overridevirtual

Get filesystem free and total space in bytes on the filesystem containing the specified path.

It is invalid to pass nullptr as the path.

Parameters
pathThe path on the filesystem to query
totalBytesReference to store the total bytes on the filesystem
freeBytesReference to store the free bytes on the filesystem
Returns
Status of the operation

Implements Os::FileSystemInterface.

Definition at line 62 of file FileSystem.cpp.

◆ _getWorkingDirectory()

PosixFileSystem::Status Os::Posix::FileSystem::PosixFileSystem::_getWorkingDirectory ( char *  path,
FwSizeType  bufferSize 
)
overridevirtual

Get the current working directory.

Writes the current working directory path to the provided buffer of size bufferSize. If the buffer is too small to hold the full path, the function will return BUFFER_TOO_SMALL.

It is invalid to pass nullptr as the path. It is invalid to pass a bufferSize of 0.

Parameters
pathBuffer to store the current working directory path
bufferSizeSize of the buffer
Returns
Status of the operation

Implements Os::FileSystemInterface.

Definition at line 46 of file FileSystem.cpp.

◆ _removeDirectory()

PosixFileSystem::Status Os::Posix::FileSystem::PosixFileSystem::_removeDirectory ( const char *  path)
overridevirtual

Remove a directory at the specified path.

It is invalid to pass nullptr as the path.

Parameters
pathThe path of the directory to remove
Returns
Status of the operation

Implements Os::FileSystemInterface.

Definition at line 22 of file FileSystem.cpp.

◆ _removeFile()

PosixFileSystem::Status Os::Posix::FileSystem::PosixFileSystem::_removeFile ( const char *  path)
overridevirtual

Remove a file at the specified path.

It is invalid to pass nullptr as the path.

Parameters
pathThe path of the file to remove
Returns
Status of the operation

Implements Os::FileSystemInterface.

Definition at line 30 of file FileSystem.cpp.

◆ _rename()

PosixFileSystem::Status Os::Posix::FileSystem::PosixFileSystem::_rename ( const char *  sourcePath,
const char *  destPath 
)
overridevirtual

Rename a file from source to destination.

If the rename fails due to a cross-device operation, this function should return EXDEV_ERROR and moveFile can be used instead to force a copy-and-remove.

It is invalid to pass nullptr as sourcePath or destPath.

Parameters
sourcePathThe path of the source file
destPathThe path of the destination file
Returns
Status of the operation

Implements Os::FileSystemInterface.

Definition at line 38 of file FileSystem.cpp.

◆ getHandle()

FileSystemHandle * Os::Posix::FileSystem::PosixFileSystem::getHandle ( )
overridevirtual

Get the raw FileSystem handle.

Gets the raw FileSystem handle from the implementation. Note: users must include the implementation specific header to make any real use of this handle. Otherwise it must be passed as an opaque type.

Returns
raw fileSystem handle

Implements Os::FileSystemInterface.

Definition at line 96 of file FileSystem.cpp.


The documentation for this class was generated from the following files: