diff options
| author | Amlal <amlal@nekernel.org> | 2025-04-27 10:58:37 +0200 |
|---|---|---|
| committer | Amlal <amlal@nekernel.org> | 2025-04-27 10:58:37 +0200 |
| commit | 2a064da4102e8c9b70b2648cc3bfc116b38fe35a (patch) | |
| tree | aba1f488290bd3481d012f08b6877ff702491ac4 /tooling | |
| parent | faee9f200898c0eb7f28ed89cdd16f8afa4438e1 (diff) | |
dev, kernel: HeFS and disk related work and improvements.
Signed-off-by: Amlal <amlal@nekernel.org>
Diffstat (limited to 'tooling')
| -rw-r--r-- | tooling/hefs.h | 6 | ||||
| -rw-r--r-- | tooling/mkfs.hefs.cc | 21 |
2 files changed, 18 insertions, 9 deletions
diff --git a/tooling/hefs.h b/tooling/hefs.h index b00d9049..d0ad823b 100644 --- a/tooling/hefs.h +++ b/tooling/hefs.h @@ -66,6 +66,12 @@ constexpr std::size_t kHeFSBlockCount = 16; // Types using ATime = std::uint64_t; +enum { + kHeFSRed = 100, + kHeFSBlack, + kHeFSColorCount, +}; + inline constexpr uint16_t kHeFSFileKindRegular = 0x00; inline constexpr uint16_t kHeFSFileKindDirectory = 0x01; inline constexpr uint16_t kHeFSFileKindBlock = 0x02; diff --git a/tooling/mkfs.hefs.cc b/tooling/mkfs.hefs.cc index f0a48bc3..e9cae578 100644 --- a/tooling/mkfs.hefs.cc +++ b/tooling/mkfs.hefs.cc @@ -114,14 +114,17 @@ int main(int argc, char** argv) { auto cnt = end_ind / sizeof(mkfs::hefs::IndexNodeDirectory); + auto start = bootNode.startIND; + auto prev = start; + // Pre-allocate index node directory tree for (size_t i = 0; i < cnt; ++i) { mkfs::hefs::IndexNodeDirectory indexNode{}; - std::memcpy(indexNode.name, u"$UNALLOCATED$", - std::u16string(u"$UNALLOCATED$").size() * sizeof(char16_t)); + std::memcpy(indexNode.name, u"/", + std::u16string(u"/").size() * sizeof(char16_t)); - indexNode.flags = 0; + indexNode.flags = mkfs::hefs::kHeFSEncodingUTF16; indexNode.kind = mkfs::hefs::kHeFSFileKindDirectory; indexNode.deleted = mkfs::hefs::kHeFSTimeMax; @@ -133,16 +136,16 @@ int main(int argc, char** argv) { indexNode.uid = 0; indexNode.gid = 0; indexNode.mode = 0; - indexNode.color = 0; - indexNode.next = 0; - indexNode.prev = 0; - indexNode.child = 0; + indexNode.color = mkfs::hefs::kHeFSBlack; indexNode.parent = bootNode.startIND; indexNode.child = bootNode.endIND; - indexNode.next = 0; - indexNode.prev = 0; + indexNode.next = start + sizeof(mkfs::hefs::IndexNodeDirectory); + indexNode.prev = prev; + + prev = start; + start += sizeof(mkfs::hefs::IndexNodeDirectory); filesystem.write(reinterpret_cast<const char*>(&indexNode), sizeof(mkfs::hefs::IndexNodeDirectory)); |
