A file system that expands some environment variables in path names. Envfs needs the list of variables and their values to expand, given to it as mount options. Envfs is very similar to Wrapfs. The only operation that is different in Envfs is vn_lookup(). All it has to do is expand any variable names to their values within the interposing file system, modify the pathname component being looked up as needed, and then call the interposed file system.
Incidentally, that is not what I call ``state,'' since it can be reproduced by remounting the file system with the same options. The state that is required is a vnode in Envfs for each vnode in the underlying file system. The reason we need it is so that open files in the interposing file system can refer to the proper interposed vnodes. For example, the current working directory (cwd) of Unix shells, is actually represented by an open directory vnode in the kernel. When a lookup operation occurs in Envfs, it starts from the directory vnode of the current working directory of the process in question; that is the vnode the kernel passes on to the lookup routine, and that operation must be able to access the interposed vnode for the lookup to proceed.