shithub: 9ferno

ref: b502a62da2ec6058923db94f87ecc2d29db2fa77
dir: /man/3/mnt/

View raw version
.TH MNT 3 
mnt \- attach to 9P servers
.B #M
.I mount driver
is used by
.B Sys->mount
(but not
.BR Sys->bind ;
.IR sys-bind (2))
to connect the name space of a process to
the service provided by a 9P server over a communications channel.
After the
.BR mount ,
file operations in that portion of the name space will
be converted by the mount driver into the appropriate
9P messages to the server, and its 9P replies returned
as the status of the system calls.
Any authentication must precede
.IR mount ,
which does none itself;
.IR security-intro (2)
for a discussion of the authentication and security
mechanisms provided `ready made' by Inferno, but
any other scheme can be agreed between client and server.
.I mount
system call does, however, issue an
.IR attach (5)
message to the server to identify the user of the connection.
Each distinct user of a connection must mount it separately;
the mount driver multiplexes the access of the various users and their
processes to the service.
File-oriented system calls are converted by the kernel into messages in the 9P protocol.
Within the kernel, 9P is implemented by procedure calls to the
various kernel device drivers, as described in
.IR intro (10)
.IR dev (10.2).
The mount driver translates these procedure calls into remote procedure calls
to be transmitted as messages over the communication channel to the server.
Each message is implemented by a write
of the corresponding protocol message to the server channel
followed by a read on the server channel to get the reply.
Errors in the reply message are turned into system call error returns.
.IR sys-read (2)
.I Sys->write
system call on a file served by the mount driver
may be translated
into more than one
since there is a maximum data size for a 9P message.
The system call
will return when the specified number of bytes have been transferred
or a short reply is returned.
The string
.L #M
is an illegal file name,
so this device can be accessed directly only by the kernel.
.IR bind (1),
.IR sys-bind (2)
.B /emu/port/devmnt.c
.B /os/port/devmnt.c
When mounting a service through the mount driver,
that is, when the channel being multiplexed is itself
a file being served by the mount driver,
large messages may be broken in two.