diff --git a/sysdata/programs/vfsaur/src/main.hb b/sysdata/programs/vfsaur/src/main.hb index 9b27539..aa031f2 100644 --- a/sysdata/programs/vfsaur/src/main.hb +++ b/sysdata/programs/vfsaur/src/main.hb @@ -1,40 +1,70 @@ stn := @use("stn"); -.{string, buffer, log} := stn; +.{string, buffer, log, acs} := stn; .{info} := log; - -.{acs} := stn; .{BufferID} := acs FilesystemServiceListing := struct { // The Root to match against of the file system root: []u8, - // Replace with a slice here soon. // The buffer to forward fs requests to. buffer_id: BufferID, + + new := fn(root: []u8, buffer_id: BufferID): Self { + return .(root, buffer_id) + } +} + +Path := struct { + root: []u8, + path: []u8, +} + +MessageTypes := enum { + Create, + Delete, + // Used to register filesystem handlers. + Mount, +} + +VFSMessage := struct { + msg_type: MessageTypes, } main := fn(): int { log.info("VFSaur starting.") vfs_buff := buffer.create("VFS") + bid := BufferID.(0, 0) + fsl := FilesystemServiceListing.new("acs", bid) + fsl2 := FilesystemServiceListing.new("boot", bid) + full_path := "acs:/path/to/a/file" a := parse_str_to_path(full_path) if a != null { log.info(a.root) log.info(a.path) } + vfs_event := VFSMessage.(MessageTypes.Mount) + loop { + buffer.recv(VFSMessage, vfs_buff, &vfs_event) + if vfs_event.msg_type == MessageTypes.Mount { + // TODO: get info from the message itself + fsl3 := FilesystemServiceListing.new("acs", bid) + } + // TODO: sleep till vfs_buff message + } return 0 } -OSPath := struct {root: []u8, path: []u8} - -parse_str_to_path := fn(full_path: []u8): ?OSPath { - path := string.split_once(full_path, '/') - if path == null return null; - +parse_str_to_path := fn(full_path: []u8): ?Path { + path := string.split_once(full_path, ':') + if path == null { + return null + } root := full_path[..full_path.len - path.len] + bpath := full_path[full_path.len - path.len + 1..] - return OSPath.(root, path) + return Path.(root, bpath) } \ No newline at end of file diff --git a/sysdata/system_config.toml b/sysdata/system_config.toml index 7c28208..684d0cf 100644 --- a/sysdata/system_config.toml +++ b/sysdata/system_config.toml @@ -50,8 +50,8 @@ path = "boot:///ps2_driver.hbf" # [boot.limine.ableos.modules.angels_halo] # path = "boot:///angels_halo.hbf" -[boot.limine.ableos.modules.test] -path = "boot:///test.hbf" +# [boot.limine.ableos.modules.test] +# path = "boot:///test.hbf" -# [boot.limine.ableos.modules.vfsaur] -# path = "boot:///vfsaur.hbf" +[boot.limine.ableos.modules.vfsaur] +path = "boot:///vfsaur.hbf"