MCPcopy
hub / github.com/hanwen/go-fuse

github.com/hanwen/go-fuse @v2.10.1 sqlite

repository ↗ · DeepWiki ↗ · release v2.10.1 ↗
2,266 symbols 7,541 edges 252 files 577 documented · 25%
README

Go-FUSE

CI GoDoc

Go native bindings for the FUSE kernel module.

Use github.com/hanwen/go-fuse/v2/fs library. It follows the wire protocol closely, but provides convenient abstractions for building both node and path based file systems

Release notes

v2.10:

  • fs: LoopbackFile is now public.
  • fuse: ReadResultPipe allows more flexibility for zero-copy read results, eg. concatenate data from multiple files at the same time.
  • fuse: Options.ExtraCapabilities/DisabledCapabilities allows generically en/disabling kernel features
  • fuse, fs: PruneNotify support. This lets the file system force the kernel to forget nodes.
  • fuse: type ProtocolServer. This enables running the FUSE protocol over transports that are not the standard kernel connection
  • virtiofs: serve FUSE file system to VMs directly as virtiofs servers.
  • general: require go 1.21

v2.9:

  • fs: NodeWrapChilder interface
  • fs: FileLookuper interface

v2.8

  • fuse, fs: support IOCTL
  • fuse: add RawFileSystem.OnUnmount
  • fs: symlink safety for fs.LoopbackRoot
  • fuse: ID mapped mounts
  • fs: NewLoopbackDirStreamFd

v2.7

  • fuse, fs: support STATX

v2.6

  • general:
  • drop support for go1.16
  • fuse:
  • FreeBSD support
  • passthrough support for increased performance
  • DirEntryList.Offset and DirEntry.Off are visible now; add DirEntry.Parse
  • fs:
  • new directory API, supporting caching and file handles for Readdir and FsyncDir
  • passthrough support for increased performance
  • allow LoopbackNode to be used as non-root
  • OnForget method

v2.5

  • Support for RenameExchange on Darwin

Comparison with other FUSE libraries

Further highlights of this library is

  • Comprehensive and up to date protocol support (up to 7.12.28).

  • Performance that is competitive with libfuse.

Examples

  • example/hello/ contains a 60-line "hello world" filesystem

  • zipfs/zipfs contains a small and simple read-only filesystem for zip and tar files. The corresponding command is in example/zipfs/ For example,

```shell mkdir /tmp/mountpoint example/zipfs/zipfs /tmp/mountpoint file.zip & ls /tmp/mountpoint fusermount -u /tmp/mountpoint ````

  • zipfs/multizipfs shows how to use combine simple Go-FUSE filesystems into a larger filesystem.

  • example/loopback mounts another piece of the filesystem. Functionally, it is similar to a symlink. A binary to run is in example/loopback/ . For example

shell mkdir /tmp/mountpoint example/loopback/loopback -debug /tmp/mountpoint /some/other/directory & ls /tmp/mountpoint fusermount -u /tmp/mountpoint

macOS Support

The main developer (hanwen@) does not own a Mac to test, but accepts patches to make Go-FUSE work on Mac.

  • All of the limitations of OSXFUSE, including lack of support for NOTIFY.

  • OSX issues STATFS calls continuously (leading to performance concerns).

  • OSX has trouble with concurrent reads from the FUSE device, leading to performance concerns.

  • Tests are expected to pass; report any failure as a bug!

Credits

  • Inspired by Taru Karttunen's package, https://bitbucket.org/taruti/go-extra.

  • Originally based on Ivan Krasin's https://github.com/krasin/go-fuse-zip

Bugs

Report them through https://github.com/hanwen/go-fuse/issues. Please include a debug trace (set fuse.MountOptions.Debug to true).

License

Like Go, this library is distributed under the new BSD license. See accompanying LICENSE file.

Extension points exported contracts — how you extend this code

NodeAccesser (Interface)
Access should return if the caller can access the file with the given mode. This is used for two purposes: to determine [9 …
fs/api.go
ReadResult (Interface)
Types for users to implement. The result of Read is an array of bytes, but for performance reasons, we can also return d [3 …
fuse/api.go
File (Interface)
A File object is returned from FileSystem.Open and FileSystem.Create. Include the NewDefaultFile return value into the [3 …
fuse/nodefs/api.go
FileSystem (Interface)
A filesystem API that uses paths rather than inodes. A minimal file system should have at least a functional GetAttr me [3 …
fuse/pathfs/api.go
LatencyMap (Interface)
This type may be provided for recording latencies of each FUSE operation. [2 implementers]
fuse/server.go
ServerCallbacks (Interface)
ServerCallbacks are calls into the kernel to manipulate the inode, entry and page cache. They are stubbed so filesystem [1 …
fs/bridge.go
NodeGetattrer (Interface)
GetAttr reads attributes for an Inode. The library will ensure that Mode and Ino are set correctly. For files that are n [17 …
fs/api.go
RawFileSystem (Interface)
RawFileSystem is an interface close to the FUSE wire protocol. Unless you really know what you are doing, you should no [2 …
fuse/api.go

Core symbols most depended-on inside this repo

Close
called by 183
fs/api.go
Ok
called by 81
fuse/misc.go
Open
called by 74
fs/api.go
ToErrno
called by 67
fs/constants.go
Inode
called by 57
fuse/nodefs/api.go
VerboseTest
called by 55
internal/testutil/verbose.go
ToStatus
called by 53
fuse/misc.go
errnoToStatus
called by 52
fs/bridge.go

Shape

Method 1,352
Function 559
Struct 274
Interface 75
TypeAlias 4
FuncType 2

Languages

Go100%

Modules by API surface

fs/api.go125 symbols
fuse/types.go86 symbols
fs/bridge.go71 symbols
fuse/pathfs/pathfs.go66 symbols
fuse/nodefs/api.go56 symbols
fuse/opcode.go49 symbols
fuse/nodefs/fsops.go48 symbols
fuse/api.go48 symbols
fuse/print.go47 symbols
fs/inode.go46 symbols
fuse/defaultraw.go44 symbols
fuse/nodefs/files.go42 symbols

Dependencies from manifests, versioned

github.com/kylelemons/godebugv1.1.0 · 1×
github.com/moby/sys/mountinfov0.7.2 · 1×
golang.org/x/syncv0.10.0 · 1×
golang.org/x/sysv0.28.0 · 1×

For agents

$ claude mcp add go-fuse \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact