在Windows上创建一个可以添加读/写调用功能的虚拟文件有多难?
举例来说,理想我想创建一个文件,然后附加一个事件处理程序,以便每当读取文件时,读取通话块和码飞奔着去取数据,该数据被填充到该文件,然后将数据发送到请求阅读的程序.
根据我的理解,这与FUSE的工作方式非常接近,但在Windows中似乎没有FUSE实现.如果有办法,那么捕获开放/读/写真的是我所需要的.
我有一个OSGi包,它使用bundle-context.xml文件来初始化bean.
<bean id="myBean" class="test.MyClass">
<property name="output" value="test"/>
</bean>
Run Code Online (Sandbox Code Playgroud)
我有一个需要获取bean实例的工厂类.在非OSGI世界中,我总是只需要以下内容来初始化上下文并获取bean的句柄...
ApplicationContext applicationContext = new ClassPathXmlApplicationContext("bundle-context.xml");
MyClass bean = (MyClass) applicationContext.getBean("myBean");
Run Code Online (Sandbox Code Playgroud)
但是,在OSGI(FuseESB 4.2,Servicemix4)中,容器会自动加载bundle-context.xml文件并初始化spring上下文.如果我显式加载上下文(使用上面的代码),则会创建2个上下文(这是不好的).那么,获取相同上下文/ bean的句柄的正确方法是什么?
我正在玩用Go包裹FUSE.但是我已经陷入了如何应对的困境struct fuse_operations.我似乎无法通过声明type Operations C.struct_fuse_operations成员是小写来暴露操作结构,而我的pure-Go源必须使用C-hackery来设置成员.在这种情况下我的第一个错误是"无法设置getattr",看起来是Go等效的默认复制构造函数.我的下一个尝试是揭露一个期望的接口GetAttr,ReadLink等等,然后生成C.struct_fuse_operations和函数指针绑定到打电话给定接口关闭.
这就是我所拥有的(代码后解释继续):
package fuse
// #include <fuse.h>
// #include <stdlib.h>
import "C"
import (
//"fmt"
"os"
"unsafe"
)
type Operations interface {
GetAttr(string, *os.FileInfo) int
}
func Main(args []string, ops Operations) int {
argv := make([]*C.char, len(args) + 1)
for i, s := range args {
p := C.CString(s)
defer C.free(unsafe.Pointer(p))
argv[i] = p
}
cop := new(C.struct_fuse_operations)
cop.getattr = func(*C.char, *C.struct_stat) int {}
argc := C.int(len(args)) …Run Code Online (Sandbox Code Playgroud) 我readdir()在保险丝中实现功能时遇到了一个奇怪的问题.基本上当我ls在保险丝中的任何目录上执行时,我收到一个错误,例如:
#ls
ls:读取目录.:输入/输出错误
file1.c file2.c
但奇怪的是,readdir()它正在做它应该做的事情.在某个意义上,在该特定目录中,我有两个名为的文件file1.c,file2.c并且能够正确读取它.
在调试问题时,我注意到fuse filler函数(fuse_fill_dir_t作为参数传递readdir())可能导致此错误.
这是因为如果我只是使用调试打印目录printf的内容而不使用填充函数返回内容,我没有看到错误.
但是一旦我开始使用填充函数返回内容,我就开始看到这个错误.
我有两个与此相关的问题:
1)任何人都知道为什么filler函数可能导致这个问题?
2)如何查找fuse_fill_dir_t函数代码的定义?我已经通过这种论证查看了大部分保险丝功能但直到现在都没有运气.
任何帮助表示赞赏!
干杯,Vinay
上下文:Ubuntu 11.10和libfuse 2.8.4-1.4ubuntu1 Linux 3.0.0-14-generic#23-Ubuntu SMP Mon Nov 21 20:28:43 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux
我正在尝试使用libfuse.我想让fuse_session_loop退出(从信号处理程序或不同的线程),但是当我调用fuse_session_exit时,在会话收到新请求之前没有任何反应.
fuse_session_exit设置一个由fuse_session_exited读取的标志.调试到fuse_session_loop它似乎在fuse_chan_recv上阻塞,因此它不会再次检查fuse_session_exited直到循环的顶部...
int fuse_session_loop(struct fuse_session *se)
{
int res = 0;
struct fuse_chan *ch = fuse_session_next_chan(se, NULL);
size_t bufsize = fuse_chan_bufsize(ch);
char *buf = (char *) malloc(bufsize);
if (!buf) {
fprintf(stderr, "fuse: failed to allocate read buffer\n");
return -1;
}
while (!fuse_session_exited(se)) {
struct fuse_chan *tmpch = ch;
res = fuse_chan_recv(&tmpch, buf, bufsize); <--- BLOCKING
if (res == -EINTR)
continue;
if (res <= 0) …Run Code Online (Sandbox Code Playgroud) 我在我的日常工作中使用macosx 10.7上的sshfs.
要安装sshfs,我使用过macport:"port install fuse4x sshfs".
今天的错误:
$ sshfs user@domain.com:/path myfolder
fuse4x client library version is incompatible with the kernel extension (kext='0.9.0', library='0.9.2').
Run Code Online (Sandbox Code Playgroud)
欢迎任何提示.我不明白,我还没有更新系统.
我有一个我需要在EC2实例(Ubuntu 12.04.2)上安装的Amazon S3存储桶(我们称之为static.example.com).我已经安装了s3fs.我能够安装音量,但我无法写入音量.我试过了:
sudo s3fs static.example.com -o use_cache=/tmp,allow_other,uid=33,gid=33 /mnt/static.example.com
Run Code Online (Sandbox Code Playgroud)
然后我就可以cd /mnt和ls -la看:
drwxr-xr-x 5 root root 4096 Mar 28 18:03 .
drwxr-xr-x 25 root root 4096 Feb 19 19:22 ..
lrwxrwxrwx 1 root root 7 Feb 21 19:19 httpd -> /httpd/
drwx------ 2 root root 16384 Oct 9 2012 lost+found
drwxr-xr-x 1 www-data www-data 0 Jan 1 1970 static.example.com
Run Code Online (Sandbox Code Playgroud)
这一切看起来都不错,但是当我cd static.example.com和mkdir test我得到:
mkdir: cannot create directory `test': Permission denied
Run Code Online (Sandbox Code Playgroud)
我可以实际创建目录或触摸文件的唯一方法是强制它sudo.但是,这不是一个可行的选择,因为我想从Apache将文件写入存储桶.我的Apache服务器以用户身份运行:group …
我正在尝试在 Fedora 机器上构建一个 java 项目 http://sourceforge.net/projects/fuse-j/?source=typ_redirect。编译 JNI 绑定时编译失败。
生成文件
include ../build.conf
include ../jvm_ldpath.def
SRCS := javafs.c javafs_bindings.c
HDRS := javafs.h javafs_bindings.h
LIB_SO := libjavafs.so
INCLUDES := -I${FUSE_HOME}/include -I${JDK_HOME}/include -I${JDK_HOME}/include/linux
LDPATH := ${LDPATH} -L${FUSE_HOME}/lib
all: ${LIB_SO}
${LIB_SO}: ${SRCS} ${HDRS}
gcc -fPIC -shared -D_FILE_OFFSET_BITS=64 -o ${LIB_SO} ${INCLUDES} ${LDPATH} -ljvm -lfuse -lpthread ${SRCS}
clean:
rm -f ${LIB_SO}
Run Code Online (Sandbox Code Playgroud)
错误:
/bin/ld: cannot find -ljvm
collect2: error: ld returned 1 exit status
Makefile:17: recipe for target 'libjavafs.so' failed
make[1]: *** [libjavafs.so] Error
Run Code Online (Sandbox Code Playgroud)
JDK_HOME ,FUSE_HOME 设置正确。你能建议这里有什么问题吗?
我在docker容器中使用gcsfuse(基本映像centos7),并且无法读取或写入已安装的目录.
我正在使用gcsfuse安装目录,如下所示:
[root@6c24c3a6cc28 /]# gcsfuse --foreground --key-file=/src/gcloud_service_account.json my-bucket /gcloud/
Using mount point: /gcloud
Opening GCS connection...
Opening bucket...
Mounting file system...
File system has been successfully mounted.
Run Code Online (Sandbox Code Playgroud)
当我尝试读取或写入已安装的目录时,我收到此错误:
[root @ 6c24c3a6cc28 /] #ls -la/gcloud/ls:reading directory/gcloud /:输入/输出错误总数0
gcsfuse打印出调试信息说:
fuse:2016/01/14 01:33:41.110260*fuseops.ReadDirOp错误:readAllEntries:ReadEntries:ListObjects:获取https://www.googleapis.com/storage/v1/b/my-bucket/o?delimiter =%2F&projection = full:私钥应该是PEM或普通PKSC1或PKCS8; 解析错误:asn1:结构错误:标记不匹配(16 vs {class:1 tag:27 length:123 isCompound:true}){optional:false explicit:false application:false defaultValue:tag:stringType:0 timeType: 0 set:false omitEmpty:false} pkcs1PrivateKey @ 2
我正在运行这样的
docker :docker run -p 3000:3000 \
--privileged\--cap-add SYS_ADMIN\--device/dev/fuse\--name gcsfuseTest\gcsfuseImage
我不是100%肯定--cap-add SYS_ADMIN和--device/dev/fuse得到我.我把它们放在其他使用docker上的保险丝安装的用户的基础上.
我刚刚开始学习 FUSE,我将在 FreeBSD 和 MacOS 下将它与 Python 3 一起使用。首先,我有点困惑哪个模块是 Python 3 端 FUSE 的实际接口:
所以,看起来,FUSE 库的实际版本是 3,看起来,我应该使用pyfuse3,但是关于“Linux 文件系统”的评论让我想知道我是否应该回退到python-fuse在 FreeBSD/MacOS 下愉快地工作。