coda.txt 49 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673
  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.