I would like to build a FUSE-based underland filesystem application, in Java. There are a few bindings library available on the web, Fuse-J, jnetfs, Fuseforjava, javafuse.
None of them seem really alive as of today, so I gave my first try to JavaFuse
.
The interface we must implement is there: http://code.google.com/p/javafuse/source/browse/fs/JavaFS.java
and I wanted to reproduce this fuse helloworld example.
Question: Is there any chance that this:
static int hello_readdir(const char *path, void *buf, fuse_fill_dir_t filler,
off_t offset, struct fuse_file_info *fi)
{
(void) offset;
(void) fi;
if(strcmp(path, "/") != 0)
return -ENOENT;
filler(buf, ".", NULL, 0);
filler(buf, "..", NULL, 0);
filler(buf, hello_path + 1, NULL, 0);
return 0;
}
can be implemented by this java function:
public int readdir_pre(String path, long buf, long filler, int offset, Fuse_file_info info);
public int readdir_post(String path, long buf, long filler, int offset, Fuse_file_info info, int result);
Maybe I missed something, but I can't see how to use filler
to populate the directory content ...
There are other oddities just for this helloworld example, like:
public int read_post(String path, String buf, int size, int offset, Fuse_file_info info, int result);
which is supposed to fill buf
with size
bytes of data, whereas Java String
are supposed to be immutable.
You can try jnr-fuse project.
The project uses JNR, so you achieve full JNI performance and ease of implementation.
An example of implementation hello-world filesystem filter.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With