hostfs is split into a kernelspace piece and a userspace piece. The kernel portion implements the VFS interface and converts it into calls to the userspace portion, which makes libc calls on the host. The interface between them provides a set of simple file access operations.
This interface enables a number of possibilities besides simple access to the host's file systems. External resources that can be made to look like files and filesystems can be plugged into the interface, with the result that UML processes can access them as files. For example, with a suitable implementation of this interface, a database on the host could be mounted inside UML as a filesystem, with individual records possibly being represented as files.
This would allow processes such as shell scripts to browse and manipulate a database without requiring any database programming. Obviously, this is not the way to write a real database application, but it may be useful for writing a simple database browser. It would also be possible to create a special directory hierarchy within this filesystem that allows database queries to be made and which would provide access to the results. For example, if a MySQL database is mounted on /mysql, the command
% cd /mysql/query/'select * from cars where color = ``red'''
would change the current directory to a location where ls would show the records that matched the query.
Another possible use of a mountable database is to mount it jointly with a normal host filesystem. If the database and the filesystem initially contain the same information, then the userspace layer of hostfs can keep them in sync with each other by updating both whenever something is written out. The benefit of this is that searches on the filesystem can be performed by querying the database rather than doing a full search of the host filesystem. The standard Linux utilities have no ability to perform specialized database queries like this, so this would require that applications which have a particular need for this have knowledge of hostfs added. A good example would be a mail reader which knows that the user's mail directory is a joint hostfs mount of a normal directory and a database. It could implement its search capability by making a query to the database rather than the equivalent of grepping the directory.