F´ Flight Software - C/C++ Documentation  devel
A framework for building embedded system applications to NASA flight quality standards.
Os::FileSystemInterface Class Referenceabstract

#include <Os/FileSystem.hpp>

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

Public Types

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 }
 

Public Member Functions

 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...
 
virtual FileSystemHandlegetHandle ()=0
 return the underlying FileSystem handle (implementation specific) More...
 
virtual Status _removeDirectory (const char *path)=0
 Remove a directory at the specified path. More...
 
virtual Status _removeFile (const char *path)=0
 Remove a file at the specified path. More...
 
virtual Status _rename (const char *sourcePath, const char *destPath)=0
 Rename (or move) a file from source to destination. More...
 
virtual Status _getFreeSpace (const char *path, FwSizeType &totalBytes, FwSizeType &freeBytes)=0
 Get filesystem free and total space in bytes on the filesystem containing the specified path. More...
 
virtual Status _getWorkingDirectory (char *path, FwSizeType bufferSize)=0
 Get the current working directory. More...
 
virtual Status _changeWorkingDirectory (const char *path)=0
 Change the current working directory to the specified path. More...
 

Static Public Member Functions

static FileSystemInterfacegetDelegate (FileSystemHandleStorage &aligned_new_memory)
 provide a pointer to a FileSystem delegate object More...
 

Static Public Attributes

static constexpr FwSignedSizeType FILE_SYSTEM_FILE_CHUNK_SIZE = FW_FILE_CHUNK_SIZE
 Size of file system chunk. More...
 

Detailed Description

Definition at line 18 of file FileSystem.hpp.

Member Enumeration Documentation

◆ PathType

Enumerator
FILE 

Path is a file.

DIRECTORY 

Path is a directory.

NOT_EXIST 

Path does not exist.

Definition at line 44 of file FileSystem.hpp.

◆ Status

Enumerator
OP_OK 

Operation was successful.

ALREADY_EXISTS 

File already exists.

NO_SPACE 

No space left.

NO_PERMISSION 

No permission to write.

NOT_DIR 

Path is not a directory.

IS_DIR 

Path is a directory.

NOT_EMPTY 

directory is not empty

INVALID_PATH 

Path is too long, too many sym links, etc.

DOESNT_EXIST 

Path doesn't exist.

FILE_LIMIT 

Too many files or links.

BUSY 

Operand is in use by the system or by a process.

NO_MORE_FILES 

Directory stream has no more files.

BUFFER_TOO_SMALL 

Buffer size is too small to hold full path (for getWorkingDirectory)

EXDEV_ERROR 
OVERFLOW_ERROR 
NOT_SUPPORTED 

Operation is not supported by the current implementation.

OTHER_ERROR 

other OS-specific error

Definition at line 24 of file FileSystem.hpp.

Constructor & Destructor Documentation

◆ FileSystemInterface() [1/2]

Os::FileSystemInterface::FileSystemInterface ( )
default

default constructor

◆ ~FileSystemInterface()

virtual Os::FileSystemInterface::~FileSystemInterface ( )
virtualdefault

default virtual destructor

◆ FileSystemInterface() [2/2]

Os::FileSystemInterface::FileSystemInterface ( const FileSystemInterface other)
delete

copy constructor is forbidden

Member Function Documentation

◆ _changeWorkingDirectory()

virtual Status Os::FileSystemInterface::_changeWorkingDirectory ( const char *  path)
pure virtual

Change the current working directory to the specified path.

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

Implemented in Os::Stub::FileSystem::StubFileSystem, Os::Posix::FileSystem::PosixFileSystem, and Os::FileSystem.

◆ _getFreeSpace()

virtual Status Os::FileSystemInterface::_getFreeSpace ( const char *  path,
FwSizeType totalBytes,
FwSizeType freeBytes 
)
pure virtual

Get filesystem free and total space in bytes on the filesystem containing the specified 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

Implemented in Os::Stub::FileSystem::StubFileSystem, Os::Posix::FileSystem::PosixFileSystem, and Os::FileSystem.

◆ _getWorkingDirectory()

virtual Status Os::FileSystemInterface::_getWorkingDirectory ( char *  path,
FwSizeType  bufferSize 
)
pure virtual

Get the current working directory.

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

Implemented in Os::Stub::FileSystem::StubFileSystem, Os::Posix::FileSystem::PosixFileSystem, and Os::FileSystem.

◆ _removeDirectory()

virtual Status Os::FileSystemInterface::_removeDirectory ( const char *  path)
pure virtual

Remove a directory at the specified path.

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

Implemented in Os::Stub::FileSystem::StubFileSystem, Os::Posix::FileSystem::PosixFileSystem, and Os::FileSystem.

◆ _removeFile()

virtual Status Os::FileSystemInterface::_removeFile ( const char *  path)
pure virtual

Remove a file at the specified path.

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

Implemented in Os::Stub::FileSystem::StubFileSystem, Os::Posix::FileSystem::PosixFileSystem, and Os::FileSystem.

◆ _rename()

virtual Status Os::FileSystemInterface::_rename ( const char *  sourcePath,
const char *  destPath 
)
pure virtual

Rename (or move) a file from source to destination.

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

Implemented in Os::Stub::FileSystem::StubFileSystem, Os::Posix::FileSystem::PosixFileSystem, and Os::FileSystem.

◆ getDelegate()

FileSystemInterface * Os::FileSystemInterface::getDelegate ( FileSystemHandleStorage aligned_placement_new_memory)
static

provide a pointer to a FileSystem delegate object

get a delegate for FileSystemInterface that intercepts calls for stub fileSystem usage

Parameters
aligned_new_memoryaligned memory to fill
to_copypointer to copy-constructor input
Returns
: pointer to delegate

Definition at line 17 of file DefaultFile.cpp.

◆ getHandle()

virtual FileSystemHandle* Os::FileSystemInterface::getHandle ( )
pure virtual

return the underlying FileSystem handle (implementation specific)

Returns
internal FileSystem handle representation

Implemented in Os::Stub::FileSystem::StubFileSystem, Os::Posix::FileSystem::PosixFileSystem, and Os::FileSystem.

◆ operator=()

FileSystemInterface& Os::FileSystemInterface::operator= ( const FileSystemInterface other)
delete

assignment operator is forbidden

Member Data Documentation

◆ FILE_SYSTEM_FILE_CHUNK_SIZE

constexpr FwSignedSizeType Os::FileSystemInterface::FILE_SYSTEM_FILE_CHUNK_SIZE = FW_FILE_CHUNK_SIZE
staticconstexpr

Size of file system chunk.

Definition at line 22 of file FileSystem.hpp.


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