12 #ifndef INCLUDE_DISTORTOS_FILESYSTEM_LITTLEFS1_LITTLEFS1FILESYSTEM_HPP_ 13 #define INCLUDE_DISTORTOS_FILESYSTEM_LITTLEFS1_LITTLEFS1FILESYSTEM_HPP_ 27 class MemoryTechnologyDevice;
58 const size_t readBlockSize = {},
const size_t programBlockSize = {},
const size_t eraseBlockSize = {},
59 const size_t blocksCount = {},
const size_t lookahead = 32 * 16) :
62 mutex_{Mutex::Type::recursive, Mutex::Protocol::priorityInheritance},
122 int getFileStatus(
const char* path,
struct stat& status)
override;
159 void lock()
override;
193 int mount()
override;
213 std::pair<int, std::unique_ptr<Directory>>
openDirectory(
const char* path)
override;
236 std::pair<int, std::unique_ptr<File>>
openFile(
const char* path,
int flags)
override;
254 int remove(
const char* path)
override;
273 int rename(
const char* path,
const char* newPath)
override;
349 #endif // INCLUDE_DISTORTOS_FILESYSTEM_LITTLEFS1_LITTLEFS1FILESYSTEM_HPP_ Definition: Littlefs1Directory.hpp:30
int rename(const char *path, const char *newPath) override
Renames file or directory.
Definition: Littlefs1FileSystem.cpp:436
size_t lookahead_
number of blocks to lookahead during block allocation
Definition: Littlefs1FileSystem.hpp:341
bool mounted_
tells whether the file system is currently mounted on associated memory technology device (true) or n...
Definition: Littlefs1FileSystem.hpp:344
size_t readBlockSize_
read block size, bytes, 0 to use default value of device
Definition: Littlefs1FileSystem.hpp:329
void lock() override
Locks the file system for exclusive use by current thread.
Definition: Littlefs1FileSystem.cpp:303
lfs1_config configuration_
configuration of littlefs
Definition: Littlefs1FileSystem.hpp:308
void unlock() override
Unlocks the file system which was previously locked by current thread.
Definition: Littlefs1FileSystem.cpp:448
Definition: MemoryTechnologyDevice.hpp:30
devices::MemoryTechnologyDevice & memoryTechnologyDevice_
reference to associated memory technology device
Definition: Littlefs1FileSystem.hpp:326
std::pair< int, std::unique_ptr< Directory > > openDirectory(const char *path) override
Opens directory.
Definition: Littlefs1FileSystem.cpp:387
int getFileStatus(const char *path, struct stat &status) override
Returns status of file.
Definition: Littlefs1FileSystem.cpp:259
int format() override
Formats associated device with the file system.
Definition: Littlefs1FileSystem.cpp:200
size_t programBlockSize_
program block size, bytes, 0 to use default value of device
Definition: Littlefs1FileSystem.hpp:332
int unmount() override
Unmounts file system from associated device.
Definition: Littlefs1FileSystem.cpp:454
std::unique_ptr< uint8_t[]> readBuffer_
read buffer
Definition: Littlefs1FileSystem.hpp:323
int remove(const char *path) override
Removes file or directory.
Definition: Littlefs1FileSystem.cpp:425
Top-level namespace of distortos project.
Definition: buttons.hpp:33
std::unique_ptr< uint8_t[]> lookaheadBuffer_
lookahead buffer
Definition: Littlefs1FileSystem.hpp:317
Mutex is the basic synchronization primitive.
Definition: Mutex.hpp:30
Definition: Littlefs1File.hpp:34
Definition: Littlefs1FileSystem.hpp:37
std::unique_ptr< uint8_t[]> programBuffer_
program buffer
Definition: Littlefs1FileSystem.hpp:320
int makeDirectory(const char *path, mode_t mode) override
Makes a directory.
Definition: Littlefs1FileSystem.cpp:309
int getStatus(struct statvfs &status) override
Returns status of file system.
Definition: Littlefs1FileSystem.cpp:280
lfs1_t fileSystem_
littlefs-v1 file system
Definition: Littlefs1FileSystem.hpp:311
~Littlefs1FileSystem() override
Littlefs1FileSystem's destructor.
Definition: Littlefs1FileSystem.cpp:195
Definition: FileSystem.hpp:34
int mount() override
Mounts file system on associated device.
Definition: Littlefs1FileSystem.cpp:320
std::pair< int, std::unique_ptr< File > > openFile(const char *path, int flags) override
Opens file.
Definition: Littlefs1FileSystem.cpp:406
constexpr Littlefs1FileSystem(devices::MemoryTechnologyDevice &memoryTechnologyDevice, const size_t readBlockSize={}, const size_t programBlockSize={}, const size_t eraseBlockSize={}, const size_t blocksCount={}, const size_t lookahead=32 *16)
Littlefs1FileSystem's constructor.
Definition: Littlefs1FileSystem.hpp:57
size_t eraseBlockSize_
erase block size, bytes, 0 to use default value of device
Definition: Littlefs1FileSystem.hpp:335
distortos::Mutex mutex_
mutex for serializing access to the object
Definition: Littlefs1FileSystem.hpp:314
size_t blocksCount_
number of erase blocks used for file system, 0 to use max value of device
Definition: Littlefs1FileSystem.hpp:338