littlefs-project / littlefs

A little fail-safe filesystem designed for microcontrollers

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Tags with id == 0x3ff

andriyndev opened this issue · comments

Id (10-bits) - File id associated with the tag. Each file in a metadata block gets a unique id which is used to associate tags with that file. The special value 0x3ff is used for any tags that are not associated with a file, such as directory and global metadata.

Do I understand correctly that all the directories have tag id = 0x3ff, or only some folders?

Ah, I can see where this would be confusing. That last sentence could probably be made clearer.

The tricky bit is that directories have two relationships with the mdirs:

  1. Directories exist as files in their parent's mdir. These mdir entries have the type LFS_TYPE_DIR, but otherwise are mostly the same as regular files. These have normal ids 0x0-0x3fe based on their location in the mdir.

  2. The contents of a directory is stored as a linked-list of mdirs. This linked-list may contain its own metadata unrelated to any files in the mdirs. These entries use the special id 0x3ff to indicate they aren't normal files. Currently this is limited to the pointers that construct the linked-list, LFS_TYPE_TAIL, and global metadata, LFS_TYPE_GLOBALS.

Thank you!