forked from Imagelibrary/littlefs
Adopted different strategy for hypothetical future configs
Instead of writing every possible config that has the potential to be useful in the future, stick to just writing the configs that we know are useful, and error if we see any configs we don't understand. This prevents unnecessary config bloat, while still allowing configs to be introduced in a backwards compatible way in the future. Currently unknown configs are treated as a mount error, but in theory you could still try to read the filesystem, just with potentially corrupted data. Maybe this could be behind some sort of "FORCE" mount flag. littlefs must never write to the filesystem if it finds unknown configs. --- This also creates a curious case for the hole in our tag encoding previously taken up by the OCOMPATFLAGS config. We can query for any config > SIZELIMIT with lookupnext, but the OCOMPATFLAGS flag would need an extra lookup which just isn't worth it. Instead I'm just adding OCOMPATFLAGS back in. To support OCOMPATFLAGS littlefs has to do literally nothing, so this is really more of a documentation change. And who know, maybe OCOMPATFLAGS will have some weird use case in the future...
This commit is contained in:
@@ -12,18 +12,13 @@ TAG_NULL = 0x0000
|
||||
TAG_CONFIG = 0x0000
|
||||
TAG_MAGIC = 0x0003
|
||||
TAG_VERSION = 0x0004
|
||||
TAG_OCOMPATFLAGS = 0x0005
|
||||
TAG_RCOMPATFLAGS = 0x0006
|
||||
TAG_WCOMPATFLAGS = 0x0007
|
||||
TAG_BLOCKSIZE = 0x0008
|
||||
TAG_BLOCKCOUNT = 0x0009
|
||||
TAG_NAMELIMIT = 0x000a
|
||||
TAG_SIZELIMIT = 0x000b
|
||||
TAG_UTAGLIMIT = 0x000c
|
||||
TAG_UATTRLIMIT = 0x000d
|
||||
TAG_STAGLIMIT = 0x000e
|
||||
TAG_SATTRLIMIT = 0x000f
|
||||
TAG_MDIRLIMIT = 0x0010
|
||||
TAG_MTREELIMIT = 0x0011
|
||||
TAG_GDELTA = 0x0100
|
||||
TAG_GRMDELTA = 0x0100
|
||||
TAG_NAME = 0x0200
|
||||
@@ -168,18 +163,13 @@ def tagrepr(tag, w, size, off=None):
|
||||
'shrub' if tag & TAG_SHRUB else '',
|
||||
'magic' if (tag & 0xfff) == TAG_MAGIC
|
||||
else 'version' if (tag & 0xfff) == TAG_VERSION
|
||||
else 'ocompatflags' if (tag & 0xfff) == TAG_OCOMPATFLAGS
|
||||
else 'rcompatflags' if (tag & 0xfff) == TAG_RCOMPATFLAGS
|
||||
else 'wcompatflags' if (tag & 0xfff) == TAG_WCOMPATFLAGS
|
||||
else 'blocksize' if (tag & 0xfff) == TAG_BLOCKSIZE
|
||||
else 'blockcount' if (tag & 0xfff) == TAG_BLOCKCOUNT
|
||||
else 'sizelimit' if (tag & 0xfff) == TAG_SIZELIMIT
|
||||
else 'namelimit' if (tag & 0xfff) == TAG_NAMELIMIT
|
||||
else 'utaglimit' if (tag & 0xfff) == TAG_UTAGLIMIT
|
||||
else 'uattrlimit' if (tag & 0xfff) == TAG_UATTRLIMIT
|
||||
else 'staglimit' if (tag & 0xfff) == TAG_STAGLIMIT
|
||||
else 'sattrlimit' if (tag & 0xfff) == TAG_SATTRLIMIT
|
||||
else 'mdirlimit' if (tag & 0xfff) == TAG_MDIRLIMIT
|
||||
else 'mtreelimit' if (tag & 0xfff) == TAG_MTREELIMIT
|
||||
else 'config 0x%02x' % (tag & 0xff),
|
||||
' w%d' % w if w else '',
|
||||
size)
|
||||
|
||||
Reference in New Issue
Block a user