summaryrefslogtreecommitdiff
path: root/src/init/fs
diff options
context:
space:
mode:
authordzwdz2022-07-07 19:24:42 +0200
committerdzwdz2022-07-07 19:24:42 +0200
commitbbdacaddcc25d1d137a0bb0781eba603641baa92 (patch)
tree898ddd186d8e1def04e818b192a8c9b8d2721504 /src/init/fs
parent8dc3d7df4c73b320fa84b2e871732276a7c6e20f (diff)
kernel/vfs: delegate support in _syscall_fs_respond!
this is big in terms of speed, it avoids a lot of unnecessary context switches
Diffstat (limited to 'src/init/fs')
-rw-r--r--src/init/fs/misc.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/init/fs/misc.c b/src/init/fs/misc.c
index 7f0c1fb..b394c26 100644
--- a/src/init/fs/misc.c
+++ b/src/init/fs/misc.c
@@ -111,11 +111,11 @@ void fs_passthru(const char *prefix) {
} else {
ret = _syscall_open(buf, res.len, res.flags);
}
- _syscall_fs_respond(NULL, ret, 0);
+ _syscall_fs_respond(NULL, ret, FSR_DELEGATE);
break;
default:
- fs_respond_delegate(&res, res.id, buf);
+ _syscall_fs_respond(NULL, -1, 0);
break;
}
}
@@ -139,11 +139,11 @@ void fs_whitelist(const char **list) {
break;
}
}
- _syscall_fs_respond(NULL, allow ? _syscall_open(buf, res.len, res.flags) : -1, 0);
+ _syscall_fs_respond(NULL, allow ? _syscall_open(buf, res.len, res.flags) : -1, FSR_DELEGATE);
break;
default:
- fs_respond_delegate(&res, res.id, buf);
+ _syscall_fs_respond(NULL, -1, 0);
break;
}
}
@@ -183,15 +183,18 @@ void fs_dir_inject(const char *path) {
if (buf[res.len - 1] == '/' &&
res.len < path_len && !memcmp(path, buf, res.len)) {
+ /* we're injecting */
handles[hid].inject = path + res.len;
/* if we're making up the opened directory, disallow create */
if (ret < 0 && (res.flags & OPEN_CREATE)) hid = ret;
+ _syscall_fs_respond(NULL, hid, 0);
} else {
/* not injecting, don't allow opening nonexistent stuff */
- if (ret < 0) hid = ret;
+
+ handles[hid].taken = false;
+ _syscall_fs_respond(NULL, ret, FSR_DELEGATE);
}
- _syscall_fs_respond(NULL, hid, 0);
break;
case VFSOP_CLOSE: