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/request.c | |
parent | 0d59c8d11173b28f958413128eb792655568a365 (diff) |
kernel/proc: only change state through `process_transition`
Diffstat (limited to 'src/kernel/vfs/request.c')
-rw-r--r-- | src/kernel/vfs/request.c | 9 |
1 files changed, 4 insertions, 5 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; } |