diff options
author | Christopher Haster <chaster@utexas.edu> | 2017-06-27 07:17:14 +0300 |
---|---|---|
committer | Christopher Haster <chaster@utexas.edu> | 2017-06-29 05:46:34 +0300 |
commit | 8a9b9baa128262d894b7cb8e0d690bad912edd8d (patch) | |
tree | 013384a51d47a36e9348921c56f395dbe7bcac45 /lfs.h | |
parent | 931442a784a3e7403adc098aaf71fd78c4f52012 (diff) |
Modified entry head to include name length
This provides a path for adding inlined files in the future, which
requires multiple lengths to distinguish between the file data and name.
As an extra bonus, the directory can now be iterated over even if the
types are unknown, since the name's representation is consistent on all
entry types.
This does come at the cost of reducing types from 16-bits to 8-bits, but
I doubt this will become a problem.
Diffstat (limited to 'lfs.h')
-rw-r--r-- | lfs.h | 16 |
1 files changed, 9 insertions, 7 deletions
@@ -44,9 +44,9 @@ enum lfs_error { // File types enum lfs_type { - LFS_TYPE_REG = 0x01, - LFS_TYPE_DIR = 0x02, - LFS_TYPE_SUPERBLOCK = 0x12, + LFS_TYPE_REG = 0x11, + LFS_TYPE_DIR = 0x22, + LFS_TYPE_SUPERBLOCK = 0xe2, }; // File open flags @@ -159,7 +159,8 @@ typedef struct lfs_entry { lfs_off_t off; struct lfs_disk_entry { - uint16_t type; + uint8_t type; + uint8_t name; uint16_t len; union { struct { @@ -210,13 +211,14 @@ typedef struct lfs_superblock { lfs_off_t off; struct lfs_disk_superblock { - uint16_t type; + uint8_t type; + uint8_t name; uint16_t len; lfs_block_t root[2]; - uint32_t version; - char magic[8]; uint32_t block_size; uint32_t block_count; + uint32_t version; + char magic[8]; } d; } lfs_superblock_t; |