Extended entry tag to support attributes

Zero attributes are actually supported at the moment, but this change
will allow entry attribute to be added in a backwards compatible manner.

Each dir entry is now prefixed with a 32 bit tag:
4b - entry type
4b - data structure
8b - entry len
8b - attribute len
8b - name len

A full entry on disk looks a bit like this:
[-  8 -|-  8 -|-  8 -|-  8 -|-- elen --|-- alen --|-- nlen --]
[ type | elen | alen | nlen |  entry   |  attrs   |   name   ]

The actually contents of the attributes section is a bit handwavey
until the first attributes are implemented, but to put plans in place:
Each attribute will be prefixed with only a byte that indicates the type
of attribute. Attributes should be sorted based on portability, since
unknown attributes will force attribute parsing to stop.
This commit is contained in:
Christopher Haster
2017-07-18 02:09:35 -05:00
parent 8795f0e0b7
commit c2283a2753
2 changed files with 41 additions and 33 deletions

10
lfs.h
View File

@@ -160,8 +160,9 @@ typedef struct lfs_entry {
struct lfs_disk_entry {
uint8_t type;
uint8_t name;
uint16_t len;
uint8_t elen;
uint8_t alen;
uint8_t nlen;
union {
struct {
lfs_block_t head;
@@ -212,8 +213,9 @@ typedef struct lfs_superblock {
struct lfs_disk_superblock {
uint8_t type;
uint8_t name;
uint16_t len;
uint8_t elen;
uint8_t alen;
uint8_t nlen;
lfs_block_t root[2];
uint32_t block_size;
uint32_t block_count;