project-machine / puzzlefs

Apache License 2.0
380 stars 18 forks source link

Replace fuse with fuser, a maintained fork of fuse #51

Closed ariel-miculas closed 1 year ago

ariel-miculas commented 1 year ago

Features:

This requires changes in structure definitions, mainly because (the unsafe) thread-scoped was removed from fuser in https://github.com/cberner/fuser/commit/f20051e6bdbe809c13e0d41ef5e2592df84b5b53

Because thread-scope was removed, the spawn_mount function signature was changed; fuse's spawn_mount function differs in signature from fuser's spawn_mount2 in the FS trait: fuse: FS: Filesystem + Send + 'a fuser: FS: Filesystem + Send + 'static + 'a

The 'static trait bound means that the type does not contain any non-static references. Any owned data always passes a 'static lifetime bound, but a reference to that owned data generally does not. https://doc.rust-lang.org/rust-by-example/scope/lifetime/static_lifetime.html

In short, scoped threads allowed us to borrow non-'static data, so it was ok for struct PuzzleFs to store a reference to an Image. Since we're not using thread-scope anymore, PuzzleFs needs to own its fields instead of storing references, so the structure can be moved into another thread. We use an Arc which is a thread-safe reference-counting pointer.

Signed-off-by: Ariel Miculas amiculas@cisco.com