diff options
Diffstat (limited to 'src/init/fs')
-rw-r--r-- | src/init/fs/misc.c | 18 | ||||
-rw-r--r-- | src/init/fs/misc.h | 2 |
2 files changed, 16 insertions, 4 deletions
diff --git a/src/init/fs/misc.c b/src/init/fs/misc.c index 55d14fa..d12fce3 100644 --- a/src/init/fs/misc.c +++ b/src/init/fs/misc.c @@ -10,16 +10,28 @@ bool fork2_n_mount(const char *path) { return h; } -void fs_passthru(void) { +void fs_passthru(const char *prefix) { struct fs_wait_response res; int buf_size = 64; char buf[ 64]; - int ret; + int ret, prefix_len; + if (prefix) prefix_len = strlen(prefix); for (;;) { switch (_syscall_fs_wait(buf, buf_size, &res)) { case VFSOP_OPEN: - ret = _syscall_open(buf, res.len); + if (prefix) { + if (prefix_len + res.len <= buf_size) { + // TODO memmove + char tmp[64]; + memcpy(tmp, buf, res.len); + memcpy(buf, prefix, prefix_len); + memcpy(buf + prefix_len, tmp, res.len); + ret = _syscall_open(buf, res.len + prefix_len); + } else ret = -1; + } else { + ret = _syscall_open(buf, res.len); + } _syscall_fs_respond(NULL, ret); break; diff --git a/src/init/fs/misc.h b/src/init/fs/misc.h index 87d5bdb..33e98f5 100644 --- a/src/init/fs/misc.h +++ b/src/init/fs/misc.h @@ -3,4 +3,4 @@ bool fork2_n_mount(const char *path); -void fs_passthru(void); +void fs_passthru(const char *prefix); |