WebAssembly / WASI

WebAssembly System Interface
Other
4.84k stars 251 forks source link

Filesystem in userspace support (FUSE) #123

Open ilyaigpetrov opened 4 years ago

ilyaigpetrov commented 4 years ago

I wish a wasi program could emulate filesystem, e.g.:

myprogram mount ./configs
# Downloads my config files in ./configs.
# I edit configs in ./configs.
vim ./configs/main.json
# libfuse automatically uploads my changes if no errors.
# Web service starts working according to new configs without the need to visit a site
# and change configs there.
umount ./configs

I tried to compile libfuse's hello.c but get the following error in wasi-sdk:

$ /opt/wasi-sdk/bin/clang hello.c `pkg-config fuse3 --cflags --libs` -o demo.wasm
In file included from hello.c:24:
/usr/local/include/fuse3/fuse.h:25:10: fatal error: 'sys/statvfs.h' file not found
#include <sys/statvfs.h>
         ^~~~~~~~~~~~~~~
1 error generated.

Initially discussed here: https://github.com/CraneStation/wasi-sdk/issues/66.

NotWearingPants commented 4 years ago

It doesn't make sense to be able to compile FUSE using WASI, because it relies on Linux. What does make sense is to create a vfs API, which I believe is being done, but I'm not sure.

Either way, supporting FUSE itself makes no sense, but supporting the same behavior does.

eddyp commented 4 years ago

It doesn't make sense to be able to compile FUSE using WASI, because it relies on Linux. What does make sense is to create a vfs API, which I believe is being done, but I'm not sure.

Either way, supporting FUSE itself makes no sense, but supporting the same behavior does.

This is incorrect, FUSE is supported on various *nix systems.

https://en.wikipedia.org/wiki/Filesystem_in_Userspace:

FUSE is available for Linux, FreeBSD, OpenBSD, NetBSD (as puffs), OpenSolaris, Minix 3, Android and macOS.[2]

There is some support for WIndows, too: http://www.secfs.net/winfsp/ http://dokan-dev.github.io/