bind 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. .TH BIND 1
  2. .SH NAME
  3. bind, mount, unmount \- change name space
  4. .SH SYNOPSIS
  5. .B bind
  6. [
  7. .I option ...
  8. ]
  9. .I new old
  10. .PP
  11. .B mount
  12. [
  13. .I option ...
  14. ]
  15. .I servename old
  16. [
  17. .I spec
  18. ]
  19. .PP
  20. .B unmount
  21. [
  22. .I new
  23. ]
  24. .I old
  25. .SH DESCRIPTION
  26. .I Bind
  27. and
  28. .I mount
  29. modify the file name space of the current process
  30. and other processes in the same name space group
  31. (see
  32. .IR fork (2)).
  33. For both calls,
  34. .I old
  35. is the name of an existing file or directory in the
  36. current name space where the modification is to be made.
  37. .PP
  38. For
  39. .IR bind ,
  40. .I new
  41. is the name of another (or possibly the same)
  42. existing file or directory in
  43. the current name space.
  44. After a successful
  45. .IR bind ,
  46. the file name
  47. .I old
  48. is an alias for the object originally named by
  49. .IR new ;
  50. if the modification doesn't hide it,
  51. .I new
  52. will also still refer to its original file.
  53. The evaluation of
  54. .I new
  55. (see
  56. .IR intro (2))
  57. happens at the time of the
  58. .IR bind ,
  59. not when the binding is later used.
  60. .PP
  61. The
  62. .I servename
  63. argument to
  64. .I mount
  65. is the name of a file that, when opened, yields an
  66. existing connection to a file server.
  67. Almost always,
  68. .I servename
  69. will be a file in
  70. .B /srv
  71. (see
  72. .IR srv (3)).
  73. In the discussion below,
  74. .I new
  75. refers to the file named by the
  76. .I new
  77. argument to
  78. .I bind
  79. or the root directory of the service
  80. available in
  81. .I servename
  82. after a
  83. .IR mount .
  84. Either both
  85. .I old
  86. and
  87. .I new
  88. files must be directories,
  89. or both must not be directories.
  90. .PP
  91. Options control aspects of the modification to the name space:
  92. .TP 10
  93. (none)
  94. Replace the
  95. .I old
  96. file by the new one.
  97. Henceforth, an evaluation of
  98. .I old
  99. will be translated to the new file.
  100. If they are directories (for
  101. .IR mount ,
  102. this condition is true by definition),
  103. .I old
  104. becomes a
  105. .I "union directory"
  106. consisting of one directory (the new file).
  107. .TP
  108. .B -b
  109. Both files must be directories.
  110. Add the new directory to the beginning
  111. of the union directory represented by the old file.
  112. .TP
  113. .B -a
  114. Both files must be directories.
  115. Add the new directory to the end
  116. of the union directory represented by the old file.
  117. .TP
  118. .B -c
  119. This can be used in addition to any of the above to permit
  120. creation in a union directory.
  121. When a new file is created in a union directory,
  122. it is placed in the first element of the union that has been bound or mounted with the
  123. .B -c
  124. flag.
  125. If that directory does not have write permission, the create fails.
  126. .TP
  127. .B -C
  128. (Only in
  129. .IR mount .)
  130. By default, file contents are always retrieved from the server.
  131. With this option, the kernel may instead use a local cache to satisfy
  132. .IR read (5)
  133. requests for files accessible through this mount point.
  134. The currency of cached data for a file is verified at each
  135. .IR open (5)
  136. of the file from this client machine.
  137. .TP
  138. .B -q
  139. Exit silently if the
  140. .B bind
  141. or
  142. .B mount
  143. operation fails.
  144. .PD
  145. .PP
  146. .I Mount
  147. takes two additional options.
  148. The first,
  149. .B -k
  150. .IR keypattern ,
  151. constrains the set of
  152. .IR factotum (4)
  153. keys used for an authenticated mount.
  154. The second,
  155. .BR -n ,
  156. causes
  157. .I mount
  158. to skip authentication entirely.
  159. .PP
  160. The
  161. .I spec
  162. argument to
  163. .I mount
  164. is passed in the
  165. .IR attach (5)
  166. message to the server, and selects among different
  167. file trees served by the server.
  168. .PP
  169. The
  170. .IR srv (3)
  171. service registry device, normally bound to
  172. .BR /srv ,
  173. is a convenient rendezvous point for services that can be mounted.
  174. After bootstrap, the file
  175. .B /srv/boot
  176. contains the communications port to the file system from which
  177. the system was loaded.
  178. .PP
  179. The effects of
  180. .I bind
  181. and
  182. .I mount
  183. can be undone with the
  184. .I unmount
  185. command.
  186. If two arguments are given to
  187. .IR unmount ,
  188. the effect is to undo a
  189. .I bind
  190. or
  191. .I mount
  192. with the same arguments.
  193. If only one argument is given,
  194. everything bound to or mounted upon
  195. .I old
  196. is unmounted.
  197. .SH EXAMPLES
  198. To compile a program with the C library from July 16, 1992:
  199. .IP
  200. .EX
  201. mount /srv/boot /n/dump dump
  202. bind /n/dump/1992/0716/mips/lib/libc.a /mips/lib/libc.a
  203. mk
  204. .EE
  205. .SH SOURCE
  206. .B /sys/src/cmd/bind.c
  207. .br
  208. .B /sys/src/cmd/mount.c
  209. .br
  210. .B /sys/src/cmd/unmount.c
  211. .SH SEE ALSO
  212. .IR bind (2),
  213. .IR open (2),
  214. .IR srv (3),
  215. .IR srv (4)