-
Notifications
You must be signed in to change notification settings - Fork 0
memecode/fuse_libsmb2
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
FUSE to libsmb2 bridge ---------------------- This code allows access to SMB shares via a fuse mount. It should work under: Linux - using libfuse: https://github.com/libfuse/libfuse Windows - using winfsp: https://github.com/winfsp/winfsp Haiku - using userlandfs: https://github.com/haiku/haiku/tree/master/src/add-ons/kernel/file_systems/userlandfs Once built, you should be able to mount a folder using the syntax: fuse_libsmb2 -f --uri=smb://[user[:password]@]hostname/share /some/local/mountpoint The '-f' flag is to run in the foreground. Useful for debugging. Omit to run in the background. The code original started with all the synchronous calls to libsmb2. But gradually I'm migrating it to the async versions of those calls so that the global libsmb2 lock is not held during the waiting for response period. All libsmb2 functions are not thread safe and the global lock needs to be held when calling them. Fuse will call the wrapper functions from different threads. Also the CACHED_ATTR define switches on caching of readdir entries such that the getattr doesn't need to do a round trip to the server. This is important for large folders because the number of getattr calls can be in the 1000's and if you can only process 50/s it basically hangs for a long time just doing getattr calls. In terms of write support, there is now a range of functions for creating and removing folders, writing or truncating files and deleting files. It's partially tested. Also the caching mostly doesn't know about them. So it's likely that the cache will get out of date and return bad info once the underlying file system starts changing. At some point some timeouts should be added to requery the share for the latest info and update the cache. rmdir should also remove the entry from the cache. Linux ----- Install fuse v3: sudo apt-get install fuse3 Windows ------- Install WinFsp from here: https://winfsp.dev/rel I'm not 100% sure of the best flags to return from getattr. The current values for st_mode are a combination of the _S_IFREG style flags and various bits that aren't documented. YMMV. Haiku ----- The Haiku support that uses userlandfs is via the FUSE v2.x API. Some methods have less parameters. All the other OSs support the FUSE v3.x API. To install userlandfs: pkgman install userland_fs Under Haiku the binary is a library not an executable, and you have to install a symlink in ~/config/non-packaged/add-ons/userlandfs/fuse_libsmb2 to point at the built lib. Then you can mount via this command: mount -t userlandfs -o 'fuse_libsmb2 --uri=smb://myuser:mypass@host/share' /local/mount/path You can't run fuse_libsmb2 directly like the other OS's. MacOSX ------ I guess support is entirely possible... but I haven't tried it yet. I would expect that MacFUSE would be the logical way forward: https://osxfuse.github.io/