coda.txt 49 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674
  1. NOTE:
  2. This is one of the technical documents describing a component of
  3. Coda -- this document describes the client kernel-Venus interface.
  4. For more information:
  5. http://www.coda.cs.cmu.edu
  6. For user level software needed to run Coda:
  7. ftp://ftp.coda.cs.cmu.edu
  8. To run Coda you need to get a user level cache manager for the client,
  9. named Venus, as well as tools to manipulate ACLs, to log in, etc. The
  10. client needs to have the Coda filesystem selected in the kernel
  11. configuration.
  12. The server needs a user level server and at present does not depend on
  13. kernel support.
  14. The Venus kernel interface
  15. Peter J. Braam
  16. v1.0, Nov 9, 1997
  17. This document describes the communication between Venus and kernel
  18. level filesystem code needed for the operation of the Coda file sys-
  19. tem. This document version is meant to describe the current interface
  20. (version 1.0) as well as improvements we envisage.
  21. ______________________________________________________________________
  22. Table of Contents
  23. 1. Introduction
  24. 2. Servicing Coda filesystem calls
  25. 3. The message layer
  26. 3.1 Implementation details
  27. 4. The interface at the call level
  28. 4.1 Data structures shared by the kernel and Venus
  29. 4.2 The pioctl interface
  30. 4.3 root
  31. 4.4 lookup
  32. 4.5 getattr
  33. 4.6 setattr
  34. 4.7 access
  35. 4.8 create
  36. 4.9 mkdir
  37. 4.10 link
  38. 4.11 symlink
  39. 4.12 remove
  40. 4.13 rmdir
  41. 4.14 readlink
  42. 4.15 open
  43. 4.16 close
  44. 4.17 ioctl
  45. 4.18 rename
  46. 4.19 readdir
  47. 4.20 vget
  48. 4.21 fsync
  49. 4.22 inactive
  50. 4.23 rdwr
  51. 4.24 odymount
  52. 4.25 ody_lookup
  53. 4.26 ody_expand
  54. 4.27 prefetch
  55. 4.28 signal
  56. 5. The minicache and downcalls
  57. 5.1 INVALIDATE
  58. 5.2 FLUSH
  59. 5.3 PURGEUSER
  60. 5.4 ZAPFILE
  61. 5.5 ZAPDIR
  62. 5.6 ZAPVNODE
  63. 5.7 PURGEFID
  64. 5.8 REPLACE
  65. 6. Initialization and cleanup
  66. 6.1 Requirements
  67. ______________________________________________________________________
  68. 0wpage
  69. 11.. IInnttrroodduuccttiioonn
  70. A key component in the Coda Distributed File System is the cache
  71. manager, _V_e_n_u_s.
  72. When processes on a Coda enabled system access files in the Coda
  73. filesystem, requests are directed at the filesystem layer in the
  74. operating system. The operating system will communicate with Venus to
  75. service the request for the process. Venus manages a persistent
  76. client cache and makes remote procedure calls to Coda file servers and
  77. related servers (such as authentication servers) to service these
  78. requests it receives from the operating system. When Venus has
  79. serviced a request it replies to the operating system with appropriate
  80. return codes, and other data related to the request. Optionally the
  81. kernel support for Coda may maintain a minicache of recently processed
  82. requests to limit the number of interactions with Venus. Venus
  83. possesses the facility to inform the kernel when elements from its
  84. minicache are no longer valid.
  85. This document describes precisely this communication between the
  86. kernel and Venus. The definitions of so called upcalls and downcalls
  87. will be given with the format of the data they handle. We shall also
  88. describe the semantic invariants resulting from the calls.
  89. Historically Coda was implemented in a BSD file system in Mach 2.6.
  90. The interface between the kernel and Venus is very similar to the BSD
  91. VFS interface. Similar functionality is provided, and the format of
  92. the parameters and returned data is very similar to the BSD VFS. This
  93. leads to an almost natural environment for implementing a kernel-level
  94. filesystem driver for Coda in a BSD system. However, other operating
  95. systems such as Linux and Windows 95 and NT have virtual filesystem
  96. with different interfaces.
  97. To implement Coda on these systems some reverse engineering of the
  98. Venus/Kernel protocol is necessary. Also it came to light that other
  99. systems could profit significantly from certain small optimizations
  100. and modifications to the protocol. To facilitate this work as well as
  101. to make future ports easier, communication between Venus and the
  102. kernel should be documented in great detail. This is the aim of this
  103. document.
  104. 0wpage
  105. 22.. SSeerrvviicciinngg CCooddaa ffiilleessyysstteemm ccaallllss
  106. The service of a request for a Coda file system service originates in
  107. a process PP which accessing a Coda file. It makes a system call which
  108. traps to the OS kernel. Examples of such calls trapping to the kernel
  109. are _r_e_a_d_, _w_r_i_t_e_, _o_p_e_n_, _c_l_o_s_e_, _c_r_e_a_t_e_, _m_k_d_i_r_, _r_m_d_i_r_, _c_h_m_o_d in a Unix
  110. context. Similar calls exist in the Win32 environment, and are named
  111. _C_r_e_a_t_e_F_i_l_e_, .
  112. Generally the operating system handles the request in a virtual
  113. filesystem (VFS) layer, which is named I/O Manager in NT and IFS
  114. manager in Windows 95. The VFS is responsible for partial processing
  115. of the request and for locating the specific filesystem(s) which will
  116. service parts of the request. Usually the information in the path
  117. assists in locating the correct FS drivers. Sometimes after extensive
  118. pre-processing, the VFS starts invoking exported routines in the FS
  119. driver. This is the point where the FS specific processing of the
  120. request starts, and here the Coda specific kernel code comes into
  121. play.
  122. The FS layer for Coda must expose and implement several interfaces.
  123. First and foremost the VFS must be able to make all necessary calls to
  124. the Coda FS layer, so the Coda FS driver must expose the VFS interface
  125. as applicable in the operating system. These differ very significantly
  126. among operating systems, but share features such as facilities to
  127. read/write and create and remove objects. The Coda FS layer services
  128. such VFS requests by invoking one or more well defined services
  129. offered by the cache manager Venus. When the replies from Venus have
  130. come back to the FS driver, servicing of the VFS call continues and
  131. finishes with a reply to the kernel's VFS. Finally the VFS layer
  132. returns to the process.
  133. As a result of this design a basic interface exposed by the FS driver
  134. must allow Venus to manage message traffic. In particular Venus must
  135. be able to retrieve and place messages and to be notified of the
  136. arrival of a new message. The notification must be through a mechanism
  137. which does not block Venus since Venus must attend to other tasks even
  138. when no messages are waiting or being processed.
  139. Interfaces of the Coda FS Driver
  140. Furthermore the FS layer provides for a special path of communication
  141. between a user process and Venus, called the pioctl interface. The
  142. pioctl interface is used for Coda specific services, such as
  143. requesting detailed information about the persistent cache managed by
  144. Venus. Here the involvement of the kernel is minimal. It identifies
  145. the calling process and passes the information on to Venus. When
  146. Venus replies the response is passed back to the caller in unmodified
  147. form.
  148. Finally Venus allows the kernel FS driver to cache the results from
  149. certain services. This is done to avoid excessive context switches
  150. and results in an efficient system. However, Venus may acquire
  151. information, for example from the network which implies that cached
  152. information must be flushed or replaced. Venus then makes a downcall
  153. to the Coda FS layer to request flushes or updates in the cache. The
  154. kernel FS driver handles such requests synchronously.
  155. Among these interfaces the VFS interface and the facility to place,
  156. receive and be notified of messages are platform specific. We will
  157. not go into the calls exported to the VFS layer but we will state the
  158. requirements of the message exchange mechanism.
  159. 0wpage
  160. 33.. TThhee mmeessssaaggee llaayyeerr
  161. At the lowest level the communication between Venus and the FS driver
  162. proceeds through messages. The synchronization between processes
  163. requesting Coda file service and Venus relies on blocking and waking
  164. up processes. The Coda FS driver processes VFS- and pioctl-requests
  165. on behalf of a process P, creates messages for Venus, awaits replies
  166. and finally returns to the caller. The implementation of the exchange
  167. of messages is platform specific, but the semantics have (so far)
  168. appeared to be generally applicable. Data buffers are created by the
  169. FS Driver in kernel memory on behalf of P and copied to user memory in
  170. Venus.
  171. The FS Driver while servicing P makes upcalls to Venus. Such an
  172. upcall is dispatched to Venus by creating a message structure. The
  173. structure contains the identification of P, the message sequence
  174. number, the size of the request and a pointer to the data in kernel
  175. memory for the request. Since the data buffer is re-used to hold the
  176. reply from Venus, there is a field for the size of the reply. A flags
  177. field is used in the message to precisely record the status of the
  178. message. Additional platform dependent structures involve pointers to
  179. determine the position of the message on queues and pointers to
  180. synchronization objects. In the upcall routine the message structure
  181. is filled in, flags are set to 0, and it is placed on the _p_e_n_d_i_n_g
  182. queue. The routine calling upcall is responsible for allocating the
  183. data buffer; its structure will be described in the next section.
  184. A facility must exist to notify Venus that the message has been
  185. created, and implemented using available synchronization objects in
  186. the OS. This notification is done in the upcall context of the process
  187. P. When the message is on the pending queue, process P cannot proceed
  188. in upcall. The (kernel mode) processing of P in the filesystem
  189. request routine must be suspended until Venus has replied. Therefore
  190. the calling thread in P is blocked in upcall. A pointer in the
  191. message structure will locate the synchronization object on which P is
  192. sleeping.
  193. Venus detects the notification that a message has arrived, and the FS
  194. driver allow Venus to retrieve the message with a getmsg_from_kernel
  195. call. This action finishes in the kernel by putting the message on the
  196. queue of processing messages and setting flags to READ. Venus is
  197. passed the contents of the data buffer. The getmsg_from_kernel call
  198. now returns and Venus processes the request.
  199. At some later point the FS driver receives a message from Venus,
  200. namely when Venus calls sendmsg_to_kernel. At this moment the Coda FS
  201. driver looks at the contents of the message and decides if:
  202. +o the message is a reply for a suspended thread P. If so it removes
  203. the message from the processing queue and marks the message as
  204. WRITTEN. Finally, the FS driver unblocks P (still in the kernel
  205. mode context of Venus) and the sendmsg_to_kernel call returns to
  206. Venus. The process P will be scheduled at some point and continues
  207. processing its upcall with the data buffer replaced with the reply
  208. from Venus.
  209. +o The message is a _d_o_w_n_c_a_l_l. A downcall is a request from Venus to
  210. the FS Driver. The FS driver processes the request immediately
  211. (usually a cache eviction or replacement) and when it finishes
  212. sendmsg_to_kernel returns.
  213. Now P awakes and continues processing upcall. There are some
  214. subtleties to take account of. First P will determine if it was woken
  215. up in upcall by a signal from some other source (for example an
  216. attempt to terminate P) or as is normally the case by Venus in its
  217. sendmsg_to_kernel call. In the normal case, the upcall routine will
  218. deallocate the message structure and return. The FS routine can proceed
  219. with its processing.
  220. Sleeping and IPC arrangements
  221. In case P is woken up by a signal and not by Venus, it will first look
  222. at the flags field. If the message is not yet READ, the process P can
  223. handle its signal without notifying Venus. If Venus has READ, and
  224. the request should not be processed, P can send Venus a signal message
  225. to indicate that it should disregard the previous message. Such
  226. signals are put in the queue at the head, and read first by Venus. If
  227. the message is already marked as WRITTEN it is too late to stop the
  228. processing. The VFS routine will now continue. (-- If a VFS request
  229. involves more than one upcall, this can lead to complicated state, an
  230. extra field "handle_signals" could be added in the message structure
  231. to indicate points of no return have been passed.--)
  232. 33..11.. IImmpplleemmeennttaattiioonn ddeettaaiillss
  233. The Unix implementation of this mechanism has been through the
  234. implementation of a character device associated with Coda. Venus
  235. retrieves messages by doing a read on the device, replies are sent
  236. with a write and notification is through the select system call on the
  237. file descriptor for the device. The process P is kept waiting on an
  238. interruptible wait queue object.
  239. In Windows NT and the DPMI Windows 95 implementation a DeviceIoControl
  240. call is used. The DeviceIoControl call is designed to copy buffers
  241. from user memory to kernel memory with OPCODES. The sendmsg_to_kernel
  242. is issued as a synchronous call, while the getmsg_from_kernel call is
  243. asynchronous. Windows EventObjects are used for notification of
  244. message arrival. The process P is kept waiting on a KernelEvent
  245. object in NT and a semaphore in Windows 95.
  246. 0wpage
  247. 44.. TThhee iinntteerrffaaccee aatt tthhee ccaallll lleevveell
  248. This section describes the upcalls a Coda FS driver can make to Venus.
  249. Each of these upcalls make use of two structures: inputArgs and
  250. outputArgs. In pseudo BNF form the structures take the following
  251. form:
  252. struct inputArgs {
  253. u_long opcode;
  254. u_long unique; /* Keep multiple outstanding msgs distinct */
  255. u_short pid; /* Common to all */
  256. u_short pgid; /* Common to all */
  257. struct CodaCred cred; /* Common to all */
  258. <union "in" of call dependent parts of inputArgs>
  259. };
  260. struct outputArgs {
  261. u_long opcode;
  262. u_long unique; /* Keep multiple outstanding msgs distinct */
  263. u_long result;
  264. <union "out" of call dependent parts of inputArgs>
  265. };
  266. Before going on let us elucidate the role of the various fields. The
  267. inputArgs start with the opcode which defines the type of service
  268. requested from Venus. There are approximately 30 upcalls at present
  269. which we will discuss. The unique field labels the inputArg with a
  270. unique number which will identify the message uniquely. A process and
  271. process group id are passed. Finally the credentials of the caller
  272. are included.
  273. Before delving into the specific calls we need to discuss a variety of
  274. data structures shared by the kernel and Venus.
  275. 44..11.. DDaattaa ssttrruuccttuurreess sshhaarreedd bbyy tthhee kkeerrnneell aanndd VVeennuuss
  276. The CodaCred structure defines a variety of user and group ids as
  277. they are set for the calling process. The vuid_t and guid_t are 32 bit
  278. unsigned integers. It also defines group membership in an array. On
  279. Unix the CodaCred has proven sufficient to implement good security
  280. semantics for Coda but the structure may have to undergo modification
  281. for the Windows environment when these mature.
  282. struct CodaCred {
  283. vuid_t cr_uid, cr_euid, cr_suid, cr_fsuid; /* Real, effective, set, fs uid*/
  284. vgid_t cr_gid, cr_egid, cr_sgid, cr_fsgid; /* same for groups */
  285. vgid_t cr_groups[NGROUPS]; /* Group membership for caller */
  286. };
  287. NNOOTTEE It is questionable if we need CodaCreds in Venus. Finally Venus
  288. doesn't know about groups, although it does create files with the
  289. default uid/gid. Perhaps the list of group membership is superfluous.
  290. The next item is the fundamental identifier used to identify Coda
  291. files, the ViceFid. A fid of a file uniquely defines a file or
  292. directory in the Coda filesystem within a _c_e_l_l. (-- A _c_e_l_l is a
  293. group of Coda servers acting under the aegis of a single system
  294. control machine or SCM. See the Coda Administration manual for a
  295. detailed description of the role of the SCM.--)
  296. typedef struct ViceFid {
  297. VolumeId Volume;
  298. VnodeId Vnode;
  299. Unique_t Unique;
  300. } ViceFid;
  301. Each of the constituent fields: VolumeId, VnodeId and Unique_t are
  302. unsigned 32 bit integers. We envisage that a further field will need
  303. to be prefixed to identify the Coda cell; this will probably take the
  304. form of a Ipv6 size IP address naming the Coda cell through DNS.
  305. The next important structure shared between Venus and the kernel is
  306. the attributes of the file. The following structure is used to
  307. exchange information. It has room for future extensions such as
  308. support for device files (currently not present in Coda).
  309. struct coda_vattr {
  310. enum coda_vtype va_type; /* vnode type (for create) */
  311. u_short va_mode; /* files access mode and type */
  312. short va_nlink; /* number of references to file */
  313. vuid_t va_uid; /* owner user id */
  314. vgid_t va_gid; /* owner group id */
  315. long va_fsid; /* file system id (dev for now) */
  316. long va_fileid; /* file id */
  317. u_quad_t va_size; /* file size in bytes */
  318. long va_blocksize; /* blocksize preferred for i/o */
  319. struct timespec va_atime; /* time of last access */
  320. struct timespec va_mtime; /* time of last modification */
  321. struct timespec va_ctime; /* time file changed */
  322. u_long va_gen; /* generation number of file */
  323. u_long va_flags; /* flags defined for file */
  324. dev_t va_rdev; /* device special file represents */
  325. u_quad_t va_bytes; /* bytes of disk space held by file */
  326. u_quad_t va_filerev; /* file modification number */
  327. u_int va_vaflags; /* operations flags, see below */
  328. long va_spare; /* remain quad aligned */
  329. };
  330. 44..22.. TThhee ppiiooccttll iinntteerrffaaccee
  331. Coda specific requests can be made by application through the pioctl
  332. interface. The pioctl is implemented as an ordinary ioctl on a
  333. fictitious file /coda/.CONTROL. The pioctl call opens this file, gets
  334. a file handle and makes the ioctl call. Finally it closes the file.
  335. The kernel involvement in this is limited to providing the facility to
  336. open and close and pass the ioctl message _a_n_d to verify that a path in
  337. the pioctl data buffers is a file in a Coda filesystem.
  338. The kernel is handed a data packet of the form:
  339. struct {
  340. const char *path;
  341. struct ViceIoctl vidata;
  342. int follow;
  343. } data;
  344. where
  345. struct ViceIoctl {
  346. caddr_t in, out; /* Data to be transferred in, or out */
  347. short in_size; /* Size of input buffer <= 2K */
  348. short out_size; /* Maximum size of output buffer, <= 2K */
  349. };
  350. The path must be a Coda file, otherwise the ioctl upcall will not be
  351. made.
  352. NNOOTTEE The data structures and code are a mess. We need to clean this
  353. up.
  354. We now proceed to document the individual calls:
  355. 0wpage
  356. 44..33.. rroooott
  357. AArrgguummeennttss
  358. iinn empty
  359. oouutt
  360. struct cfs_root_out {
  361. ViceFid VFid;
  362. } cfs_root;
  363. DDeessccrriippttiioonn This call is made to Venus during the initialization of
  364. the Coda filesystem. If the result is zero, the cfs_root structure
  365. contains the ViceFid of the root of the Coda filesystem. If a non-zero
  366. result is generated, its value is a platform dependent error code
  367. indicating the difficulty Venus encountered in locating the root of
  368. the Coda filesystem.
  369. 0wpage
  370. 44..44.. llooookkuupp
  371. SSuummmmaarryy Find the ViceFid and type of an object in a directory if it
  372. exists.
  373. AArrgguummeennttss
  374. iinn
  375. struct cfs_lookup_in {
  376. ViceFid VFid;
  377. char *name; /* Place holder for data. */
  378. } cfs_lookup;
  379. oouutt
  380. struct cfs_lookup_out {
  381. ViceFid VFid;
  382. int vtype;
  383. } cfs_lookup;
  384. DDeessccrriippttiioonn This call is made to determine the ViceFid and filetype of
  385. a directory entry. The directory entry requested carries name name
  386. and Venus will search the directory identified by cfs_lookup_in.VFid.
  387. The result may indicate that the name does not exist, or that
  388. difficulty was encountered in finding it (e.g. due to disconnection).
  389. If the result is zero, the field cfs_lookup_out.VFid contains the
  390. targets ViceFid and cfs_lookup_out.vtype the coda_vtype giving the
  391. type of object the name designates.
  392. The name of the object is an 8 bit character string of maximum length
  393. CFS_MAXNAMLEN, currently set to 256 (including a 0 terminator.)
  394. It is extremely important to realize that Venus bitwise ors the field
  395. cfs_lookup.vtype with CFS_NOCACHE to indicate that the object should
  396. not be put in the kernel name cache.
  397. NNOOTTEE The type of the vtype is currently wrong. It should be
  398. coda_vtype. Linux does not take note of CFS_NOCACHE. It should.
  399. 0wpage
  400. 44..55.. ggeettaattttrr
  401. SSuummmmaarryy Get the attributes of a file.
  402. AArrgguummeennttss
  403. iinn
  404. struct cfs_getattr_in {
  405. ViceFid VFid;
  406. struct coda_vattr attr; /* XXXXX */
  407. } cfs_getattr;
  408. oouutt
  409. struct cfs_getattr_out {
  410. struct coda_vattr attr;
  411. } cfs_getattr;
  412. DDeessccrriippttiioonn This call returns the attributes of the file identified by
  413. fid.
  414. EErrrroorrss Errors can occur if the object with fid does not exist, is
  415. unaccessible or if the caller does not have permission to fetch
  416. attributes.
  417. NNoottee Many kernel FS drivers (Linux, NT and Windows 95) need to acquire
  418. the attributes as well as the Fid for the instantiation of an internal
  419. "inode" or "FileHandle". A significant improvement in performance on
  420. such systems could be made by combining the _l_o_o_k_u_p and _g_e_t_a_t_t_r calls
  421. both at the Venus/kernel interaction level and at the RPC level.
  422. The vattr structure included in the input arguments is superfluous and
  423. should be removed.
  424. 0wpage
  425. 44..66.. sseettaattttrr
  426. SSuummmmaarryy Set the attributes of a file.
  427. AArrgguummeennttss
  428. iinn
  429. struct cfs_setattr_in {
  430. ViceFid VFid;
  431. struct coda_vattr attr;
  432. } cfs_setattr;
  433. oouutt
  434. empty
  435. DDeessccrriippttiioonn The structure attr is filled with attributes to be changed
  436. in BSD style. Attributes not to be changed are set to -1, apart from
  437. vtype which is set to VNON. Other are set to the value to be assigned.
  438. The only attributes which the FS driver may request to change are the
  439. mode, owner, groupid, atime, mtime and ctime. The return value
  440. indicates success or failure.
  441. EErrrroorrss A variety of errors can occur. The object may not exist, may
  442. be inaccessible, or permission may not be granted by Venus.
  443. 0wpage
  444. 44..77.. aacccceessss
  445. SSuummmmaarryy
  446. AArrgguummeennttss
  447. iinn
  448. struct cfs_access_in {
  449. ViceFid VFid;
  450. int flags;
  451. } cfs_access;
  452. oouutt
  453. empty
  454. DDeessccrriippttiioonn Verify if access to the object identified by VFid for
  455. operations described by flags is permitted. The result indicates if
  456. access will be granted. It is important to remember that Coda uses
  457. ACLs to enforce protection and that ultimately the servers, not the
  458. clients enforce the security of the system. The result of this call
  459. will depend on whether a _t_o_k_e_n is held by the user.
  460. EErrrroorrss The object may not exist, or the ACL describing the protection
  461. may not be accessible.
  462. 0wpage
  463. 44..88.. ccrreeaattee
  464. SSuummmmaarryy Invoked to create a file
  465. AArrgguummeennttss
  466. iinn
  467. struct cfs_create_in {
  468. ViceFid VFid;
  469. struct coda_vattr attr;
  470. int excl;
  471. int mode;
  472. char *name; /* Place holder for data. */
  473. } cfs_create;
  474. oouutt
  475. struct cfs_create_out {
  476. ViceFid VFid;
  477. struct coda_vattr attr;
  478. } cfs_create;
  479. DDeessccrriippttiioonn This upcall is invoked to request creation of a file.
  480. The file will be created in the directory identified by VFid, its name
  481. will be name, and the mode will be mode. If excl is set an error will
  482. be returned if the file already exists. If the size field in attr is
  483. set to zero the file will be truncated. The uid and gid of the file
  484. are set by converting the CodaCred to a uid using a macro CRTOUID
  485. (this macro is platform dependent). Upon success the VFid and
  486. attributes of the file are returned. The Coda FS Driver will normally
  487. instantiate a vnode, inode or file handle at kernel level for the new
  488. object.
  489. EErrrroorrss A variety of errors can occur. Permissions may be insufficient.
  490. If the object exists and is not a file the error EISDIR is returned
  491. under Unix.
  492. NNOOTTEE The packing of parameters is very inefficient and appears to
  493. indicate confusion between the system call creat and the VFS operation
  494. create. The VFS operation create is only called to create new objects.
  495. This create call differs from the Unix one in that it is not invoked
  496. to return a file descriptor. The truncate and exclusive options,
  497. together with the mode, could simply be part of the mode as it is
  498. under Unix. There should be no flags argument; this is used in open
  499. (2) to return a file descriptor for READ or WRITE mode.
  500. The attributes of the directory should be returned too, since the size
  501. and mtime changed.
  502. 0wpage
  503. 44..99.. mmkkddiirr
  504. SSuummmmaarryy Create a new directory.
  505. AArrgguummeennttss
  506. iinn
  507. struct cfs_mkdir_in {
  508. ViceFid VFid;
  509. struct coda_vattr attr;
  510. char *name; /* Place holder for data. */
  511. } cfs_mkdir;
  512. oouutt
  513. struct cfs_mkdir_out {
  514. ViceFid VFid;
  515. struct coda_vattr attr;
  516. } cfs_mkdir;
  517. DDeessccrriippttiioonn This call is similar to create but creates a directory.
  518. Only the mode field in the input parameters is used for creation.
  519. Upon successful creation, the attr returned contains the attributes of
  520. the new directory.
  521. EErrrroorrss As for create.
  522. NNOOTTEE The input parameter should be changed to mode instead of
  523. attributes.
  524. The attributes of the parent should be returned since the size and
  525. mtime changes.
  526. 0wpage
  527. 44..1100.. lliinnkk
  528. SSuummmmaarryy Create a link to an existing file.
  529. AArrgguummeennttss
  530. iinn
  531. struct cfs_link_in {
  532. ViceFid sourceFid; /* cnode to link *to* */
  533. ViceFid destFid; /* Directory in which to place link */
  534. char *tname; /* Place holder for data. */
  535. } cfs_link;
  536. oouutt
  537. empty
  538. DDeessccrriippttiioonn This call creates a link to the sourceFid in the directory
  539. identified by destFid with name tname. The source must reside in the
  540. target's parent, i.e. the source must be have parent destFid, i.e. Coda
  541. does not support cross directory hard links. Only the return value is
  542. relevant. It indicates success or the type of failure.
  543. EErrrroorrss The usual errors can occur.0wpage
  544. 44..1111.. ssyymmlliinnkk
  545. SSuummmmaarryy create a symbolic link
  546. AArrgguummeennttss
  547. iinn
  548. struct cfs_symlink_in {
  549. ViceFid VFid; /* Directory to put symlink in */
  550. char *srcname;
  551. struct coda_vattr attr;
  552. char *tname;
  553. } cfs_symlink;
  554. oouutt
  555. none
  556. DDeessccrriippttiioonn Create a symbolic link. The link is to be placed in the
  557. directory identified by VFid and named tname. It should point to the
  558. pathname srcname. The attributes of the newly created object are to
  559. be set to attr.
  560. EErrrroorrss
  561. NNOOTTEE The attributes of the target directory should be returned since
  562. its size changed.
  563. 0wpage
  564. 44..1122.. rreemmoovvee
  565. SSuummmmaarryy Remove a file
  566. AArrgguummeennttss
  567. iinn
  568. struct cfs_remove_in {
  569. ViceFid VFid;
  570. char *name; /* Place holder for data. */
  571. } cfs_remove;
  572. oouutt
  573. none
  574. DDeessccrriippttiioonn Remove file named cfs_remove_in.name in directory
  575. identified by VFid.
  576. EErrrroorrss
  577. NNOOTTEE The attributes of the directory should be returned since its
  578. mtime and size may change.
  579. 0wpage
  580. 44..1133.. rrmmddiirr
  581. SSuummmmaarryy Remove a directory
  582. AArrgguummeennttss
  583. iinn
  584. struct cfs_rmdir_in {
  585. ViceFid VFid;
  586. char *name; /* Place holder for data. */
  587. } cfs_rmdir;
  588. oouutt
  589. none
  590. DDeessccrriippttiioonn Remove the directory with name name from the directory
  591. identified by VFid.
  592. EErrrroorrss
  593. NNOOTTEE The attributes of the parent directory should be returned since
  594. its mtime and size may change.
  595. 0wpage
  596. 44..1144.. rreeaaddlliinnkk
  597. SSuummmmaarryy Read the value of a symbolic link.
  598. AArrgguummeennttss
  599. iinn
  600. struct cfs_readlink_in {
  601. ViceFid VFid;
  602. } cfs_readlink;
  603. oouutt
  604. struct cfs_readlink_out {
  605. int count;
  606. caddr_t data; /* Place holder for data. */
  607. } cfs_readlink;
  608. DDeessccrriippttiioonn This routine reads the contents of symbolic link
  609. identified by VFid into the buffer data. The buffer data must be able
  610. to hold any name up to CFS_MAXNAMLEN (PATH or NAM??).
  611. EErrrroorrss No unusual errors.
  612. 0wpage
  613. 44..1155.. ooppeenn
  614. SSuummmmaarryy Open a file.
  615. AArrgguummeennttss
  616. iinn
  617. struct cfs_open_in {
  618. ViceFid VFid;
  619. int flags;
  620. } cfs_open;
  621. oouutt
  622. struct cfs_open_out {
  623. dev_t dev;
  624. ino_t inode;
  625. } cfs_open;
  626. DDeessccrriippttiioonn This request asks Venus to place the file identified by
  627. VFid in its cache and to note that the calling process wishes to open
  628. it with flags as in open(2). The return value to the kernel differs
  629. for Unix and Windows systems. For Unix systems the Coda FS Driver is
  630. informed of the device and inode number of the container file in the
  631. fields dev and inode. For Windows the path of the container file is
  632. returned to the kernel.
  633. EErrrroorrss
  634. NNOOTTEE Currently the cfs_open_out structure is not properly adapted to
  635. deal with the Windows case. It might be best to implement two
  636. upcalls, one to open aiming at a container file name, the other at a
  637. container file inode.
  638. 0wpage
  639. 44..1166.. cclloossee
  640. SSuummmmaarryy Close a file, update it on the servers.
  641. AArrgguummeennttss
  642. iinn
  643. struct cfs_close_in {
  644. ViceFid VFid;
  645. int flags;
  646. } cfs_close;
  647. oouutt
  648. none
  649. DDeessccrriippttiioonn Close the file identified by VFid.
  650. EErrrroorrss
  651. NNOOTTEE The flags argument is bogus and not used. However, Venus' code
  652. has room to deal with an execp input field, probably this field should
  653. be used to inform Venus that the file was closed but is still memory
  654. mapped for execution. There are comments about fetching versus not
  655. fetching the data in Venus vproc_vfscalls. This seems silly. If a
  656. file is being closed, the data in the container file is to be the new
  657. data. Here again the execp flag might be in play to create confusion:
  658. currently Venus might think a file can be flushed from the cache when
  659. it is still memory mapped. This needs to be understood.
  660. 0wpage
  661. 44..1177.. iiooccttll
  662. SSuummmmaarryy Do an ioctl on a file. This includes the pioctl interface.
  663. AArrgguummeennttss
  664. iinn
  665. struct cfs_ioctl_in {
  666. ViceFid VFid;
  667. int cmd;
  668. int len;
  669. int rwflag;
  670. char *data; /* Place holder for data. */
  671. } cfs_ioctl;
  672. oouutt
  673. struct cfs_ioctl_out {
  674. int len;
  675. caddr_t data; /* Place holder for data. */
  676. } cfs_ioctl;
  677. DDeessccrriippttiioonn Do an ioctl operation on a file. The command, len and
  678. data arguments are filled as usual. flags is not used by Venus.
  679. EErrrroorrss
  680. NNOOTTEE Another bogus parameter. flags is not used. What is the
  681. business about PREFETCHING in the Venus code?
  682. 0wpage
  683. 44..1188.. rreennaammee
  684. SSuummmmaarryy Rename a fid.
  685. AArrgguummeennttss
  686. iinn
  687. struct cfs_rename_in {
  688. ViceFid sourceFid;
  689. char *srcname;
  690. ViceFid destFid;
  691. char *destname;
  692. } cfs_rename;
  693. oouutt
  694. none
  695. DDeessccrriippttiioonn Rename the object with name srcname in directory
  696. sourceFid to destname in destFid. It is important that the names
  697. srcname and destname are 0 terminated strings. Strings in Unix
  698. kernels are not always null terminated.
  699. EErrrroorrss
  700. 0wpage
  701. 44..1199.. rreeaaddddiirr
  702. SSuummmmaarryy Read directory entries.
  703. AArrgguummeennttss
  704. iinn
  705. struct cfs_readdir_in {
  706. ViceFid VFid;
  707. int count;
  708. int offset;
  709. } cfs_readdir;
  710. oouutt
  711. struct cfs_readdir_out {
  712. int size;
  713. caddr_t data; /* Place holder for data. */
  714. } cfs_readdir;
  715. DDeessccrriippttiioonn Read directory entries from VFid starting at offset and
  716. read at most count bytes. Returns the data in data and returns
  717. the size in size.
  718. EErrrroorrss
  719. NNOOTTEE This call is not used. Readdir operations exploit container
  720. files. We will re-evaluate this during the directory revamp which is
  721. about to take place.
  722. 0wpage
  723. 44..2200.. vvggeett
  724. SSuummmmaarryy instructs Venus to do an FSDB->Get.
  725. AArrgguummeennttss
  726. iinn
  727. struct cfs_vget_in {
  728. ViceFid VFid;
  729. } cfs_vget;
  730. oouutt
  731. struct cfs_vget_out {
  732. ViceFid VFid;
  733. int vtype;
  734. } cfs_vget;
  735. DDeessccrriippttiioonn This upcall asks Venus to do a get operation on an fsobj
  736. labelled by VFid.
  737. EErrrroorrss
  738. NNOOTTEE This operation is not used. However, it is extremely useful
  739. since it can be used to deal with read/write memory mapped files.
  740. These can be "pinned" in the Venus cache using vget and released with
  741. inactive.
  742. 0wpage
  743. 44..2211.. ffssyynncc
  744. SSuummmmaarryy Tell Venus to update the RVM attributes of a file.
  745. AArrgguummeennttss
  746. iinn
  747. struct cfs_fsync_in {
  748. ViceFid VFid;
  749. } cfs_fsync;
  750. oouutt
  751. none
  752. DDeessccrriippttiioonn Ask Venus to update RVM attributes of object VFid. This
  753. should be called as part of kernel level fsync type calls. The
  754. result indicates if the syncing was successful.
  755. EErrrroorrss
  756. NNOOTTEE Linux does not implement this call. It should.
  757. 0wpage
  758. 44..2222.. iinnaaccttiivvee
  759. SSuummmmaarryy Tell Venus a vnode is no longer in use.
  760. AArrgguummeennttss
  761. iinn
  762. struct cfs_inactive_in {
  763. ViceFid VFid;
  764. } cfs_inactive;
  765. oouutt
  766. none
  767. DDeessccrriippttiioonn This operation returns EOPNOTSUPP.
  768. EErrrroorrss
  769. NNOOTTEE This should perhaps be removed.
  770. 0wpage
  771. 44..2233.. rrddwwrr
  772. SSuummmmaarryy Read or write from a file
  773. AArrgguummeennttss
  774. iinn
  775. struct cfs_rdwr_in {
  776. ViceFid VFid;
  777. int rwflag;
  778. int count;
  779. int offset;
  780. int ioflag;
  781. caddr_t data; /* Place holder for data. */
  782. } cfs_rdwr;
  783. oouutt
  784. struct cfs_rdwr_out {
  785. int rwflag;
  786. int count;
  787. caddr_t data; /* Place holder for data. */
  788. } cfs_rdwr;
  789. DDeessccrriippttiioonn This upcall asks Venus to read or write from a file.
  790. EErrrroorrss
  791. NNOOTTEE It should be removed since it is against the Coda philosophy that
  792. read/write operations never reach Venus. I have been told the
  793. operation does not work. It is not currently used.
  794. 0wpage
  795. 44..2244.. ooddyymmoouunntt
  796. SSuummmmaarryy Allows mounting multiple Coda "filesystems" on one Unix mount
  797. point.
  798. AArrgguummeennttss
  799. iinn
  800. struct ody_mount_in {
  801. char *name; /* Place holder for data. */
  802. } ody_mount;
  803. oouutt
  804. struct ody_mount_out {
  805. ViceFid VFid;
  806. } ody_mount;
  807. DDeessccrriippttiioonn Asks Venus to return the rootfid of a Coda system named
  808. name. The fid is returned in VFid.
  809. EErrrroorrss
  810. NNOOTTEE This call was used by David for dynamic sets. It should be
  811. removed since it causes a jungle of pointers in the VFS mounting area.
  812. It is not used by Coda proper. Call is not implemented by Venus.
  813. 0wpage
  814. 44..2255.. ooddyy__llooookkuupp
  815. SSuummmmaarryy Looks up something.
  816. AArrgguummeennttss
  817. iinn irrelevant
  818. oouutt
  819. irrelevant
  820. DDeessccrriippttiioonn
  821. EErrrroorrss
  822. NNOOTTEE Gut it. Call is not implemented by Venus.
  823. 0wpage
  824. 44..2266.. ooddyy__eexxppaanndd
  825. SSuummmmaarryy expands something in a dynamic set.
  826. AArrgguummeennttss
  827. iinn irrelevant
  828. oouutt
  829. irrelevant
  830. DDeessccrriippttiioonn
  831. EErrrroorrss
  832. NNOOTTEE Gut it. Call is not implemented by Venus.
  833. 0wpage
  834. 44..2277.. pprreeffeettcchh
  835. SSuummmmaarryy Prefetch a dynamic set.
  836. AArrgguummeennttss
  837. iinn Not documented.
  838. oouutt
  839. Not documented.
  840. DDeessccrriippttiioonn Venus worker.cc has support for this call, although it is
  841. noted that it doesn't work. Not surprising, since the kernel does not
  842. have support for it. (ODY_PREFETCH is not a defined operation).
  843. EErrrroorrss
  844. NNOOTTEE Gut it. It isn't working and isn't used by Coda.
  845. 0wpage
  846. 44..2288.. ssiiggnnaall
  847. SSuummmmaarryy Send Venus a signal about an upcall.
  848. AArrgguummeennttss
  849. iinn none
  850. oouutt
  851. not applicable.
  852. DDeessccrriippttiioonn This is an out-of-band upcall to Venus to inform Venus
  853. that the calling process received a signal after Venus read the
  854. message from the input queue. Venus is supposed to clean up the
  855. operation.
  856. EErrrroorrss No reply is given.
  857. NNOOTTEE We need to better understand what Venus needs to clean up and if
  858. it is doing this correctly. Also we need to handle multiple upcall
  859. per system call situations correctly. It would be important to know
  860. what state changes in Venus take place after an upcall for which the
  861. kernel is responsible for notifying Venus to clean up (e.g. open
  862. definitely is such a state change, but many others are maybe not).
  863. 0wpage
  864. 55.. TThhee mmiinniiccaacchhee aanndd ddoowwnnccaallllss
  865. The Coda FS Driver can cache results of lookup and access upcalls, to
  866. limit the frequency of upcalls. Upcalls carry a price since a process
  867. context switch needs to take place. The counterpart of caching the
  868. information is that Venus will notify the FS Driver that cached
  869. entries must be flushed or renamed.
  870. The kernel code generally has to maintain a structure which links the
  871. internal file handles (called vnodes in BSD, inodes in Linux and
  872. FileHandles in Windows) with the ViceFid's which Venus maintains. The
  873. reason is that frequent translations back and forth are needed in
  874. order to make upcalls and use the results of upcalls. Such linking
  875. objects are called ccnnooddeess.
  876. The current minicache implementations have cache entries which record
  877. the following:
  878. 1. the name of the file
  879. 2. the cnode of the directory containing the object
  880. 3. a list of CodaCred's for which the lookup is permitted.
  881. 4. the cnode of the object
  882. The lookup call in the Coda FS Driver may request the cnode of the
  883. desired object from the cache, by passing its name, directory and the
  884. CodaCred's of the caller. The cache will return the cnode or indicate
  885. that it cannot be found. The Coda FS Driver must be careful to
  886. invalidate cache entries when it modifies or removes objects.
  887. When Venus obtains information that indicates that cache entries are
  888. no longer valid, it will make a downcall to the kernel. Downcalls are
  889. intercepted by the Coda FS Driver and lead to cache invalidations of
  890. the kind described below. The Coda FS Driver does not return an error
  891. unless the downcall data could not be read into kernel memory.
  892. 55..11.. IINNVVAALLIIDDAATTEE
  893. No information is available on this call.
  894. 55..22.. FFLLUUSSHH
  895. AArrgguummeennttss None
  896. SSuummmmaarryy Flush the name cache entirely.
  897. DDeessccrriippttiioonn Venus issues this call upon startup and when it dies. This
  898. is to prevent stale cache information being held. Some operating
  899. systems allow the kernel name cache to be switched off dynamically.
  900. When this is done, this downcall is made.
  901. 55..33.. PPUURRGGEEUUSSEERR
  902. AArrgguummeennttss
  903. struct cfs_purgeuser_out {/* CFS_PURGEUSER is a venus->kernel call */
  904. struct CodaCred cred;
  905. } cfs_purgeuser;
  906. DDeessccrriippttiioonn Remove all entries in the cache carrying the Cred. This
  907. call is issued when tokens for a user expire or are flushed.
  908. 55..44.. ZZAAPPFFIILLEE
  909. AArrgguummeennttss
  910. struct cfs_zapfile_out { /* CFS_ZAPFILE is a venus->kernel call */
  911. ViceFid CodaFid;
  912. } cfs_zapfile;
  913. DDeessccrriippttiioonn Remove all entries which have the (dir vnode, name) pair.
  914. This is issued as a result of an invalidation of cached attributes of
  915. a vnode.
  916. NNOOTTEE Call is not named correctly in NetBSD and Mach. The minicache
  917. zapfile routine takes different arguments. Linux does not implement
  918. the invalidation of attributes correctly.
  919. 55..55.. ZZAAPPDDIIRR
  920. AArrgguummeennttss
  921. struct cfs_zapdir_out { /* CFS_ZAPDIR is a venus->kernel call */
  922. ViceFid CodaFid;
  923. } cfs_zapdir;
  924. DDeessccrriippttiioonn Remove all entries in the cache lying in a directory
  925. CodaFid, and all children of this directory. This call is issued when
  926. Venus receives a callback on the directory.
  927. 55..66.. ZZAAPPVVNNOODDEE
  928. AArrgguummeennttss
  929. struct cfs_zapvnode_out { /* CFS_ZAPVNODE is a venus->kernel call */
  930. struct CodaCred cred;
  931. ViceFid VFid;
  932. } cfs_zapvnode;
  933. DDeessccrriippttiioonn Remove all entries in the cache carrying the cred and VFid
  934. as in the arguments. This downcall is probably never issued.
  935. 55..77.. PPUURRGGEEFFIIDD
  936. SSuummmmaarryy
  937. AArrgguummeennttss
  938. struct cfs_purgefid_out { /* CFS_PURGEFID is a venus->kernel call */
  939. ViceFid CodaFid;
  940. } cfs_purgefid;
  941. DDeessccrriippttiioonn Flush the attribute for the file. If it is a dir (odd
  942. vnode), purge its children from the namecache and remove the file from the
  943. namecache.
  944. 55..88.. RREEPPLLAACCEE
  945. SSuummmmaarryy Replace the Fid's for a collection of names.
  946. AArrgguummeennttss
  947. struct cfs_replace_out { /* cfs_replace is a venus->kernel call */
  948. ViceFid NewFid;
  949. ViceFid OldFid;
  950. } cfs_replace;
  951. DDeessccrriippttiioonn This routine replaces a ViceFid in the name cache with
  952. another. It is added to allow Venus during reintegration to replace
  953. locally allocated temp fids while disconnected with global fids even
  954. when the reference counts on those fids are not zero.
  955. 0wpage
  956. 66.. IInniittiiaalliizzaattiioonn aanndd cclleeaannuupp
  957. This section gives brief hints as to desirable features for the Coda
  958. FS Driver at startup and upon shutdown or Venus failures. Before
  959. entering the discussion it is useful to repeat that the Coda FS Driver
  960. maintains the following data:
  961. 1. message queues
  962. 2. cnodes
  963. 3. name cache entries
  964. The name cache entries are entirely private to the driver, so they
  965. can easily be manipulated. The message queues will generally have
  966. clear points of initialization and destruction. The cnodes are
  967. much more delicate. User processes hold reference counts in Coda
  968. filesystems and it can be difficult to clean up the cnodes.
  969. It can expect requests through:
  970. 1. the message subsystem
  971. 2. the VFS layer
  972. 3. pioctl interface
  973. Currently the _p_i_o_c_t_l passes through the VFS for Coda so we can
  974. treat these similarly.
  975. 66..11.. RReeqquuiirreemmeennttss
  976. The following requirements should be accommodated:
  977. 1. The message queues should have open and close routines. On Unix
  978. the opening of the character devices are such routines.
  979. +o Before opening, no messages can be placed.
  980. +o Opening will remove any old messages still pending.
  981. +o Close will notify any sleeping processes that their upcall cannot
  982. be completed.
  983. +o Close will free all memory allocated by the message queues.
  984. 2. At open the namecache shall be initialized to empty state.
  985. 3. Before the message queues are open, all VFS operations will fail.
  986. Fortunately this can be achieved by making sure than mounting the
  987. Coda filesystem cannot succeed before opening.
  988. 4. After closing of the queues, no VFS operations can succeed. Here
  989. one needs to be careful, since a few operations (lookup,
  990. read/write, readdir) can proceed without upcalls. These must be
  991. explicitly blocked.
  992. 5. Upon closing the namecache shall be flushed and disabled.
  993. 6. All memory held by cnodes can be freed without relying on upcalls.
  994. 7. Unmounting the file system can be done without relying on upcalls.
  995. 8. Mounting the Coda filesystem should fail gracefully if Venus cannot
  996. get the rootfid or the attributes of the rootfid. The latter is
  997. best implemented by Venus fetching these objects before attempting
  998. to mount.
  999. NNOOTTEE NetBSD in particular but also Linux have not implemented the
  1000. above requirements fully. For smooth operation this needs to be
  1001. corrected.