diff options
author | Christopher Haster <chaster@utexas.edu> | 2018-10-05 00:25:19 +0300 |
---|---|---|
committer | Christopher Haster <chaster@utexas.edu> | 2018-10-18 18:00:49 +0300 |
commit | 97a7191814a5900a35f11c3ebac0f6a710a6bb90 (patch) | |
tree | 960bcbdb6009861958c061ee5782e31e8990a983 /lfs.h | |
parent | aeca7667b32097c109b4ce84a2f3adb2949643ab (diff) |
Fixed issue with creating files named "littlefs"
A rather humorous issue, we accidentally ended up mixing our file
namespace with our superblocks. This meant if we created a file named
"littlefs" it would reference the superblock and all sorts of things
would break.
Fixing this also highlighted another issue, the fact that the superblock
always needs to come before any file entries in the directory. I didn't
account for this in the initial B-tree design, but we need a higher
ordering for superblocks + children + files than just name. To fix this
I added ordering information in the 2 bits currently unused in the tag
type. Though note that the size of these fields are flexible.
9-bit type field:
[--- 9 ---]
[1|- 3 -|- 2 -|- 3 -]
^ ^ ^ ^- type-specific info
| | \------- ordering info
| \------------- subtype
\----------------- user bit
Diffstat (limited to 'lfs.h')
-rw-r--r-- | lfs.h | 12 |
1 files changed, 5 insertions, 7 deletions
@@ -88,12 +88,12 @@ enum lfs_error { // File types enum lfs_type { // file types - LFS_TYPE_REG = 0x002, - LFS_TYPE_DIR = 0x003, + LFS_TYPE_REG = 0x011, + LFS_TYPE_DIR = 0x010, // internally used types LFS_TYPE_USERATTR = 0x100, - LFS_TYPE_NAME = 0x000, + LFS_TYPE_CREATE = 0x000, LFS_TYPE_DELETE = 0x020, LFS_TYPE_STRUCT = 0x040, LFS_TYPE_TAIL = 0x080, @@ -110,8 +110,8 @@ enum lfs_type { // internal chip sources LFS_FROM_MEM = 0x000, LFS_FROM_DISK = 0x200, - LFS_FROM_MOVE = 0x0c1, - LFS_FROM_USERATTRS = 0x0c2, + LFS_FROM_MOVE = 0x061, + LFS_FROM_USERATTRS = 0x062, }; // File open flags @@ -339,9 +339,7 @@ typedef struct lfs_file { } lfs_file_t; typedef struct lfs_superblock { - char magic[8]; uint32_t version; - lfs_size_t block_size; lfs_size_t block_count; |