Edited tag structure to balance size vs id count

This is a minor tweak that resulted from looking at some other use cases
for the littlefs data-structure on disk. Consider an implementation that
does not need to buffer inline-files in RAM. In this case we should have
as large a tag size field as possible. Unfortunately, we don't have much
space to work with in the 32-bit tag struct, so we have to make some
compromises. These limitations could be removed with a 64-bit tag
struct, at the cost of code size.

32-bit tag structure:
[---       32       ---]
[1|- 9 -|- 9 -|-- 13 --]
 ^   ^     ^      ^- entry length
 |   |     \-------- file id
 |   \-------------- tag type
 \------------------ valid bit
This commit is contained in:
Christopher Haster
2018-09-15 02:40:53 -05:00
parent cafe6ab466
commit d7e4abad0b
4 changed files with 45 additions and 45 deletions

View File

@@ -19,7 +19,7 @@ def corrupt(block):
break
tag ^= ntag
size = (tag & 0xfff) if (tag & 0xfff) != 0xfff else 0
size = (tag & 0x1fff) if (tag & 0x1fff) != 0x1fff else 0
file.seek(size, os.SEEK_CUR)
# lob off last 3 bytes