简体   繁体   English

javafuse有什么机会可以工作吗?

[英]Any chance javafuse can work?

I would like to build a FUSE -based underland filesystem application, in Java. 我想用Java构建一个基于FUSE的underland文件系统应用程序。 There are a few bindings library available on the web, Fuse-J , jnetfs , Fuseforjava , javafuse . 网上有一些绑定库, Fuse-JjnetfsFuseforjavajavafuse

None of them seem really alive as of today, so I gave my first try to JavaFuse . JavaFuse ,他们似乎都没有真正活着,所以我第一次尝试使用JavaFuse

The interface we must implement is there: http://code.google.com/p/javafuse/source/browse/fs/JavaFS.java 我们必须实现的界面是: http//code.google.com/p/javafuse/source/browse/fs/JavaFS.java

and I wanted to reproduce this fuse helloworld example . 我想重现这个保险丝helloworld的例子


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: 可以通过这个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);

Maybe I missed something, but I can't see how to use filler to populate the directory content ... 也许我错过了什么,但我看不到如何使用filler来填充目录内容...

There are other oddities just for this helloworld example, like: 这个helloworld示例还有其他奇怪之处,例如:

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. 应该用size字节的数据填充 buf ,而Java String应该是不可变的。

You can try jnr-fuse project. 你可以尝试jnr-fuse项目。

The project uses JNR, so you achieve full JNI performance and ease of implementation. 该项目使用JNR,因此您可以实现完整的JNI性能和易于实现。

An example of implementation hello-world filesystem filter. 实现hello-world文件系统过滤器的示例。

I'm not exactly sure, what you are trying to do with the double function read_pre & read_post . 我不太确定,你正在尝试用double函数read_preread_post做什么。

Though I guess, they represent pre-work and post-work. 虽然我猜,但它们代表了前期工作和后期工作。 Maybe you can declare the normal readdir() and call you pre & post from inside? 也许你可以声明正常的readdir()并从内部调用你的pre&post? Passing the same arguments back & forth? 来回传递相同的参数? Because you have to declare readdir() to the fuse_main() . 因为你必须将readdir()声明为fuse_main()

And about the second thing with buffers, it just expects a byte holding storage. 关于缓冲区的第二件事,它只需要一个字节存储空间。 You can pass it character arrays, or anything with bytes in it, denoted by size_t size that represents the size of buffer. 您可以传递字符数组或其中包含字节的任何内容,由size_t size表示,表示缓冲区的大小。 In helloworld.c , the string characters are copied to buffer through memcpy() . helloworld.c ,字符串字符通过memcpy()复制到缓冲区。 You can read bytes from file and pass them on as buffer along with appropriate length. 您可以从文件中读取字节并将其作为缓冲区以及适当的长度传递。

I'm new to FUSE and would like to know how it is to work using Java as compared to the standard C. 我是FUSE的新手,想知道使用Java与标准C相比如何工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我们能不能在没有导入声明的情况下写这个? 就是想 - Can we write this without an import statement by any chance? Just wondering 如何在Ubuntu上构建Javafuse? - How to build javafuse on Ubuntu? 此代码是否有可能打印为空? - Is there any chance of this code printing null? 只有一个同步点的任何死锁机会? - Any chance of deadlock with only one sync point? 是否有机会将对象自动转换为Integer? - Any chance of Object auto casting to Integer? 是否有机会连接到主机上的在线数据库? - Is there any chance for connecting to online database in a host machine? 此Java代码是否有可能出现ClassCastException / IllegalStateException? - Is there any chance of ClassCastException/IllegalStateException with this java code? 只需点击一下,是否有机会获得双击按钮? - Is there any chance to get a button with double clicked after disabling it with one click? 是否有机会验证请求正文中 DTO Object 的所有值是 null - Is there any chance to validate all the values of the DTO Object is null in Request Body 有没有机会摆脱那个错误?(超出内存限制) - Is there any chance to get rid of that error?(Memory Limit Exceeded)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM