bind, mount, unmount – change name space
int bind(char *name, char *old, int flag)
int mount(int fd, int afd, char *old, int flag, char *aname)
int unmount(char *name, char *old)
modify the file name space of the current process and other
processes in its name space group
For both calls,
is the name of an existing file or directory in the
current name space where the modification is to be made.
as described in
except that no translation of the final path element is done.
is the name of another (or possibly the same)
existing file or directory in
the current name space.
After a successful
call, the file name
is an alias for the object originally named by
if the modification doesn’t hide it,
will also still refer to its original file.
The evaluation of
happens at the time of the
not when the binding is later used.
is a file descriptor of an open network connection
or pipe to a file server, while
is a authentication file descriptor as created by
and subsequently authenticated.
If authentication is not required,
should be -1.
file must be a directory.
After a successful
the file tree
(see below) by
will be visible with its root directory having name
controls details of the modification made to the name space.
In the following,
refers to the file
as defined by
or the root directory served by
and new files must be directories,
or both must not be directories.
can be one of:
file by the new one.
Henceforth, an evaluation of
will be translated to the new file.
If they are directories (for
this condition is true by definition),
consisting of one directory (the new file).
and new files must be directories.
Add the constituent files of the new directory
to the union directory at
so its contents appear first in the union.
the new directory will be searched first when evaluating file names
in the union directory.
but the new directory goes at the end of the union.
The flags are defined in
In addition, there is an
flag that can be OR’d with any of the above.
system call (see
attempts to create in a union directory, and the file does not exist,
the elements of the union are searched in order until one is found
The file is created in that directory; if that attempt fails,
flag, valid for
only, turns on caching for files made available by the mount.
By default, file contents are always retrieved from the server.
With caching enabled, the kernel may instead use a local cache to satisfy
requests for files accessible through this mount point.
The currency of cached data for a file is verified at each
of the file from this client machine.
the file descriptor
must be open for reading and writing
and prepared to respond to 9P messages
(see Section 5).
the file tree starting at
is served by a kernel
That device will turn operations in the tree into messages on
selects among different
file trees on the server; the null string chooses the default tree.
The file descriptor
is automatically closed by a successful
The effects of
can be undone by
is zero, everything bound to or mounted upon
is unbound or unmounted.
is not zero, it is evaluated as described above for
and the effect of binding or mounting that particular result on
The return value is a positive integer (a unique sequence number) for
success, -1 for failure.
These routines set
will not return until it has successfully attached
to the file server, so the process doing a
cannot be the one serving.