GithubHelp home page GithubHelp logo

go-fuse-c's Introduction

go-fuse-c

Build Status GoDoc

CGO wrapper for FUSE C low-level API.

Purpose

After running into trouble getting a couple "pure-Go" FUSE wrappers working, I decided that the most practical approach was to wrap the C library. This would allow reuse of system-specific libraries (like OSXFuse) and avoid ongoing work of porting fixes from multiple client libraries. If your system has a C-API compatible libfuse, then it is likely that this will work with it.

Additionally, I want access to the FUSE Low-Level API, which deals with inodes, rather than the Path based API. Although the Path based API makes it easy to write simple filesystems, the Low Level API is more powerful and makes it easier to make the filesystem behave like a built-in Posix filesystem.

Alternatives

For more FUSE-related references, see Resources Related to FUSE

  • GoFuse: The GoFuse library is a little difficult to use, even if you're familiar with FUSE and Go.

  • Bazil Fuse: Bazil has a low-level API which is similar to this library, however it is lacks good examples and has been mostly dead for years. 4 years ago (April 2015), I spent time figuring out all the interfaces used by Bazil in order to make an in-memory FS example. That PR request is still pending add in-memory example.

  • jacobsa/fuse: Has lots of samples. Don't have any experience with it myself.

Examples

To try the hello example, which corresponds to hello low-level API example that comes with FUSE:

go build example/hello/hello.go
./hello /tmp/mountpoint

Also provided is a slightly more interesting in-memory filesystem:

go build example/memfs/memfs.go
./memfs /tmp/mountpoint

Development Notes

Bridge functions and filesystem handles

The C bridge functions handle the initial FUSE operation callbacks. They call through to static Go functions which are exported in the bridge code. These static functions lookup the filesystem from the provided filesystem handle and pass control to the filesystem implementation.

Integer filesystem handles are used instead of pointers as it is bad form to hold pointers to Go structures in C.

Testing

Bridge methods are normally called from FUSE. However the bridge methods are also available in Go for testing purposes. Since types such as fuse_req are opaque, the FUSE reply methods cannot be called during tests. An internal function enable_bridge_test_mode is used to switch to using test reply methods so that the C / Go interfaces can be tested without running FUSE code.

Run go test -v ./... to execute tests.

go-fuse-c's People

Contributors

vgough avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

go-fuse-c's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.