我想用Java構建一個基於FUSE的基於底層的文件系統應用程序。 網上有幾個綁定庫,Fuse-J,jnetfs,Fuseforjava,javafuse。任何機會javafuse可以工作?
他們沒有一個像今天一樣真正活着,所以我給了我第一次嘗試JavaFuse
。
我們必須實現的接口有: http://code.google.com/p/javafuse/source/browse/fs/JavaFS.java
,我想重現此fuse helloworld example。
問:是否有任何機會,這:
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;
}
可以通過這個Java函數來實現:
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);
也許我錯過了什麼,但我不能看到如何使用filler
填充目錄內容...
還有其他的古怪只是這個HelloWorld示例,如:
public int read_post(String path, String buf, int size, int offset, Fuse_file_info info, int result);
這是假設爲填充buf
與size
字節的數據,而Java String
應該是不可變的。
我會使用https://github.com/EtiennePerot/fuse-jna來吸收 – user629926
是的,它看起來很有趣。但是我已經切換到[JNetFs](https://code.launchpad.net/jnetfs),它回答了我迄今爲止的所有要求! (雖然在C庫中仍然缺少一些綁定,但我必須自己綁定它們) – Kevin
+1以獲得FUSE-Java實現的列表。 –