diff options
author | dzwdz | 2022-04-14 22:11:36 +0200 |
---|---|---|
committer | dzwdz | 2022-04-14 22:11:36 +0200 |
commit | 6613d7e5f3c2e704a6812b0fbcaf79ade8d19980 (patch) | |
tree | c83241169567f857bc03cb3e730a4eee4de64d13 /src/kernel/vfs | |
parent | 0d59c8d11173b28f958413128eb792655568a365 (diff) |
kernel/proc: only change state through `process_transition`
Diffstat (limited to 'src/kernel/vfs')
-rw-r--r-- | src/kernel/vfs/request.c | 9 | ||||
-rw-r--r-- | src/kernel/vfs/root.c | 2 |
2 files changed, 5 insertions, 6 deletions
diff --git a/src/kernel/vfs/request.c b/src/kernel/vfs/request.c index 0ac0b3a..687f456 100644 --- a/src/kernel/vfs/request.c +++ b/src/kernel/vfs/request.c @@ -7,8 +7,7 @@ int vfs_request_create(struct vfs_request req_) { struct vfs_request *req; - assert(process_current->state == PS_RUNNING); - process_current->state = PS_WAITS4FS; + process_transition(process_current, PS_WAITS4FS); process_current->waits4fs.queue_next = NULL; // the request is owned by the caller @@ -64,7 +63,7 @@ int vfs_request_accept(struct vfs_request *req) { handler->awaited_req.res, &res, sizeof res)) goto fail; // can't copy response struct - handler->state = PS_RUNNING; + process_transition(handler, PS_RUNNING); handler->handled_req = req; regs_savereturn(&handler->regs, 0); return 0; @@ -92,8 +91,8 @@ int vfs_request_finish(struct vfs_request *req, int ret) { if (req->input.kern) kfree(req->input.buf_kern); - assert(req->caller->state = PS_WAITS4FS); - req->caller->state = PS_RUNNING; + assert(req->caller->state == PS_WAITS4FS || req->caller->state == PS_WAITS4IRQ); + process_transition(req->caller, PS_RUNNING); regs_savereturn(&req->caller->regs, ret); return ret; } diff --git a/src/kernel/vfs/root.c b/src/kernel/vfs/root.c index cdc388f..11d5f64 100644 --- a/src/kernel/vfs/root.c +++ b/src/kernel/vfs/root.c @@ -56,7 +56,7 @@ static void wait_callback(struct process *proc) { static bool wait_setup(struct vfs_request *req, bool *ready, bool (*ready_fn)()) { if (!ready_fn()) { *ready = false; - req->caller->state = PS_WAITS4IRQ; + process_transition(req->caller, PS_WAITS4IRQ); req->caller->waits4irq.req = *req; req->caller->waits4irq.ready = ready_fn; req->caller->waits4irq.callback = wait_callback; |