I just came across a VFS and a filesystem in userspace like FUSE.
Now, as far as I understand, it simulates a file system, so that an application can have a standard file system hierarchy. But I don't understand, why do we need a separate file system for that? Can't we just create a regular folder structure and place files which will be used by the app?
So, my questions are:
What is a VFS?
Can you give some real world examples, use cases where VFS is used.
What is the benefit of using a VFS?
Any Java based VFS?
VFS and FUSE are related, but not quite the same thing. The main purpose of FUSE is to turn things-that-are-almost-like-files-but-not-quite (such as files on a remote server, or inside a ZIP file) into "real" directories and files. See the roster of FUSE filesystems to get an idea of what this is good for; this hopefully will make it clearer why FUSE beats "plain old files" in a lot of circumstances.
A VFS is an Application Program Interface (API) for files. In case you are not familiar with the concept of an API, I suggest that you take a look at the Wikipedia page for "Virtual File System"; it describes what a VFS is from the point of view of an operating system kernel. Yes, your OS kernel (be it Windows, Linux or MacOS) has a VFS! Some user-space programs, such as GNOME, have one too (it's called GnomeVFS).
The purpose of a VFS is to present files and directories to applications in a uniform way; be they files from a CD-ROM, from a Linux or Windows filesystem on a hard disk or USB stick or RAM disk, or from a network server. That an OS kernel have a use for a VFS is probably obvious. Then why also have userspace ones, such as GnomeVFS? The answer is that you don't want every filesystem and its dog to reside in the kernel, because such code runs with supervisor privileges and any bug in it can cause the entire machine to crash. Of course, the drawback is that userspace VFSes are only useful for applications that use them, eg only GNOME applications can "see" through GnomeVFS; one cannot do "ls" inside a GnomeVFS tree. The solution is FUSE: its exact purpose and description is to turn a user-space VFS into a kernel one. In other words, it bridges a VFS API into the kernel, so that "fake" files can appear as "real".