Skip to content

Commit 5c4ee21

Browse files
jrastgeky
authored andcommitted
Added a note about the callback functions
Added a short section about the callback functions, based on the answers to issue #35 and #36
1 parent 1552246 commit 5c4ee21

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,18 @@ really do anything to ensure that the data written to disk is machine portable.
120120
This is fine as long as all of the involved machines share endianness
121121
(little-endian) and don't have strange padding requirements.
122122
123+
In the configuration struct, the `prog` and `erase` function provided by the
124+
user may return a `LFS_ERR_CORRUPT` error if the implementation already can
125+
detect corrupt blocks. However, the wear leveling does not depend on the return
126+
code of these functions, instead all data is read back and checked for
127+
integrity.
128+
129+
If your storage caches writes, make sure that the provided `sync` function
130+
flushes all the data to memory and ensures that the next read fetches the data
131+
from memory, otherwise data integrity can not be guaranteed. If the `write`
132+
function does not perform caching, and therefore each `read` or `write` call
133+
hits the memory, the `sync` function can simply return 0.
134+
123135
## Reference material
124136
125137
[DESIGN.md](DESIGN.md) - DESIGN.md contains a fully detailed dive into how

0 commit comments

Comments
 (0)