Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Any chance javafuse can work?

Tags:

java

fuse

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);
  • Fuse_file_info

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.

like image 547
Kevin Avatar asked Nov 13 '22 03:11

Kevin


1 Answers

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.

like image 113
SerCe Avatar answered Nov 16 '22 04:11

SerCe