From d9caa17f3c675b858b24337881f7e1de1cad390d Mon Sep 17 00:00:00 2001 From: Able Date: Tue, 17 Sep 2024 09:39:46 -0500 Subject: [PATCH] commits --- Cargo.lock | 6 ++--- sysdata/libraries/stn/src/acs.hb | 4 ++- sysdata/libraries/stn/src/file_io.hb | 13 ++++++++-- .../src/bios_parameter_block.hb | 26 +++++++++++++++---- sysdata/programs/filesystem_fat32/src/main.hb | 20 +++++++++++--- 5 files changed, 55 insertions(+), 14 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0108916..e2a26c2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -390,7 +390,7 @@ dependencies = [ [[package]] name = "hbbytecode" version = "0.1.0" -source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#254d5ed96234c8291770d84b2ac11ef7dd403b28" +source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#4a9b9de87fd56a6bbd5d0ca2c622104d4807612b" [[package]] name = "hbbytecode" @@ -400,7 +400,7 @@ source = "git+https://git.ablecorp.us/ableos/holey-bytes#c133c2dbe71b3f1e1142bac [[package]] name = "hblang" version = "0.1.0" -source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#254d5ed96234c8291770d84b2ac11ef7dd403b28" +source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#4a9b9de87fd56a6bbd5d0ca2c622104d4807612b" dependencies = [ "hbvm 0.1.0 (git+https://git.ablecorp.us/AbleOS/holey-bytes.git)", ] @@ -408,7 +408,7 @@ dependencies = [ [[package]] name = "hbvm" version = "0.1.0" -source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#254d5ed96234c8291770d84b2ac11ef7dd403b28" +source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#4a9b9de87fd56a6bbd5d0ca2c622104d4807612b" dependencies = [ "hbbytecode 0.1.0 (git+https://git.ablecorp.us/AbleOS/holey-bytes.git)", ] diff --git a/sysdata/libraries/stn/src/acs.hb b/sysdata/libraries/stn/src/acs.hb index 4ec12ca..2f4ac8e 100644 --- a/sysdata/libraries/stn/src/acs.hb +++ b/sysdata/libraries/stn/src/acs.hb @@ -5,4 +5,6 @@ HostID := int DeviceID := struct { host_id: HostID, id: int, -} \ No newline at end of file +} + +DiskID := DeviceID \ No newline at end of file diff --git a/sysdata/libraries/stn/src/file_io.hb b/sysdata/libraries/stn/src/file_io.hb index 2e28998..70ec741 100644 --- a/sysdata/libraries/stn/src/file_io.hb +++ b/sysdata/libraries/stn/src/file_io.hb @@ -1,5 +1,14 @@ -// TODO: This is a bad path struct and should be better thoughtout. -Path := struct {length: u8, data: ^u8} +acs := @use("rel:acs.hb") + + +// Paths without a node-disk component are to be treated as local files. +// file_path := "DID:/test\0"; +Path := struct { + // DiskID holds the host id + disk_id: acs.DiskID + length: u8, + data: ^u8 +} FileID := struct { host_id: int, diff --git a/sysdata/programs/filesystem_fat32/src/bios_parameter_block.hb b/sysdata/programs/filesystem_fat32/src/bios_parameter_block.hb index afb56a2..fa9d8ca 100644 --- a/sysdata/programs/filesystem_fat32/src/bios_parameter_block.hb +++ b/sysdata/programs/filesystem_fat32/src/bios_parameter_block.hb @@ -147,19 +147,35 @@ FSInfo := struct { fs_info_sanity_check := fn(fs_info: FSInfo): int { ret := 0 - if fs_info.last_known_free_cluster_count == 0xFFFFFFFF { + if fs_info.lead_signature != VALID_LEAD_FS_INFO { ret &= 1 - log.warn("Last known free cluster count unknown\0") + log.warn("Invalid leading signature in FSInfo.\0") + } + if fs_info.last_known_free_cluster_count == 0xFFFFFFFF { + ret &= 2 + log.warn("Last known free cluster count unknown.\0") } if fs_info.last_known_avalible_cluster == 0xFFFFFFFF { - ret &= 2 - log.warn("Last known avalible cluster count unknown\0") + ret &= 4 + log.warn("Last known avalible cluster count unknown.\0") } + if fs_info.trail_signature != VALID_TRAIL_FS_INFO { + ret &= 8 + log.warn("Invalid trailing signature in FSInfo.\0") + } + return ret } new_fs_info := fn(): FSInfo { lead_reserved := @as([u8; 480], idk) trail_reserved := @as([u8; 12], idk) - return FSInfo.(0, lead_reserved, 0, 0, trail_reserved, 0) + return FSInfo.( + VALID_LEAD_FS_INFO, + lead_reserved, + 0, + 0, + trail_reserved, + VALID_TRAIL_FS_INFO, + ) } \ No newline at end of file diff --git a/sysdata/programs/filesystem_fat32/src/main.hb b/sysdata/programs/filesystem_fat32/src/main.hb index 3d71620..5778b4f 100644 --- a/sysdata/programs/filesystem_fat32/src/main.hb +++ b/sysdata/programs/filesystem_fat32/src/main.hb @@ -39,9 +39,23 @@ main := fn(): int { log.warn("filesystem_fat32 driver only supports Fat32.\0") } - bpb_sanity_check(bpb) - ebr_sanity_check(ebr) - fs_info_sanity_check(fsi) + bsc := bpb_sanity_check(bpb) + esc := ebr_sanity_check(ebr) + fssc := fs_info_sanity_check(fsi) + + msg_type := 0 + + + loop { + // Open file + if msg_type == 0 { + // Paths without a node-disk component are to be treated as local files. + file_path := "node-disk:/test\0"; + + } else { + // error + } + } return 0 } \ No newline at end of file