core/iwasm: Support mapped file system access on non-libuv WASI (#2628)

This patch enables mapping host directories to guest directories by parsing
the `map_dir_list` argument in API `wasm_runtime_init_wasi` for libc-wasi. It
follows the format `<guest-path>::<host-path>`.

It also adds argument `--map-dir=<guest::host>` argument for `iwasm`
common line tool, and allows to add multiple mappings:
```bash
iwasm --map-dir=<guest-path1::host-path1> --map-dir=<guest-path2::host-path2> ...
```
This commit is contained in:
Alfred E. Neumayer
2023-10-27 06:48:10 +02:00
committed by GitHub
parent 8038b9c524
commit 9b8fe049b3
3 changed files with 95 additions and 4 deletions

View File

@ -423,6 +423,7 @@ wasm_runtime_get_module_hash(wasm_module_t module);
* @param dir_list The list of directories to preopen. (real path)
* @param dir_count The number of elements in dir_list.
* @param map_dir_list The list of directories to preopen. (mapped path)
* Format for each map entry: <guest-path>::<host-path>
* @param map_dir_count The number of elements in map_dir_list.
* If map_dir_count is smaller than dir_count,
* mapped path is assumed to be same as the