summaryrefslogtreecommitdiffhomepage
path: root/dev/kernel/src
diff options
context:
space:
mode:
authorAmlal <amlal@nekernel.org>2025-05-11 08:44:23 +0200
committerAmlal <amlal@nekernel.org>2025-05-11 08:45:23 +0200
commit2bbe51e66f96f4f50f7d1de71a5e65e5de213350 (patch)
tree77b44f8e32eb860f7b838e741cd71b261249ed46 /dev/kernel/src
parentf80d6fec128e87ef1116558137131383453b4943 (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>
Diffstat (limited to 'dev/kernel/src')
-rw-r--r--dev/kernel/src/FS/HeFS+FileSystemParser.cc29
-rw-r--r--dev/kernel/src/UtfUtils.cc2
2 files changed, 25 insertions, 6 deletions
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;
}