Lookup
Unlike most operating-system filesystems, the jvvfs
filesystem has so-called "union" semantics. The filesystem maintains
a list of mounted archives, sorted in order of most-recently mounted -
the first archive in the list is the archive that was most recently mounted.
In order to look up an object in the filesystem at a given path
p, it's first necessary to look up all
of the ancestors of p to ensure that
they exist and are directories. Looking up an object at
p directly
means to look up p without looking up
any of the ancestors of p.
When attempting to look up an object directly
in the filesystem at a given path p,
each archive a in the list of archives
is considered in turn, starting with the most recently mounted first. The
lookup procedure takes the following steps:
If no archives return an object, then no object exists at
p in the filesystem.
As mentioned, it's necessary to look up all of the ancestors
of p to ensure the correct
semantics, so the above procedure is simply applied to all
ancestors of p before being
applied to p itself. If any
ancestor of p turns out not
to exist, or not to be a directory, or if an error occurs,
the function returns an error.
The above steps are in contrast to how operating-system
filesystems usually behave. Typically, operating systems
will take steps analogous to the following (where archives
are replaced by disks or disk partitions):
In other words, at most one archive is checked for
objects.
The procedure that jvvfs
uses to locate filesystem objects is the source of the
term "union": With multiple directories overlapping in
different archives, the set of visible files is the
union of those in the mounted archives. Directories
and files can be hidden by files in more recently mounted
archives, but a directories can never hide other directories.
Directory Listing
Listing directories proceeds in a similar manner to
file lookups.
When attempting to list a directory in the filesystem at a given path
p,
p
is first
looked up
to ensure that it is a directory as are all of its ancestors.
If this is not the case, an error is returned.
Then, each archive a in the list of archives
is considered in turn, starting with the most recently mounted first. The
listing procedure begins with an empty set of names
S and takes the following steps: