46#ifdef USE_STORAGE_LOCK
Mutex implementation, with API based on the unavailable std::mutex.
A device addressed in fixed size blocks, such as a flash chip, an SD card or a RAM buffer.
StorageError sync()
Return once all earlier writes are stored on the media.
virtual StorageError device_program(uint32_t block, uint32_t offset, const void *buf, uint32_t len)=0
StorageError trim(uint32_t block, uint32_t count)
Tell the device that the blocks no longer hold data it needs to keep.
StorageError check_access_(uint32_t block, uint32_t offset, uint32_t len, uint16_t align, bool write) const
virtual StorageError device_read(uint32_t block, uint32_t offset, void *buf, uint32_t len)=0
uint8_t get_media_generation() const
Changes each time media is inserted or removed, so a user can tell that its cached state is stale.
uint8_t media_generation_
StorageError read(uint32_t block, uint32_t offset, void *buf, uint32_t len)
void dump_geometry_(const char *tag) const
virtual StorageError device_trim(uint32_t block, uint32_t count)
StorageError check_range_(uint32_t block, uint32_t count) const
uint64_t get_capacity() const
StorageError program(uint32_t block, uint32_t offset, const void *buf, uint32_t len)
const BlockGeometry & get_geometry() const
virtual StorageError device_erase(uint32_t block, uint32_t count)
StorageError erase(uint32_t block, uint32_t count)
virtual StorageError device_sync()
@ STORAGE_ERROR_READ_ONLY
const LogString * storage_error_to_string(StorageError error)
The shape of a block device. A block_count of 0 means no media is present.
Stands in for a mutex where nothing runs on other tasks.