How do communicate between FUSE filesystem daemon process and user application process in linux?

2

I'm studying Linux FUSE.

Now I understand overall FUSE architecture and what is libfuse, /dev/fuse device file. But I can't find detail information about process communication between application process and FUSE filesystem daemon process. So I analysis fuse code.

It looks like fuse uses a wait queue and file to communicate between two processes. The wait queue is used for sending a signal. a file is used for send/receive request contents. Is that right??

If my analysis is right, why does fuse use a file? Why not use some other IPC? File looks slower than other IPC mechanisms...

My question is not IPC in user level. Kernel - userspace interface section in https://www.kernel.org/doc/Documentation/filesystems/fuse.txt, there is a example rm application and Fuse file system daemon. Two process communicates by using request_send(), request_receive() function. so I analyzed those functions. I want these functions how works. thanks.

Supsupi

Posted 2017-08-23T10:08:53.717

Reputation: 31

Why would a file be used? File descriptors are used for many things, including pipes and network sockets and whatnot. – Daniel B – 2017-08-23T10:55:47.777

Answers

2

FUSE uses a filesystem API because the whole purpose of FUSE is to provide a filesystem API to the process.

Say you have some program that accesses files. It's going to use a filesystem API because that's how programs access files. Now, say you want the program to work with FUSE. FUSE has to provide a filesystem API to that process because that's what that program is using and we don't want to have to modify every program on a system just to get FUSE to work. You don't have to rewrite programs for any other filesystem.

Imagine how awful a filesystem would be if it used its own APIs and you have to modify every program on your system if you wanted it to be able to use files on that filesystem. Yuck.

If My analysis is right, why fuse ues file? why don't use other ipc? File looks like slower than other ipc mechanisms...

Why would that be the case? Remember, we're not talking about files on a disk. We're talking about the concept of a file as an IPC mechanism. That is, process A tells process B that it wants to open a file by using an open call or that it wants to write to a file by using a write call. Why would that be slower than using any other call? The implementation of those functions can be whatever we want.

David Schwartz

Posted 2017-08-23T10:08:53.717

Reputation: 58 310

thanks for reply. I know that fuse provide filesystem API such as open, read, write... but my question is not application level IPC. – Supsupi – 2017-08-23T10:53:32.920

Kernel - userspace interface section in https://www.kernel.org/doc/Documentation/filesystems/fuse.txt, there is a example rm application and Fuse file system daemon. Two process communicates by using request_send(), request_receive() function. so I analysis those functions.

– Supsupi – 2017-08-23T10:58:22.213

I analysed Fuse Module. and find out how to communicate two processes. Fuse module makes ring buffer in kernel memory space and uses it to communicate. – Supsupi – 2017-09-05T07:50:46.283