Virtualfs is implemented using GLIBC weak_alias feature. It allows a preloaded shared object (dll) to intercept various GLIBC functionalities. Virtualfs intercept most file system related function and either do something else, or call the original one.
It generally does this by analyzing the path of the request. If the path falls within a given directory, then operation such as file open ,read,write, close etc... are interpreted differently. The operation performed are generally:
When accessing the directory n/cdrom under you HOME directory the persmount driver will either redirect the access to /mnt/cdrom after making sure the CD is mounted. If you are running an X terminal, it will make an NFS mount to the terminal CD in /mnt/xterminal_name/cdrom and redirect the request there.
Path redirection offers two advantages:
All file operation may be redefine. The Litefs driver is an example of that. It allows one to establish a connection to a litefs server which is free to implement the semantic it wants. One such litefs server could map ftp session to file system semantic.
The AclFS driver is a good example of that. It intercepts only a few file system operations. For example, it does not intercept reads and writes. It only intercept the file open command. It does a request to the AclFS server (aclfsd) to perform the request on behalf of the client. The AclFS server may perform the file open operation based on the access rights the client have. If the operation is successful, a file handle is passed back to the client and the client will perform normal file operations (straight in the OS, no overhead) normally.
Virtualfs is a personal thing. Each user may have its own configuration. The $HOME/n directory is the special directory used by most Virtualfs drivers. Under this directory, you will find
To access the floppy, you must have an entry in /etc/fstab that looks like this
/dev/fd0 /mnt/floppy msdos user,noauto 0 0
Note that Virtualfs is enabled per process. This means that you can have a shell/desktop operating with Virtualfs while another is not on the same machine. It also means that one user may be running some part of its desktop environment with Virtualfs support and the other part without. While strange, this may turn to be the major feature behind Virtualfs, once many Virtualfs drivers are available. One can think of Virtualfs as providing several different (virtual) views of the same file system.