This commit is contained in:
Able 2024-09-17 09:39:46 -05:00
parent b0ecbfa168
commit d9caa17f3c
5 changed files with 55 additions and 14 deletions

6
Cargo.lock generated
View file

@ -390,7 +390,7 @@ dependencies = [
[[package]] [[package]]
name = "hbbytecode" name = "hbbytecode"
version = "0.1.0" 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]] [[package]]
name = "hbbytecode" name = "hbbytecode"
@ -400,7 +400,7 @@ source = "git+https://git.ablecorp.us/ableos/holey-bytes#c133c2dbe71b3f1e1142bac
[[package]] [[package]]
name = "hblang" name = "hblang"
version = "0.1.0" 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 = [ dependencies = [
"hbvm 0.1.0 (git+https://git.ablecorp.us/AbleOS/holey-bytes.git)", "hbvm 0.1.0 (git+https://git.ablecorp.us/AbleOS/holey-bytes.git)",
] ]
@ -408,7 +408,7 @@ dependencies = [
[[package]] [[package]]
name = "hbvm" name = "hbvm"
version = "0.1.0" 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 = [ dependencies = [
"hbbytecode 0.1.0 (git+https://git.ablecorp.us/AbleOS/holey-bytes.git)", "hbbytecode 0.1.0 (git+https://git.ablecorp.us/AbleOS/holey-bytes.git)",
] ]

View file

@ -5,4 +5,6 @@ HostID := int
DeviceID := struct { DeviceID := struct {
host_id: HostID, host_id: HostID,
id: int, id: int,
} }
DiskID := DeviceID

View file

@ -1,5 +1,14 @@
// TODO: This is a bad path struct and should be better thoughtout. acs := @use("rel:acs.hb")
Path := struct {length: u8, data: ^u8}
// 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 { FileID := struct {
host_id: int, host_id: int,

View file

@ -147,19 +147,35 @@ FSInfo := struct {
fs_info_sanity_check := fn(fs_info: FSInfo): int { fs_info_sanity_check := fn(fs_info: FSInfo): int {
ret := 0 ret := 0
if fs_info.last_known_free_cluster_count == 0xFFFFFFFF { if fs_info.lead_signature != VALID_LEAD_FS_INFO {
ret &= 1 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 { if fs_info.last_known_avalible_cluster == 0xFFFFFFFF {
ret &= 2 ret &= 4
log.warn("Last known avalible cluster count unknown\0") 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 return ret
} }
new_fs_info := fn(): FSInfo { new_fs_info := fn(): FSInfo {
lead_reserved := @as([u8; 480], idk) lead_reserved := @as([u8; 480], idk)
trail_reserved := @as([u8; 12], 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,
)
} }

View file

@ -39,9 +39,23 @@ main := fn(): int {
log.warn("filesystem_fat32 driver only supports Fat32.\0") log.warn("filesystem_fat32 driver only supports Fat32.\0")
} }
bpb_sanity_check(bpb) bsc := bpb_sanity_check(bpb)
ebr_sanity_check(ebr) esc := ebr_sanity_check(ebr)
fs_info_sanity_check(fsi) 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 return 0
} }