F´ Flight Software - C/C++ Documentation  NASA-v2.0.0
A framework for building embedded system applications to NASA flight quality standards.
FileSystem.hpp
Go to the documentation of this file.
1 #ifndef _FileSystem_hpp_
2 #define _FileSystem_hpp_
3 
4 #include <FpConfig.hpp>
7 
8 #define FILE_SYSTEM_CHUNK_SIZE (256)
9 
10 namespace Os {
11 
12  // This namespace encapsulates a very simple file system interface that has the most often-used features.
13  namespace FileSystem {
14 
15  typedef enum {
25  BUSY,
27  } Status;
28 
29  Status createDirectory(const char* path);
30  Status removeDirectory(const char* path);
31  Status readDirectory(const char* path, const U32 maxNum, Fw::EightyCharString fileArray[], U32& numFiles);
32  Status removeFile(const char* path);
33  Status moveFile(const char* originPath, const char* destPath);
34  Status copyFile(const char* originPath, const char* destPath);
35  Status appendFile(const char* originPath, const char* destPath, bool createMissingDest=false);
36  Status getFileSize(const char* path, U64& size);
37  Status getFileCount(const char* directory, U32& fileCount);
38  Status changeWorkingDirectory(const char* path);
39 
40  Status getFreeSpace(const char* path, U64& totalBytes, U64& freeBytes);
41  }
42 
43 }
44 
45 #endif
Os
Definition: File.cpp:7
Os::FileSystem::getFileCount
Status getFileCount(const char *directory, U32 &fileCount)
counts the number of files in the given directory
Definition: FileSystem.cpp:48
Os::FileSystem::Status
Status
Definition: FileSystem.hpp:15
Os::FileSystem::copyFile
Status copyFile(const char *originPath, const char *destPath)
moves a file from origin to destination
Definition: FileSystem.cpp:36
Os::FileSystem::NO_SPACE
@ NO_SPACE
No space left.
Definition: FileSystem.hpp:18
Os::FileSystem::readDirectory
Status readDirectory(const char *path, const U32 maxNum, Fw::EightyCharString fileArray[])
Definition: FileSystem.cpp:17
Fw::EightyCharString
Definition: EightyCharString.hpp:10
Os::FileSystem::removeDirectory
Status removeDirectory(const char *path)
remove a directory at location path
Definition: FileSystem.cpp:13
Os::FileSystem::changeWorkingDirectory
Status changeWorkingDirectory(const char *path)
move current directory to path
Definition: FileSystem.cpp:44
Os::FileSystem::NOT_DIR
@ NOT_DIR
Path is not a directory.
Definition: FileSystem.hpp:20
Os::FileSystem::OTHER_ERROR
@ OTHER_ERROR
other OS-specific error
Definition: FileSystem.hpp:26
Os::FileSystem::moveFile
Status moveFile(const char *originPath, const char *destPath)
Definition: FileSystem.cpp:27
Os::FileSystem::NOT_EMPTY
@ NOT_EMPTY
directory is not empty
Definition: FileSystem.hpp:22
U64
#define U64(C)
Definition: sha.h:176
EightyCharString.hpp
Os::FileSystem::OP_OK
@ OP_OK
Operation was successful.
Definition: FileSystem.hpp:16
Os::FileSystem::INVALID_PATH
@ INVALID_PATH
Path is too long, too many sym links, doesn't exist, ect.
Definition: FileSystem.hpp:23
Os::FileSystem::IS_DIR
@ IS_DIR
Path is a directory.
Definition: FileSystem.hpp:21
Os::FileSystem::appendFile
Status appendFile(const char *originPath, const char *destPath, bool createMissingDest=false)
copies a file from origin to destination
Definition: FileSystem.cpp:404
Os::FileSystem::ALREADY_EXISTS
@ ALREADY_EXISTS
File already exists.
Definition: FileSystem.hpp:17
FpConfig.hpp
ISF configuration file.
Os::FileSystem::getFreeSpace
Status getFreeSpace(const char *path, U64 &totalBytes, U64 &freeBytes)
get FS free and total space in bytes on filesystem containing path
Definition: FileSystem.cpp:493
Os::FileSystem::FILE_LIMIT
@ FILE_LIMIT
Too many files or links.
Definition: FileSystem.hpp:24
Os::FileSystem::createDirectory
Status createDirectory(const char *path)
create a new directory at location path
Definition: FileSystem.cpp:9
Os::FileSystem::NO_PERMISSION
@ NO_PERMISSION
No permission to write.
Definition: FileSystem.hpp:19
BasicTypes.hpp
Declares ISF basic types.
Os::FileSystem::getFileSize
Status getFileSize(const char *path, U64 &size)
append file origin to destination file. If boolean true, creates a brand new file if the destination ...
Definition: FileSystem.cpp:40
Os::FileSystem::BUSY
@ BUSY
Operand is in use by the system or by a process.
Definition: FileSystem.hpp:25
Os::FileSystem::removeFile
Status removeFile(const char *path)
removes a file at location path
Definition: FileSystem.cpp:22