bind [option... ] source target mount [option... ] addr target unmount [source ] target
The effects of bind and mount can be undone with the unmount command. If two arguments are given to unmount, the effect is to undo a bind or mount with the same arguments. If only one argument is given, everything bound to or mounted upon target is unmounted.
bind command
For bind, source is the name of an existing file or directory in the current name space. After a successful bind, the file name target is an alias for the object originally named by source; if the modification doesn't hide it, source will also still refer to its original file. The evaluation of source (see File Name Expansion in sh - command line interface to the Inferno system) happens at the time of the bind, not when the binding is later used.
Both target and source must be of the same type: either both directories or both files.
bind '#c' /dev
However, before the mount command is given you must setup your computer with the IP device driver to communicate over the network. For example:
bind -a ‘#I’ /net
If you wish to have an authenticated connection to the remote computer, you must issue the getauthinfo command (see login, getauthinfo — get an Authinfo adt from a certificate authority). For example:
getauthinfo net!machine
mount command
The mount command must be used before binding to a remote computer,. In the mount command, source is a network address for the server machine in the form:mount [option] addr target
In the mount command, addr is a network address for the server machine in the form:
net!destination!service. net
The net component defines the network to be used (for example, tcp, udp). The special value net can be supplied to request the most expedient network. Currently, net is synonymous with tcp. machine
The machine component can be any of the following
service
A service name or port number. The default is Styx
numeric port value
|
Used verbatim.
|
Service name
|
Converted to a port number.
|
sys->bind("#c", "/dev", flags);
bind -r source target This has the same results as the bind command without any options.
The source and target arguments are assumed to be existing directories. A simple case of binding one directory to another is illustrated in Figure 5-1. The sample configuration has two sub-trees A and C rooted (for convenience) in the common directory E.
Binding one directory to another
Assuming the current directory is E, the command to bind directory B to D is: Accessing fileb by the path C/D/
The contents of directory D have been replaced with those of directory B. The bind command: unions
When bind command is used with either the -a or -b options the effect is not to replace the target but to create a union of the contents of the source and target at the target directory. (The difference between the options is not of immediate importance and will be discussed below.) Thus,
Union of the contents of directories A/B and C/D
The bind operation can be repeated to create the union of several directories at D.
xxx$ mkdir A A/B C C/D xxx$ >A/fileA; xxx$ >C/fileC; xxx$ >A/B/fileB xxx$ >C/D/fileD xxx$ echo 'hello, world!' > A/B/file_com xxx$ echo 'how are you?' > C/D/file_comAs before, a union directory is created at D using bind with the -b option. A directory listing of that directory shows two entries for file_com; however, the pathname C/D/file_com leads to just one file.
Since the source directory was bound 'before' (-b) that of the target, its file supersede those of the target. The cat command shows (by content) that the pathname C/D/file_com is resolved to the file corresponding to pathname A/B/file_com.
xxx$ bind -b A/B C/D xxx$ ls -l C/D -rwxrwxrwx U 0 Everyone Everyone 0 Jan 21 16:10 C/D/fileB -rwxrwxrwx U 0 Everyone Everyone 0 Jan 21 16:10 C/D/fileD -rwxrwxrwx U 0 Everyone Everyone 14 Jan 21 16:10 C/D/file_com -rwxrwxrwx U 0 Everyone Everyone 13 Jan 21 16:10 C/D/file_com xxx$ cat C/D/file_com hello, world!When the binding is undone and redone with the -a ('after') option, the cat command shows that file originally in the directory has precedent when pathnames are resolved.
xxx$ unmount C/D xxx$ bind -a A/B C/D xxx$ ls -l C/D -rwxrwxrwx U 0 Everyone Everyone 0 Jan 21 16:10 C/D/fileB -rwxrwxrwx U 0 Everyone Everyone 0 Jan 21 16:10 C/D/fileD -rwxrwxrwx U 0 Everyone Everyone 13 Jan 21 16:10 C/D/file_com -rwxrwxrwx U 0 Everyone Everyone 14 Jan 21 16:10 C/D/file_com xxx$ cat C/D/file_com how are you? xxx$