Add Example Grate: In Memory File System#4
Conversation
examples/imfs-grate/compile_grate.sh
Outdated
| @@ -0,0 +1,4 @@ | |||
| #!/bin/bash | |||
|
|
|||
| /home/lind/lind-wasm/clang+llvm-16.0.4-x86_64-linux-gnu-ubuntu-22.04/bin/clang -pthread --target=wasm32-unknown-wasi --sysroot /home/lind/lind-wasm/src/glibc/sysroot -Wl,--import-memory,--export-memory,--max-memory=1570242560,--export=signal_callback,--export=__stack_pointer,--export=__stack_low,--export=open_grate,--export=close_grate,--export=lseek_grate,--export=read_grate,--export=write_grate,--export=fcntl_grate,--export-table imfs_grate.c imfs.c -g -DLIB -DDIAG -D_GNU_SOURCE -O0 -o imfs_grate.wasm && /home/lind/lind-wasm/tools/binaryen/bin/wasm-opt --epoch-injection --asyncify -O2 --debuginfo imfs_grate.wasm -o imfs_grate.wasm && /home/lind/lind-wasm/src/wasmtime/target/release/wasmtime compile imfs_grate.wasm -o imfs_grate.cwasm | |||
There was a problem hiding this comment.
is this custom per grate or extensible?
There was a problem hiding this comment.
For now it is per grate since we need to specify which grate functions are exported. I believe Alice is working on a way around this, so that we don't need to do function dispatches based on exports.
marcelamelara
left a comment
There was a problem hiding this comment.
Thanks! I've reviewed the README, and have a few places where I think clarification would help. I also think we should revisit some default settings, if possible.
- Fix comments on the README - Working version compatible with lind-wasm changes - New folder structure + compile script for grates - Add tests, remove random logs - clang-format
|
Re-requesting review from @rennergade and @Yaxuan-w. Need inputs on this:
My basic logic is that we should ideally have a uniform way for building and running these example grates. |
|
compile_grate.sh hard-codes toolchain paths under /home/lind/..., could we make these env-overridable (or derived from LIND_WASM_ROOT) so it's easier? build.conf sets C_FLAGS=... but the script only reads EXTRA_CFLAGS, so those flags never get applied unless users manually set EXTRA_CFLAGS |
rennergade
left a comment
There was a problem hiding this comment.
I think this looks good. @Yaxuan-w can you review when you have a chance? Feel free to merge if you approve
Yaxuan-w
left a comment
There was a problem hiding this comment.
Great job! Would be helpful to have comments about general description and functionality at top of each file
|
Also, would be helpful to open up an issue about adding more tests about imfs |
- Reset doomed to 0 on reallocated nodes. - Terminate strings with \0 in add_child. - Fix offset math in imfs_write. - Use _USR instead of _OTH for access checks. - Add added access checks on read and write.
|
Re-requesting review from @Yaxuan-w, have addressed the comments about more documentation on imfs_grate and compile_grate script. Also added more thorough tests for testing the imfs with the grate in lind. |
Yaxuan-w
left a comment
There was a problem hiding this comment.
LGTM! But I'm a bit worried about the register_handler usage would need to update after refactoring PR being merged
Closes: #2