Reworked rcompat flags

Mainly to add LFS_RCOMPAT_MSPROUT. It makes sense that a littlefs driver
may not want to support mroot-inlined mdirs, and this flag would be the
only way to indicate that. (Currently inlined mdir -> mtree is one way,
but this may not always be the case.)

This also makes space for a couple planned features:

  LFS_RCOMPAT_NONSTANDARD  0x00000001  Non-standard filesystem format
  LFS_RCOMPAT_WRONLY*      0x00000002  Reading is disallowed
  LFS_RCOMPAT_GRM          0x00000004  May use a global-remove
  LFS_RCOMPAT_MSPROUT      0x00000010  May use an inlined mdir
  LFS_RCOMPAT_MLEAF        0x00000020  May use a single mdir pointer
  LFS_RCOMPAT_MSHRUB       0x00000040  May use an inlined mtree
  LFS_RCOMPAT_MTREE        0x00000080  May use an mdir btree
  LFS_RCOMPAT_BSPROUT      0x00000100  Files may use inlined data
  LFS_RCOMPAT_BLEAF        0x00000200  Files may use single block pointers
  LFS_RCOMPAT_BSHRUB       0x00000400  Files may use inlined btrees
  LFS_RCOMPAT_BTREE        0x00000800  Files may use btrees

  *Planned

I've gone ahead and included rcompat flags we reserve but don't
currently use (LFS_RCOMPAT_MSHRUB). It seems like a good idea to make
these reservations explicit. Though we should still prohibit their use
until there is a good reason, in case we want to repurpose these flags
in the future.

Code changes minimal (larger literal? compiler noise?):

           code          stack          ctx
  before: 37788           2608          620
  after:  37792 (+0.0%)   2608 (+0.0%)  620 (+0.0%)
This commit is contained in:
Christopher Haster
2025-01-09 18:23:55 -06:00
parent 5f6dbdcb14
commit af6ea39cca
2 changed files with 22 additions and 17 deletions
+9 -7
View File
@@ -149,13 +149,15 @@ FLAGS = [
# Read-compat flags
('RCOMPAT', 'NONSTANDARD',
0x0001, "Non-standard filesystem format" ),
('RCOMPAT', 'MLEAF', 0x0002, "May use a single mdir pointer" ),
('RCOMPAT', 'MTREE', 0x0008, "May use an mdir btree" ),
('RCOMPAT', 'BSPROUT', 0x0010, "Files may use inlined data" ),
('RCOMPAT', 'BLEAF', 0x0020, "Files may use single block pointers" ),
('RCOMPAT', 'BSHRUB', 0x0040, "Files may use inlined btrees" ),
('RCOMPAT', 'BTREE', 0x0080, "Files may use btrees" ),
('RCOMPAT', 'GRM', 0x0100, "May use a global-remove" ),
('RCOMPAT', 'GRM', 0x0004, "May use a global-remove" ),
('RCOMPAT', 'MSPROUT', 0x0010, "May use an inlined mdir" ),
('RCOMPAT', 'MLEAF', 0x0020, "May use a single mdir pointer" ),
('RCOMPAT', 'MSHRUB', 0x0040, "May use an inlined mtree" ),
('RCOMPAT', 'MTREE', 0x0080, "May use an mdir btree" ),
('RCOMPAT', 'BSPROUT', 0x0100, "Files may use inlined data" ),
('RCOMPAT', 'BLEAF', 0x0200, "Files may use single block pointers" ),
('RCOMPAT', 'BSHRUB', 0x0400, "Files may use inlined btrees" ),
('RCOMPAT', 'BTREE', 0x0800, "Files may use btrees" ),
('rcompat', 'OVERFLOW',0x8000, "Can't represent all flags" ),