forked from Imagelibrary/littlefs
Added LFS_T_RDONLY, LFS_T_RDWR, etc
These mimic the relevant LFS_O_* flags, and allow users to assert
whether or not a traversal will mutate the filesystem:
LFS_T_MODE 0x00000001 The traversal's access mode
LFS_T_RDWR 0x00000000 Open traversal as read and write
LFS_T_RDONLY 0x00000001 Open traversal as read only
In theory, these could also change internal allocations, but littlefs
doesn't really work that way.
Note we _don't_ add related LFS_GC_RDONLY, LFS_GC_RDWR, etc flags. These
are sort of implied by the relevant LFS_M_* flags.
Adds a bit more code, probably because of the slightly more complicated
internal constants for the internal traversals. But I think the
self-documentingness is worth it:
code stack ctx
before: 37200 2288 636
after: 37220 (+0.1%) 2288 (+0.0%) 636 (+0.0%)
This commit is contained in:
@@ -126,7 +126,10 @@ FLAGS = [
|
||||
('i', 'INMTREE', 0x08000000, "Committing to mtree" ),
|
||||
|
||||
# Traversal flags
|
||||
('T', 'MTREEONLY', 0x00000004, "Only traverse the mtree" ),
|
||||
('T', 'MODE', 1, "The traversal's access mode" ),
|
||||
('^', 'RDWR', 0, "Open traversal as read and write" ),
|
||||
('^', 'RDONLY', 1, "Open traversal as read only" ),
|
||||
('T', 'MTREEONLY', 0x00000002, "Only traverse the mtree" ),
|
||||
('T', 'MKCONSISTENT',
|
||||
0x00000100, "Make the filesystem consistent" ),
|
||||
('T', 'LOOKAHEAD', 0x00000200, "Populate lookahead buffer" ),
|
||||
|
||||
Reference in New Issue
Block a user