#include <FileSystem.h>
Public Member Functions | |
| FileSystem (Storage::Partition partition) | |
| ~FileSystem () | |
| int | mount () override |
| Mount file system, performing any required initialisation. More... | |
| int | getinfo (Info &info) override |
| get filing system information More... | |
| String | getErrorString (int err) override |
| get the text for a returned error code More... | |
| int | opendir (const char *path, DirHandle &dir) override |
| open a directory for reading More... | |
| int | readdir (DirHandle dir, Stat &stat) override |
| read a directory entry More... | |
| int | rewinddir (DirHandle dir) override |
| Reset directory read position to start. More... | |
| int | closedir (DirHandle dir) override |
| close a directory object More... | |
| int | mkdir (const char *path) override |
| Create a directory. More... | |
| int | stat (const char *path, Stat *stat) override |
| get file information More... | |
| int | fstat (FileHandle file, Stat *stat) override |
| get file information More... | |
| int | setacl (FileHandle file, const ACL &acl) override |
| Set access control information for file. More... | |
| int | setattr (const char *path, FileAttributes attr) override |
| Set file attributes. More... | |
| int | settime (FileHandle file, time_t mtime) override |
| Set modificatino tiem for file. More... | |
| int | setcompression (FileHandle file, const Compression &compression) override |
| Set file compression information. More... | |
| FileHandle | open (const char *path, OpenFlags flags) override |
| open a file by name/path More... | |
| FileHandle | fopen (const Stat &stat, OpenFlags flags) override |
| open a file from it's stat structure More... | |
| int | close (FileHandle file) override |
| close an open file More... | |
| int | read (FileHandle file, void *data, size_t size) override |
| read content from a file and advance cursor More... | |
| int | write (FileHandle file, const void *data, size_t size) override |
| write content to a file at current position and advance cursor More... | |
| int | lseek (FileHandle file, int offset, SeekOrigin origin) override |
| change file read/write position More... | |
| int | eof (FileHandle file) override |
| determine if current file position is at end of file More... | |
| int32_t | tell (FileHandle file) override |
| get current file position More... | |
| int | ftruncate (FileHandle file, size_t new_size) override |
| Truncate (reduce) the size of an open file. More... | |
| int | flush (FileHandle file) override |
| flush any buffered data to physical media More... | |
| int | rename (const char *oldpath, const char *newpath) override |
| rename a file More... | |
| int | remove (const char *path) override |
| remove (delete) a file by path More... | |
| int | fremove (FileHandle file) override |
| remove (delete) a file by handle More... | |
| int | format () override |
| format the filing system More... | |
| int | check () override |
| Perform a file system consistency check. More... | |
| int | getFilePath (FileID fileid, NameBuffer &buffer) |
| get the full path of a file from its ID More... | |
Public Member Functions inherited from IFS::IFileSystem | |
| virtual | ~IFileSystem () |
| Filing system implementations should dismount and cleanup here. More... | |
| virtual int | fopendir (const Stat *stat, DirHandle &dir) |
| open a directory for reading More... | |
| virtual int | fcontrol (FileHandle file, ControlCode code, void *buffer, size_t bufSize) |
| Low-level and non-standard file control operations. More... | |
Additional Inherited Members | |
Public Types inherited from IFS::IFileSystem | |
| enum | Type { Type::XX, Type::MAX } |
| enum | Attribute { Attribute::XX, Attribute::MAX } |
| using | Attributes = BitSet< uint8_t, Attribute, size_t(Attribute::MAX)> |
Constructor & Destructor Documentation
◆ FileSystem()
|
inline |
◆ ~FileSystem()
| IFS::SPIFFS::FileSystem::~FileSystem | ( | ) |
Member Function Documentation
◆ check()
|
overridevirtual |
Perform a file system consistency check.
- Return values
-
int error code
- Note
- if possible, issues should be resolved. Returns 0 if file system checked out OK. Otherwise there were issues: < 0 for unrecoverable errors,
0 for recoverable errors.
Reimplemented from IFS::IFileSystem.
◆ close()
|
overridevirtual |
close an open file
- Parameters
-
file handle to open file
- Return values
-
int error code
Implements IFS::IFileSystem.
◆ closedir()
close a directory object
- Parameters
-
dir directory to close
- Return values
-
int error code
Implements IFS::IFileSystem.
◆ eof()
|
overridevirtual |
determine if current file position is at end of file
- Parameters
-
file handle to open file
- Return values
-
int 0 - not EOF, > 0 - at EOF, < 0 - error
Implements IFS::IFileSystem.
◆ flush()
|
overridevirtual |
flush any buffered data to physical media
- Parameters
-
file handle to open file
- Return values
-
int error code
Implements IFS::IFileSystem.
◆ fopen()
|
overridevirtual |
open a file from it's stat structure
- Parameters
-
stat obtained from readdir() flags opens for opening file
- Return values
-
FileHandle file handle or error code
Implements IFS::IFileSystem.
◆ format()
|
overridevirtual |
format the filing system
- Return values
-
int error code
- Note
- this does a default format, returning file system to a fresh state The filing system implementation may define more specialised methods which can be called directly.
Implements IFS::IFileSystem.
◆ fremove()
|
overridevirtual |
remove (delete) a file by handle
- Parameters
-
file handle to open file
- Return values
-
int error code
Implements IFS::IFileSystem.
◆ fstat()
|
overridevirtual |
get file information
- Parameters
-
file handle to open file stat structure to return information in, may be null
- Return values
-
int error code
Implements IFS::IFileSystem.
◆ ftruncate()
|
overridevirtual |
Truncate (reduce) the size of an open file.
- Parameters
-
file Open file handle, must have Write access newSize
- Return values
-
int Error code
- Note
- In POSIX
ftruncate()can also make the file bigger, however SPIFFS can only reduce the file size and will return an error if newSize > fileSize
Implements IFS::IFileSystem.
◆ getErrorString()
◆ getFilePath()
| int IFS::SPIFFS::FileSystem::getFilePath | ( | FileID | fileid, |
| NameBuffer & | buffer | ||
| ) |
get the full path of a file from its ID
- Parameters
-
fileid buffer
- Return values
-
int error code
◆ getinfo()
get filing system information
- Parameters
-
info structure to read information into
- Return values
-
int error code
Implements IFS::IFileSystem.
◆ lseek()
|
overridevirtual |
change file read/write position
- Parameters
-
file handle to open file offset position relative to origin origin where to seek from (start/end or current position)
- Return values
-
int current position or error code
Implements IFS::IFileSystem.
◆ mkdir()
|
overridevirtual |
Create a directory.
- Parameters
-
path Path to directory
- Return values
-
int error code
Only the final directory in the path is guaranteed to be created. Usually, this call will fail if intermediate directories are not present. Use makedirs() for this purpose.
Implements IFS::IFileSystem.
◆ mount()
|
overridevirtual |
Mount file system, performing any required initialisation.
- Return values
-
error code
Implements IFS::IFileSystem.
◆ open()
|
overridevirtual |
open a file by name/path
- Parameters
-
path full path to file flags opens for opening file
- Return values
-
FileHandle file handle or error code
Implements IFS::IFileSystem.
◆ opendir()
open a directory for reading
- Parameters
-
path path to directory. nullptr is interpreted as root directory dir returns a pointer to the directory object
- Return values
-
int error code
Implements IFS::IFileSystem.
◆ read()
|
overridevirtual |
read content from a file and advance cursor
- Parameters
-
file handle to open file data buffer to write into size size of file buffer, maximum number of bytes to read
- Return values
-
int number of bytes read or error code
Implements IFS::IFileSystem.
◆ readdir()
read a directory entry
- Parameters
-
dir stat
- Return values
-
int error code
- Note
- File system allocates entries structure as it usually needs to track other information. It releases memory when closedir() is called.
Implements IFS::IFileSystem.
◆ remove()
|
overridevirtual |
remove (delete) a file by path
- Parameters
-
path
- Return values
-
int error code
Implements IFS::IFileSystem.
◆ rename()
|
overridevirtual |
◆ rewinddir()
Reset directory read position to start.
- Parameters
-
dir
- Return values
-
int error code
Implements IFS::IFileSystem.
◆ setacl()
|
overridevirtual |
Set access control information for file.
- Parameters
-
file handle to open file acl
- Return values
-
int error code
Implements IFS::IFileSystem.
◆ setattr()
|
overridevirtual |
Set file attributes.
- Parameters
-
path Full path to file attr
- Return values
-
int error code
Implements IFS::IFileSystem.
◆ setcompression()
|
overridevirtual |
Set file compression information.
- Parameters
-
file compression
- Return values
-
int error code
Implements IFS::IFileSystem.
◆ settime()
|
overridevirtual |
Set modificatino tiem for file.
- Parameters
-
file handle to open file, must have write access
- Return values
-
int error code
- Note
- any subsequent writes to file will reset this to current time
Implements IFS::IFileSystem.
◆ stat()
get file information
- Parameters
-
path name or path of file s structure to return information in, may be null to do a simple file existence check
- Return values
-
int error code
Implements IFS::IFileSystem.
◆ tell()
|
overridevirtual |
get current file position
- Parameters
-
file handle to open file
- Return values
-
int32_t current position relative to start of file, or error code
Implements IFS::IFileSystem.
◆ write()
|
overridevirtual |
write content to a file at current position and advance cursor
- Parameters
-
file handle to open file data buffer to read from size number of bytes to write
- Return values
-
int number of bytes written or error code
Implements IFS::IFileSystem.
The documentation for this class was generated from the following file:
Public Member Functions inherited from
1.8.13