This is my first time playing with emscripten and sharing buffers between wasm and javascript is awkward.
This is my first time playing with emscripten and sharing buffers between wasm and javascript is awkward.
I know what you are saying is true and I should have no fear. I just need to write lots of tests and log like a mofo until I get all the ioctl commands it needs built out on the javascript side.
What's the value of having direct device access in Javascript? Are we expected to give the browser raw block device access now? Maybe we could implement a FAT layer on top of S3, but I really don't see the value in reimplementing block-level storage on top of object storage.
When I found FatFs, I realized I had a perfect fit: a realish filesystem with an API that I could map right onto system calls, and FAT32 - a klunky old jalopy that will need defragmenters and other disk tools to maintain it. It'll make for an altogether more interesting ecosystem and a gentle challenge for the user to maintain.
Also, there are many areas of my javascript that are primed for conversion to C -> WASM, like sprite collision detection. JavaScript optimizers have done ok with my code, but I'd like my compy to run fast on mobile too. If I am successful with FatFs, I will have a convenient spot in my codebase for converting my busy number-intensive routines into WASM.
People are expecting to embed WASM[1]. A generic FAT can provide a lightweight storage abstraction for such work. The WAMR AOT compiled runtime is 50K; 2.5-10% of the flash memory on a STM32F4, for example. Obviously not appropriate for the smallest extant MCUs. Otherwise it's a viable choice.
https://web.archive.org/web/20210505023207/http://dunfield.c...
> This is my first time playing with emscripten and sharing buffers between wasm and javascript is awkward.
You are using "SharedArrayBuffer", I assume?It could have been replaced by 3 or 4 calls with a clear single purpose, and I'd hope they'll realize this and fix the API in a future version.
kdbus could probably provide richer interfaces eventually, but proximity to freedesktop will probably perpetuate a certain amount of pushback.
The main point is that the ioctl interface is limited in its expression. It is hard to filter for security, and have bad evolutionary properties. Many of the subprotocol designs over the top of ioctl have memory safety hazards even beyond the immediate issue of needing to often make and trim buffers in less than ideal ways. This is to say the interface is hard to design well with, and a more formally typed system would provide a better solution.
Regardless, OP isn't on Linux, and the point is to not copy the bad interface!
It is fatfs, a tiny fat library for embedded use, which most of the time will be used w/o an OS.