~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/Documentation/filesystems/coda.rst

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /Documentation/filesystems/coda.rst (Version linux-6.12-rc7) and /Documentation/filesystems/coda.rst (Version linux-5.18.19)


  1 .. SPDX-License-Identifier: GPL-2.0                 1 .. SPDX-License-Identifier: GPL-2.0
  2                                                     2 
  3 ===========================                         3 ===========================
  4 Coda Kernel-Venus Interface                         4 Coda Kernel-Venus Interface
  5 ===========================                         5 ===========================
  6                                                     6 
  7 .. Note::                                           7 .. Note::
  8                                                     8 
  9    This is one of the technical documents desc      9    This is one of the technical documents describing a component of
 10    Coda -- this document describes the client      10    Coda -- this document describes the client kernel-Venus interface.
 11                                                    11 
 12 For more information:                              12 For more information:
 13                                                    13 
 14   http://www.coda.cs.cmu.edu                       14   http://www.coda.cs.cmu.edu
 15                                                    15 
 16 For user level software needed to run Coda:        16 For user level software needed to run Coda:
 17                                                    17 
 18   ftp://ftp.coda.cs.cmu.edu                        18   ftp://ftp.coda.cs.cmu.edu
 19                                                    19 
 20 To run Coda you need to get a user level cache     20 To run Coda you need to get a user level cache manager for the client,
 21 named Venus, as well as tools to manipulate AC     21 named Venus, as well as tools to manipulate ACLs, to log in, etc.  The
 22 client needs to have the Coda filesystem selec     22 client needs to have the Coda filesystem selected in the kernel
 23 configuration.                                     23 configuration.
 24                                                    24 
 25 The server needs a user level server and at pr     25 The server needs a user level server and at present does not depend on
 26 kernel support.                                    26 kernel support.
 27                                                    27 
 28   The Venus kernel interface                       28   The Venus kernel interface
 29                                                    29 
 30   Peter J. Braam                                   30   Peter J. Braam
 31                                                    31 
 32   v1.0, Nov 9, 1997                                32   v1.0, Nov 9, 1997
 33                                                    33 
 34   This document describes the communication be     34   This document describes the communication between Venus and kernel
 35   level filesystem code needed for the operati     35   level filesystem code needed for the operation of the Coda file sys-
 36   tem.  This document version is meant to desc     36   tem.  This document version is meant to describe the current interface
 37   (version 1.0) as well as improvements we env     37   (version 1.0) as well as improvements we envisage.
 38                                                    38 
 39 .. Table of Contents                               39 .. Table of Contents
 40                                                    40 
 41   1. Introduction                                  41   1. Introduction
 42                                                    42 
 43   2. Servicing Coda filesystem calls               43   2. Servicing Coda filesystem calls
 44                                                    44 
 45   3. The message layer                             45   3. The message layer
 46                                                    46 
 47      3.1 Implementation details                    47      3.1 Implementation details
 48                                                    48 
 49   4. The interface at the call level               49   4. The interface at the call level
 50                                                    50 
 51      4.1 Data structures shared by the kernel      51      4.1 Data structures shared by the kernel and Venus
 52      4.2 The pioctl interface                      52      4.2 The pioctl interface
 53      4.3 root                                      53      4.3 root
 54      4.4 lookup                                    54      4.4 lookup
 55      4.5 getattr                                   55      4.5 getattr
 56      4.6 setattr                                   56      4.6 setattr
 57      4.7 access                                    57      4.7 access
 58      4.8 create                                    58      4.8 create
 59      4.9 mkdir                                     59      4.9 mkdir
 60      4.10 link                                     60      4.10 link
 61      4.11 symlink                                  61      4.11 symlink
 62      4.12 remove                                   62      4.12 remove
 63      4.13 rmdir                                    63      4.13 rmdir
 64      4.14 readlink                                 64      4.14 readlink
 65      4.15 open                                     65      4.15 open
 66      4.16 close                                    66      4.16 close
 67      4.17 ioctl                                    67      4.17 ioctl
 68      4.18 rename                                   68      4.18 rename
 69      4.19 readdir                                  69      4.19 readdir
 70      4.20 vget                                     70      4.20 vget
 71      4.21 fsync                                    71      4.21 fsync
 72      4.22 inactive                                 72      4.22 inactive
 73      4.23 rdwr                                     73      4.23 rdwr
 74      4.24 odymount                                 74      4.24 odymount
 75      4.25 ody_lookup                               75      4.25 ody_lookup
 76      4.26 ody_expand                               76      4.26 ody_expand
 77      4.27 prefetch                                 77      4.27 prefetch
 78      4.28 signal                                   78      4.28 signal
 79                                                    79 
 80   5. The minicache and downcalls                   80   5. The minicache and downcalls
 81                                                    81 
 82      5.1 INVALIDATE                                82      5.1 INVALIDATE
 83      5.2 FLUSH                                     83      5.2 FLUSH
 84      5.3 PURGEUSER                                 84      5.3 PURGEUSER
 85      5.4 ZAPFILE                                   85      5.4 ZAPFILE
 86      5.5 ZAPDIR                                    86      5.5 ZAPDIR
 87      5.6 ZAPVNODE                                  87      5.6 ZAPVNODE
 88      5.7 PURGEFID                                  88      5.7 PURGEFID
 89      5.8 REPLACE                                   89      5.8 REPLACE
 90                                                    90 
 91   6. Initialization and cleanup                    91   6. Initialization and cleanup
 92                                                    92 
 93      6.1 Requirements                              93      6.1 Requirements
 94                                                    94 
 95 1. Introduction                                    95 1. Introduction
 96 ===============                                    96 ===============
 97                                                    97 
 98   A key component in the Coda Distributed File     98   A key component in the Coda Distributed File System is the cache
 99   manager, Venus.                                  99   manager, Venus.
100                                                   100 
101   When processes on a Coda enabled system acce    101   When processes on a Coda enabled system access files in the Coda
102   filesystem, requests are directed at the fil    102   filesystem, requests are directed at the filesystem layer in the
103   operating system. The operating system will     103   operating system. The operating system will communicate with Venus to
104   service the request for the process.  Venus     104   service the request for the process.  Venus manages a persistent
105   client cache and makes remote procedure call    105   client cache and makes remote procedure calls to Coda file servers and
106   related servers (such as authentication serv    106   related servers (such as authentication servers) to service these
107   requests it receives from the operating syst    107   requests it receives from the operating system.  When Venus has
108   serviced a request it replies to the operati    108   serviced a request it replies to the operating system with appropriate
109   return codes, and other data related to the     109   return codes, and other data related to the request.  Optionally the
110   kernel support for Coda may maintain a minic    110   kernel support for Coda may maintain a minicache of recently processed
111   requests to limit the number of interactions    111   requests to limit the number of interactions with Venus.  Venus
112   possesses the facility to inform the kernel     112   possesses the facility to inform the kernel when elements from its
113   minicache are no longer valid.                  113   minicache are no longer valid.
114                                                   114 
115   This document describes precisely this commu    115   This document describes precisely this communication between the
116   kernel and Venus.  The definitions of so cal    116   kernel and Venus.  The definitions of so called upcalls and downcalls
117   will be given with the format of the data th    117   will be given with the format of the data they handle. We shall also
118   describe the semantic invariants resulting f    118   describe the semantic invariants resulting from the calls.
119                                                   119 
120   Historically Coda was implemented in a BSD f    120   Historically Coda was implemented in a BSD file system in Mach 2.6.
121   The interface between the kernel and Venus i    121   The interface between the kernel and Venus is very similar to the BSD
122   VFS interface.  Similar functionality is pro    122   VFS interface.  Similar functionality is provided, and the format of
123   the parameters and returned data is very sim    123   the parameters and returned data is very similar to the BSD VFS.  This
124   leads to an almost natural environment for i    124   leads to an almost natural environment for implementing a kernel-level
125   filesystem driver for Coda in a BSD system.     125   filesystem driver for Coda in a BSD system.  However, other operating
126   systems such as Linux and Windows 95 and NT     126   systems such as Linux and Windows 95 and NT have virtual filesystem
127   with different interfaces.                      127   with different interfaces.
128                                                   128 
129   To implement Coda on these systems some reve    129   To implement Coda on these systems some reverse engineering of the
130   Venus/Kernel protocol is necessary.  Also it    130   Venus/Kernel protocol is necessary.  Also it came to light that other
131   systems could profit significantly from cert    131   systems could profit significantly from certain small optimizations
132   and modifications to the protocol. To facili    132   and modifications to the protocol. To facilitate this work as well as
133   to make future ports easier, communication b    133   to make future ports easier, communication between Venus and the
134   kernel should be documented in great detail.    134   kernel should be documented in great detail.  This is the aim of this
135   document.                                       135   document.
136                                                   136 
137 2.  Servicing Coda filesystem calls               137 2.  Servicing Coda filesystem calls
138 ===================================               138 ===================================
139                                                   139 
140   The service of a request for a Coda file sys    140   The service of a request for a Coda file system service originates in
141   a process P which accessing a Coda file. It     141   a process P which accessing a Coda file. It makes a system call which
142   traps to the OS kernel. Examples of such cal    142   traps to the OS kernel. Examples of such calls trapping to the kernel
143   are ``read``, ``write``, ``open``, ``close``    143   are ``read``, ``write``, ``open``, ``close``, ``create``, ``mkdir``,
144   ``rmdir``, ``chmod`` in a Unix ontext.  Simi    144   ``rmdir``, ``chmod`` in a Unix ontext.  Similar calls exist in the Win32
145   environment, and are named ``CreateFile``.      145   environment, and are named ``CreateFile``.
146                                                   146 
147   Generally the operating system handles the r    147   Generally the operating system handles the request in a virtual
148   filesystem (VFS) layer, which is named I/O M    148   filesystem (VFS) layer, which is named I/O Manager in NT and IFS
149   manager in Windows 95.  The VFS is responsib    149   manager in Windows 95.  The VFS is responsible for partial processing
150   of the request and for locating the specific    150   of the request and for locating the specific filesystem(s) which will
151   service parts of the request.  Usually the i    151   service parts of the request.  Usually the information in the path
152   assists in locating the correct FS drivers.     152   assists in locating the correct FS drivers.  Sometimes after extensive
153   pre-processing, the VFS starts invoking expo    153   pre-processing, the VFS starts invoking exported routines in the FS
154   driver.  This is the point where the FS spec    154   driver.  This is the point where the FS specific processing of the
155   request starts, and here the Coda specific k    155   request starts, and here the Coda specific kernel code comes into
156   play.                                           156   play.
157                                                   157 
158   The FS layer for Coda must expose and implem    158   The FS layer for Coda must expose and implement several interfaces.
159   First and foremost the VFS must be able to m    159   First and foremost the VFS must be able to make all necessary calls to
160   the Coda FS layer, so the Coda FS driver mus    160   the Coda FS layer, so the Coda FS driver must expose the VFS interface
161   as applicable in the operating system. These    161   as applicable in the operating system. These differ very significantly
162   among operating systems, but share features     162   among operating systems, but share features such as facilities to
163   read/write and create and remove objects.  T    163   read/write and create and remove objects.  The Coda FS layer services
164   such VFS requests by invoking one or more we    164   such VFS requests by invoking one or more well defined services
165   offered by the cache manager Venus.  When th    165   offered by the cache manager Venus.  When the replies from Venus have
166   come back to the FS driver, servicing of the    166   come back to the FS driver, servicing of the VFS call continues and
167   finishes with a reply to the kernel's VFS. F    167   finishes with a reply to the kernel's VFS. Finally the VFS layer
168   returns to the process.                         168   returns to the process.
169                                                   169 
170   As a result of this design a basic interface    170   As a result of this design a basic interface exposed by the FS driver
171   must allow Venus to manage message traffic.     171   must allow Venus to manage message traffic.  In particular Venus must
172   be able to retrieve and place messages and t    172   be able to retrieve and place messages and to be notified of the
173   arrival of a new message. The notification m    173   arrival of a new message. The notification must be through a mechanism
174   which does not block Venus since Venus must     174   which does not block Venus since Venus must attend to other tasks even
175   when no messages are waiting or being proces    175   when no messages are waiting or being processed.
176                                                   176 
177   **Interfaces of the Coda FS Driver**            177   **Interfaces of the Coda FS Driver**
178                                                   178 
179   Furthermore the FS layer provides for a spec    179   Furthermore the FS layer provides for a special path of communication
180   between a user process and Venus, called the    180   between a user process and Venus, called the pioctl interface. The
181   pioctl interface is used for Coda specific s    181   pioctl interface is used for Coda specific services, such as
182   requesting detailed information about the pe    182   requesting detailed information about the persistent cache managed by
183   Venus. Here the involvement of the kernel is    183   Venus. Here the involvement of the kernel is minimal.  It identifies
184   the calling process and passes the informati    184   the calling process and passes the information on to Venus.  When
185   Venus replies the response is passed back to    185   Venus replies the response is passed back to the caller in unmodified
186   form.                                           186   form.
187                                                   187 
188   Finally Venus allows the kernel FS driver to    188   Finally Venus allows the kernel FS driver to cache the results from
189   certain services.  This is done to avoid exc    189   certain services.  This is done to avoid excessive context switches
190   and results in an efficient system.  However    190   and results in an efficient system.  However, Venus may acquire
191   information, for example from the network wh    191   information, for example from the network which implies that cached
192   information must be flushed or replaced. Ven    192   information must be flushed or replaced. Venus then makes a downcall
193   to the Coda FS layer to request flushes or u    193   to the Coda FS layer to request flushes or updates in the cache.  The
194   kernel FS driver handles such requests synch    194   kernel FS driver handles such requests synchronously.
195                                                   195 
196   Among these interfaces the VFS interface and    196   Among these interfaces the VFS interface and the facility to place,
197   receive and be notified of messages are plat    197   receive and be notified of messages are platform specific.  We will
198   not go into the calls exported to the VFS la    198   not go into the calls exported to the VFS layer but we will state the
199   requirements of the message exchange mechani    199   requirements of the message exchange mechanism.
200                                                   200 
201                                                   201 
202 3.  The message layer                             202 3.  The message layer
203 =====================                             203 =====================
204                                                   204 
205   At the lowest level the communication betwee    205   At the lowest level the communication between Venus and the FS driver
206   proceeds through messages.  The synchronizat    206   proceeds through messages.  The synchronization between processes
207   requesting Coda file service and Venus relie    207   requesting Coda file service and Venus relies on blocking and waking
208   up processes.  The Coda FS driver processes     208   up processes.  The Coda FS driver processes VFS- and pioctl-requests
209   on behalf of a process P, creates messages f    209   on behalf of a process P, creates messages for Venus, awaits replies
210   and finally returns to the caller.  The impl    210   and finally returns to the caller.  The implementation of the exchange
211   of messages is platform specific, but the se    211   of messages is platform specific, but the semantics have (so far)
212   appeared to be generally applicable.  Data b    212   appeared to be generally applicable.  Data buffers are created by the
213   FS Driver in kernel memory on behalf of P an    213   FS Driver in kernel memory on behalf of P and copied to user memory in
214   Venus.                                          214   Venus.
215                                                   215 
216   The FS Driver while servicing P makes upcall    216   The FS Driver while servicing P makes upcalls to Venus.  Such an
217   upcall is dispatched to Venus by creating a     217   upcall is dispatched to Venus by creating a message structure.  The
218   structure contains the identification of P,     218   structure contains the identification of P, the message sequence
219   number, the size of the request and a pointe    219   number, the size of the request and a pointer to the data in kernel
220   memory for the request.  Since the data buff    220   memory for the request.  Since the data buffer is re-used to hold the
221   reply from Venus, there is a field for the s    221   reply from Venus, there is a field for the size of the reply.  A flags
222   field is used in the message to precisely re    222   field is used in the message to precisely record the status of the
223   message.  Additional platform dependent stru    223   message.  Additional platform dependent structures involve pointers to
224   determine the position of the message on que    224   determine the position of the message on queues and pointers to
225   synchronization objects.  In the upcall rout    225   synchronization objects.  In the upcall routine the message structure
226   is filled in, flags are set to 0, and it is     226   is filled in, flags are set to 0, and it is placed on the *pending*
227   queue.  The routine calling upcall is respon    227   queue.  The routine calling upcall is responsible for allocating the
228   data buffer; its structure will be described    228   data buffer; its structure will be described in the next section.
229                                                   229 
230   A facility must exist to notify Venus that t    230   A facility must exist to notify Venus that the message has been
231   created, and implemented using available syn    231   created, and implemented using available synchronization objects in
232   the OS. This notification is done in the upc    232   the OS. This notification is done in the upcall context of the process
233   P. When the message is on the pending queue,    233   P. When the message is on the pending queue, process P cannot proceed
234   in upcall.  The (kernel mode) processing of     234   in upcall.  The (kernel mode) processing of P in the filesystem
235   request routine must be suspended until Venu    235   request routine must be suspended until Venus has replied.  Therefore
236   the calling thread in P is blocked in upcall    236   the calling thread in P is blocked in upcall.  A pointer in the
237   message structure will locate the synchroniz    237   message structure will locate the synchronization object on which P is
238   sleeping.                                       238   sleeping.
239                                                   239 
240   Venus detects the notification that a messag    240   Venus detects the notification that a message has arrived, and the FS
241   driver allow Venus to retrieve the message w    241   driver allow Venus to retrieve the message with a getmsg_from_kernel
242   call. This action finishes in the kernel by     242   call. This action finishes in the kernel by putting the message on the
243   queue of processing messages and setting fla    243   queue of processing messages and setting flags to READ.  Venus is
244   passed the contents of the data buffer. The     244   passed the contents of the data buffer. The getmsg_from_kernel call
245   now returns and Venus processes the request.    245   now returns and Venus processes the request.
246                                                   246 
247   At some later point the FS driver receives a    247   At some later point the FS driver receives a message from Venus,
248   namely when Venus calls sendmsg_to_kernel.      248   namely when Venus calls sendmsg_to_kernel.  At this moment the Coda FS
249   driver looks at the contents of the message     249   driver looks at the contents of the message and decides if:
250                                                   250 
251                                                   251 
252   *  the message is a reply for a suspended th    252   *  the message is a reply for a suspended thread P.  If so it removes
253      the message from the processing queue and    253      the message from the processing queue and marks the message as
254      WRITTEN.  Finally, the FS driver unblocks    254      WRITTEN.  Finally, the FS driver unblocks P (still in the kernel
255      mode context of Venus) and the sendmsg_to    255      mode context of Venus) and the sendmsg_to_kernel call returns to
256      Venus.  The process P will be scheduled a    256      Venus.  The process P will be scheduled at some point and continues
257      processing its upcall with the data buffe    257      processing its upcall with the data buffer replaced with the reply
258      from Venus.                                  258      from Venus.
259                                                   259 
260   *  The message is a ``downcall``.  A downcal    260   *  The message is a ``downcall``.  A downcall is a request from Venus to
261      the FS Driver. The FS driver processes th    261      the FS Driver. The FS driver processes the request immediately
262      (usually a cache eviction or replacement)    262      (usually a cache eviction or replacement) and when it finishes
263      sendmsg_to_kernel returns.                   263      sendmsg_to_kernel returns.
264                                                   264 
265   Now P awakes and continues processing upcall    265   Now P awakes and continues processing upcall.  There are some
266   subtleties to take account of. First P will     266   subtleties to take account of. First P will determine if it was woken
267   up in upcall by a signal from some other sou    267   up in upcall by a signal from some other source (for example an
268   attempt to terminate P) or as is normally th    268   attempt to terminate P) or as is normally the case by Venus in its
269   sendmsg_to_kernel call.  In the normal case,    269   sendmsg_to_kernel call.  In the normal case, the upcall routine will
270   deallocate the message structure and return.    270   deallocate the message structure and return.  The FS routine can proceed
271   with its processing.                            271   with its processing.
272                                                   272 
273                                                   273 
274   **Sleeping and IPC arrangements**               274   **Sleeping and IPC arrangements**
275                                                   275 
276   In case P is woken up by a signal and not by    276   In case P is woken up by a signal and not by Venus, it will first look
277   at the flags field.  If the message is not y    277   at the flags field.  If the message is not yet READ, the process P can
278   handle its signal without notifying Venus.      278   handle its signal without notifying Venus.  If Venus has READ, and
279   the request should not be processed, P can s    279   the request should not be processed, P can send Venus a signal message
280   to indicate that it should disregard the pre    280   to indicate that it should disregard the previous message.  Such
281   signals are put in the queue at the head, an    281   signals are put in the queue at the head, and read first by Venus.  If
282   the message is already marked as WRITTEN it     282   the message is already marked as WRITTEN it is too late to stop the
283   processing.  The VFS routine will now contin    283   processing.  The VFS routine will now continue.  (-- If a VFS request
284   involves more than one upcall, this can lead    284   involves more than one upcall, this can lead to complicated state, an
285   extra field "handle_signals" could be added     285   extra field "handle_signals" could be added in the message structure
286   to indicate points of no return have been pa    286   to indicate points of no return have been passed.--)
287                                                   287 
288                                                   288 
289                                                   289 
290 3.1.  Implementation details                      290 3.1.  Implementation details
291 ----------------------------                      291 ----------------------------
292                                                   292 
293   The Unix implementation of this mechanism ha    293   The Unix implementation of this mechanism has been through the
294   implementation of a character device associa    294   implementation of a character device associated with Coda.  Venus
295   retrieves messages by doing a read on the de    295   retrieves messages by doing a read on the device, replies are sent
296   with a write and notification is through the    296   with a write and notification is through the select system call on the
297   file descriptor for the device.  The process    297   file descriptor for the device.  The process P is kept waiting on an
298   interruptible wait queue object.                298   interruptible wait queue object.
299                                                   299 
300   In Windows NT and the DPMI Windows 95 implem    300   In Windows NT and the DPMI Windows 95 implementation a DeviceIoControl
301   call is used.  The DeviceIoControl call is d    301   call is used.  The DeviceIoControl call is designed to copy buffers
302   from user memory to kernel memory with OPCOD    302   from user memory to kernel memory with OPCODES. The sendmsg_to_kernel
303   is issued as a synchronous call, while the g    303   is issued as a synchronous call, while the getmsg_from_kernel call is
304   asynchronous.  Windows EventObjects are used    304   asynchronous.  Windows EventObjects are used for notification of
305   message arrival.  The process P is kept wait    305   message arrival.  The process P is kept waiting on a KernelEvent
306   object in NT and a semaphore in Windows 95.     306   object in NT and a semaphore in Windows 95.
307                                                   307 
308                                                   308 
309 4.  The interface at the call level               309 4.  The interface at the call level
310 ===================================               310 ===================================
311                                                   311 
312                                                   312 
313   This section describes the upcalls a Coda FS    313   This section describes the upcalls a Coda FS driver can make to Venus.
314   Each of these upcalls make use of two struct    314   Each of these upcalls make use of two structures: inputArgs and
315   outputArgs.   In pseudo BNF form the structu    315   outputArgs.   In pseudo BNF form the structures take the following
316   form::                                          316   form::
317                                                   317 
318                                                   318 
319         struct inputArgs {                        319         struct inputArgs {
320             u_long opcode;                        320             u_long opcode;
321             u_long unique;     /* Keep multipl    321             u_long unique;     /* Keep multiple outstanding msgs distinct */
322             u_short pid;                 /* Co    322             u_short pid;                 /* Common to all */
323             u_short pgid;                /* Co    323             u_short pgid;                /* Common to all */
324             struct CodaCred cred;        /* Co    324             struct CodaCred cred;        /* Common to all */
325                                                   325 
326             <union "in" of call dependent part    326             <union "in" of call dependent parts of inputArgs>
327         };                                        327         };
328                                                   328 
329         struct outputArgs {                       329         struct outputArgs {
330             u_long opcode;                        330             u_long opcode;
331             u_long unique;       /* Keep multi    331             u_long unique;       /* Keep multiple outstanding msgs distinct */
332             u_long result;                        332             u_long result;
333                                                   333 
334             <union "out" of call dependent par    334             <union "out" of call dependent parts of inputArgs>
335         };                                        335         };
336                                                   336 
337                                                   337 
338                                                   338 
339   Before going on let us elucidate the role of    339   Before going on let us elucidate the role of the various fields. The
340   inputArgs start with the opcode which define    340   inputArgs start with the opcode which defines the type of service
341   requested from Venus. There are approximatel    341   requested from Venus. There are approximately 30 upcalls at present
342   which we will discuss.   The unique field la    342   which we will discuss.   The unique field labels the inputArg with a
343   unique number which will identify the messag    343   unique number which will identify the message uniquely.  A process and
344   process group id are passed.  Finally the cr    344   process group id are passed.  Finally the credentials of the caller
345   are included.                                   345   are included.
346                                                   346 
347   Before delving into the specific calls we ne    347   Before delving into the specific calls we need to discuss a variety of
348   data structures shared by the kernel and Ven    348   data structures shared by the kernel and Venus.
349                                                   349 
350                                                   350 
351                                                   351 
352                                                   352 
353 4.1.  Data structures shared by the kernel and    353 4.1.  Data structures shared by the kernel and Venus
354 ----------------------------------------------    354 ----------------------------------------------------
355                                                   355 
356                                                   356 
357   The CodaCred structure defines a variety of     357   The CodaCred structure defines a variety of user and group ids as
358   they are set for the calling process. The vu    358   they are set for the calling process. The vuid_t and vgid_t are 32 bit
359   unsigned integers.  It also defines group me    359   unsigned integers.  It also defines group membership in an array.  On
360   Unix the CodaCred has proven sufficient to i    360   Unix the CodaCred has proven sufficient to implement good security
361   semantics for Coda but the structure may hav    361   semantics for Coda but the structure may have to undergo modification
362   for the Windows environment when these matur    362   for the Windows environment when these mature::
363                                                   363 
364         struct CodaCred {                         364         struct CodaCred {
365             vuid_t cr_uid, cr_euid, cr_suid, c    365             vuid_t cr_uid, cr_euid, cr_suid, cr_fsuid; /* Real, effective, set, fs uid */
366             vgid_t cr_gid, cr_egid, cr_sgid, c    366             vgid_t cr_gid, cr_egid, cr_sgid, cr_fsgid; /* same for groups */
367             vgid_t cr_groups[NGROUPS];            367             vgid_t cr_groups[NGROUPS];        /* Group membership for caller */
368         };                                        368         };
369                                                   369 
370                                                   370 
371   .. Note::                                       371   .. Note::
372                                                   372 
373      It is questionable if we need CodaCreds i    373      It is questionable if we need CodaCreds in Venus. Finally Venus
374      doesn't know about groups, although it do    374      doesn't know about groups, although it does create files with the
375      default uid/gid.  Perhaps the list of gro    375      default uid/gid.  Perhaps the list of group membership is superfluous.
376                                                   376 
377                                                   377 
378   The next item is the fundamental identifier     378   The next item is the fundamental identifier used to identify Coda
379   files, the ViceFid.  A fid of a file uniquel    379   files, the ViceFid.  A fid of a file uniquely defines a file or
380   directory in the Coda filesystem within a ce    380   directory in the Coda filesystem within a cell [1]_::
381                                                   381 
382         typedef struct ViceFid {                  382         typedef struct ViceFid {
383             VolumeId Volume;                      383             VolumeId Volume;
384             VnodeId Vnode;                        384             VnodeId Vnode;
385             Unique_t Unique;                      385             Unique_t Unique;
386         } ViceFid;                                386         } ViceFid;
387                                                   387 
388   .. [1] A cell is agroup of Coda servers acti    388   .. [1] A cell is agroup of Coda servers acting under the aegis of a single
389          system control machine or SCM. See th    389          system control machine or SCM. See the Coda Administration manual
390          for a detailed description of the rol    390          for a detailed description of the role of the SCM.
391                                                   391 
392   Each of the constituent fields: VolumeId, Vn    392   Each of the constituent fields: VolumeId, VnodeId and Unique_t are
393   unsigned 32 bit integers.  We envisage that     393   unsigned 32 bit integers.  We envisage that a further field will need
394   to be prefixed to identify the Coda cell; th    394   to be prefixed to identify the Coda cell; this will probably take the
395   form of a Ipv6 size IP address naming the Co    395   form of a Ipv6 size IP address naming the Coda cell through DNS.
396                                                   396 
397   The next important structure shared between     397   The next important structure shared between Venus and the kernel is
398   the attributes of the file.  The following s    398   the attributes of the file.  The following structure is used to
399   exchange information.  It has room for futur    399   exchange information.  It has room for future extensions such as
400   support for device files (currently not pres    400   support for device files (currently not present in Coda)::
401                                                   401 
402                                                   402 
403         struct coda_timespec {                    403         struct coda_timespec {
404                 int64_t         tv_sec;           404                 int64_t         tv_sec;         /* seconds */
405                 long            tv_nsec;          405                 long            tv_nsec;        /* nanoseconds */
406         };                                        406         };
407                                                   407 
408         struct coda_vattr {                       408         struct coda_vattr {
409                 enum coda_vtype va_type;          409                 enum coda_vtype va_type;        /* vnode type (for create) */
410                 u_short         va_mode;          410                 u_short         va_mode;        /* files access mode and type */
411                 short           va_nlink;         411                 short           va_nlink;       /* number of references to file */
412                 vuid_t          va_uid;           412                 vuid_t          va_uid;         /* owner user id */
413                 vgid_t          va_gid;           413                 vgid_t          va_gid;         /* owner group id */
414                 long            va_fsid;          414                 long            va_fsid;        /* file system id (dev for now) */
415                 long            va_fileid;        415                 long            va_fileid;      /* file id */
416                 u_quad_t        va_size;          416                 u_quad_t        va_size;        /* file size in bytes */
417                 long            va_blocksize;     417                 long            va_blocksize;   /* blocksize preferred for i/o */
418                 struct coda_timespec va_atime;    418                 struct coda_timespec va_atime;  /* time of last access */
419                 struct coda_timespec va_mtime;    419                 struct coda_timespec va_mtime;  /* time of last modification */
420                 struct coda_timespec va_ctime;    420                 struct coda_timespec va_ctime;  /* time file changed */
421                 u_long          va_gen;           421                 u_long          va_gen;         /* generation number of file */
422                 u_long          va_flags;         422                 u_long          va_flags;       /* flags defined for file */
423                 dev_t           va_rdev;          423                 dev_t           va_rdev;        /* device special file represents */
424                 u_quad_t        va_bytes;         424                 u_quad_t        va_bytes;       /* bytes of disk space held by file */
425                 u_quad_t        va_filerev;       425                 u_quad_t        va_filerev;     /* file modification number */
426                 u_int           va_vaflags;       426                 u_int           va_vaflags;     /* operations flags, see below */
427                 long            va_spare;         427                 long            va_spare;       /* remain quad aligned */
428         };                                        428         };
429                                                   429 
430                                                   430 
431 4.2.  The pioctl interface                        431 4.2.  The pioctl interface
432 --------------------------                        432 --------------------------
433                                                   433 
434                                                   434 
435   Coda specific requests can be made by applic    435   Coda specific requests can be made by application through the pioctl
436   interface. The pioctl is implemented as an o    436   interface. The pioctl is implemented as an ordinary ioctl on a
437   fictitious file /coda/.CONTROL.  The pioctl     437   fictitious file /coda/.CONTROL.  The pioctl call opens this file, gets
438   a file handle and makes the ioctl call. Fina    438   a file handle and makes the ioctl call. Finally it closes the file.
439                                                   439 
440   The kernel involvement in this is limited to    440   The kernel involvement in this is limited to providing the facility to
441   open and close and pass the ioctl message an    441   open and close and pass the ioctl message and to verify that a path in
442   the pioctl data buffers is a file in a Coda     442   the pioctl data buffers is a file in a Coda filesystem.
443                                                   443 
444   The kernel is handed a data packet of the fo    444   The kernel is handed a data packet of the form::
445                                                   445 
446         struct {                                  446         struct {
447             const char *path;                     447             const char *path;
448             struct ViceIoctl vidata;              448             struct ViceIoctl vidata;
449             int follow;                           449             int follow;
450         } data;                                   450         } data;
451                                                   451 
452                                                   452 
453                                                   453 
454   where::                                         454   where::
455                                                   455 
456                                                   456 
457         struct ViceIoctl {                        457         struct ViceIoctl {
458                 caddr_t in, out;        /* Dat    458                 caddr_t in, out;        /* Data to be transferred in, or out */
459                 short in_size;          /* Siz    459                 short in_size;          /* Size of input buffer <= 2K */
460                 short out_size;         /* Max    460                 short out_size;         /* Maximum size of output buffer, <= 2K */
461         };                                        461         };
462                                                   462 
463                                                   463 
464                                                   464 
465   The path must be a Coda file, otherwise the     465   The path must be a Coda file, otherwise the ioctl upcall will not be
466   made.                                           466   made.
467                                                   467 
468   .. Note:: The data structures and code are a    468   .. Note:: The data structures and code are a mess.  We need to clean this up.
469                                                   469 
470                                                   470 
471 **We now proceed to document the individual ca    471 **We now proceed to document the individual calls**:
472                                                   472 
473                                                   473 
474 4.3.  root                                        474 4.3.  root
475 ----------                                        475 ----------
476                                                   476 
477                                                   477 
478   Arguments                                       478   Arguments
479      in                                           479      in
480                                                   480 
481         empty                                     481         empty
482                                                   482 
483      out::                                        483      out::
484                                                   484 
485                 struct cfs_root_out {             485                 struct cfs_root_out {
486                     ViceFid VFid;                 486                     ViceFid VFid;
487                 } cfs_root;                       487                 } cfs_root;
488                                                   488 
489                                                   489 
490                                                   490 
491   Description                                     491   Description
492     This call is made to Venus during the init    492     This call is made to Venus during the initialization of
493     the Coda filesystem. If the result is zero    493     the Coda filesystem. If the result is zero, the cfs_root structure
494     contains the ViceFid of the root of the Co    494     contains the ViceFid of the root of the Coda filesystem. If a non-zero
495     result is generated, its value is a platfo    495     result is generated, its value is a platform dependent error code
496     indicating the difficulty Venus encountere    496     indicating the difficulty Venus encountered in locating the root of
497     the Coda filesystem.                          497     the Coda filesystem.
498                                                   498 
499 4.4.  lookup                                      499 4.4.  lookup
500 ------------                                      500 ------------
501                                                   501 
502                                                   502 
503   Summary                                         503   Summary
504     Find the ViceFid and type of an object in     504     Find the ViceFid and type of an object in a directory if it exists.
505                                                   505 
506   Arguments                                       506   Arguments
507      in::                                         507      in::
508                                                   508 
509                 struct  cfs_lookup_in {           509                 struct  cfs_lookup_in {
510                     ViceFid     VFid;             510                     ViceFid     VFid;
511                     char        *name;            511                     char        *name;          /* Place holder for data. */
512                 } cfs_lookup;                     512                 } cfs_lookup;
513                                                   513 
514                                                   514 
515                                                   515 
516      out::                                        516      out::
517                                                   517 
518                 struct cfs_lookup_out {           518                 struct cfs_lookup_out {
519                     ViceFid VFid;                 519                     ViceFid VFid;
520                     int vtype;                    520                     int vtype;
521                 } cfs_lookup;                     521                 } cfs_lookup;
522                                                   522 
523                                                   523 
524                                                   524 
525   Description                                     525   Description
526     This call is made to determine the ViceFid    526     This call is made to determine the ViceFid and filetype of
527     a directory entry.  The directory entry re    527     a directory entry.  The directory entry requested carries name 'name'
528     and Venus will search the directory identi    528     and Venus will search the directory identified by cfs_lookup_in.VFid.
529     The result may indicate that the name does    529     The result may indicate that the name does not exist, or that
530     difficulty was encountered in finding it (    530     difficulty was encountered in finding it (e.g. due to disconnection).
531     If the result is zero, the field cfs_looku    531     If the result is zero, the field cfs_lookup_out.VFid contains the
532     targets ViceFid and cfs_lookup_out.vtype t    532     targets ViceFid and cfs_lookup_out.vtype the coda_vtype giving the
533     type of object the name designates.           533     type of object the name designates.
534                                                   534 
535   The name of the object is an 8 bit character    535   The name of the object is an 8 bit character string of maximum length
536   CFS_MAXNAMLEN, currently set to 256 (includi    536   CFS_MAXNAMLEN, currently set to 256 (including a 0 terminator.)
537                                                   537 
538   It is extremely important to realize that Ve    538   It is extremely important to realize that Venus bitwise ors the field
539   cfs_lookup.vtype with CFS_NOCACHE to indicat    539   cfs_lookup.vtype with CFS_NOCACHE to indicate that the object should
540   not be put in the kernel name cache.            540   not be put in the kernel name cache.
541                                                   541 
542   .. Note::                                       542   .. Note::
543                                                   543 
544      The type of the vtype is currently wrong.    544      The type of the vtype is currently wrong.  It should be
545      coda_vtype. Linux does not take note of C    545      coda_vtype. Linux does not take note of CFS_NOCACHE.  It should.
546                                                   546 
547                                                   547 
548 4.5.  getattr                                     548 4.5.  getattr
549 -------------                                     549 -------------
550                                                   550 
551                                                   551 
552   Summary Get the attributes of a file.           552   Summary Get the attributes of a file.
553                                                   553 
554   Arguments                                       554   Arguments
555      in::                                         555      in::
556                                                   556 
557                 struct cfs_getattr_in {           557                 struct cfs_getattr_in {
558                     ViceFid VFid;                 558                     ViceFid VFid;
559                     struct coda_vattr attr; /*    559                     struct coda_vattr attr; /* XXXXX */
560                 } cfs_getattr;                    560                 } cfs_getattr;
561                                                   561 
562                                                   562 
563                                                   563 
564      out::                                        564      out::
565                                                   565 
566                 struct cfs_getattr_out {          566                 struct cfs_getattr_out {
567                     struct coda_vattr attr;       567                     struct coda_vattr attr;
568                 } cfs_getattr;                    568                 } cfs_getattr;
569                                                   569 
570                                                   570 
571                                                   571 
572   Description                                     572   Description
573     This call returns the attributes of the fi    573     This call returns the attributes of the file identified by fid.
574                                                   574 
575   Errors                                          575   Errors
576     Errors can occur if the object with fid do    576     Errors can occur if the object with fid does not exist, is
577     unaccessible or if the caller does not hav    577     unaccessible or if the caller does not have permission to fetch
578     attributes.                                   578     attributes.
579                                                   579 
580   .. Note::                                       580   .. Note::
581                                                   581 
582      Many kernel FS drivers (Linux, NT and Win    582      Many kernel FS drivers (Linux, NT and Windows 95) need to acquire
583      the attributes as well as the Fid for the    583      the attributes as well as the Fid for the instantiation of an internal
584      "inode" or "FileHandle".  A significant i    584      "inode" or "FileHandle".  A significant improvement in performance on
585      such systems could be made by combining t    585      such systems could be made by combining the lookup and getattr calls
586      both at the Venus/kernel interaction leve    586      both at the Venus/kernel interaction level and at the RPC level.
587                                                   587 
588   The vattr structure included in the input ar    588   The vattr structure included in the input arguments is superfluous and
589   should be removed.                              589   should be removed.
590                                                   590 
591                                                   591 
592 4.6.  setattr                                     592 4.6.  setattr
593 -------------                                     593 -------------
594                                                   594 
595                                                   595 
596   Summary                                         596   Summary
597     Set the attributes of a file.                 597     Set the attributes of a file.
598                                                   598 
599   Arguments                                       599   Arguments
600      in::                                         600      in::
601                                                   601 
602                 struct cfs_setattr_in {           602                 struct cfs_setattr_in {
603                     ViceFid VFid;                 603                     ViceFid VFid;
604                     struct coda_vattr attr;       604                     struct coda_vattr attr;
605                 } cfs_setattr;                    605                 } cfs_setattr;
606                                                   606 
607                                                   607 
608                                                   608 
609                                                   609 
610      out                                          610      out
611                                                   611 
612         empty                                     612         empty
613                                                   613 
614   Description                                     614   Description
615     The structure attr is filled with attribut    615     The structure attr is filled with attributes to be changed
616     in BSD style.  Attributes not to be change    616     in BSD style.  Attributes not to be changed are set to -1, apart from
617     vtype which is set to VNON. Other are set     617     vtype which is set to VNON. Other are set to the value to be assigned.
618     The only attributes which the FS driver ma    618     The only attributes which the FS driver may request to change are the
619     mode, owner, groupid, atime, mtime and cti    619     mode, owner, groupid, atime, mtime and ctime.  The return value
620     indicates success or failure.                 620     indicates success or failure.
621                                                   621 
622   Errors                                          622   Errors
623     A variety of errors can occur.  The object    623     A variety of errors can occur.  The object may not exist, may
624     be inaccessible, or permission may not be     624     be inaccessible, or permission may not be granted by Venus.
625                                                   625 
626                                                   626 
627 4.7.  access                                      627 4.7.  access
628 ------------                                      628 ------------
629                                                   629 
630                                                   630 
631   Arguments                                       631   Arguments
632      in::                                         632      in::
633                                                   633 
634                 struct cfs_access_in {            634                 struct cfs_access_in {
635                     ViceFid     VFid;             635                     ViceFid     VFid;
636                     int flags;                    636                     int flags;
637                 } cfs_access;                     637                 } cfs_access;
638                                                   638 
639                                                   639 
640                                                   640 
641      out                                          641      out
642                                                   642 
643         empty                                     643         empty
644                                                   644 
645   Description                                     645   Description
646     Verify if access to the object identified     646     Verify if access to the object identified by VFid for
647     operations described by flags is permitted    647     operations described by flags is permitted.  The result indicates if
648     access will be granted.  It is important t    648     access will be granted.  It is important to remember that Coda uses
649     ACLs to enforce protection and that ultima    649     ACLs to enforce protection and that ultimately the servers, not the
650     clients enforce the security of the system    650     clients enforce the security of the system.  The result of this call
651     will depend on whether a token is held by     651     will depend on whether a token is held by the user.
652                                                   652 
653   Errors                                          653   Errors
654     The object may not exist, or the ACL descr    654     The object may not exist, or the ACL describing the protection
655     may not be accessible.                        655     may not be accessible.
656                                                   656 
657                                                   657 
658 4.8.  create                                      658 4.8.  create
659 ------------                                      659 ------------
660                                                   660 
661                                                   661 
662   Summary                                         662   Summary
663     Invoked to create a file                      663     Invoked to create a file
664                                                   664 
665   Arguments                                       665   Arguments
666      in::                                         666      in::
667                                                   667 
668                 struct cfs_create_in {            668                 struct cfs_create_in {
669                     ViceFid VFid;                 669                     ViceFid VFid;
670                     struct coda_vattr attr;       670                     struct coda_vattr attr;
671                     int excl;                     671                     int excl;
672                     int mode;                     672                     int mode;
673                     char        *name;            673                     char        *name;          /* Place holder for data. */
674                 } cfs_create;                     674                 } cfs_create;
675                                                   675 
676                                                   676 
677                                                   677 
678                                                   678 
679      out::                                        679      out::
680                                                   680 
681                 struct cfs_create_out {           681                 struct cfs_create_out {
682                     ViceFid VFid;                 682                     ViceFid VFid;
683                     struct coda_vattr attr;       683                     struct coda_vattr attr;
684                 } cfs_create;                     684                 } cfs_create;
685                                                   685 
686                                                   686 
687                                                   687 
688   Description                                     688   Description
689     This upcall is invoked to request creation    689     This upcall is invoked to request creation of a file.
690     The file will be created in the directory     690     The file will be created in the directory identified by VFid, its name
691     will be name, and the mode will be mode.      691     will be name, and the mode will be mode.  If excl is set an error will
692     be returned if the file already exists.  I    692     be returned if the file already exists.  If the size field in attr is
693     set to zero the file will be truncated.  T    693     set to zero the file will be truncated.  The uid and gid of the file
694     are set by converting the CodaCred to a ui    694     are set by converting the CodaCred to a uid using a macro CRTOUID
695     (this macro is platform dependent).  Upon     695     (this macro is platform dependent).  Upon success the VFid and
696     attributes of the file are returned.  The     696     attributes of the file are returned.  The Coda FS Driver will normally
697     instantiate a vnode, inode or file handle     697     instantiate a vnode, inode or file handle at kernel level for the new
698     object.                                       698     object.
699                                                   699 
700                                                   700 
701   Errors                                          701   Errors
702     A variety of errors can occur. Permissions    702     A variety of errors can occur. Permissions may be insufficient.
703     If the object exists and is not a file the    703     If the object exists and is not a file the error EISDIR is returned
704     under Unix.                                   704     under Unix.
705                                                   705 
706   .. Note::                                       706   .. Note::
707                                                   707 
708      The packing of parameters is very ineffic    708      The packing of parameters is very inefficient and appears to
709      indicate confusion between the system cal    709      indicate confusion between the system call creat and the VFS operation
710      create. The VFS operation create is only     710      create. The VFS operation create is only called to create new objects.
711      This create call differs from the Unix on    711      This create call differs from the Unix one in that it is not invoked
712      to return a file descriptor. The truncate    712      to return a file descriptor. The truncate and exclusive options,
713      together with the mode, could simply be p    713      together with the mode, could simply be part of the mode as it is
714      under Unix.  There should be no flags arg    714      under Unix.  There should be no flags argument; this is used in open
715      (2) to return a file descriptor for READ     715      (2) to return a file descriptor for READ or WRITE mode.
716                                                   716 
717   The attributes of the directory should be re    717   The attributes of the directory should be returned too, since the size
718   and mtime changed.                              718   and mtime changed.
719                                                   719 
720                                                   720 
721 4.9.  mkdir                                       721 4.9.  mkdir
722 -----------                                       722 -----------
723                                                   723 
724                                                   724 
725   Summary                                         725   Summary
726     Create a new directory.                       726     Create a new directory.
727                                                   727 
728   Arguments                                       728   Arguments
729      in::                                         729      in::
730                                                   730 
731                 struct cfs_mkdir_in {             731                 struct cfs_mkdir_in {
732                     ViceFid     VFid;             732                     ViceFid     VFid;
733                     struct coda_vattr attr;       733                     struct coda_vattr attr;
734                     char        *name;            734                     char        *name;          /* Place holder for data. */
735                 } cfs_mkdir;                      735                 } cfs_mkdir;
736                                                   736 
737                                                   737 
738                                                   738 
739      out::                                        739      out::
740                                                   740 
741                 struct cfs_mkdir_out {            741                 struct cfs_mkdir_out {
742                     ViceFid VFid;                 742                     ViceFid VFid;
743                     struct coda_vattr attr;       743                     struct coda_vattr attr;
744                 } cfs_mkdir;                      744                 } cfs_mkdir;
745                                                   745 
746                                                   746 
747                                                   747 
748                                                   748 
749   Description                                     749   Description
750     This call is similar to create but creates    750     This call is similar to create but creates a directory.
751     Only the mode field in the input parameter    751     Only the mode field in the input parameters is used for creation.
752     Upon successful creation, the attr returne    752     Upon successful creation, the attr returned contains the attributes of
753     the new directory.                            753     the new directory.
754                                                   754 
755   Errors                                          755   Errors
756     As for create.                                756     As for create.
757                                                   757 
758   .. Note::                                       758   .. Note::
759                                                   759 
760      The input parameter should be changed to     760      The input parameter should be changed to mode instead of
761      attributes.                                  761      attributes.
762                                                   762 
763   The attributes of the parent should be retur    763   The attributes of the parent should be returned since the size and
764   mtime changes.                                  764   mtime changes.
765                                                   765 
766                                                   766 
767 4.10.  link                                       767 4.10.  link
768 -----------                                       768 -----------
769                                                   769 
770                                                   770 
771   Summary                                         771   Summary
772     Create a link to an existing file.            772     Create a link to an existing file.
773                                                   773 
774   Arguments                                       774   Arguments
775      in::                                         775      in::
776                                                   776 
777                 struct cfs_link_in {              777                 struct cfs_link_in {
778                     ViceFid sourceFid;            778                     ViceFid sourceFid;          /* cnode to link *to* */
779                     ViceFid destFid;              779                     ViceFid destFid;            /* Directory in which to place link */
780                     char        *tname;           780                     char        *tname;         /* Place holder for data. */
781                 } cfs_link;                       781                 } cfs_link;
782                                                   782 
783                                                   783 
784                                                   784 
785      out                                          785      out
786                                                   786 
787         empty                                     787         empty
788                                                   788 
789   Description                                     789   Description
790     This call creates a link to the sourceFid     790     This call creates a link to the sourceFid in the directory
791     identified by destFid with name tname.  Th    791     identified by destFid with name tname.  The source must reside in the
792     target's parent, i.e. the source must be h    792     target's parent, i.e. the source must be have parent destFid, i.e. Coda
793     does not support cross directory hard link    793     does not support cross directory hard links.  Only the return value is
794     relevant.  It indicates success or the typ    794     relevant.  It indicates success or the type of failure.
795                                                   795 
796   Errors                                          796   Errors
797     The usual errors can occur.                   797     The usual errors can occur.
798                                                   798 
799                                                   799 
800 4.11.  symlink                                    800 4.11.  symlink
801 --------------                                    801 --------------
802                                                   802 
803                                                   803 
804   Summary                                         804   Summary
805     create a symbolic link                        805     create a symbolic link
806                                                   806 
807   Arguments                                       807   Arguments
808      in::                                         808      in::
809                                                   809 
810                 struct cfs_symlink_in {           810                 struct cfs_symlink_in {
811                     ViceFid     VFid;             811                     ViceFid     VFid;          /* Directory to put symlink in */
812                     char        *srcname;         812                     char        *srcname;
813                     struct coda_vattr attr;       813                     struct coda_vattr attr;
814                     char        *tname;           814                     char        *tname;
815                 } cfs_symlink;                    815                 } cfs_symlink;
816                                                   816 
817                                                   817 
818                                                   818 
819      out                                          819      out
820                                                   820 
821         none                                      821         none
822                                                   822 
823   Description                                     823   Description
824     Create a symbolic link. The link is to be     824     Create a symbolic link. The link is to be placed in the
825     directory identified by VFid and named tna    825     directory identified by VFid and named tname.  It should point to the
826     pathname srcname.  The attributes of the n    826     pathname srcname.  The attributes of the newly created object are to
827     be set to attr.                               827     be set to attr.
828                                                   828 
829   .. Note::                                       829   .. Note::
830                                                   830 
831      The attributes of the target directory sh    831      The attributes of the target directory should be returned since
832      its size changed.                            832      its size changed.
833                                                   833 
834                                                   834 
835 4.12.  remove                                     835 4.12.  remove
836 -------------                                     836 -------------
837                                                   837 
838                                                   838 
839   Summary                                         839   Summary
840     Remove a file                                 840     Remove a file
841                                                   841 
842   Arguments                                       842   Arguments
843      in::                                         843      in::
844                                                   844 
845                 struct cfs_remove_in {            845                 struct cfs_remove_in {
846                     ViceFid     VFid;             846                     ViceFid     VFid;
847                     char        *name;            847                     char        *name;          /* Place holder for data. */
848                 } cfs_remove;                     848                 } cfs_remove;
849                                                   849 
850                                                   850 
851                                                   851 
852      out                                          852      out
853                                                   853 
854         none                                      854         none
855                                                   855 
856   Description                                     856   Description
857     Remove file named cfs_remove_in.name in di    857     Remove file named cfs_remove_in.name in directory
858     identified by   VFid.                         858     identified by   VFid.
859                                                   859 
860                                                   860 
861   .. Note::                                       861   .. Note::
862                                                   862 
863      The attributes of the directory should be    863      The attributes of the directory should be returned since its
864      mtime and size may change.                   864      mtime and size may change.
865                                                   865 
866                                                   866 
867 4.13.  rmdir                                      867 4.13.  rmdir
868 ------------                                      868 ------------
869                                                   869 
870                                                   870 
871   Summary                                         871   Summary
872     Remove a directory                            872     Remove a directory
873                                                   873 
874   Arguments                                       874   Arguments
875      in::                                         875      in::
876                                                   876 
877                 struct cfs_rmdir_in {             877                 struct cfs_rmdir_in {
878                     ViceFid     VFid;             878                     ViceFid     VFid;
879                     char        *name;            879                     char        *name;          /* Place holder for data. */
880                 } cfs_rmdir;                      880                 } cfs_rmdir;
881                                                   881 
882                                                   882 
883                                                   883 
884      out                                          884      out
885                                                   885 
886         none                                      886         none
887                                                   887 
888   Description                                     888   Description
889     Remove the directory with name 'name' from    889     Remove the directory with name 'name' from the directory
890     identified by VFid.                           890     identified by VFid.
891                                                   891 
892   .. Note:: The attributes of the parent direc    892   .. Note:: The attributes of the parent directory should be returned since
893             its mtime and size may change.        893             its mtime and size may change.
894                                                   894 
895                                                   895 
896 4.14.  readlink                                   896 4.14.  readlink
897 ---------------                                   897 ---------------
898                                                   898 
899                                                   899 
900   Summary                                         900   Summary
901     Read the value of a symbolic link.            901     Read the value of a symbolic link.
902                                                   902 
903   Arguments                                       903   Arguments
904      in::                                         904      in::
905                                                   905 
906                 struct cfs_readlink_in {          906                 struct cfs_readlink_in {
907                     ViceFid VFid;                 907                     ViceFid VFid;
908                 } cfs_readlink;                   908                 } cfs_readlink;
909                                                   909 
910                                                   910 
911                                                   911 
912      out::                                        912      out::
913                                                   913 
914                 struct cfs_readlink_out {         914                 struct cfs_readlink_out {
915                     int count;                    915                     int count;
916                     caddr_t     data;             916                     caddr_t     data;           /* Place holder for data. */
917                 } cfs_readlink;                   917                 } cfs_readlink;
918                                                   918 
919                                                   919 
920                                                   920 
921   Description                                     921   Description
922     This routine reads the contents of symboli    922     This routine reads the contents of symbolic link
923     identified by VFid into the buffer data.      923     identified by VFid into the buffer data.  The buffer data must be able
924     to hold any name up to CFS_MAXNAMLEN (PATH    924     to hold any name up to CFS_MAXNAMLEN (PATH or NAM??).
925                                                   925 
926   Errors                                          926   Errors
927     No unusual errors.                            927     No unusual errors.
928                                                   928 
929                                                   929 
930 4.15.  open                                       930 4.15.  open
931 -----------                                       931 -----------
932                                                   932 
933                                                   933 
934   Summary                                         934   Summary
935     Open a file.                                  935     Open a file.
936                                                   936 
937   Arguments                                       937   Arguments
938      in::                                         938      in::
939                                                   939 
940                 struct cfs_open_in {              940                 struct cfs_open_in {
941                     ViceFid     VFid;             941                     ViceFid     VFid;
942                     int flags;                    942                     int flags;
943                 } cfs_open;                       943                 } cfs_open;
944                                                   944 
945                                                   945 
946                                                   946 
947      out::                                        947      out::
948                                                   948 
949                 struct cfs_open_out {             949                 struct cfs_open_out {
950                     dev_t       dev;              950                     dev_t       dev;
951                     ino_t       inode;            951                     ino_t       inode;
952                 } cfs_open;                       952                 } cfs_open;
953                                                   953 
954                                                   954 
955                                                   955 
956   Description                                     956   Description
957     This request asks Venus to place the file     957     This request asks Venus to place the file identified by
958     VFid in its cache and to note that the cal    958     VFid in its cache and to note that the calling process wishes to open
959     it with flags as in open(2).  The return v    959     it with flags as in open(2).  The return value to the kernel differs
960     for Unix and Windows systems.  For Unix sy    960     for Unix and Windows systems.  For Unix systems the Coda FS Driver is
961     informed of the device and inode number of    961     informed of the device and inode number of the container file in the
962     fields dev and inode.  For Windows the pat    962     fields dev and inode.  For Windows the path of the container file is
963     returned to the kernel.                       963     returned to the kernel.
964                                                   964 
965                                                   965 
966   .. Note::                                       966   .. Note::
967                                                   967 
968      Currently the cfs_open_out structure is n    968      Currently the cfs_open_out structure is not properly adapted to
969      deal with the Windows case.  It might be     969      deal with the Windows case.  It might be best to implement two
970      upcalls, one to open aiming at a containe    970      upcalls, one to open aiming at a container file name, the other at a
971      container file inode.                        971      container file inode.
972                                                   972 
973                                                   973 
974 4.16.  close                                      974 4.16.  close
975 ------------                                      975 ------------
976                                                   976 
977                                                   977 
978   Summary                                         978   Summary
979     Close a file, update it on the servers.       979     Close a file, update it on the servers.
980                                                   980 
981   Arguments                                       981   Arguments
982      in::                                         982      in::
983                                                   983 
984                 struct cfs_close_in {             984                 struct cfs_close_in {
985                     ViceFid     VFid;             985                     ViceFid     VFid;
986                     int flags;                    986                     int flags;
987                 } cfs_close;                      987                 } cfs_close;
988                                                   988 
989                                                   989 
990                                                   990 
991      out                                          991      out
992                                                   992 
993         none                                      993         none
994                                                   994 
995   Description                                     995   Description
996     Close the file identified by VFid.            996     Close the file identified by VFid.
997                                                   997 
998   .. Note::                                       998   .. Note::
999                                                   999 
1000      The flags argument is bogus and not used    1000      The flags argument is bogus and not used.  However, Venus' code
1001      has room to deal with an execp input fie    1001      has room to deal with an execp input field, probably this field should
1002      be used to inform Venus that the file wa    1002      be used to inform Venus that the file was closed but is still memory
1003      mapped for execution.  There are comment    1003      mapped for execution.  There are comments about fetching versus not
1004      fetching the data in Venus vproc_vfscall    1004      fetching the data in Venus vproc_vfscalls.  This seems silly.  If a
1005      file is being closed, the data in the co    1005      file is being closed, the data in the container file is to be the new
1006      data.  Here again the execp flag might b    1006      data.  Here again the execp flag might be in play to create confusion:
1007      currently Venus might think a file can b    1007      currently Venus might think a file can be flushed from the cache when
1008      it is still memory mapped.  This needs t    1008      it is still memory mapped.  This needs to be understood.
1009                                                  1009 
1010                                                  1010 
1011 4.17.  ioctl                                     1011 4.17.  ioctl
1012 ------------                                     1012 ------------
1013                                                  1013 
1014                                                  1014 
1015   Summary                                        1015   Summary
1016     Do an ioctl on a file. This includes the     1016     Do an ioctl on a file. This includes the pioctl interface.
1017                                                  1017 
1018   Arguments                                      1018   Arguments
1019      in::                                        1019      in::
1020                                                  1020 
1021                 struct cfs_ioctl_in {            1021                 struct cfs_ioctl_in {
1022                     ViceFid VFid;                1022                     ViceFid VFid;
1023                     int cmd;                     1023                     int cmd;
1024                     int len;                     1024                     int len;
1025                     int rwflag;                  1025                     int rwflag;
1026                     char *data;                  1026                     char *data;                 /* Place holder for data. */
1027                 } cfs_ioctl;                     1027                 } cfs_ioctl;
1028                                                  1028 
1029                                                  1029 
1030                                                  1030 
1031      out::                                       1031      out::
1032                                                  1032 
1033                                                  1033 
1034                 struct cfs_ioctl_out {           1034                 struct cfs_ioctl_out {
1035                     int len;                     1035                     int len;
1036                     caddr_t     data;            1036                     caddr_t     data;           /* Place holder for data. */
1037                 } cfs_ioctl;                     1037                 } cfs_ioctl;
1038                                                  1038 
1039                                                  1039 
1040                                                  1040 
1041   Description                                    1041   Description
1042     Do an ioctl operation on a file.  The com    1042     Do an ioctl operation on a file.  The command, len and
1043     data arguments are filled as usual.  flag    1043     data arguments are filled as usual.  flags is not used by Venus.
1044                                                  1044 
1045   .. Note::                                      1045   .. Note::
1046                                                  1046 
1047      Another bogus parameter.  flags is not u    1047      Another bogus parameter.  flags is not used.  What is the
1048      business about PREFETCHING in the Venus     1048      business about PREFETCHING in the Venus code?
1049                                                  1049 
1050                                                  1050 
1051                                                  1051 
1052 4.18.  rename                                    1052 4.18.  rename
1053 -------------                                    1053 -------------
1054                                                  1054 
1055                                                  1055 
1056   Summary                                        1056   Summary
1057     Rename a fid.                                1057     Rename a fid.
1058                                                  1058 
1059   Arguments                                      1059   Arguments
1060      in::                                        1060      in::
1061                                                  1061 
1062                 struct cfs_rename_in {           1062                 struct cfs_rename_in {
1063                     ViceFid     sourceFid;       1063                     ViceFid     sourceFid;
1064                     char        *srcname;        1064                     char        *srcname;
1065                     ViceFid destFid;             1065                     ViceFid destFid;
1066                     char        *destname;       1066                     char        *destname;
1067                 } cfs_rename;                    1067                 } cfs_rename;
1068                                                  1068 
1069                                                  1069 
1070                                                  1070 
1071      out                                         1071      out
1072                                                  1072 
1073         none                                     1073         none
1074                                                  1074 
1075   Description                                    1075   Description
1076     Rename the object with name srcname in di    1076     Rename the object with name srcname in directory
1077     sourceFid to destname in destFid.   It is    1077     sourceFid to destname in destFid.   It is important that the names
1078     srcname and destname are 0 terminated str    1078     srcname and destname are 0 terminated strings.  Strings in Unix
1079     kernels are not always null terminated.      1079     kernels are not always null terminated.
1080                                                  1080 
1081                                                  1081 
1082 4.19.  readdir                                   1082 4.19.  readdir
1083 --------------                                   1083 --------------
1084                                                  1084 
1085                                                  1085 
1086   Summary                                        1086   Summary
1087     Read directory entries.                      1087     Read directory entries.
1088                                                  1088 
1089   Arguments                                      1089   Arguments
1090      in::                                        1090      in::
1091                                                  1091 
1092                 struct cfs_readdir_in {          1092                 struct cfs_readdir_in {
1093                     ViceFid     VFid;            1093                     ViceFid     VFid;
1094                     int count;                   1094                     int count;
1095                     int offset;                  1095                     int offset;
1096                 } cfs_readdir;                   1096                 } cfs_readdir;
1097                                                  1097 
1098                                                  1098 
1099                                                  1099 
1100                                                  1100 
1101      out::                                       1101      out::
1102                                                  1102 
1103                 struct cfs_readdir_out {         1103                 struct cfs_readdir_out {
1104                     int size;                    1104                     int size;
1105                     caddr_t     data;            1105                     caddr_t     data;           /* Place holder for data. */
1106                 } cfs_readdir;                   1106                 } cfs_readdir;
1107                                                  1107 
1108                                                  1108 
1109                                                  1109 
1110   Description                                    1110   Description
1111     Read directory entries from VFid starting    1111     Read directory entries from VFid starting at offset and
1112     read at most count bytes.  Returns the da    1112     read at most count bytes.  Returns the data in data and returns
1113     the size in size.                            1113     the size in size.
1114                                                  1114 
1115                                                  1115 
1116   .. Note::                                      1116   .. Note::
1117                                                  1117 
1118      This call is not used.  Readdir operatio    1118      This call is not used.  Readdir operations exploit container
1119      files.  We will re-evaluate this during     1119      files.  We will re-evaluate this during the directory revamp which is
1120      about to take place.                        1120      about to take place.
1121                                                  1121 
1122                                                  1122 
1123 4.20.  vget                                      1123 4.20.  vget
1124 -----------                                      1124 -----------
1125                                                  1125 
1126                                                  1126 
1127   Summary                                        1127   Summary
1128     instructs Venus to do an FSDB->Get.          1128     instructs Venus to do an FSDB->Get.
1129                                                  1129 
1130   Arguments                                      1130   Arguments
1131      in::                                        1131      in::
1132                                                  1132 
1133                 struct cfs_vget_in {             1133                 struct cfs_vget_in {
1134                     ViceFid VFid;                1134                     ViceFid VFid;
1135                 } cfs_vget;                      1135                 } cfs_vget;
1136                                                  1136 
1137                                                  1137 
1138                                                  1138 
1139      out::                                       1139      out::
1140                                                  1140 
1141                 struct cfs_vget_out {            1141                 struct cfs_vget_out {
1142                     ViceFid VFid;                1142                     ViceFid VFid;
1143                     int vtype;                   1143                     int vtype;
1144                 } cfs_vget;                      1144                 } cfs_vget;
1145                                                  1145 
1146                                                  1146 
1147                                                  1147 
1148   Description                                    1148   Description
1149     This upcall asks Venus to do a get operat    1149     This upcall asks Venus to do a get operation on an fsobj
1150     labelled by VFid.                            1150     labelled by VFid.
1151                                                  1151 
1152   .. Note::                                      1152   .. Note::
1153                                                  1153 
1154      This operation is not used.  However, it    1154      This operation is not used.  However, it is extremely useful
1155      since it can be used to deal with read/w    1155      since it can be used to deal with read/write memory mapped files.
1156      These can be "pinned" in the Venus cache    1156      These can be "pinned" in the Venus cache using vget and released with
1157      inactive.                                   1157      inactive.
1158                                                  1158 
1159                                                  1159 
1160 4.21.  fsync                                     1160 4.21.  fsync
1161 ------------                                     1161 ------------
1162                                                  1162 
1163                                                  1163 
1164   Summary                                        1164   Summary
1165     Tell Venus to update the RVM attributes o    1165     Tell Venus to update the RVM attributes of a file.
1166                                                  1166 
1167   Arguments                                      1167   Arguments
1168      in::                                        1168      in::
1169                                                  1169 
1170                 struct cfs_fsync_in {            1170                 struct cfs_fsync_in {
1171                     ViceFid VFid;                1171                     ViceFid VFid;
1172                 } cfs_fsync;                     1172                 } cfs_fsync;
1173                                                  1173 
1174                                                  1174 
1175                                                  1175 
1176      out                                         1176      out
1177                                                  1177 
1178         none                                     1178         none
1179                                                  1179 
1180   Description                                    1180   Description
1181     Ask Venus to update RVM attributes of obj    1181     Ask Venus to update RVM attributes of object VFid. This
1182     should be called as part of kernel level     1182     should be called as part of kernel level fsync type calls.  The
1183     result indicates if the syncing was succe    1183     result indicates if the syncing was successful.
1184                                                  1184 
1185   .. Note:: Linux does not implement this cal    1185   .. Note:: Linux does not implement this call. It should.
1186                                                  1186 
1187                                                  1187 
1188 4.22.  inactive                                  1188 4.22.  inactive
1189 ---------------                                  1189 ---------------
1190                                                  1190 
1191                                                  1191 
1192   Summary                                        1192   Summary
1193     Tell Venus a vnode is no longer in use.      1193     Tell Venus a vnode is no longer in use.
1194                                                  1194 
1195   Arguments                                      1195   Arguments
1196      in::                                        1196      in::
1197                                                  1197 
1198                 struct cfs_inactive_in {         1198                 struct cfs_inactive_in {
1199                     ViceFid VFid;                1199                     ViceFid VFid;
1200                 } cfs_inactive;                  1200                 } cfs_inactive;
1201                                                  1201 
1202                                                  1202 
1203                                                  1203 
1204      out                                         1204      out
1205                                                  1205 
1206         none                                     1206         none
1207                                                  1207 
1208   Description                                    1208   Description
1209     This operation returns EOPNOTSUPP.           1209     This operation returns EOPNOTSUPP.
1210                                                  1210 
1211   .. Note:: This should perhaps be removed.      1211   .. Note:: This should perhaps be removed.
1212                                                  1212 
1213                                                  1213 
1214 4.23.  rdwr                                      1214 4.23.  rdwr
1215 -----------                                      1215 -----------
1216                                                  1216 
1217                                                  1217 
1218   Summary                                        1218   Summary
1219     Read or write from a file                    1219     Read or write from a file
1220                                                  1220 
1221   Arguments                                      1221   Arguments
1222      in::                                        1222      in::
1223                                                  1223 
1224                 struct cfs_rdwr_in {             1224                 struct cfs_rdwr_in {
1225                     ViceFid     VFid;            1225                     ViceFid     VFid;
1226                     int rwflag;                  1226                     int rwflag;
1227                     int count;                   1227                     int count;
1228                     int offset;                  1228                     int offset;
1229                     int ioflag;                  1229                     int ioflag;
1230                     caddr_t     data;            1230                     caddr_t     data;           /* Place holder for data. */
1231                 } cfs_rdwr;                      1231                 } cfs_rdwr;
1232                                                  1232 
1233                                                  1233 
1234                                                  1234 
1235                                                  1235 
1236      out::                                       1236      out::
1237                                                  1237 
1238                 struct cfs_rdwr_out {            1238                 struct cfs_rdwr_out {
1239                     int rwflag;                  1239                     int rwflag;
1240                     int count;                   1240                     int count;
1241                     caddr_t     data;   /* Pl    1241                     caddr_t     data;   /* Place holder for data. */
1242                 } cfs_rdwr;                      1242                 } cfs_rdwr;
1243                                                  1243 
1244                                                  1244 
1245                                                  1245 
1246   Description                                    1246   Description
1247     This upcall asks Venus to read or write f    1247     This upcall asks Venus to read or write from a file.
1248                                                  1248 
1249                                                  1249 
1250   .. Note::                                      1250   .. Note::
1251                                                  1251 
1252     It should be removed since it is against     1252     It should be removed since it is against the Coda philosophy that
1253     read/write operations never reach Venus.     1253     read/write operations never reach Venus.  I have been told the
1254     operation does not work.  It is not curre    1254     operation does not work.  It is not currently used.
1255                                                  1255 
1256                                                  1256 
1257                                                  1257 
1258 4.24.  odymount                                  1258 4.24.  odymount
1259 ---------------                                  1259 ---------------
1260                                                  1260 
1261                                                  1261 
1262   Summary                                        1262   Summary
1263     Allows mounting multiple Coda "filesystem    1263     Allows mounting multiple Coda "filesystems" on one Unix mount point.
1264                                                  1264 
1265   Arguments                                      1265   Arguments
1266      in::                                        1266      in::
1267                                                  1267 
1268                 struct ody_mount_in {            1268                 struct ody_mount_in {
1269                     char        *name;           1269                     char        *name;          /* Place holder for data. */
1270                 } ody_mount;                     1270                 } ody_mount;
1271                                                  1271 
1272                                                  1272 
1273                                                  1273 
1274      out::                                       1274      out::
1275                                                  1275 
1276                 struct ody_mount_out {           1276                 struct ody_mount_out {
1277                     ViceFid VFid;                1277                     ViceFid VFid;
1278                 } ody_mount;                     1278                 } ody_mount;
1279                                                  1279 
1280                                                  1280 
1281                                                  1281 
1282   Description                                    1282   Description
1283     Asks Venus to return the rootfid of a Cod    1283     Asks Venus to return the rootfid of a Coda system named
1284     name.  The fid is returned in VFid.          1284     name.  The fid is returned in VFid.
1285                                                  1285 
1286   .. Note::                                      1286   .. Note::
1287                                                  1287 
1288      This call was used by David for dynamic     1288      This call was used by David for dynamic sets.  It should be
1289      removed since it causes a jungle of poin    1289      removed since it causes a jungle of pointers in the VFS mounting area.
1290      It is not used by Coda proper.  Call is     1290      It is not used by Coda proper.  Call is not implemented by Venus.
1291                                                  1291 
1292                                                  1292 
1293 4.25.  ody_lookup                                1293 4.25.  ody_lookup
1294 -----------------                                1294 -----------------
1295                                                  1295 
1296                                                  1296 
1297   Summary                                        1297   Summary
1298     Looks up something.                          1298     Looks up something.
1299                                                  1299 
1300   Arguments                                      1300   Arguments
1301      in                                          1301      in
1302                                                  1302 
1303         irrelevant                               1303         irrelevant
1304                                                  1304 
1305                                                  1305 
1306      out                                         1306      out
1307                                                  1307 
1308         irrelevant                               1308         irrelevant
1309                                                  1309 
1310                                                  1310 
1311   .. Note:: Gut it. Call is not implemented b    1311   .. Note:: Gut it. Call is not implemented by Venus.
1312                                                  1312 
1313                                                  1313 
1314 4.26.  ody_expand                                1314 4.26.  ody_expand
1315 -----------------                                1315 -----------------
1316                                                  1316 
1317                                                  1317 
1318   Summary                                        1318   Summary
1319     expands something in a dynamic set.          1319     expands something in a dynamic set.
1320                                                  1320 
1321   Arguments                                      1321   Arguments
1322      in                                          1322      in
1323                                                  1323 
1324         irrelevant                               1324         irrelevant
1325                                                  1325 
1326      out                                         1326      out
1327                                                  1327 
1328         irrelevant                               1328         irrelevant
1329                                                  1329 
1330   .. Note:: Gut it. Call is not implemented b    1330   .. Note:: Gut it. Call is not implemented by Venus.
1331                                                  1331 
1332                                                  1332 
1333 4.27.  prefetch                                  1333 4.27.  prefetch
1334 ---------------                                  1334 ---------------
1335                                                  1335 
1336                                                  1336 
1337   Summary                                        1337   Summary
1338     Prefetch a dynamic set.                      1338     Prefetch a dynamic set.
1339                                                  1339 
1340   Arguments                                      1340   Arguments
1341                                                  1341 
1342      in                                          1342      in
1343                                                  1343 
1344         Not documented.                          1344         Not documented.
1345                                                  1345 
1346      out                                         1346      out
1347                                                  1347 
1348         Not documented.                          1348         Not documented.
1349                                                  1349 
1350   Description                                    1350   Description
1351     Venus worker.cc has support for this call    1351     Venus worker.cc has support for this call, although it is
1352     noted that it doesn't work.  Not surprisi    1352     noted that it doesn't work.  Not surprising, since the kernel does not
1353     have support for it. (ODY_PREFETCH is not    1353     have support for it. (ODY_PREFETCH is not a defined operation).
1354                                                  1354 
1355                                                  1355 
1356   .. Note:: Gut it. It isn't working and isn'    1356   .. Note:: Gut it. It isn't working and isn't used by Coda.
1357                                                  1357 
1358                                                  1358 
1359                                                  1359 
1360 4.28.  signal                                    1360 4.28.  signal
1361 -------------                                    1361 -------------
1362                                                  1362 
1363                                                  1363 
1364   Summary                                        1364   Summary
1365     Send Venus a signal about an upcall.         1365     Send Venus a signal about an upcall.
1366                                                  1366 
1367   Arguments                                      1367   Arguments
1368      in                                          1368      in
1369                                                  1369 
1370         none                                     1370         none
1371                                                  1371 
1372      out                                         1372      out
1373                                                  1373 
1374         not applicable.                          1374         not applicable.
1375                                                  1375 
1376   Description                                    1376   Description
1377     This is an out-of-band upcall to Venus to    1377     This is an out-of-band upcall to Venus to inform Venus
1378     that the calling process received a signa    1378     that the calling process received a signal after Venus read the
1379     message from the input queue.  Venus is s    1379     message from the input queue.  Venus is supposed to clean up the
1380     operation.                                   1380     operation.
1381                                                  1381 
1382   Errors                                         1382   Errors
1383     No reply is given.                           1383     No reply is given.
1384                                                  1384 
1385   .. Note::                                      1385   .. Note::
1386                                                  1386 
1387      We need to better understand what Venus     1387      We need to better understand what Venus needs to clean up and if
1388      it is doing this correctly.  Also we nee    1388      it is doing this correctly.  Also we need to handle multiple upcall
1389      per system call situations correctly.  I    1389      per system call situations correctly.  It would be important to know
1390      what state changes in Venus take place a    1390      what state changes in Venus take place after an upcall for which the
1391      kernel is responsible for notifying Venu    1391      kernel is responsible for notifying Venus to clean up (e.g. open
1392      definitely is such a state change, but m    1392      definitely is such a state change, but many others are maybe not).
1393                                                  1393 
1394                                                  1394 
1395 5.  The minicache and downcalls                  1395 5.  The minicache and downcalls
1396 ===============================                  1396 ===============================
1397                                                  1397 
1398                                                  1398 
1399   The Coda FS Driver can cache results of loo    1399   The Coda FS Driver can cache results of lookup and access upcalls, to
1400   limit the frequency of upcalls.  Upcalls ca    1400   limit the frequency of upcalls.  Upcalls carry a price since a process
1401   context switch needs to take place.  The co    1401   context switch needs to take place.  The counterpart of caching the
1402   information is that Venus will notify the F    1402   information is that Venus will notify the FS Driver that cached
1403   entries must be flushed or renamed.            1403   entries must be flushed or renamed.
1404                                                  1404 
1405   The kernel code generally has to maintain a    1405   The kernel code generally has to maintain a structure which links the
1406   internal file handles (called vnodes in BSD    1406   internal file handles (called vnodes in BSD, inodes in Linux and
1407   FileHandles in Windows) with the ViceFid's     1407   FileHandles in Windows) with the ViceFid's which Venus maintains.  The
1408   reason is that frequent translations back a    1408   reason is that frequent translations back and forth are needed in
1409   order to make upcalls and use the results o    1409   order to make upcalls and use the results of upcalls.  Such linking
1410   objects are called cnodes.                     1410   objects are called cnodes.
1411                                                  1411 
1412   The current minicache implementations have     1412   The current minicache implementations have cache entries which record
1413   the following:                                 1413   the following:
1414                                                  1414 
1415   1. the name of the file                        1415   1. the name of the file
1416                                                  1416 
1417   2. the cnode of the directory containing th    1417   2. the cnode of the directory containing the object
1418                                                  1418 
1419   3. a list of CodaCred's for which the looku    1419   3. a list of CodaCred's for which the lookup is permitted.
1420                                                  1420 
1421   4. the cnode of the object                     1421   4. the cnode of the object
1422                                                  1422 
1423   The lookup call in the Coda FS Driver may r    1423   The lookup call in the Coda FS Driver may request the cnode of the
1424   desired object from the cache, by passing i    1424   desired object from the cache, by passing its name, directory and the
1425   CodaCred's of the caller.  The cache will r    1425   CodaCred's of the caller.  The cache will return the cnode or indicate
1426   that it cannot be found.  The Coda FS Drive    1426   that it cannot be found.  The Coda FS Driver must be careful to
1427   invalidate cache entries when it modifies o    1427   invalidate cache entries when it modifies or removes objects.
1428                                                  1428 
1429   When Venus obtains information that indicat    1429   When Venus obtains information that indicates that cache entries are
1430   no longer valid, it will make a downcall to    1430   no longer valid, it will make a downcall to the kernel.  Downcalls are
1431   intercepted by the Coda FS Driver and lead     1431   intercepted by the Coda FS Driver and lead to cache invalidations of
1432   the kind described below.  The Coda FS Driv    1432   the kind described below.  The Coda FS Driver does not return an error
1433   unless the downcall data could not be read     1433   unless the downcall data could not be read into kernel memory.
1434                                                  1434 
1435                                                  1435 
1436 5.1.  INVALIDATE                                 1436 5.1.  INVALIDATE
1437 ----------------                                 1437 ----------------
1438                                                  1438 
1439                                                  1439 
1440   No information is available on this call.      1440   No information is available on this call.
1441                                                  1441 
1442                                                  1442 
1443 5.2.  FLUSH                                      1443 5.2.  FLUSH
1444 -----------                                      1444 -----------
1445                                                  1445 
1446                                                  1446 
1447                                                  1447 
1448   Arguments                                      1448   Arguments
1449     None                                         1449     None
1450                                                  1450 
1451   Summary                                        1451   Summary
1452     Flush the name cache entirely.               1452     Flush the name cache entirely.
1453                                                  1453 
1454   Description                                    1454   Description
1455     Venus issues this call upon startup and w    1455     Venus issues this call upon startup and when it dies. This
1456     is to prevent stale cache information bei    1456     is to prevent stale cache information being held.  Some operating
1457     systems allow the kernel name cache to be    1457     systems allow the kernel name cache to be switched off dynamically.
1458     When this is done, this downcall is made.    1458     When this is done, this downcall is made.
1459                                                  1459 
1460                                                  1460 
1461 5.3.  PURGEUSER                                  1461 5.3.  PURGEUSER
1462 ---------------                                  1462 ---------------
1463                                                  1463 
1464                                                  1464 
1465   Arguments                                      1465   Arguments
1466     ::                                           1466     ::
1467                                                  1467 
1468           struct cfs_purgeuser_out {/* CFS_PU    1468           struct cfs_purgeuser_out {/* CFS_PURGEUSER is a venus->kernel call */
1469               struct CodaCred cred;              1469               struct CodaCred cred;
1470           } cfs_purgeuser;                       1470           } cfs_purgeuser;
1471                                                  1471 
1472                                                  1472 
1473                                                  1473 
1474   Description                                    1474   Description
1475     Remove all entries in the cache carrying     1475     Remove all entries in the cache carrying the Cred.  This
1476     call is issued when tokens for a user exp    1476     call is issued when tokens for a user expire or are flushed.
1477                                                  1477 
1478                                                  1478 
1479 5.4.  ZAPFILE                                    1479 5.4.  ZAPFILE
1480 -------------                                    1480 -------------
1481                                                  1481 
1482                                                  1482 
1483   Arguments                                      1483   Arguments
1484     ::                                           1484     ::
1485                                                  1485 
1486           struct cfs_zapfile_out {  /* CFS_ZA    1486           struct cfs_zapfile_out {  /* CFS_ZAPFILE is a venus->kernel call */
1487               ViceFid CodaFid;                   1487               ViceFid CodaFid;
1488           } cfs_zapfile;                         1488           } cfs_zapfile;
1489                                                  1489 
1490                                                  1490 
1491                                                  1491 
1492   Description                                    1492   Description
1493     Remove all entries which have the (dir vn    1493     Remove all entries which have the (dir vnode, name) pair.
1494     This is issued as a result of an invalida    1494     This is issued as a result of an invalidation of cached attributes of
1495     a vnode.                                     1495     a vnode.
1496                                                  1496 
1497   .. Note::                                      1497   .. Note::
1498                                                  1498 
1499      Call is not named correctly in NetBSD an    1499      Call is not named correctly in NetBSD and Mach.  The minicache
1500      zapfile routine takes different argument    1500      zapfile routine takes different arguments. Linux does not implement
1501      the invalidation of attributes correctly    1501      the invalidation of attributes correctly.
1502                                                  1502 
1503                                                  1503 
1504                                                  1504 
1505 5.5.  ZAPDIR                                     1505 5.5.  ZAPDIR
1506 ------------                                     1506 ------------
1507                                                  1507 
1508                                                  1508 
1509   Arguments                                      1509   Arguments
1510     ::                                           1510     ::
1511                                                  1511 
1512           struct cfs_zapdir_out {   /* CFS_ZA    1512           struct cfs_zapdir_out {   /* CFS_ZAPDIR is a venus->kernel call */
1513               ViceFid CodaFid;                   1513               ViceFid CodaFid;
1514           } cfs_zapdir;                          1514           } cfs_zapdir;
1515                                                  1515 
1516                                                  1516 
1517                                                  1517 
1518   Description                                    1518   Description
1519     Remove all entries in the cache lying in     1519     Remove all entries in the cache lying in a directory
1520     CodaFid, and all children of this directo    1520     CodaFid, and all children of this directory. This call is issued when
1521     Venus receives a callback on the director    1521     Venus receives a callback on the directory.
1522                                                  1522 
1523                                                  1523 
1524 5.6.  ZAPVNODE                                   1524 5.6.  ZAPVNODE
1525 --------------                                   1525 --------------
1526                                                  1526 
1527                                                  1527 
1528                                                  1528 
1529   Arguments                                      1529   Arguments
1530     ::                                           1530     ::
1531                                                  1531 
1532           struct cfs_zapvnode_out { /* CFS_ZA    1532           struct cfs_zapvnode_out { /* CFS_ZAPVNODE is a venus->kernel call */
1533               struct CodaCred cred;              1533               struct CodaCred cred;
1534               ViceFid VFid;                      1534               ViceFid VFid;
1535           } cfs_zapvnode;                        1535           } cfs_zapvnode;
1536                                                  1536 
1537                                                  1537 
1538                                                  1538 
1539   Description                                    1539   Description
1540     Remove all entries in the cache carrying     1540     Remove all entries in the cache carrying the cred and VFid
1541     as in the arguments. This downcall is pro    1541     as in the arguments. This downcall is probably never issued.
1542                                                  1542 
1543                                                  1543 
1544 5.7.  PURGEFID                                   1544 5.7.  PURGEFID
1545 --------------                                   1545 --------------
1546                                                  1546 
1547                                                  1547 
1548   Arguments                                      1548   Arguments
1549     ::                                           1549     ::
1550                                                  1550 
1551           struct cfs_purgefid_out { /* CFS_PU    1551           struct cfs_purgefid_out { /* CFS_PURGEFID is a venus->kernel call */
1552               ViceFid CodaFid;                   1552               ViceFid CodaFid;
1553           } cfs_purgefid;                        1553           } cfs_purgefid;
1554                                                  1554 
1555                                                  1555 
1556                                                  1556 
1557   Description                                    1557   Description
1558     Flush the attribute for the file. If it i    1558     Flush the attribute for the file. If it is a dir (odd
1559     vnode), purge its children from the namec    1559     vnode), purge its children from the namecache and remove the file from the
1560     namecache.                                   1560     namecache.
1561                                                  1561 
1562                                                  1562 
1563                                                  1563 
1564 5.8.  REPLACE                                    1564 5.8.  REPLACE
1565 -------------                                    1565 -------------
1566                                                  1566 
1567                                                  1567 
1568   Summary                                        1568   Summary
1569     Replace the Fid's for a collection of nam    1569     Replace the Fid's for a collection of names.
1570                                                  1570 
1571   Arguments                                      1571   Arguments
1572     ::                                           1572     ::
1573                                                  1573 
1574           struct cfs_replace_out { /* cfs_rep    1574           struct cfs_replace_out { /* cfs_replace is a venus->kernel call */
1575               ViceFid NewFid;                    1575               ViceFid NewFid;
1576               ViceFid OldFid;                    1576               ViceFid OldFid;
1577           } cfs_replace;                         1577           } cfs_replace;
1578                                                  1578 
1579                                                  1579 
1580                                                  1580 
1581   Description                                    1581   Description
1582     This routine replaces a ViceFid in the na    1582     This routine replaces a ViceFid in the name cache with
1583     another.  It is added to allow Venus duri    1583     another.  It is added to allow Venus during reintegration to replace
1584     locally allocated temp fids while disconn    1584     locally allocated temp fids while disconnected with global fids even
1585     when the reference counts on those fids a    1585     when the reference counts on those fids are not zero.
1586                                                  1586 
1587                                                  1587 
1588 6.  Initialization and cleanup                   1588 6.  Initialization and cleanup
1589 ==============================                   1589 ==============================
1590                                                  1590 
1591                                                  1591 
1592   This section gives brief hints as to desira    1592   This section gives brief hints as to desirable features for the Coda
1593   FS Driver at startup and upon shutdown or V    1593   FS Driver at startup and upon shutdown or Venus failures.  Before
1594   entering the discussion it is useful to rep    1594   entering the discussion it is useful to repeat that the Coda FS Driver
1595   maintains the following data:                  1595   maintains the following data:
1596                                                  1596 
1597                                                  1597 
1598   1. message queues                              1598   1. message queues
1599                                                  1599 
1600   2. cnodes                                      1600   2. cnodes
1601                                                  1601 
1602   3. name cache entries                          1602   3. name cache entries
1603                                                  1603 
1604      The name cache entries are entirely priv    1604      The name cache entries are entirely private to the driver, so they
1605      can easily be manipulated.   The message    1605      can easily be manipulated.   The message queues will generally have
1606      clear points of initialization and destr    1606      clear points of initialization and destruction.  The cnodes are
1607      much more delicate.  User processes hold    1607      much more delicate.  User processes hold reference counts in Coda
1608      filesystems and it can be difficult to c    1608      filesystems and it can be difficult to clean up the cnodes.
1609                                                  1609 
1610   It can expect requests through:                1610   It can expect requests through:
1611                                                  1611 
1612   1. the message subsystem                       1612   1. the message subsystem
1613                                                  1613 
1614   2. the VFS layer                               1614   2. the VFS layer
1615                                                  1615 
1616   3. pioctl interface                            1616   3. pioctl interface
1617                                                  1617 
1618      Currently the pioctl passes through the     1618      Currently the pioctl passes through the VFS for Coda so we can
1619      treat these similarly.                      1619      treat these similarly.
1620                                                  1620 
1621                                                  1621 
1622 6.1.  Requirements                               1622 6.1.  Requirements
1623 ------------------                               1623 ------------------
1624                                                  1624 
1625                                                  1625 
1626   The following requirements should be accomm    1626   The following requirements should be accommodated:
1627                                                  1627 
1628   1. The message queues should have open and     1628   1. The message queues should have open and close routines.  On Unix
1629      the opening of the character devices are    1629      the opening of the character devices are such routines.
1630                                                  1630 
1631     -  Before opening, no messages can be pla    1631     -  Before opening, no messages can be placed.
1632                                                  1632 
1633     -  Opening will remove any old messages s    1633     -  Opening will remove any old messages still pending.
1634                                                  1634 
1635     -  Close will notify any sleeping process    1635     -  Close will notify any sleeping processes that their upcall cannot
1636        be completed.                             1636        be completed.
1637                                                  1637 
1638     -  Close will free all memory allocated b    1638     -  Close will free all memory allocated by the message queues.
1639                                                  1639 
1640                                                  1640 
1641   2. At open the namecache shall be initializ    1641   2. At open the namecache shall be initialized to empty state.
1642                                                  1642 
1643   3. Before the message queues are open, all     1643   3. Before the message queues are open, all VFS operations will fail.
1644      Fortunately this can be achieved by maki    1644      Fortunately this can be achieved by making sure than mounting the
1645      Coda filesystem cannot succeed before op    1645      Coda filesystem cannot succeed before opening.
1646                                                  1646 
1647   4. After closing of the queues, no VFS oper    1647   4. After closing of the queues, no VFS operations can succeed.  Here
1648      one needs to be careful, since a few ope    1648      one needs to be careful, since a few operations (lookup,
1649      read/write, readdir) can proceed without    1649      read/write, readdir) can proceed without upcalls.  These must be
1650      explicitly blocked.                         1650      explicitly blocked.
1651                                                  1651 
1652   5. Upon closing the namecache shall be flus    1652   5. Upon closing the namecache shall be flushed and disabled.
1653                                                  1653 
1654   6. All memory held by cnodes can be freed w    1654   6. All memory held by cnodes can be freed without relying on upcalls.
1655                                                  1655 
1656   7. Unmounting the file system can be done w    1656   7. Unmounting the file system can be done without relying on upcalls.
1657                                                  1657 
1658   8. Mounting the Coda filesystem should fail    1658   8. Mounting the Coda filesystem should fail gracefully if Venus cannot
1659      get the rootfid or the attributes of the    1659      get the rootfid or the attributes of the rootfid.  The latter is
1660      best implemented by Venus fetching these    1660      best implemented by Venus fetching these objects before attempting
1661      to mount.                                   1661      to mount.
1662                                                  1662 
1663   .. Note::                                      1663   .. Note::
1664                                                  1664 
1665      NetBSD in particular but also Linux have    1665      NetBSD in particular but also Linux have not implemented the
1666      above requirements fully.  For smooth op    1666      above requirements fully.  For smooth operation this needs to be
1667      corrected.                                  1667      corrected.
1668                                                  1668 
1669                                                  1669 
1670                                                  1670 
                                                      

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php