diff options
| author | Amlal <amlal@nekernel.org> | 2025-05-11 08:44:23 +0200 |
|---|---|---|
| committer | Amlal <amlal@nekernel.org> | 2025-05-11 08:45:23 +0200 |
| commit | 2bbe51e66f96f4f50f7d1de71a5e65e5de213350 (patch) | |
| tree | 77b44f8e32eb860f7b838e741cd71b261249ed46 | |
| parent | f80d6fec128e87ef1116558137131383453b4943 (diff) | |
feat(kernel): HeFS TeX specs have been updated, and cleaned up the official filesystem implementation, with a bootinfo.cfg being added too.
why:
- The LaTeX specs were outdated, some elements had to be reseen.
also:
- Removed useless part of the logger, for the panic message.
Signed-off-by: Amlal <amlal@nekernel.org>
| -rw-r--r-- | dev/kernel/FSKit/HeFS.h | 14 | ||||
| -rw-r--r-- | dev/kernel/HALKit/AMD64/HalDebugOutput.cc | 14 | ||||
| -rw-r--r-- | dev/kernel/src/FS/HeFS+FileSystemParser.cc | 29 | ||||
| -rw-r--r-- | dev/kernel/src/UtfUtils.cc | 2 | ||||
| -rw-r--r-- | docs/tex/hefs.tex | 4 | ||||
| -rwxr-xr-x | setup_x64.sh | 3 |
6 files changed, 33 insertions, 33 deletions
diff --git a/dev/kernel/FSKit/HeFS.h b/dev/kernel/FSKit/HeFS.h index 85421069..bf1bf867 100644 --- a/dev/kernel/FSKit/HeFS.h +++ b/dev/kernel/FSKit/HeFS.h @@ -25,7 +25,7 @@ #define kHeFSFileNameLen (256U)
#define kHeFSPartNameLen (128U)
-#define kHeFSMinimumDiskSize (gib_cast(1))
+#define kHeFSMinimumDiskSize (gib_cast(8))
#define kHeFSDefaultVolumeName u8"HeFS Volume"
@@ -38,7 +38,6 @@ struct HEFS_BOOT_NODE; struct HEFS_INDEX_NODE;
struct HEFS_INDEX_NODE_DIRECTORY;
struct HEFS_JOURNAL_NODE;
-struct HEFS_SLICE_NODE;
enum : UInt8 {
kHeFSHardDrive = 0xC0, // Hard Drive
@@ -135,12 +134,6 @@ struct PACKED HEFS_BOOT_NODE final { inline constexpr ATime kHeFSTimeInvalid = 0x0000000000000000;
inline constexpr ATime kHeFSTimeMax = 0xFFFFFFFFFFFFFFFF - 1;
-/// @brief INode Slice structure, organized like a range container.
-struct PACKED HEFS_SLICE_NODE {
- UInt32 fBase;
- UInt32 fLength;
-};
-
/// @brief Journal Node structure
/// @param fHashPath target hash path
/// @param fStatus target status
@@ -178,10 +171,7 @@ struct PACKED HEFS_INDEX_NODE final { UInt32 fOffsetSliceLow;
UInt32 fOffsetSliceHigh;
- ATTRIBUTE(deprecated)
- HEFS_SLICE_NODE fSlices[kHeFSSliceCount]; /// @brief block slice, unused as of current HeFS.
-
- Char fPad[309];
+ Char fPad[437];
};
enum {
diff --git a/dev/kernel/HALKit/AMD64/HalDebugOutput.cc b/dev/kernel/HALKit/AMD64/HalDebugOutput.cc index 71dee911..bd8fe734 100644 --- a/dev/kernel/HALKit/AMD64/HalDebugOutput.cc +++ b/dev/kernel/HALKit/AMD64/HalDebugOutput.cc @@ -108,7 +108,6 @@ EXTERN_C void ke_io_write(IDeviceObject<const Char*>* obj, const Char* bytes) { len = rt_string_len(bytes); STATIC SizeT x = kFontSizeX, y = kFontSizeY; - STATIC BOOL not_important = YES; while (index < len) { if (bytes[index] == '\r') HAL::rt_out8(Detail::kPort, '\r'); @@ -119,18 +118,7 @@ EXTERN_C void ke_io_write(IDeviceObject<const Char*>* obj, const Char* bytes) { tmp_str[0] = bytes[index]; tmp_str[1] = 0; - if (bytes[index] == '*') { - if (not_important) - not_important = NO; - else - not_important = YES; - - ++index; - - continue; - } - - fb_render_string(tmp_str, y, x, not_important ? RGB(0xff, 0xff, 0xff) : RGB(0xff, 0x00, 0x00)); + fb_render_string(tmp_str, y, x, RGB(0xff, 0xff, 0xff)); if (bytes[index] == '\r') { y += kFontSizeY; diff --git a/dev/kernel/src/FS/HeFS+FileSystemParser.cc b/dev/kernel/src/FS/HeFS+FileSystemParser.cc index fa82320f..e91040b2 100644 --- a/dev/kernel/src/FS/HeFS+FileSystemParser.cc +++ b/dev/kernel/src/FS/HeFS+FileSystemParser.cc @@ -800,8 +800,8 @@ _Output Bool HeFileSystemParser::Format(_Input _Output DriveTrait* mnt, _Input c /// @note all HeFS strucutres are equal to 512, so here it's fine, unless fSectoSize is 2048. const SizeT max_lba = drv_std_get_size() / root->fSectorSize; - const SizeT dir_max = max_lba / 5; // 20% for directory inodes - const SizeT inode_max = max_lba / 3; // 30% for inodes + const SizeT dir_max = max_lba / 20; // 20% for directory inodes + const SizeT inode_max = max_lba / 30; // 30% for inodes root->fStartIND = mnt->fLbaStart + kHeFSINDStartOffset; root->fEndIND = root->fStartIND + dir_max; @@ -954,7 +954,7 @@ _Output Bool HeFileSystemParser::CreateINode(_Input DriveTrait* mnt, _Input cons _Output Bool HeFileSystemParser::INodeManip(_Input DriveTrait* mnt, VoidPtr block, SizeT block_sz, const Utf8Char* dir, const Utf8Char* name, - const UInt8 kind, const BOOL in) { + const UInt8 kind, const BOOL is_input) { if (urt_string_len(dir) > kHeFSFileNameLen) { err_global_get() = kErrorDisk; return NO; @@ -999,7 +999,7 @@ _Output Bool HeFileSystemParser::INodeManip(_Input DriveTrait* mnt, VoidPtr bloc mnt->fPacket.fPacketSize = block_sz; mnt->fPacket.fPacketContent = block; - if (in) { + if (is_input) { mnt->fInput(mnt->fPacket); } else { mnt->fOutput(mnt->fPacket); @@ -1137,7 +1137,26 @@ Boolean fs_init_hefs(Void) { MUST_PASS(parser.INodeManip(&kMountPoint, contents_1, kHeFSBlockLen, u8"/boot", u8"bootinfo.cfg", kHeFSFileKindRegular, YES)); - kout8 << contents_1 << kendl8; + if (*contents_1 != u'\0') { + (Void)(kout << "/boot/bootinfo.cfg:" << kendl); + (Void)(kout8 << contents_1 << kendl8); + } else { + auto src = + u8"[boot]\r" + u8"path=bootz.efi\r" + u8"name=BootZ\r" + u8"[kernel]\r" + u8"path=krnl.efi\r" + u8"name=NeKernel\r" + u8"[chk]\r" + u8"path=chk.efi\r" + u8"name=SysChk\r"; + + urt_copy_memory((VoidPtr) src, contents_1, urt_string_len(src)); + + MUST_PASS(parser.INodeManip(&kMountPoint, contents_1, kHeFSBlockLen, u8"/boot", + u8"bootinfo.cfg", kHeFSFileKindRegular, NO)); + } return YES; } diff --git a/dev/kernel/src/UtfUtils.cc b/dev/kernel/src/UtfUtils.cc index ed0e4591..11d7471a 100644 --- a/dev/kernel/src/UtfUtils.cc +++ b/dev/kernel/src/UtfUtils.cc @@ -10,7 +10,7 @@ namespace Kernel { Size urt_string_len(const Utf8Char* str) { SizeT len{0}; - while (str[len] != u'\0') ++len; + while (str[len] != u8'\0') ++len; return len; } diff --git a/docs/tex/hefs.tex b/docs/tex/hefs.tex index e5a08049..bc152293 100644 --- a/docs/tex/hefs.tex +++ b/docs/tex/hefs.tex @@ -26,9 +26,9 @@ The High-throughput Extended File System (HeFS) is a custom filesystem tailored \texttt{kHeFSBlockLen} & 512 bytes \\ \texttt{kHeFSFileNameLen} & 256 characters \\ \texttt{kHeFSPartNameLen} & 128 characters \\ -\texttt{kHeFSMinimumDiskSize} & 1 GiB \\ +\texttt{kHeFSMinimumDiskSize} & 8 GiB \\ \texttt{kHeFSDefaultVolumeName} & "HeFS Volume" \\ -\texttt{kHeFSINDStartOffset} & Offset after boot + dir nodes \\ +\texttt{kHeFSINDStartOffset} & Offset after boot node \\ \texttt{kHeFSSearchAllStr} & "\*" (wildcard string) \\ \hline \end{longtable} diff --git a/setup_x64.sh b/setup_x64.sh index da2027a1..6afc1633 100755 --- a/setup_x64.sh +++ b/setup_x64.sh @@ -5,6 +5,9 @@ # 04/05/25: Improve and fix script. cd dev/user +cd src +make sci_asm_io_x64 +cd .. btb user.json cd ../boot make -f amd64-desktop.make efi |
