5 ms·
The libfuse github has some good examples for C/C++ in [0] of increasing complexity: - passthrough.c mirrors existing filesystem, "Its performance is terrible.
by dsp_person 2y ago
The libfuse github has some good examples for C/C++ in [0] of increasing complexity:
- passthrough.c mirrors existing filesystem, "Its performance is terrible."
- passthrough_fh.c "performance is not quite as bad."
- passthrough_ll.c implemented with low level api and "the least bad among the three"
- passthrough_hp.cc high performance version written in C++
Some interesting fuse projects in my notes: [1] splitting large files into segments; [2] show ZFS incremental snapshots as files; [3] transparent filesystem compression; [4] and [5] options for mounting archives as filesytems.
- [0] https://github.com/libfuse/libfuse/tree/master/example https://github.com/libfuse/libfuse/tree/master/example
- [1] https://github.com/seiferma/splitviewfuse https://github.com/seiferma/splitviewfuse
- [2] https://github.com/UNFmontreal/zfs_fuse_snapshot https://github.com/UNFmontreal/zfs_fuse_snapshot
- [3] https://github.com/FS-make-simple/fusecompress https://github.com/FS-make-simple/fusecompress
- [4] https://github.com/google/fuse-archive https://github.com/google/fuse-archive
- [5] https://github.com/mxmlnkn/ratarmount https://github.com/mxmlnkn/ratarmount
- craftkiller 2y agoWhile [2] might be a good code example, this functionality is already built into ZFS. At the mountpoint of every dataset is a hidden ".zfs" folder that doesn't show up, even on a `ls -A`. You just have to believe its there and cd into it. Under that is a "snapshot" folder, and inside that is a folder for each snapshot of that dataset. Those folders contain the files in the snapshot. So for example, /etc/hosts from my snapshot zrepl_20241011_010143_000 would be at /.zfs/snapshot/zrepl_20241011_010143_000/etc/hosts If you don't like the magic hidden nature of it, you can even configure it to behave like a normal folder with `zfs set snapdir=visible <dataset>`
- dsp_person 2y agoWhat [2] is doing is exposing the raw send stream as a file, not what the contents of the hidden .zfs folder contains. https://github.com/UNFmontreal/zfs_fuse_snapshot/blob/64b17be54601a775be17c99fcfe20fcac91a6567/zfs_fuse_snapshot.py#L65 https://github.com/UNFmontreal/zfs_fuse_snapshot/blob/64b17b...
- hnlmorg 2y agoThe GP wasn’t suggesting [2] was using the ZFS snapshot folder. It was saying that ZFS natively supports a file system via of snapshots so people should be mindful to use [2] as an example of writing FUSE file systems rather than a practical tool for working with ZFS.
- j45 2y agoI was just thinking about Fuse the other day for a project to get around case sensitivity in linux for a use case. Appreciate these links. I'm a little rusty on it, if anyone has any Fuse tutorials or guides they found helpful, happy to receive.
- giis 2y agoIf you have recent kernel version and using ext4, case insensitivity for specific directory can be enabled using casefold feature. See https://unix.stackexchange.com/questions/558977/how-to-enable-new-in-kernel-5-2-case-insensitivity-for-ext4-on-a-given-directory https://unix.stackexchange.com/questions/558977/how-to-enabl...
- j45 2y agoNice, thank so much.
- RunningDroid 2y ago> I was just thinking about Fuse the other day for a project to get around case sensitivity in linux for a use case. You should give ciopfs* a shot, it's worked well enough for my use case (playing games indirectly based on nwjs) *https://www.brain-dump.org/projects/ciopfs/ https://www.brain-dump.org/projects/ciopfs/