basic changes
This commit is contained in:
1
TODO.md
1
TODO.md
@@ -1,5 +1,6 @@
|
||||
# For MVP functionality
|
||||
|
||||
- write a tester OS, basically a menu with tests to run
|
||||
- stop doing linear scans and do hashmaps smh (ls /dev is awfully slow and this MIGHT be why)
|
||||
- volatile filesystem
|
||||
- device info
|
||||
|
||||
BIN
data/drive.img
BIN
data/drive.img
Binary file not shown.
@@ -200,7 +200,12 @@ nn_Exit ne_fsState_handler(nn_FilesystemRequest *req) {
|
||||
if(feof(f)) {
|
||||
req->strarg1 = NULL;
|
||||
} else {
|
||||
req->strarg1len = fread(req->strarg1, sizeof(char), req->strarg1len, f);
|
||||
size_t off = 0;
|
||||
while(off < req->strarg1len) {
|
||||
if(feof(f)) break;
|
||||
off += fread(req->strarg1 + off, sizeof(char), req->strarg1len - off, f);
|
||||
}
|
||||
req->strarg1len = off;
|
||||
}
|
||||
return NN_OK;
|
||||
case NN_FS_WRITE:
|
||||
|
||||
@@ -2718,7 +2718,9 @@ nn_Exit nn_filesystem_handler(nn_ComponentRequest *req) {
|
||||
if(nn_checkinteger(computer, 0, "bad argument #1 (integer expected)")) return NN_EBADCALL;
|
||||
fsreq.fd = nn_tointeger(computer, 0);
|
||||
fsreq.action = NN_FS_CLOSE;
|
||||
return state->handler(&fsreq);
|
||||
err = state->handler(&fsreq);
|
||||
if(err) return err;
|
||||
return nn_pushbool(computer, true);
|
||||
}
|
||||
if(method == NN_FSNUM_READ) {
|
||||
nn_costComponent(computer, req->compAddress, state->fs.readsPerTick);
|
||||
|
||||
Reference in New Issue
Block a user