diff options
| author | user <user@clank> | 2026-07-16 12:49:19 +0200 |
|---|---|---|
| committer | user <user@clank> | 2026-07-16 12:49:19 +0200 |
| commit | 5fefd233769a56caefdb2ffecaa9fb8b9ec6db86 (patch) | |
| tree | 99f5b285a45c7b3792bb64e79fe58f70a6d01cab /README.md | |
| parent | fs rewrite stage 2: inodes + root directory (block-based, persistent) (diff) | |
| download | gbos-5fefd233769a56caefdb2ffecaa9fb8b9ec6db86.tar.gz gbos-5fefd233769a56caefdb2ffecaa9fb8b9ec6db86.tar.xz gbos-5fefd233769a56caefdb2ffecaa9fb8b9ec6db86.zip | |
fs rewrite stage 3: nested directories, paths, cwd (cd/mkdir/ls)
- directories generalized: dir_find/dir_add/dir_remove take any dir inode;
every dir carries '.'/'..'. Path resolution (resolve / resolve_parent) walks
absolute or cwd-relative paths; open/mkdir/chdir/remove/opendir take paths.
- per-process cwd: PROC_CWD in the PCB (root by default, inherited on fork);
sys_chdir sets it, sys_opendir points ls at any directory.
- shell: 'cd' builtin + cwd-aware prompt; 'mkdir'/'ls <dir>' tools; 'exit'/'quit'
and EOF call poweroff() (clean shutdown via the $ED opcode -> reliable save).
- three HL/buffer-clobber bugs fixed along the way: resolve didn't preserve the
path cursor across dir_find; cur_cwd clobbered HL; resolve_parent set the final
name before resolve() overwrote wFsNameBuf (now copied after).
- verified: nested mkdir/cd/save, multi-level paths (cat docs/sub/b), and the
whole tree persists across a reboot.
- README: document directories + the poweroff opcode.
Diffstat (limited to '')
| -rw-r--r-- | README.md | 23 |
1 files changed, 17 insertions, 6 deletions
@@ -304,9 +304,12 @@ blocks 2-3 inode table (32 inodes x 16 B: type, size, 8 direct block ptrs) blocks 4.. data blocks ``` -- **Inodes + a root directory.** A directory is a file of 16-byte entries - (inode# + name). Files are up to **2 KiB** (8 direct blocks); up to **16** - entries in the root, **32** inodes. +- **Inodes + nested directories.** A directory is a file of 16-byte entries + (inode# + name), each carrying `.`/`..`. Files are up to **2 KiB** (8 direct + blocks); **32** inodes, 16 entries per directory. +- **Paths + per-process cwd.** `open`/`mkdir`/`chdir`/`remove`/`ls` take paths + (absolute `/a/b` or relative `a/b`); each process has a cwd inode (`PROC_CWD`, + inherited on fork). Shell builtins: `cd`, and a cwd-aware prompt. - **Bounce buffer.** Only `read_block`/`write_block` touch cart-RAM banking; everything else works on WRAM buffers. The bitmap + inode table are cached in WRAMX; data/dir blocks stream through a one-block cache. @@ -320,8 +323,15 @@ $ save notes gbos has a real filesystem now $ cat notes gbos has a real filesystem now -$ ls -notes +$ mkdir docs +$ cd docs +/docs$ save note +hi +/docs$ cd / +$ cat docs/note +hi +$ ls docs +note $ wc notes # survives a reboot 1 5 31 ``` @@ -347,7 +357,8 @@ $ wc notes # survives a reboot - [x] **stage 1**: block device (`blk.asm`) via a WRAM bounce buffer - [x] **stage 2**: inodes + root directory; variable-size files (<=2 KiB), bitmap allocators; 16 files / 32 inodes; persists across reboots - - [ ] stage 3: nested directories, path resolution, per-process cwd, `cd`/`mkdir` + - [x] **stage 3**: nested directories, path resolution, per-process cwd, + `cd`/`mkdir`/`ls <dir>` — the whole tree persists across reboots - [ ] Preemptive scheduling: real context save in `TimerISR` → `hSwitchTo` - [ ] Use the `$D000-$DFFF` u-area (SVBK) for per-process kernel state / kstack - [ ] `brk`/heap allocator inside the task bank (heap up, stack down, collision = ENOMEM) |
