mirror of
https://github.com/littlefs-project/littlefs.git
synced 2025-12-26 17:18:26 +00:00
Reworked the flag encoding again
This time to account for the new LFS_o_UNCRYST and LFS_o_UNGRAFT flags.
This required moving the T flags out of the way, which of course
conflicted with TSTATE, so that had to move...
One thing that helped was shoving LFS_O_DESYNC up with the internal
state flags. It's definitely more a state flag than the other public
flags, it just also happens to be user toggleable.
Here's the new jenga:
8 8 8 8
.----++----++----++----.
.-..----..-..-..-------.
o_flags: |t|| f ||o||t|| o |
|-||-.--':-:|-|'--.-.--'
|-||-|.----.|-'--------.
t_flags: |t||f||tstt|| t |
'-''-''----'|----.-----'
.----..-.:-:|----|:-:.-.
m_flags: | m ||c||o|| t ||o||m|
|----||-|'-'|-.--''-''-'
|----||-|---|-|.-------.
f_flags: | m ||c| |t|| f |
'----''-'---'-''-------'
This adds a bit of code, but that's not the end of the world:
code stack ctx
before: 37172 2288 636
after: 37200 (+0.1%) 2288 (+0.0%) 636 (+0.0%)
This commit is contained in:
@@ -32,9 +32,9 @@ FLAGS = [
|
||||
('O', 'APPEND', 0x00000020, "Move to end of file on every write" ),
|
||||
('O', 'FLUSH', 0x00000040, "Flush data on every write" ),
|
||||
('O', 'SYNC', 0x00000080, "Sync metadata on every write" ),
|
||||
('O', 'DESYNC', 0x00000100, "Do not sync or recieve file updates" ),
|
||||
('O', 'CKMETA', 0x00100000, "Check metadata checksums" ),
|
||||
('O', 'CKDATA', 0x00200000, "Check metadata + data checksums" ),
|
||||
('O', 'DESYNC', 0x04000000, "Do not sync or recieve file updates" ),
|
||||
('O', 'CKMETA', 0x00001000, "Check metadata checksums" ),
|
||||
('O', 'CKDATA', 0x00002000, "Check metadata + data checksums" ),
|
||||
|
||||
('o', 'TYPE', 0xf0000000, "The file's type" ),
|
||||
('^', 'REG', 0x10000000, "Type = regular-file" ),
|
||||
@@ -44,12 +44,12 @@ FLAGS = [
|
||||
('^', 'ORPHAN', 0x50000000, "Type = orphan" ),
|
||||
('^', 'TRAVERSAL', 0x60000000, "Type = traversal" ),
|
||||
('^', 'UNKNOWN', 0x70000000, "Type = unknown" ),
|
||||
('o', 'UNCRYST', 0x00400000, "File's leaf not fully crystallized" ),
|
||||
('o', 'UNGRAFT', 0x00800000, "File's leaf does not match bshrub/btree" ),
|
||||
('o', 'UNFLUSH', 0x01000000, "File's data does not match disk" ),
|
||||
('o', 'UNSYNC', 0x02000000, "File's metadata does not match disk" ),
|
||||
('o', 'UNCREAT', 0x04000000, "File does not exist yet" ),
|
||||
('o', 'ZOMBIE', 0x08000000, "File has been removed" ),
|
||||
('o', 'UNCREAT', 0x02000000, "File does not exist yet" ),
|
||||
('o', 'UNSYNC', 0x01000000, "File's metadata does not match disk" ),
|
||||
('o', 'UNCRYST', 0x00800000, "File's leaf not fully crystallized" ),
|
||||
('o', 'UNGRAFT', 0x00400000, "File's leaf does not match bshrub/btree" ),
|
||||
('o', 'UNFLUSH', 0x00200000, "File's data does not match disk" ),
|
||||
|
||||
# Custom attribute flags
|
||||
('A', 'MODE', 3, "The attr's access mode" ),
|
||||
@@ -63,15 +63,15 @@ FLAGS = [
|
||||
('^', 'RDWR', 0, "Format the filesystem as read and write" ),
|
||||
('F', 'REVDBG', 0x00000010, "Add debug info to revision counts" ),
|
||||
('F', 'REVNOISE', 0x00000020, "Add noise to revision counts" ),
|
||||
('F', 'CKPROGS', 0x00000800, "Check progs by reading back progged data" ),
|
||||
('F', 'CKFETCHES', 0x00001000, "Check block checksums before first use" ),
|
||||
('F', 'CKPROGS', 0x00080000, "Check progs by reading back progged data" ),
|
||||
('F', 'CKFETCHES', 0x00100000, "Check block checksums before first use" ),
|
||||
('F', 'CKMETAPARITY',
|
||||
0x00002000, "Check metadata tag parity bits" ),
|
||||
0x00200000, "Check metadata tag parity bits" ),
|
||||
('F', 'CKDATACKSUMREADS',
|
||||
0x00008000, "Check data checksums on reads" ),
|
||||
0x00800000, "Check data checksums on reads" ),
|
||||
|
||||
('F', 'CKMETA', 0x00100000, "Check metadata checksums" ),
|
||||
('F', 'CKDATA', 0x00200000, "Check metadata + data checksums" ),
|
||||
('F', 'CKMETA', 0x00001000, "Check metadata checksums" ),
|
||||
('F', 'CKDATA', 0x00002000, "Check metadata + data checksums" ),
|
||||
|
||||
# Filesystem mount flags
|
||||
('M', 'MODE', 1, "Mount's access mode" ),
|
||||
@@ -81,27 +81,27 @@ FLAGS = [
|
||||
('M', 'SYNC', 0x00000080, "Open all files with LFS_O_SYNC" ),
|
||||
('M', 'REVDBG', 0x00000010, "Add debug info to revision counts" ),
|
||||
('M', 'REVNOISE', 0x00000020, "Add noise to revision counts" ),
|
||||
('M', 'CKPROGS', 0x00000800, "Check progs by reading back progged data" ),
|
||||
('M', 'CKFETCHES', 0x00001000, "Check block checksums before first use" ),
|
||||
('M', 'CKPROGS', 0x00080000, "Check progs by reading back progged data" ),
|
||||
('M', 'CKFETCHES', 0x00100000, "Check block checksums before first use" ),
|
||||
('M', 'CKMETAPARITY',
|
||||
0x00002000, "Check metadata tag parity bits" ),
|
||||
0x00200000, "Check metadata tag parity bits" ),
|
||||
('M', 'CKDATACKSUMREADS',
|
||||
0x00008000, "Check data checksums on reads" ),
|
||||
0x00800000, "Check data checksums on reads" ),
|
||||
|
||||
('M', 'MKCONSISTENT',
|
||||
0x00010000, "Make the filesystem consistent" ),
|
||||
('M', 'LOOKAHEAD', 0x00020000, "Populate lookahead buffer" ),
|
||||
('M', 'COMPACT', 0x00080000, "Compact metadata logs" ),
|
||||
('M', 'CKMETA', 0x00100000, "Check metadata checksums" ),
|
||||
('M', 'CKDATA', 0x00200000, "Check metadata + data checksums" ),
|
||||
0x00000100, "Make the filesystem consistent" ),
|
||||
('M', 'LOOKAHEAD', 0x00000200, "Populate lookahead buffer" ),
|
||||
('M', 'COMPACT', 0x00000800, "Compact metadata logs" ),
|
||||
('M', 'CKMETA', 0x00001000, "Check metadata checksums" ),
|
||||
('M', 'CKDATA', 0x00002000, "Check metadata + data checksums" ),
|
||||
|
||||
# GC flags
|
||||
('GC', 'MKCONSISTENT',
|
||||
0x00010000, "Make the filesystem consistent" ),
|
||||
('GC', 'LOOKAHEAD',0x00020000, "Populate lookahead buffer" ),
|
||||
('GC', 'COMPACT', 0x00080000, "Compact metadata logs" ),
|
||||
('GC', 'CKMETA', 0x00100000, "Check metadata checksums" ),
|
||||
('GC', 'CKDATA', 0x00200000, "Check metadata + data checksums" ),
|
||||
0x00000100, "Make the filesystem consistent" ),
|
||||
('GC', 'LOOKAHEAD',0x00000200, "Populate lookahead buffer" ),
|
||||
('GC', 'COMPACT', 0x00000800, "Compact metadata logs" ),
|
||||
('GC', 'CKMETA', 0x00001000, "Check metadata checksums" ),
|
||||
('GC', 'CKDATA', 0x00002000, "Check metadata + data checksums" ),
|
||||
|
||||
# Filesystem info flags
|
||||
('I', 'RDONLY', 0x00000001, "Mounted read only" ),
|
||||
@@ -109,32 +109,32 @@ FLAGS = [
|
||||
('I', 'SYNC', 0x00000080, "Mounted with LFS_M_SYNC" ),
|
||||
('I', 'REVDBG', 0x00000010, "Mounted with LFS_M_REVDBG" ),
|
||||
('I', 'REVNOISE', 0x00000020, "Mounted with LFS_M_REVNOISE" ),
|
||||
('I', 'CKPROGS', 0x00000800, "Mounted with LFS_M_CKPROGS" ),
|
||||
('I', 'CKFETCHES', 0x00001000, "Mounted with LFS_M_CKFETCHES" ),
|
||||
('I', 'CKPROGS', 0x00080000, "Mounted with LFS_M_CKPROGS" ),
|
||||
('I', 'CKFETCHES', 0x00100000, "Mounted with LFS_M_CKFETCHES" ),
|
||||
('I', 'CKMETAPARITY',
|
||||
0x00002000, "Mounted with LFS_M_CKMETAPARITY" ),
|
||||
0x00200000, "Mounted with LFS_M_CKMETAPARITY" ),
|
||||
('I', 'CKDATACKSUMREADS',
|
||||
0x00008000, "Mounted with LFS_M_CKDATACKSUMREADS" ),
|
||||
0x00800000, "Mounted with LFS_M_CKDATACKSUMREADS" ),
|
||||
|
||||
('I', 'MKCONSISTENT',
|
||||
0x00010000, "Filesystem needs mkconsistent to write" ),
|
||||
('I', 'LOOKAHEAD', 0x00020000, "Lookahead buffer is not full" ),
|
||||
('I', 'COMPACT', 0x00080000, "Filesystem may have uncompacted metadata" ),
|
||||
('I', 'CKMETA', 0x00100000, "Metadata checksums not checked recently" ),
|
||||
('I', 'CKDATA', 0x00200000, "Data checksums not checked recently" ),
|
||||
0x00000100, "Filesystem needs mkconsistent to write" ),
|
||||
('I', 'LOOKAHEAD', 0x00000200, "Lookahead buffer is not full" ),
|
||||
('I', 'COMPACT', 0x00000800, "Filesystem may have uncompacted metadata" ),
|
||||
('I', 'CKMETA', 0x00001000, "Metadata checksums not checked recently" ),
|
||||
('I', 'CKDATA', 0x00002000, "Data checksums not checked recently" ),
|
||||
|
||||
('i', 'INMTREE', 0x01000000, "Committing to mtree" ),
|
||||
('i', 'INMTREE', 0x08000000, "Committing to mtree" ),
|
||||
|
||||
# Traversal flags
|
||||
('T', 'MTREEONLY', 0x00000010, "Only traverse the mtree" ),
|
||||
('T', 'MTREEONLY', 0x00000004, "Only traverse the mtree" ),
|
||||
('T', 'MKCONSISTENT',
|
||||
0x00010000, "Make the filesystem consistent" ),
|
||||
('T', 'LOOKAHEAD', 0x00020000, "Populate lookahead buffer" ),
|
||||
('T', 'COMPACT', 0x00080000, "Compact metadata logs" ),
|
||||
('T', 'CKMETA', 0x00100000, "Check metadata checksums" ),
|
||||
('T', 'CKDATA', 0x00200000, "Check metadata + data checksums" ),
|
||||
0x00000100, "Make the filesystem consistent" ),
|
||||
('T', 'LOOKAHEAD', 0x00000200, "Populate lookahead buffer" ),
|
||||
('T', 'COMPACT', 0x00000800, "Compact metadata logs" ),
|
||||
('T', 'CKMETA', 0x00001000, "Check metadata checksums" ),
|
||||
('T', 'CKDATA', 0x00002000, "Check metadata + data checksums" ),
|
||||
|
||||
('t', 'TYPE', 0xf0000000, "The file's type" ),
|
||||
('t', 'TYPE', 0xf0000000, "The traversal's type" ),
|
||||
('^', 'REG', 0x10000000, "Type = regular-file" ),
|
||||
('^', 'DIR', 0x20000000, "Type = directory" ),
|
||||
('^', 'STICKYNOTE',0x30000000, "Type = stickynote" ),
|
||||
@@ -142,24 +142,24 @@ FLAGS = [
|
||||
('^', 'ORPHAN', 0x50000000, "Type = orphan" ),
|
||||
('^', 'TRAVERSAL', 0x60000000, "Type = traversal" ),
|
||||
('^', 'UNKNOWN', 0x70000000, "Type = unknown" ),
|
||||
('t', 'TSTATE', 0x0000000f, "The traversal's current tstate" ),
|
||||
('t', 'TSTATE', 0x000f0000, "The current traversal state" ),
|
||||
('^', 'MROOTANCHOR',
|
||||
0x00000000, "Tstate = mroot-anchor" ),
|
||||
('^', 'MROOTCHAIN',0x00000001, "Tstate = mroot-chain" ),
|
||||
('^', 'MTREE', 0x00000002, "Tstate = mtree" ),
|
||||
('^', 'MDIRS', 0x00000003, "Tstate = mtree-mdirs" ),
|
||||
('^', 'MDIR', 0x00000004, "Tstate = mdir" ),
|
||||
('^', 'BTREE', 0x00000005, "Tstate = btree" ),
|
||||
('^', 'OMDIRS', 0x00000006, "Tstate = open-mdirs" ),
|
||||
('^', 'OBTREE', 0x00000007, "Tstate = open-btree" ),
|
||||
('^', 'DONE', 0x00000008, "Tstate = done" ),
|
||||
('t', 'BTYPE', 0x00000f00, "The traversal's current btype" ),
|
||||
('^', 'MDIR', 0x00000100, "Btype = mdir" ),
|
||||
('^', 'BTREE', 0x00000200, "Btype = btree" ),
|
||||
('^', 'DATA', 0x00000300, "Btype = data" ),
|
||||
('t', 'DIRTY', 0x01000000, "Filesystem modified during traversal" ),
|
||||
('t', 'MUTATED', 0x02000000, "Filesystem modified by traversal" ),
|
||||
('^', 'MROOTCHAIN',0x00010000, "Tstate = mroot-chain" ),
|
||||
('^', 'MTREE', 0x00020000, "Tstate = mtree" ),
|
||||
('^', 'MDIRS', 0x00030000, "Tstate = mtree-mdirs" ),
|
||||
('^', 'MDIR', 0x00040000, "Tstate = mdir" ),
|
||||
('^', 'BTREE', 0x00050000, "Tstate = btree" ),
|
||||
('^', 'OMDIRS', 0x00060000, "Tstate = open-mdirs" ),
|
||||
('^', 'OBTREE', 0x00070000, "Tstate = open-btree" ),
|
||||
('^', 'DONE', 0x00080000, "Tstate = done" ),
|
||||
('t', 'BTYPE', 0x00f00000, "The current block type" ),
|
||||
('^', 'MDIR', 0x00100000, "Btype = mdir" ),
|
||||
('^', 'BTREE', 0x00200000, "Btype = btree" ),
|
||||
('^', 'DATA', 0x00300000, "Btype = data" ),
|
||||
('t', 'ZOMBIE', 0x08000000, "File has been removed" ),
|
||||
('t', 'DIRTY', 0x02000000, "Filesystem modified during traversal" ),
|
||||
('t', 'MUTATED', 0x01000000, "Filesystem modified by traversal" ),
|
||||
|
||||
# Read-compat flags
|
||||
('RCOMPAT', 'NONSTANDARD',
|
||||
|
||||
Reference in New Issue
Block a user