Thanks for everyone's work on Minix!
I'd like to detail what changes were necessary to squashfuse, so the next person to try a FUSE port has an easier time, and so the idiosyncrasies in Minix's FUSE implementation can be fixed. Please let me know if I got anything wrong.
1. Missing callbacks:
It looks like the FUSE callbacks 'opendir', 'releasedir', 'open' and 'release' aren't being called on Minix.
For squashfuse, I had to force 'readdir' and 'read' to lookup the path on each call, instead of relying on data cached in the above callbacks.
2. Missing context variables:
There's a void* argument to fuse_main() that is supposed to be passed to the 'init' callback. Then the return value of 'init' is supposed to be avaiable in fuse_get_context()->private_data during other callbacks. On Minix, neither of these happen.
Similarly, fuse_opt_parse() takes a void* that should get passed to the fuse_opt_proc callback, but this doesn't happen on Minix.
For squashfuse, I used global variables to substitute for the missing contexts.
3. st_ino in getattr callback:
The 'getattr' callback is documented by upstream FUSE to ignore the st_ino field of struct stat, but on Minix st_ino is required. Thankfully, squashfuse has an obvious way to fill in st_ino. Other filesystems may have to generate and cache a synthetic inode number.
4. Parsing of unmatched arguments:
Unmatched '-o option' arguments are supposed to be passed by fuse_opt_parse() to the option callback, but that doesn't seem to happen. Filesystems may have to roll their own argument parser, as I did.
5. Strange build flags:
The fuse headers require that _POSIX_C_SOURCE be undefined. This is unusual, though not out of spec.
Linking squashfuse with the usual flags '-lfuse' or '-lrefuse -lpuffs' fails on Minix, it also needs '-lminixfs -lsys -lminlib'.
Static linking appears necessary, and the '-Wl,-wrap,main' argument too.
It would be great if all this this was documented somewhere.
6. Mounting is unusual:
On most OSes, you mount an archive with squashfuse by running:
$ squashfuse path/to/archive.squashfs path/to/mountpoint
But on Minix, FUSE filesystems must be invoked like so:
$ mount [OPTIONS] -t myfilesystem /dev/block_device path/to/mountpoint
This doesn't work well for filesystems like squashfuse that don't require a block device. My workaround is the require the user to pass a dummy block device, and then add a '-o image=/full/path/to/archive.squashfs' option. Other filesystems may have to do something similar.
(Maybe vnconfig in future versions will help with this?)
7. Setup is complex:
A stanza for squashfuse must be added to system.conf.d. It seems like a reboot is necessary after that, though maybe there's another way.
The squashfuse executable must be copied to both /usr/bin/pkg/squashfuse and /usr/bin/pkg/mount.squashfuse . It doesn't seem like /usr/bin or /usr/local/bin works, for some strange reason.
Again, some documentation of this would be great.
Good luck with your next FUSE port!
Cheers,
Dave