#include "distortos/FileSystem/littlefs1/Littlefs1Directory.hpp"
|
class | Littlefs1FileSystem |
|
◆ ~Littlefs1Directory()
distortos::Littlefs1Directory::~Littlefs1Directory |
( |
| ) |
|
|
override |
◆ Littlefs1Directory()
constexpr distortos::Littlefs1Directory::Littlefs1Directory |
( |
Littlefs1FileSystem & |
fileSystem | ) |
|
|
inlineexplicitprivate |
Littlefs1Directory's constructor.
- Parameters
-
[in] | fileSystem | is a reference to owner file system |
◆ close()
int distortos::Littlefs1Directory::close |
( |
| ) |
|
|
overridevirtual |
Closes directory.
Similar to closedir()
- Note
- Even if error code is returned, the directory must not be used.
- Warning
- This function must not be called from interrupt context!
- Precondition
- Directory is opened.
- Postcondition
- Directory is closed.
- Returns
- 0 on success, error code otherwise:
- converted error codes returned by lfs1_dir_close();
Implements distortos::Directory.
◆ getPosition()
std::pair< int, off_t > distortos::Littlefs1Directory::getPosition |
( |
| ) |
|
|
overridevirtual |
Returns current position in the directory.
Similar to telldir()
- Warning
- This function must not be called from interrupt context!
- Precondition
- Directory is opened.
- Returns
- pair with return code (0 on success, error code otherwise) and current position in the directory; error codes:
- converted error codes returned by lfs1_dir_tell();
Implements distortos::Directory.
◆ lock()
void distortos::Littlefs1Directory::lock |
( |
| ) |
|
|
overridevirtual |
Locks the directory for exclusive use by current thread.
When the object is locked, any call to any member function from other thread will be blocked until the object is unlocked. Locking is optional, but may be useful when more than one operation must be done atomically.
- Note
- Locks are recursive.
- Warning
- This function must not be called from interrupt context!
- Precondition
- The number of recursive locks of directory is less than 65535.
- Postcondition
- Directory is locked.
Implements distortos::Directory.
◆ open()
int distortos::Littlefs1Directory::open |
( |
const char * |
path | ) |
|
|
private |
Opens directory.
- Precondition
- Directory is not opened.
-
path is valid.
- Parameters
-
[in] | path | is the path of directory that will be opened, must be valid |
- Returns
- 0 on success, error code otherwise:
- converted error codes returned by lfs1_dir_open();
◆ read()
int distortos::Littlefs1Directory::read |
( |
dirent & |
entry | ) |
|
|
overridevirtual |
Reads next entry from directory.
Similar to readdir_r()
d_name
field is set in all cases. All other fields are zero-initialized.
- Warning
- This function must not be called from interrupt context!
- Precondition
- Directory is opened.
- Parameters
-
[out] | entry | is a reference to dirent struct into which next entry from directory will be written |
- Returns
- 0 on success, error code otherwise:
- ENOENT - current position in the directory is invalid (i.e. end of the directory reached);
- converted error codes returned by lfs1_dir_read();
Implements distortos::Directory.
◆ rewind()
int distortos::Littlefs1Directory::rewind |
( |
| ) |
|
|
overridevirtual |
Resets current position in the directory.
Similar to rewinddir()
- Warning
- This function must not be called from interrupt context!
- Precondition
- Directory is opened.
- Returns
- 0 on success, error code otherwise:
- converted error codes returned by lfs1_dir_rewind();
Implements distortos::Directory.
◆ seek()
int distortos::Littlefs1Directory::seek |
( |
off_t |
position | ) |
|
|
overridevirtual |
Moves position in the directory.
Similar to seekdir()
- Warning
- This function must not be called from interrupt context!
- Precondition
- Directory is opened.
- Parameters
-
[in] | position | is the value of position, must be a value previously returned by getPosition()! |
- Returns
- 0 on success, error code otherwise:
- converted error codes returned by lfs1_dir_seek();
Implements distortos::Directory.
◆ unlock()
void distortos::Littlefs1Directory::unlock |
( |
| ) |
|
|
overridevirtual |
Unlocks the directory which was previously locked by current thread.
- Note
- Locks are recursive.
- Warning
- This function must not be called from interrupt context!
- Precondition
- This function is called by the thread that locked the directory.
Implements distortos::Directory.
◆ directory_
lfs1_dir_t distortos::Littlefs1Directory::directory_ |
|
private |
◆ fileSystem_
reference to owner file system
◆ opened_
bool distortos::Littlefs1Directory::opened_ |
|
private |
true if directory is opened, false otherwise
The documentation for this class was generated from the following files: