Source

fuse-jna /

Filename Size Date modified Message
.settings
examples
lib/jna
src/net/fusejna
381 B
31 B
367 B
1.5 KB
2.3 KB

The straight dope

Grab it

git clone git://github.com/EtiennePerot/fuse-jna.git

Run it

fuse-jna/examples/hellofs.sh ~/hellofs

You now have a test filesystem in ~/hellofs. You'll find a file called hello.txt in there.

There's another example filesystem that you can use, which is writable:

fuse-jna/examples/memoryfs.sh ~/memoryfs

Make your own filesystem

  1. Subclass net.fusejna.FuseFilesystem and override the methods you need (For convenience, there is an adapter called FuseFilesystemAdapterFull).

  2. Create an instance of your subclass, then call .mount(mountpoint) on it.

  3. The filesystem will be unmounted automatically at JVM shutdown time if possible. You can unmount it at runtime using .unmount().

  4. (Bonus) You can get logging for free by calling .log(true) on the filesystem instance.

The longer stuff

The idea

fuse-jna was born out of the desire for no-compilation-required, no-bullshit, actually-working bindings to the FUSE library.

Originally built to make the OS X/Linux port of SrcDemo² possible, it was separated into its own library because I figured others would benefit from it.

I like Python, and I like using fuse.py when writing FUSE filesystems in Python. Thanks to ctypes, only one file and you get nice, straight Python bindings. The goal of fuse-jna is to bring FUSE bindings to Java with the same simplicity.

To do that, it uses JNA, which was inspired by Python's ctypes in terms of ease-of-use.

Compatibility

Following fuse.py, fuse-jna should work with:

  • OS X with MacFUSE/fuse4x/OSXFUSE on Intel architectures
  • Linux with FUSE on Intel and PowerPC architectures
  • FreeBSD with FUSE on Intel architectures

Licensing

fuse-jna is licensed under the BSD 2-Clause License. JNA is licensed under the LGPL v2.1.