1.2 VFS vs Traditional File System Access

Normally, you write data to a file with the intention of retrieving it at a later time. The file system stores your original data to some type of persistent media and ensures that the data returned is the same data that you originally stored.

Virtual files are treated much like regular files and can be deleted, created, opened, closed, read, and written. However, virtual files do not contain data and nothing is persistently stored in these files. Instead, a virtual file is configured at creation with information that tells the file system how to generate data for read operations and how to process data for write operations.

For example, a virtual file might represent a memory location that contains the amount of memory to be used in file system caching. When a read is posted to the file, the contents of the memory location are read, converted to ASCII, and the generated number is used to satisfy the read request. Data that is written to the file is converted from ASCII into a number and used to change the contents of the memory location. This process is demonstrated in the following graphic.

Figure 1-1 Virtual File Memory Contents