Rearranged tag encodings to make space for BECKSUM, ORPHAN, etc

Also:

- Renamed GSTATE -> GDELTA for gdelta tags. GSTATE tags added as
  separate in-device flags. The GSTATE tags were already serving
  this dual purpose.

- Renamed BSHRUB* -> SHRUB when the tag is not necessarily operating
  on a file bshrub.

- Renamed TRUNK -> BSHRUB

The tag encoding space now has a couple funky holes:

- 0x0005 - Hole for aligning config tags.

  I guess this could be used for OCOMPATFLAGS in the future?

- 0x0203 - Hole so that ORPHAN can be a 1-bit difference from REG. This
  could be after BOOKMARK, but having a bit to differentiate littlefs
  specific file types (BOOKMARK, ORPHAN) from normal file types (REG,
  DIR) is nice.

  I guess this could be used for SYMLINK if we ever want symlinks in the
  future?

- 0x0314-0x0318 - Hole so that the mdir related tags (MROOT, MDIR,
  MTREE) are nicely aligned.

  This is probably a good place for file-related tags to go in the
  future (BECKSUM, CID, COMPR), but we only have two slots, so will
  probably run out pretty quickly.

- 0x3028 - Hole so that all btree related tags (BTREE, BRANCH, MTREE)
  share a common lower bit-pattern.

  I guess this could be used for MSHRUB if we ever want mshrubs in the
  future?
This commit is contained in:
Christopher Haster
2023-12-08 13:28:47 -06:00
parent 04c6b5a067
commit 337bdf61ae
7 changed files with 161 additions and 158 deletions
+3 -3
View File
@@ -116,11 +116,11 @@ enum lfs_error {
// File types
enum lfs_type {
// file types
LFS_TYPE_REG = 2,
LFS_TYPE_DIR = 3,
LFS_TYPE_REG = 1,
LFS_TYPE_DIR = 2,
// used internally, don't use this
LFS_TYPE_INTERNAL = 4,
LFS_TYPE_INTERNAL = 3,
// // internally used types
// LFS_TYPE_SPLICE = 0x400,