mirror of
https://github.com/Tom-on64/kern.git
synced 2026-11-03 18:22:22 +00:00
Made 'ls' real and not just a bunch of hardcoded printf calls
This commit is contained in:
+23
-10
@@ -316,16 +316,29 @@ void main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void listFiles() {
|
void listFiles() {
|
||||||
// TODO: Make this real
|
inode_t* root = (inode_t*)impl_superblock->rootInodePtr;
|
||||||
printf("Total 8\n");
|
diskRead(root->extent[0].block * 8, root->extent[0].length * 8, (void*)SCRATCH_BLOCK_LOC);
|
||||||
printf(". [dir]\n");
|
dirEntry_t* dentry = (dirEntry_t*)SCRATCH_BLOCK_LOC;
|
||||||
printf(".. [dir]\n");
|
|
||||||
printf("stage3.bin 2868B\n");
|
uint32_t total = 0;
|
||||||
printf("kernel.bin 13536B\n");
|
while ((dentry + total)->name[0] != '\0') { total++; }
|
||||||
printf("testfont.fnt 2048B\n");
|
|
||||||
printf("term16n.fnt 2048B\n");
|
putc(' '); // TODO
|
||||||
printf("calc.bin 1724B\n");
|
printf("\bTotal %d\n", total);
|
||||||
printf("editor.bin 1280B\n");
|
|
||||||
|
while (dentry->name[0] != '\0') {
|
||||||
|
inode_t* inode = (inode_t*)BOOT_FIRST_INODE_LOC + dentry->id;
|
||||||
|
|
||||||
|
printf("%s", dentry->name);
|
||||||
|
for (uint32_t pad = (16 - strlen(dentry->name)); pad > 0; pad--) { putc(' '); }
|
||||||
|
|
||||||
|
switch (inode->type) {
|
||||||
|
case FT_FILE: printf("%dB\n", inode->sizeBytes); break;
|
||||||
|
case FT_DIR: printf("[dir]\n"); break;
|
||||||
|
}
|
||||||
|
|
||||||
|
dentry++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void printRegs() {
|
void printRegs() {
|
||||||
|
|||||||
@@ -100,6 +100,8 @@ Legend:
|
|||||||
- [x] Malloc()
|
- [x] Malloc()
|
||||||
- [x] Free()
|
- [x] Free()
|
||||||
- [ ] Seek()
|
- [ ] Seek()
|
||||||
|
- [ ] Tell()
|
||||||
|
- [ ] Exit()
|
||||||
- [ ] Shell
|
- [ ] Shell
|
||||||
- [ ] Separate file/program
|
- [ ] Separate file/program
|
||||||
- [ ] ';' separated commands
|
- [ ] ';' separated commands
|
||||||
@@ -122,7 +124,7 @@ Legend:
|
|||||||
- [ ] cd
|
- [ ] cd
|
||||||
- [ ] Standard I/O stuff
|
- [ ] Standard I/O stuff
|
||||||
- [ ] stdin
|
- [ ] stdin
|
||||||
- [ ] stdout
|
- [x] stdout
|
||||||
- [ ] stderr
|
- [ ] stderr
|
||||||
- [x] Memory manager
|
- [x] Memory manager
|
||||||
- [x] Memory map
|
- [x] Memory map
|
||||||
|
|||||||
Reference in New Issue
Block a user