18c2ecf20Sopenharmony_ci.. SPDX-License-Identifier: GPL-2.0
28c2ecf20Sopenharmony_ci
38c2ecf20Sopenharmony_ci===========================
48c2ecf20Sopenharmony_ciCoda Kernel-Venus Interface
58c2ecf20Sopenharmony_ci===========================
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ci.. Note::
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci   This is one of the technical documents describing a component of
108c2ecf20Sopenharmony_ci   Coda -- this document describes the client kernel-Venus interface.
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ciFor more information:
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci  http://www.coda.cs.cmu.edu
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ciFor user level software needed to run Coda:
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci  ftp://ftp.coda.cs.cmu.edu
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ciTo run Coda you need to get a user level cache manager for the client,
218c2ecf20Sopenharmony_cinamed Venus, as well as tools to manipulate ACLs, to log in, etc.  The
228c2ecf20Sopenharmony_ciclient needs to have the Coda filesystem selected in the kernel
238c2ecf20Sopenharmony_ciconfiguration.
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ciThe server needs a user level server and at present does not depend on
268c2ecf20Sopenharmony_cikernel support.
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci  The Venus kernel interface
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_ci  Peter J. Braam
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ci  v1.0, Nov 9, 1997
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ci  This document describes the communication between Venus and kernel
358c2ecf20Sopenharmony_ci  level filesystem code needed for the operation of the Coda file sys-
368c2ecf20Sopenharmony_ci  tem.  This document version is meant to describe the current interface
378c2ecf20Sopenharmony_ci  (version 1.0) as well as improvements we envisage.
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_ci.. Table of Contents
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ci  1. Introduction
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_ci  2. Servicing Coda filesystem calls
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_ci  3. The message layer
468c2ecf20Sopenharmony_ci
478c2ecf20Sopenharmony_ci     3.1 Implementation details
488c2ecf20Sopenharmony_ci
498c2ecf20Sopenharmony_ci  4. The interface at the call level
508c2ecf20Sopenharmony_ci
518c2ecf20Sopenharmony_ci     4.1 Data structures shared by the kernel and Venus
528c2ecf20Sopenharmony_ci     4.2 The pioctl interface
538c2ecf20Sopenharmony_ci     4.3 root
548c2ecf20Sopenharmony_ci     4.4 lookup
558c2ecf20Sopenharmony_ci     4.5 getattr
568c2ecf20Sopenharmony_ci     4.6 setattr
578c2ecf20Sopenharmony_ci     4.7 access
588c2ecf20Sopenharmony_ci     4.8 create
598c2ecf20Sopenharmony_ci     4.9 mkdir
608c2ecf20Sopenharmony_ci     4.10 link
618c2ecf20Sopenharmony_ci     4.11 symlink
628c2ecf20Sopenharmony_ci     4.12 remove
638c2ecf20Sopenharmony_ci     4.13 rmdir
648c2ecf20Sopenharmony_ci     4.14 readlink
658c2ecf20Sopenharmony_ci     4.15 open
668c2ecf20Sopenharmony_ci     4.16 close
678c2ecf20Sopenharmony_ci     4.17 ioctl
688c2ecf20Sopenharmony_ci     4.18 rename
698c2ecf20Sopenharmony_ci     4.19 readdir
708c2ecf20Sopenharmony_ci     4.20 vget
718c2ecf20Sopenharmony_ci     4.21 fsync
728c2ecf20Sopenharmony_ci     4.22 inactive
738c2ecf20Sopenharmony_ci     4.23 rdwr
748c2ecf20Sopenharmony_ci     4.24 odymount
758c2ecf20Sopenharmony_ci     4.25 ody_lookup
768c2ecf20Sopenharmony_ci     4.26 ody_expand
778c2ecf20Sopenharmony_ci     4.27 prefetch
788c2ecf20Sopenharmony_ci     4.28 signal
798c2ecf20Sopenharmony_ci
808c2ecf20Sopenharmony_ci  5. The minicache and downcalls
818c2ecf20Sopenharmony_ci
828c2ecf20Sopenharmony_ci     5.1 INVALIDATE
838c2ecf20Sopenharmony_ci     5.2 FLUSH
848c2ecf20Sopenharmony_ci     5.3 PURGEUSER
858c2ecf20Sopenharmony_ci     5.4 ZAPFILE
868c2ecf20Sopenharmony_ci     5.5 ZAPDIR
878c2ecf20Sopenharmony_ci     5.6 ZAPVNODE
888c2ecf20Sopenharmony_ci     5.7 PURGEFID
898c2ecf20Sopenharmony_ci     5.8 REPLACE
908c2ecf20Sopenharmony_ci
918c2ecf20Sopenharmony_ci  6. Initialization and cleanup
928c2ecf20Sopenharmony_ci
938c2ecf20Sopenharmony_ci     6.1 Requirements
948c2ecf20Sopenharmony_ci
958c2ecf20Sopenharmony_ci1. Introduction
968c2ecf20Sopenharmony_ci===============
978c2ecf20Sopenharmony_ci
988c2ecf20Sopenharmony_ci  A key component in the Coda Distributed File System is the cache
998c2ecf20Sopenharmony_ci  manager, Venus.
1008c2ecf20Sopenharmony_ci
1018c2ecf20Sopenharmony_ci  When processes on a Coda enabled system access files in the Coda
1028c2ecf20Sopenharmony_ci  filesystem, requests are directed at the filesystem layer in the
1038c2ecf20Sopenharmony_ci  operating system. The operating system will communicate with Venus to
1048c2ecf20Sopenharmony_ci  service the request for the process.  Venus manages a persistent
1058c2ecf20Sopenharmony_ci  client cache and makes remote procedure calls to Coda file servers and
1068c2ecf20Sopenharmony_ci  related servers (such as authentication servers) to service these
1078c2ecf20Sopenharmony_ci  requests it receives from the operating system.  When Venus has
1088c2ecf20Sopenharmony_ci  serviced a request it replies to the operating system with appropriate
1098c2ecf20Sopenharmony_ci  return codes, and other data related to the request.  Optionally the
1108c2ecf20Sopenharmony_ci  kernel support for Coda may maintain a minicache of recently processed
1118c2ecf20Sopenharmony_ci  requests to limit the number of interactions with Venus.  Venus
1128c2ecf20Sopenharmony_ci  possesses the facility to inform the kernel when elements from its
1138c2ecf20Sopenharmony_ci  minicache are no longer valid.
1148c2ecf20Sopenharmony_ci
1158c2ecf20Sopenharmony_ci  This document describes precisely this communication between the
1168c2ecf20Sopenharmony_ci  kernel and Venus.  The definitions of so called upcalls and downcalls
1178c2ecf20Sopenharmony_ci  will be given with the format of the data they handle. We shall also
1188c2ecf20Sopenharmony_ci  describe the semantic invariants resulting from the calls.
1198c2ecf20Sopenharmony_ci
1208c2ecf20Sopenharmony_ci  Historically Coda was implemented in a BSD file system in Mach 2.6.
1218c2ecf20Sopenharmony_ci  The interface between the kernel and Venus is very similar to the BSD
1228c2ecf20Sopenharmony_ci  VFS interface.  Similar functionality is provided, and the format of
1238c2ecf20Sopenharmony_ci  the parameters and returned data is very similar to the BSD VFS.  This
1248c2ecf20Sopenharmony_ci  leads to an almost natural environment for implementing a kernel-level
1258c2ecf20Sopenharmony_ci  filesystem driver for Coda in a BSD system.  However, other operating
1268c2ecf20Sopenharmony_ci  systems such as Linux and Windows 95 and NT have virtual filesystem
1278c2ecf20Sopenharmony_ci  with different interfaces.
1288c2ecf20Sopenharmony_ci
1298c2ecf20Sopenharmony_ci  To implement Coda on these systems some reverse engineering of the
1308c2ecf20Sopenharmony_ci  Venus/Kernel protocol is necessary.  Also it came to light that other
1318c2ecf20Sopenharmony_ci  systems could profit significantly from certain small optimizations
1328c2ecf20Sopenharmony_ci  and modifications to the protocol. To facilitate this work as well as
1338c2ecf20Sopenharmony_ci  to make future ports easier, communication between Venus and the
1348c2ecf20Sopenharmony_ci  kernel should be documented in great detail.  This is the aim of this
1358c2ecf20Sopenharmony_ci  document.
1368c2ecf20Sopenharmony_ci
1378c2ecf20Sopenharmony_ci2.  Servicing Coda filesystem calls
1388c2ecf20Sopenharmony_ci===================================
1398c2ecf20Sopenharmony_ci
1408c2ecf20Sopenharmony_ci  The service of a request for a Coda file system service originates in
1418c2ecf20Sopenharmony_ci  a process P which accessing a Coda file. It makes a system call which
1428c2ecf20Sopenharmony_ci  traps to the OS kernel. Examples of such calls trapping to the kernel
1438c2ecf20Sopenharmony_ci  are ``read``, ``write``, ``open``, ``close``, ``create``, ``mkdir``,
1448c2ecf20Sopenharmony_ci  ``rmdir``, ``chmod`` in a Unix ontext.  Similar calls exist in the Win32
1458c2ecf20Sopenharmony_ci  environment, and are named ``CreateFile``.
1468c2ecf20Sopenharmony_ci
1478c2ecf20Sopenharmony_ci  Generally the operating system handles the request in a virtual
1488c2ecf20Sopenharmony_ci  filesystem (VFS) layer, which is named I/O Manager in NT and IFS
1498c2ecf20Sopenharmony_ci  manager in Windows 95.  The VFS is responsible for partial processing
1508c2ecf20Sopenharmony_ci  of the request and for locating the specific filesystem(s) which will
1518c2ecf20Sopenharmony_ci  service parts of the request.  Usually the information in the path
1528c2ecf20Sopenharmony_ci  assists in locating the correct FS drivers.  Sometimes after extensive
1538c2ecf20Sopenharmony_ci  pre-processing, the VFS starts invoking exported routines in the FS
1548c2ecf20Sopenharmony_ci  driver.  This is the point where the FS specific processing of the
1558c2ecf20Sopenharmony_ci  request starts, and here the Coda specific kernel code comes into
1568c2ecf20Sopenharmony_ci  play.
1578c2ecf20Sopenharmony_ci
1588c2ecf20Sopenharmony_ci  The FS layer for Coda must expose and implement several interfaces.
1598c2ecf20Sopenharmony_ci  First and foremost the VFS must be able to make all necessary calls to
1608c2ecf20Sopenharmony_ci  the Coda FS layer, so the Coda FS driver must expose the VFS interface
1618c2ecf20Sopenharmony_ci  as applicable in the operating system. These differ very significantly
1628c2ecf20Sopenharmony_ci  among operating systems, but share features such as facilities to
1638c2ecf20Sopenharmony_ci  read/write and create and remove objects.  The Coda FS layer services
1648c2ecf20Sopenharmony_ci  such VFS requests by invoking one or more well defined services
1658c2ecf20Sopenharmony_ci  offered by the cache manager Venus.  When the replies from Venus have
1668c2ecf20Sopenharmony_ci  come back to the FS driver, servicing of the VFS call continues and
1678c2ecf20Sopenharmony_ci  finishes with a reply to the kernel's VFS. Finally the VFS layer
1688c2ecf20Sopenharmony_ci  returns to the process.
1698c2ecf20Sopenharmony_ci
1708c2ecf20Sopenharmony_ci  As a result of this design a basic interface exposed by the FS driver
1718c2ecf20Sopenharmony_ci  must allow Venus to manage message traffic.  In particular Venus must
1728c2ecf20Sopenharmony_ci  be able to retrieve and place messages and to be notified of the
1738c2ecf20Sopenharmony_ci  arrival of a new message. The notification must be through a mechanism
1748c2ecf20Sopenharmony_ci  which does not block Venus since Venus must attend to other tasks even
1758c2ecf20Sopenharmony_ci  when no messages are waiting or being processed.
1768c2ecf20Sopenharmony_ci
1778c2ecf20Sopenharmony_ci  **Interfaces of the Coda FS Driver**
1788c2ecf20Sopenharmony_ci
1798c2ecf20Sopenharmony_ci  Furthermore the FS layer provides for a special path of communication
1808c2ecf20Sopenharmony_ci  between a user process and Venus, called the pioctl interface. The
1818c2ecf20Sopenharmony_ci  pioctl interface is used for Coda specific services, such as
1828c2ecf20Sopenharmony_ci  requesting detailed information about the persistent cache managed by
1838c2ecf20Sopenharmony_ci  Venus. Here the involvement of the kernel is minimal.  It identifies
1848c2ecf20Sopenharmony_ci  the calling process and passes the information on to Venus.  When
1858c2ecf20Sopenharmony_ci  Venus replies the response is passed back to the caller in unmodified
1868c2ecf20Sopenharmony_ci  form.
1878c2ecf20Sopenharmony_ci
1888c2ecf20Sopenharmony_ci  Finally Venus allows the kernel FS driver to cache the results from
1898c2ecf20Sopenharmony_ci  certain services.  This is done to avoid excessive context switches
1908c2ecf20Sopenharmony_ci  and results in an efficient system.  However, Venus may acquire
1918c2ecf20Sopenharmony_ci  information, for example from the network which implies that cached
1928c2ecf20Sopenharmony_ci  information must be flushed or replaced. Venus then makes a downcall
1938c2ecf20Sopenharmony_ci  to the Coda FS layer to request flushes or updates in the cache.  The
1948c2ecf20Sopenharmony_ci  kernel FS driver handles such requests synchronously.
1958c2ecf20Sopenharmony_ci
1968c2ecf20Sopenharmony_ci  Among these interfaces the VFS interface and the facility to place,
1978c2ecf20Sopenharmony_ci  receive and be notified of messages are platform specific.  We will
1988c2ecf20Sopenharmony_ci  not go into the calls exported to the VFS layer but we will state the
1998c2ecf20Sopenharmony_ci  requirements of the message exchange mechanism.
2008c2ecf20Sopenharmony_ci
2018c2ecf20Sopenharmony_ci
2028c2ecf20Sopenharmony_ci3.  The message layer
2038c2ecf20Sopenharmony_ci=====================
2048c2ecf20Sopenharmony_ci
2058c2ecf20Sopenharmony_ci  At the lowest level the communication between Venus and the FS driver
2068c2ecf20Sopenharmony_ci  proceeds through messages.  The synchronization between processes
2078c2ecf20Sopenharmony_ci  requesting Coda file service and Venus relies on blocking and waking
2088c2ecf20Sopenharmony_ci  up processes.  The Coda FS driver processes VFS- and pioctl-requests
2098c2ecf20Sopenharmony_ci  on behalf of a process P, creates messages for Venus, awaits replies
2108c2ecf20Sopenharmony_ci  and finally returns to the caller.  The implementation of the exchange
2118c2ecf20Sopenharmony_ci  of messages is platform specific, but the semantics have (so far)
2128c2ecf20Sopenharmony_ci  appeared to be generally applicable.  Data buffers are created by the
2138c2ecf20Sopenharmony_ci  FS Driver in kernel memory on behalf of P and copied to user memory in
2148c2ecf20Sopenharmony_ci  Venus.
2158c2ecf20Sopenharmony_ci
2168c2ecf20Sopenharmony_ci  The FS Driver while servicing P makes upcalls to Venus.  Such an
2178c2ecf20Sopenharmony_ci  upcall is dispatched to Venus by creating a message structure.  The
2188c2ecf20Sopenharmony_ci  structure contains the identification of P, the message sequence
2198c2ecf20Sopenharmony_ci  number, the size of the request and a pointer to the data in kernel
2208c2ecf20Sopenharmony_ci  memory for the request.  Since the data buffer is re-used to hold the
2218c2ecf20Sopenharmony_ci  reply from Venus, there is a field for the size of the reply.  A flags
2228c2ecf20Sopenharmony_ci  field is used in the message to precisely record the status of the
2238c2ecf20Sopenharmony_ci  message.  Additional platform dependent structures involve pointers to
2248c2ecf20Sopenharmony_ci  determine the position of the message on queues and pointers to
2258c2ecf20Sopenharmony_ci  synchronization objects.  In the upcall routine the message structure
2268c2ecf20Sopenharmony_ci  is filled in, flags are set to 0, and it is placed on the *pending*
2278c2ecf20Sopenharmony_ci  queue.  The routine calling upcall is responsible for allocating the
2288c2ecf20Sopenharmony_ci  data buffer; its structure will be described in the next section.
2298c2ecf20Sopenharmony_ci
2308c2ecf20Sopenharmony_ci  A facility must exist to notify Venus that the message has been
2318c2ecf20Sopenharmony_ci  created, and implemented using available synchronization objects in
2328c2ecf20Sopenharmony_ci  the OS. This notification is done in the upcall context of the process
2338c2ecf20Sopenharmony_ci  P. When the message is on the pending queue, process P cannot proceed
2348c2ecf20Sopenharmony_ci  in upcall.  The (kernel mode) processing of P in the filesystem
2358c2ecf20Sopenharmony_ci  request routine must be suspended until Venus has replied.  Therefore
2368c2ecf20Sopenharmony_ci  the calling thread in P is blocked in upcall.  A pointer in the
2378c2ecf20Sopenharmony_ci  message structure will locate the synchronization object on which P is
2388c2ecf20Sopenharmony_ci  sleeping.
2398c2ecf20Sopenharmony_ci
2408c2ecf20Sopenharmony_ci  Venus detects the notification that a message has arrived, and the FS
2418c2ecf20Sopenharmony_ci  driver allow Venus to retrieve the message with a getmsg_from_kernel
2428c2ecf20Sopenharmony_ci  call. This action finishes in the kernel by putting the message on the
2438c2ecf20Sopenharmony_ci  queue of processing messages and setting flags to READ.  Venus is
2448c2ecf20Sopenharmony_ci  passed the contents of the data buffer. The getmsg_from_kernel call
2458c2ecf20Sopenharmony_ci  now returns and Venus processes the request.
2468c2ecf20Sopenharmony_ci
2478c2ecf20Sopenharmony_ci  At some later point the FS driver receives a message from Venus,
2488c2ecf20Sopenharmony_ci  namely when Venus calls sendmsg_to_kernel.  At this moment the Coda FS
2498c2ecf20Sopenharmony_ci  driver looks at the contents of the message and decides if:
2508c2ecf20Sopenharmony_ci
2518c2ecf20Sopenharmony_ci
2528c2ecf20Sopenharmony_ci  *  the message is a reply for a suspended thread P.  If so it removes
2538c2ecf20Sopenharmony_ci     the message from the processing queue and marks the message as
2548c2ecf20Sopenharmony_ci     WRITTEN.  Finally, the FS driver unblocks P (still in the kernel
2558c2ecf20Sopenharmony_ci     mode context of Venus) and the sendmsg_to_kernel call returns to
2568c2ecf20Sopenharmony_ci     Venus.  The process P will be scheduled at some point and continues
2578c2ecf20Sopenharmony_ci     processing its upcall with the data buffer replaced with the reply
2588c2ecf20Sopenharmony_ci     from Venus.
2598c2ecf20Sopenharmony_ci
2608c2ecf20Sopenharmony_ci  *  The message is a ``downcall``.  A downcall is a request from Venus to
2618c2ecf20Sopenharmony_ci     the FS Driver. The FS driver processes the request immediately
2628c2ecf20Sopenharmony_ci     (usually a cache eviction or replacement) and when it finishes
2638c2ecf20Sopenharmony_ci     sendmsg_to_kernel returns.
2648c2ecf20Sopenharmony_ci
2658c2ecf20Sopenharmony_ci  Now P awakes and continues processing upcall.  There are some
2668c2ecf20Sopenharmony_ci  subtleties to take account of. First P will determine if it was woken
2678c2ecf20Sopenharmony_ci  up in upcall by a signal from some other source (for example an
2688c2ecf20Sopenharmony_ci  attempt to terminate P) or as is normally the case by Venus in its
2698c2ecf20Sopenharmony_ci  sendmsg_to_kernel call.  In the normal case, the upcall routine will
2708c2ecf20Sopenharmony_ci  deallocate the message structure and return.  The FS routine can proceed
2718c2ecf20Sopenharmony_ci  with its processing.
2728c2ecf20Sopenharmony_ci
2738c2ecf20Sopenharmony_ci
2748c2ecf20Sopenharmony_ci  **Sleeping and IPC arrangements**
2758c2ecf20Sopenharmony_ci
2768c2ecf20Sopenharmony_ci  In case P is woken up by a signal and not by Venus, it will first look
2778c2ecf20Sopenharmony_ci  at the flags field.  If the message is not yet READ, the process P can
2788c2ecf20Sopenharmony_ci  handle its signal without notifying Venus.  If Venus has READ, and
2798c2ecf20Sopenharmony_ci  the request should not be processed, P can send Venus a signal message
2808c2ecf20Sopenharmony_ci  to indicate that it should disregard the previous message.  Such
2818c2ecf20Sopenharmony_ci  signals are put in the queue at the head, and read first by Venus.  If
2828c2ecf20Sopenharmony_ci  the message is already marked as WRITTEN it is too late to stop the
2838c2ecf20Sopenharmony_ci  processing.  The VFS routine will now continue.  (-- If a VFS request
2848c2ecf20Sopenharmony_ci  involves more than one upcall, this can lead to complicated state, an
2858c2ecf20Sopenharmony_ci  extra field "handle_signals" could be added in the message structure
2868c2ecf20Sopenharmony_ci  to indicate points of no return have been passed.--)
2878c2ecf20Sopenharmony_ci
2888c2ecf20Sopenharmony_ci
2898c2ecf20Sopenharmony_ci
2908c2ecf20Sopenharmony_ci3.1.  Implementation details
2918c2ecf20Sopenharmony_ci----------------------------
2928c2ecf20Sopenharmony_ci
2938c2ecf20Sopenharmony_ci  The Unix implementation of this mechanism has been through the
2948c2ecf20Sopenharmony_ci  implementation of a character device associated with Coda.  Venus
2958c2ecf20Sopenharmony_ci  retrieves messages by doing a read on the device, replies are sent
2968c2ecf20Sopenharmony_ci  with a write and notification is through the select system call on the
2978c2ecf20Sopenharmony_ci  file descriptor for the device.  The process P is kept waiting on an
2988c2ecf20Sopenharmony_ci  interruptible wait queue object.
2998c2ecf20Sopenharmony_ci
3008c2ecf20Sopenharmony_ci  In Windows NT and the DPMI Windows 95 implementation a DeviceIoControl
3018c2ecf20Sopenharmony_ci  call is used.  The DeviceIoControl call is designed to copy buffers
3028c2ecf20Sopenharmony_ci  from user memory to kernel memory with OPCODES. The sendmsg_to_kernel
3038c2ecf20Sopenharmony_ci  is issued as a synchronous call, while the getmsg_from_kernel call is
3048c2ecf20Sopenharmony_ci  asynchronous.  Windows EventObjects are used for notification of
3058c2ecf20Sopenharmony_ci  message arrival.  The process P is kept waiting on a KernelEvent
3068c2ecf20Sopenharmony_ci  object in NT and a semaphore in Windows 95.
3078c2ecf20Sopenharmony_ci
3088c2ecf20Sopenharmony_ci
3098c2ecf20Sopenharmony_ci4.  The interface at the call level
3108c2ecf20Sopenharmony_ci===================================
3118c2ecf20Sopenharmony_ci
3128c2ecf20Sopenharmony_ci
3138c2ecf20Sopenharmony_ci  This section describes the upcalls a Coda FS driver can make to Venus.
3148c2ecf20Sopenharmony_ci  Each of these upcalls make use of two structures: inputArgs and
3158c2ecf20Sopenharmony_ci  outputArgs.   In pseudo BNF form the structures take the following
3168c2ecf20Sopenharmony_ci  form::
3178c2ecf20Sopenharmony_ci
3188c2ecf20Sopenharmony_ci
3198c2ecf20Sopenharmony_ci	struct inputArgs {
3208c2ecf20Sopenharmony_ci	    u_long opcode;
3218c2ecf20Sopenharmony_ci	    u_long unique;     /* Keep multiple outstanding msgs distinct */
3228c2ecf20Sopenharmony_ci	    u_short pid;                 /* Common to all */
3238c2ecf20Sopenharmony_ci	    u_short pgid;                /* Common to all */
3248c2ecf20Sopenharmony_ci	    struct CodaCred cred;        /* Common to all */
3258c2ecf20Sopenharmony_ci
3268c2ecf20Sopenharmony_ci	    <union "in" of call dependent parts of inputArgs>
3278c2ecf20Sopenharmony_ci	};
3288c2ecf20Sopenharmony_ci
3298c2ecf20Sopenharmony_ci	struct outputArgs {
3308c2ecf20Sopenharmony_ci	    u_long opcode;
3318c2ecf20Sopenharmony_ci	    u_long unique;       /* Keep multiple outstanding msgs distinct */
3328c2ecf20Sopenharmony_ci	    u_long result;
3338c2ecf20Sopenharmony_ci
3348c2ecf20Sopenharmony_ci	    <union "out" of call dependent parts of inputArgs>
3358c2ecf20Sopenharmony_ci	};
3368c2ecf20Sopenharmony_ci
3378c2ecf20Sopenharmony_ci
3388c2ecf20Sopenharmony_ci
3398c2ecf20Sopenharmony_ci  Before going on let us elucidate the role of the various fields. The
3408c2ecf20Sopenharmony_ci  inputArgs start with the opcode which defines the type of service
3418c2ecf20Sopenharmony_ci  requested from Venus. There are approximately 30 upcalls at present
3428c2ecf20Sopenharmony_ci  which we will discuss.   The unique field labels the inputArg with a
3438c2ecf20Sopenharmony_ci  unique number which will identify the message uniquely.  A process and
3448c2ecf20Sopenharmony_ci  process group id are passed.  Finally the credentials of the caller
3458c2ecf20Sopenharmony_ci  are included.
3468c2ecf20Sopenharmony_ci
3478c2ecf20Sopenharmony_ci  Before delving into the specific calls we need to discuss a variety of
3488c2ecf20Sopenharmony_ci  data structures shared by the kernel and Venus.
3498c2ecf20Sopenharmony_ci
3508c2ecf20Sopenharmony_ci
3518c2ecf20Sopenharmony_ci
3528c2ecf20Sopenharmony_ci
3538c2ecf20Sopenharmony_ci4.1.  Data structures shared by the kernel and Venus
3548c2ecf20Sopenharmony_ci----------------------------------------------------
3558c2ecf20Sopenharmony_ci
3568c2ecf20Sopenharmony_ci
3578c2ecf20Sopenharmony_ci  The CodaCred structure defines a variety of user and group ids as
3588c2ecf20Sopenharmony_ci  they are set for the calling process. The vuid_t and vgid_t are 32 bit
3598c2ecf20Sopenharmony_ci  unsigned integers.  It also defines group membership in an array.  On
3608c2ecf20Sopenharmony_ci  Unix the CodaCred has proven sufficient to implement good security
3618c2ecf20Sopenharmony_ci  semantics for Coda but the structure may have to undergo modification
3628c2ecf20Sopenharmony_ci  for the Windows environment when these mature::
3638c2ecf20Sopenharmony_ci
3648c2ecf20Sopenharmony_ci	struct CodaCred {
3658c2ecf20Sopenharmony_ci	    vuid_t cr_uid, cr_euid, cr_suid, cr_fsuid; /* Real, effective, set, fs uid */
3668c2ecf20Sopenharmony_ci	    vgid_t cr_gid, cr_egid, cr_sgid, cr_fsgid; /* same for groups */
3678c2ecf20Sopenharmony_ci	    vgid_t cr_groups[NGROUPS];        /* Group membership for caller */
3688c2ecf20Sopenharmony_ci	};
3698c2ecf20Sopenharmony_ci
3708c2ecf20Sopenharmony_ci
3718c2ecf20Sopenharmony_ci  .. Note::
3728c2ecf20Sopenharmony_ci
3738c2ecf20Sopenharmony_ci     It is questionable if we need CodaCreds in Venus. Finally Venus
3748c2ecf20Sopenharmony_ci     doesn't know about groups, although it does create files with the
3758c2ecf20Sopenharmony_ci     default uid/gid.  Perhaps the list of group membership is superfluous.
3768c2ecf20Sopenharmony_ci
3778c2ecf20Sopenharmony_ci
3788c2ecf20Sopenharmony_ci  The next item is the fundamental identifier used to identify Coda
3798c2ecf20Sopenharmony_ci  files, the ViceFid.  A fid of a file uniquely defines a file or
3808c2ecf20Sopenharmony_ci  directory in the Coda filesystem within a cell [1]_::
3818c2ecf20Sopenharmony_ci
3828c2ecf20Sopenharmony_ci	typedef struct ViceFid {
3838c2ecf20Sopenharmony_ci	    VolumeId Volume;
3848c2ecf20Sopenharmony_ci	    VnodeId Vnode;
3858c2ecf20Sopenharmony_ci	    Unique_t Unique;
3868c2ecf20Sopenharmony_ci	} ViceFid;
3878c2ecf20Sopenharmony_ci
3888c2ecf20Sopenharmony_ci  .. [1] A cell is agroup of Coda servers acting under the aegis of a single
3898c2ecf20Sopenharmony_ci	 system control machine or SCM. See the Coda Administration manual
3908c2ecf20Sopenharmony_ci	 for a detailed description of the role of the SCM.
3918c2ecf20Sopenharmony_ci
3928c2ecf20Sopenharmony_ci  Each of the constituent fields: VolumeId, VnodeId and Unique_t are
3938c2ecf20Sopenharmony_ci  unsigned 32 bit integers.  We envisage that a further field will need
3948c2ecf20Sopenharmony_ci  to be prefixed to identify the Coda cell; this will probably take the
3958c2ecf20Sopenharmony_ci  form of a Ipv6 size IP address naming the Coda cell through DNS.
3968c2ecf20Sopenharmony_ci
3978c2ecf20Sopenharmony_ci  The next important structure shared between Venus and the kernel is
3988c2ecf20Sopenharmony_ci  the attributes of the file.  The following structure is used to
3998c2ecf20Sopenharmony_ci  exchange information.  It has room for future extensions such as
4008c2ecf20Sopenharmony_ci  support for device files (currently not present in Coda)::
4018c2ecf20Sopenharmony_ci
4028c2ecf20Sopenharmony_ci
4038c2ecf20Sopenharmony_ci	struct coda_timespec {
4048c2ecf20Sopenharmony_ci		int64_t         tv_sec;         /* seconds */
4058c2ecf20Sopenharmony_ci		long            tv_nsec;        /* nanoseconds */
4068c2ecf20Sopenharmony_ci	};
4078c2ecf20Sopenharmony_ci
4088c2ecf20Sopenharmony_ci	struct coda_vattr {
4098c2ecf20Sopenharmony_ci		enum coda_vtype va_type;        /* vnode type (for create) */
4108c2ecf20Sopenharmony_ci		u_short         va_mode;        /* files access mode and type */
4118c2ecf20Sopenharmony_ci		short           va_nlink;       /* number of references to file */
4128c2ecf20Sopenharmony_ci		vuid_t          va_uid;         /* owner user id */
4138c2ecf20Sopenharmony_ci		vgid_t          va_gid;         /* owner group id */
4148c2ecf20Sopenharmony_ci		long            va_fsid;        /* file system id (dev for now) */
4158c2ecf20Sopenharmony_ci		long            va_fileid;      /* file id */
4168c2ecf20Sopenharmony_ci		u_quad_t        va_size;        /* file size in bytes */
4178c2ecf20Sopenharmony_ci		long            va_blocksize;   /* blocksize preferred for i/o */
4188c2ecf20Sopenharmony_ci		struct coda_timespec va_atime;  /* time of last access */
4198c2ecf20Sopenharmony_ci		struct coda_timespec va_mtime;  /* time of last modification */
4208c2ecf20Sopenharmony_ci		struct coda_timespec va_ctime;  /* time file changed */
4218c2ecf20Sopenharmony_ci		u_long          va_gen;         /* generation number of file */
4228c2ecf20Sopenharmony_ci		u_long          va_flags;       /* flags defined for file */
4238c2ecf20Sopenharmony_ci		dev_t           va_rdev;        /* device special file represents */
4248c2ecf20Sopenharmony_ci		u_quad_t        va_bytes;       /* bytes of disk space held by file */
4258c2ecf20Sopenharmony_ci		u_quad_t        va_filerev;     /* file modification number */
4268c2ecf20Sopenharmony_ci		u_int           va_vaflags;     /* operations flags, see below */
4278c2ecf20Sopenharmony_ci		long            va_spare;       /* remain quad aligned */
4288c2ecf20Sopenharmony_ci	};
4298c2ecf20Sopenharmony_ci
4308c2ecf20Sopenharmony_ci
4318c2ecf20Sopenharmony_ci4.2.  The pioctl interface
4328c2ecf20Sopenharmony_ci--------------------------
4338c2ecf20Sopenharmony_ci
4348c2ecf20Sopenharmony_ci
4358c2ecf20Sopenharmony_ci  Coda specific requests can be made by application through the pioctl
4368c2ecf20Sopenharmony_ci  interface. The pioctl is implemented as an ordinary ioctl on a
4378c2ecf20Sopenharmony_ci  fictitious file /coda/.CONTROL.  The pioctl call opens this file, gets
4388c2ecf20Sopenharmony_ci  a file handle and makes the ioctl call. Finally it closes the file.
4398c2ecf20Sopenharmony_ci
4408c2ecf20Sopenharmony_ci  The kernel involvement in this is limited to providing the facility to
4418c2ecf20Sopenharmony_ci  open and close and pass the ioctl message and to verify that a path in
4428c2ecf20Sopenharmony_ci  the pioctl data buffers is a file in a Coda filesystem.
4438c2ecf20Sopenharmony_ci
4448c2ecf20Sopenharmony_ci  The kernel is handed a data packet of the form::
4458c2ecf20Sopenharmony_ci
4468c2ecf20Sopenharmony_ci	struct {
4478c2ecf20Sopenharmony_ci	    const char *path;
4488c2ecf20Sopenharmony_ci	    struct ViceIoctl vidata;
4498c2ecf20Sopenharmony_ci	    int follow;
4508c2ecf20Sopenharmony_ci	} data;
4518c2ecf20Sopenharmony_ci
4528c2ecf20Sopenharmony_ci
4538c2ecf20Sopenharmony_ci
4548c2ecf20Sopenharmony_ci  where::
4558c2ecf20Sopenharmony_ci
4568c2ecf20Sopenharmony_ci
4578c2ecf20Sopenharmony_ci	struct ViceIoctl {
4588c2ecf20Sopenharmony_ci		caddr_t in, out;        /* Data to be transferred in, or out */
4598c2ecf20Sopenharmony_ci		short in_size;          /* Size of input buffer <= 2K */
4608c2ecf20Sopenharmony_ci		short out_size;         /* Maximum size of output buffer, <= 2K */
4618c2ecf20Sopenharmony_ci	};
4628c2ecf20Sopenharmony_ci
4638c2ecf20Sopenharmony_ci
4648c2ecf20Sopenharmony_ci
4658c2ecf20Sopenharmony_ci  The path must be a Coda file, otherwise the ioctl upcall will not be
4668c2ecf20Sopenharmony_ci  made.
4678c2ecf20Sopenharmony_ci
4688c2ecf20Sopenharmony_ci  .. Note:: The data structures and code are a mess.  We need to clean this up.
4698c2ecf20Sopenharmony_ci
4708c2ecf20Sopenharmony_ci
4718c2ecf20Sopenharmony_ci**We now proceed to document the individual calls**:
4728c2ecf20Sopenharmony_ci
4738c2ecf20Sopenharmony_ci
4748c2ecf20Sopenharmony_ci4.3.  root
4758c2ecf20Sopenharmony_ci----------
4768c2ecf20Sopenharmony_ci
4778c2ecf20Sopenharmony_ci
4788c2ecf20Sopenharmony_ci  Arguments
4798c2ecf20Sopenharmony_ci     in
4808c2ecf20Sopenharmony_ci
4818c2ecf20Sopenharmony_ci	empty
4828c2ecf20Sopenharmony_ci
4838c2ecf20Sopenharmony_ci     out::
4848c2ecf20Sopenharmony_ci
4858c2ecf20Sopenharmony_ci		struct cfs_root_out {
4868c2ecf20Sopenharmony_ci		    ViceFid VFid;
4878c2ecf20Sopenharmony_ci		} cfs_root;
4888c2ecf20Sopenharmony_ci
4898c2ecf20Sopenharmony_ci
4908c2ecf20Sopenharmony_ci
4918c2ecf20Sopenharmony_ci  Description
4928c2ecf20Sopenharmony_ci    This call is made to Venus during the initialization of
4938c2ecf20Sopenharmony_ci    the Coda filesystem. If the result is zero, the cfs_root structure
4948c2ecf20Sopenharmony_ci    contains the ViceFid of the root of the Coda filesystem. If a non-zero
4958c2ecf20Sopenharmony_ci    result is generated, its value is a platform dependent error code
4968c2ecf20Sopenharmony_ci    indicating the difficulty Venus encountered in locating the root of
4978c2ecf20Sopenharmony_ci    the Coda filesystem.
4988c2ecf20Sopenharmony_ci
4998c2ecf20Sopenharmony_ci4.4.  lookup
5008c2ecf20Sopenharmony_ci------------
5018c2ecf20Sopenharmony_ci
5028c2ecf20Sopenharmony_ci
5038c2ecf20Sopenharmony_ci  Summary
5048c2ecf20Sopenharmony_ci    Find the ViceFid and type of an object in a directory if it exists.
5058c2ecf20Sopenharmony_ci
5068c2ecf20Sopenharmony_ci  Arguments
5078c2ecf20Sopenharmony_ci     in::
5088c2ecf20Sopenharmony_ci
5098c2ecf20Sopenharmony_ci		struct  cfs_lookup_in {
5108c2ecf20Sopenharmony_ci		    ViceFid     VFid;
5118c2ecf20Sopenharmony_ci		    char        *name;          /* Place holder for data. */
5128c2ecf20Sopenharmony_ci		} cfs_lookup;
5138c2ecf20Sopenharmony_ci
5148c2ecf20Sopenharmony_ci
5158c2ecf20Sopenharmony_ci
5168c2ecf20Sopenharmony_ci     out::
5178c2ecf20Sopenharmony_ci
5188c2ecf20Sopenharmony_ci		struct cfs_lookup_out {
5198c2ecf20Sopenharmony_ci		    ViceFid VFid;
5208c2ecf20Sopenharmony_ci		    int vtype;
5218c2ecf20Sopenharmony_ci		} cfs_lookup;
5228c2ecf20Sopenharmony_ci
5238c2ecf20Sopenharmony_ci
5248c2ecf20Sopenharmony_ci
5258c2ecf20Sopenharmony_ci  Description
5268c2ecf20Sopenharmony_ci    This call is made to determine the ViceFid and filetype of
5278c2ecf20Sopenharmony_ci    a directory entry.  The directory entry requested carries name 'name'
5288c2ecf20Sopenharmony_ci    and Venus will search the directory identified by cfs_lookup_in.VFid.
5298c2ecf20Sopenharmony_ci    The result may indicate that the name does not exist, or that
5308c2ecf20Sopenharmony_ci    difficulty was encountered in finding it (e.g. due to disconnection).
5318c2ecf20Sopenharmony_ci    If the result is zero, the field cfs_lookup_out.VFid contains the
5328c2ecf20Sopenharmony_ci    targets ViceFid and cfs_lookup_out.vtype the coda_vtype giving the
5338c2ecf20Sopenharmony_ci    type of object the name designates.
5348c2ecf20Sopenharmony_ci
5358c2ecf20Sopenharmony_ci  The name of the object is an 8 bit character string of maximum length
5368c2ecf20Sopenharmony_ci  CFS_MAXNAMLEN, currently set to 256 (including a 0 terminator.)
5378c2ecf20Sopenharmony_ci
5388c2ecf20Sopenharmony_ci  It is extremely important to realize that Venus bitwise ors the field
5398c2ecf20Sopenharmony_ci  cfs_lookup.vtype with CFS_NOCACHE to indicate that the object should
5408c2ecf20Sopenharmony_ci  not be put in the kernel name cache.
5418c2ecf20Sopenharmony_ci
5428c2ecf20Sopenharmony_ci  .. Note::
5438c2ecf20Sopenharmony_ci
5448c2ecf20Sopenharmony_ci     The type of the vtype is currently wrong.  It should be
5458c2ecf20Sopenharmony_ci     coda_vtype. Linux does not take note of CFS_NOCACHE.  It should.
5468c2ecf20Sopenharmony_ci
5478c2ecf20Sopenharmony_ci
5488c2ecf20Sopenharmony_ci4.5.  getattr
5498c2ecf20Sopenharmony_ci-------------
5508c2ecf20Sopenharmony_ci
5518c2ecf20Sopenharmony_ci
5528c2ecf20Sopenharmony_ci  Summary Get the attributes of a file.
5538c2ecf20Sopenharmony_ci
5548c2ecf20Sopenharmony_ci  Arguments
5558c2ecf20Sopenharmony_ci     in::
5568c2ecf20Sopenharmony_ci
5578c2ecf20Sopenharmony_ci		struct cfs_getattr_in {
5588c2ecf20Sopenharmony_ci		    ViceFid VFid;
5598c2ecf20Sopenharmony_ci		    struct coda_vattr attr; /* XXXXX */
5608c2ecf20Sopenharmony_ci		} cfs_getattr;
5618c2ecf20Sopenharmony_ci
5628c2ecf20Sopenharmony_ci
5638c2ecf20Sopenharmony_ci
5648c2ecf20Sopenharmony_ci     out::
5658c2ecf20Sopenharmony_ci
5668c2ecf20Sopenharmony_ci		struct cfs_getattr_out {
5678c2ecf20Sopenharmony_ci		    struct coda_vattr attr;
5688c2ecf20Sopenharmony_ci		} cfs_getattr;
5698c2ecf20Sopenharmony_ci
5708c2ecf20Sopenharmony_ci
5718c2ecf20Sopenharmony_ci
5728c2ecf20Sopenharmony_ci  Description
5738c2ecf20Sopenharmony_ci    This call returns the attributes of the file identified by fid.
5748c2ecf20Sopenharmony_ci
5758c2ecf20Sopenharmony_ci  Errors
5768c2ecf20Sopenharmony_ci    Errors can occur if the object with fid does not exist, is
5778c2ecf20Sopenharmony_ci    unaccessible or if the caller does not have permission to fetch
5788c2ecf20Sopenharmony_ci    attributes.
5798c2ecf20Sopenharmony_ci
5808c2ecf20Sopenharmony_ci  .. Note::
5818c2ecf20Sopenharmony_ci
5828c2ecf20Sopenharmony_ci     Many kernel FS drivers (Linux, NT and Windows 95) need to acquire
5838c2ecf20Sopenharmony_ci     the attributes as well as the Fid for the instantiation of an internal
5848c2ecf20Sopenharmony_ci     "inode" or "FileHandle".  A significant improvement in performance on
5858c2ecf20Sopenharmony_ci     such systems could be made by combining the lookup and getattr calls
5868c2ecf20Sopenharmony_ci     both at the Venus/kernel interaction level and at the RPC level.
5878c2ecf20Sopenharmony_ci
5888c2ecf20Sopenharmony_ci  The vattr structure included in the input arguments is superfluous and
5898c2ecf20Sopenharmony_ci  should be removed.
5908c2ecf20Sopenharmony_ci
5918c2ecf20Sopenharmony_ci
5928c2ecf20Sopenharmony_ci4.6.  setattr
5938c2ecf20Sopenharmony_ci-------------
5948c2ecf20Sopenharmony_ci
5958c2ecf20Sopenharmony_ci
5968c2ecf20Sopenharmony_ci  Summary
5978c2ecf20Sopenharmony_ci    Set the attributes of a file.
5988c2ecf20Sopenharmony_ci
5998c2ecf20Sopenharmony_ci  Arguments
6008c2ecf20Sopenharmony_ci     in::
6018c2ecf20Sopenharmony_ci
6028c2ecf20Sopenharmony_ci		struct cfs_setattr_in {
6038c2ecf20Sopenharmony_ci		    ViceFid VFid;
6048c2ecf20Sopenharmony_ci		    struct coda_vattr attr;
6058c2ecf20Sopenharmony_ci		} cfs_setattr;
6068c2ecf20Sopenharmony_ci
6078c2ecf20Sopenharmony_ci
6088c2ecf20Sopenharmony_ci
6098c2ecf20Sopenharmony_ci
6108c2ecf20Sopenharmony_ci     out
6118c2ecf20Sopenharmony_ci
6128c2ecf20Sopenharmony_ci	empty
6138c2ecf20Sopenharmony_ci
6148c2ecf20Sopenharmony_ci  Description
6158c2ecf20Sopenharmony_ci    The structure attr is filled with attributes to be changed
6168c2ecf20Sopenharmony_ci    in BSD style.  Attributes not to be changed are set to -1, apart from
6178c2ecf20Sopenharmony_ci    vtype which is set to VNON. Other are set to the value to be assigned.
6188c2ecf20Sopenharmony_ci    The only attributes which the FS driver may request to change are the
6198c2ecf20Sopenharmony_ci    mode, owner, groupid, atime, mtime and ctime.  The return value
6208c2ecf20Sopenharmony_ci    indicates success or failure.
6218c2ecf20Sopenharmony_ci
6228c2ecf20Sopenharmony_ci  Errors
6238c2ecf20Sopenharmony_ci    A variety of errors can occur.  The object may not exist, may
6248c2ecf20Sopenharmony_ci    be inaccessible, or permission may not be granted by Venus.
6258c2ecf20Sopenharmony_ci
6268c2ecf20Sopenharmony_ci
6278c2ecf20Sopenharmony_ci4.7.  access
6288c2ecf20Sopenharmony_ci------------
6298c2ecf20Sopenharmony_ci
6308c2ecf20Sopenharmony_ci
6318c2ecf20Sopenharmony_ci  Arguments
6328c2ecf20Sopenharmony_ci     in::
6338c2ecf20Sopenharmony_ci
6348c2ecf20Sopenharmony_ci		struct cfs_access_in {
6358c2ecf20Sopenharmony_ci		    ViceFid     VFid;
6368c2ecf20Sopenharmony_ci		    int flags;
6378c2ecf20Sopenharmony_ci		} cfs_access;
6388c2ecf20Sopenharmony_ci
6398c2ecf20Sopenharmony_ci
6408c2ecf20Sopenharmony_ci
6418c2ecf20Sopenharmony_ci     out
6428c2ecf20Sopenharmony_ci
6438c2ecf20Sopenharmony_ci	empty
6448c2ecf20Sopenharmony_ci
6458c2ecf20Sopenharmony_ci  Description
6468c2ecf20Sopenharmony_ci    Verify if access to the object identified by VFid for
6478c2ecf20Sopenharmony_ci    operations described by flags is permitted.  The result indicates if
6488c2ecf20Sopenharmony_ci    access will be granted.  It is important to remember that Coda uses
6498c2ecf20Sopenharmony_ci    ACLs to enforce protection and that ultimately the servers, not the
6508c2ecf20Sopenharmony_ci    clients enforce the security of the system.  The result of this call
6518c2ecf20Sopenharmony_ci    will depend on whether a token is held by the user.
6528c2ecf20Sopenharmony_ci
6538c2ecf20Sopenharmony_ci  Errors
6548c2ecf20Sopenharmony_ci    The object may not exist, or the ACL describing the protection
6558c2ecf20Sopenharmony_ci    may not be accessible.
6568c2ecf20Sopenharmony_ci
6578c2ecf20Sopenharmony_ci
6588c2ecf20Sopenharmony_ci4.8.  create
6598c2ecf20Sopenharmony_ci------------
6608c2ecf20Sopenharmony_ci
6618c2ecf20Sopenharmony_ci
6628c2ecf20Sopenharmony_ci  Summary
6638c2ecf20Sopenharmony_ci    Invoked to create a file
6648c2ecf20Sopenharmony_ci
6658c2ecf20Sopenharmony_ci  Arguments
6668c2ecf20Sopenharmony_ci     in::
6678c2ecf20Sopenharmony_ci
6688c2ecf20Sopenharmony_ci		struct cfs_create_in {
6698c2ecf20Sopenharmony_ci		    ViceFid VFid;
6708c2ecf20Sopenharmony_ci		    struct coda_vattr attr;
6718c2ecf20Sopenharmony_ci		    int excl;
6728c2ecf20Sopenharmony_ci		    int mode;
6738c2ecf20Sopenharmony_ci		    char        *name;          /* Place holder for data. */
6748c2ecf20Sopenharmony_ci		} cfs_create;
6758c2ecf20Sopenharmony_ci
6768c2ecf20Sopenharmony_ci
6778c2ecf20Sopenharmony_ci
6788c2ecf20Sopenharmony_ci
6798c2ecf20Sopenharmony_ci     out::
6808c2ecf20Sopenharmony_ci
6818c2ecf20Sopenharmony_ci		struct cfs_create_out {
6828c2ecf20Sopenharmony_ci		    ViceFid VFid;
6838c2ecf20Sopenharmony_ci		    struct coda_vattr attr;
6848c2ecf20Sopenharmony_ci		} cfs_create;
6858c2ecf20Sopenharmony_ci
6868c2ecf20Sopenharmony_ci
6878c2ecf20Sopenharmony_ci
6888c2ecf20Sopenharmony_ci  Description
6898c2ecf20Sopenharmony_ci    This upcall is invoked to request creation of a file.
6908c2ecf20Sopenharmony_ci    The file will be created in the directory identified by VFid, its name
6918c2ecf20Sopenharmony_ci    will be name, and the mode will be mode.  If excl is set an error will
6928c2ecf20Sopenharmony_ci    be returned if the file already exists.  If the size field in attr is
6938c2ecf20Sopenharmony_ci    set to zero the file will be truncated.  The uid and gid of the file
6948c2ecf20Sopenharmony_ci    are set by converting the CodaCred to a uid using a macro CRTOUID
6958c2ecf20Sopenharmony_ci    (this macro is platform dependent).  Upon success the VFid and
6968c2ecf20Sopenharmony_ci    attributes of the file are returned.  The Coda FS Driver will normally
6978c2ecf20Sopenharmony_ci    instantiate a vnode, inode or file handle at kernel level for the new
6988c2ecf20Sopenharmony_ci    object.
6998c2ecf20Sopenharmony_ci
7008c2ecf20Sopenharmony_ci
7018c2ecf20Sopenharmony_ci  Errors
7028c2ecf20Sopenharmony_ci    A variety of errors can occur. Permissions may be insufficient.
7038c2ecf20Sopenharmony_ci    If the object exists and is not a file the error EISDIR is returned
7048c2ecf20Sopenharmony_ci    under Unix.
7058c2ecf20Sopenharmony_ci
7068c2ecf20Sopenharmony_ci  .. Note::
7078c2ecf20Sopenharmony_ci
7088c2ecf20Sopenharmony_ci     The packing of parameters is very inefficient and appears to
7098c2ecf20Sopenharmony_ci     indicate confusion between the system call creat and the VFS operation
7108c2ecf20Sopenharmony_ci     create. The VFS operation create is only called to create new objects.
7118c2ecf20Sopenharmony_ci     This create call differs from the Unix one in that it is not invoked
7128c2ecf20Sopenharmony_ci     to return a file descriptor. The truncate and exclusive options,
7138c2ecf20Sopenharmony_ci     together with the mode, could simply be part of the mode as it is
7148c2ecf20Sopenharmony_ci     under Unix.  There should be no flags argument; this is used in open
7158c2ecf20Sopenharmony_ci     (2) to return a file descriptor for READ or WRITE mode.
7168c2ecf20Sopenharmony_ci
7178c2ecf20Sopenharmony_ci  The attributes of the directory should be returned too, since the size
7188c2ecf20Sopenharmony_ci  and mtime changed.
7198c2ecf20Sopenharmony_ci
7208c2ecf20Sopenharmony_ci
7218c2ecf20Sopenharmony_ci4.9.  mkdir
7228c2ecf20Sopenharmony_ci-----------
7238c2ecf20Sopenharmony_ci
7248c2ecf20Sopenharmony_ci
7258c2ecf20Sopenharmony_ci  Summary
7268c2ecf20Sopenharmony_ci    Create a new directory.
7278c2ecf20Sopenharmony_ci
7288c2ecf20Sopenharmony_ci  Arguments
7298c2ecf20Sopenharmony_ci     in::
7308c2ecf20Sopenharmony_ci
7318c2ecf20Sopenharmony_ci		struct cfs_mkdir_in {
7328c2ecf20Sopenharmony_ci		    ViceFid     VFid;
7338c2ecf20Sopenharmony_ci		    struct coda_vattr attr;
7348c2ecf20Sopenharmony_ci		    char        *name;          /* Place holder for data. */
7358c2ecf20Sopenharmony_ci		} cfs_mkdir;
7368c2ecf20Sopenharmony_ci
7378c2ecf20Sopenharmony_ci
7388c2ecf20Sopenharmony_ci
7398c2ecf20Sopenharmony_ci     out::
7408c2ecf20Sopenharmony_ci
7418c2ecf20Sopenharmony_ci		struct cfs_mkdir_out {
7428c2ecf20Sopenharmony_ci		    ViceFid VFid;
7438c2ecf20Sopenharmony_ci		    struct coda_vattr attr;
7448c2ecf20Sopenharmony_ci		} cfs_mkdir;
7458c2ecf20Sopenharmony_ci
7468c2ecf20Sopenharmony_ci
7478c2ecf20Sopenharmony_ci
7488c2ecf20Sopenharmony_ci
7498c2ecf20Sopenharmony_ci  Description
7508c2ecf20Sopenharmony_ci    This call is similar to create but creates a directory.
7518c2ecf20Sopenharmony_ci    Only the mode field in the input parameters is used for creation.
7528c2ecf20Sopenharmony_ci    Upon successful creation, the attr returned contains the attributes of
7538c2ecf20Sopenharmony_ci    the new directory.
7548c2ecf20Sopenharmony_ci
7558c2ecf20Sopenharmony_ci  Errors
7568c2ecf20Sopenharmony_ci    As for create.
7578c2ecf20Sopenharmony_ci
7588c2ecf20Sopenharmony_ci  .. Note::
7598c2ecf20Sopenharmony_ci
7608c2ecf20Sopenharmony_ci     The input parameter should be changed to mode instead of
7618c2ecf20Sopenharmony_ci     attributes.
7628c2ecf20Sopenharmony_ci
7638c2ecf20Sopenharmony_ci  The attributes of the parent should be returned since the size and
7648c2ecf20Sopenharmony_ci  mtime changes.
7658c2ecf20Sopenharmony_ci
7668c2ecf20Sopenharmony_ci
7678c2ecf20Sopenharmony_ci4.10.  link
7688c2ecf20Sopenharmony_ci-----------
7698c2ecf20Sopenharmony_ci
7708c2ecf20Sopenharmony_ci
7718c2ecf20Sopenharmony_ci  Summary
7728c2ecf20Sopenharmony_ci    Create a link to an existing file.
7738c2ecf20Sopenharmony_ci
7748c2ecf20Sopenharmony_ci  Arguments
7758c2ecf20Sopenharmony_ci     in::
7768c2ecf20Sopenharmony_ci
7778c2ecf20Sopenharmony_ci		struct cfs_link_in {
7788c2ecf20Sopenharmony_ci		    ViceFid sourceFid;          /* cnode to link *to* */
7798c2ecf20Sopenharmony_ci		    ViceFid destFid;            /* Directory in which to place link */
7808c2ecf20Sopenharmony_ci		    char        *tname;         /* Place holder for data. */
7818c2ecf20Sopenharmony_ci		} cfs_link;
7828c2ecf20Sopenharmony_ci
7838c2ecf20Sopenharmony_ci
7848c2ecf20Sopenharmony_ci
7858c2ecf20Sopenharmony_ci     out
7868c2ecf20Sopenharmony_ci
7878c2ecf20Sopenharmony_ci	empty
7888c2ecf20Sopenharmony_ci
7898c2ecf20Sopenharmony_ci  Description
7908c2ecf20Sopenharmony_ci    This call creates a link to the sourceFid in the directory
7918c2ecf20Sopenharmony_ci    identified by destFid with name tname.  The source must reside in the
7928c2ecf20Sopenharmony_ci    target's parent, i.e. the source must be have parent destFid, i.e. Coda
7938c2ecf20Sopenharmony_ci    does not support cross directory hard links.  Only the return value is
7948c2ecf20Sopenharmony_ci    relevant.  It indicates success or the type of failure.
7958c2ecf20Sopenharmony_ci
7968c2ecf20Sopenharmony_ci  Errors
7978c2ecf20Sopenharmony_ci    The usual errors can occur.
7988c2ecf20Sopenharmony_ci
7998c2ecf20Sopenharmony_ci
8008c2ecf20Sopenharmony_ci4.11.  symlink
8018c2ecf20Sopenharmony_ci--------------
8028c2ecf20Sopenharmony_ci
8038c2ecf20Sopenharmony_ci
8048c2ecf20Sopenharmony_ci  Summary
8058c2ecf20Sopenharmony_ci    create a symbolic link
8068c2ecf20Sopenharmony_ci
8078c2ecf20Sopenharmony_ci  Arguments
8088c2ecf20Sopenharmony_ci     in::
8098c2ecf20Sopenharmony_ci
8108c2ecf20Sopenharmony_ci		struct cfs_symlink_in {
8118c2ecf20Sopenharmony_ci		    ViceFid     VFid;          /* Directory to put symlink in */
8128c2ecf20Sopenharmony_ci		    char        *srcname;
8138c2ecf20Sopenharmony_ci		    struct coda_vattr attr;
8148c2ecf20Sopenharmony_ci		    char        *tname;
8158c2ecf20Sopenharmony_ci		} cfs_symlink;
8168c2ecf20Sopenharmony_ci
8178c2ecf20Sopenharmony_ci
8188c2ecf20Sopenharmony_ci
8198c2ecf20Sopenharmony_ci     out
8208c2ecf20Sopenharmony_ci
8218c2ecf20Sopenharmony_ci	none
8228c2ecf20Sopenharmony_ci
8238c2ecf20Sopenharmony_ci  Description
8248c2ecf20Sopenharmony_ci    Create a symbolic link. The link is to be placed in the
8258c2ecf20Sopenharmony_ci    directory identified by VFid and named tname.  It should point to the
8268c2ecf20Sopenharmony_ci    pathname srcname.  The attributes of the newly created object are to
8278c2ecf20Sopenharmony_ci    be set to attr.
8288c2ecf20Sopenharmony_ci
8298c2ecf20Sopenharmony_ci  .. Note::
8308c2ecf20Sopenharmony_ci
8318c2ecf20Sopenharmony_ci     The attributes of the target directory should be returned since
8328c2ecf20Sopenharmony_ci     its size changed.
8338c2ecf20Sopenharmony_ci
8348c2ecf20Sopenharmony_ci
8358c2ecf20Sopenharmony_ci4.12.  remove
8368c2ecf20Sopenharmony_ci-------------
8378c2ecf20Sopenharmony_ci
8388c2ecf20Sopenharmony_ci
8398c2ecf20Sopenharmony_ci  Summary
8408c2ecf20Sopenharmony_ci    Remove a file
8418c2ecf20Sopenharmony_ci
8428c2ecf20Sopenharmony_ci  Arguments
8438c2ecf20Sopenharmony_ci     in::
8448c2ecf20Sopenharmony_ci
8458c2ecf20Sopenharmony_ci		struct cfs_remove_in {
8468c2ecf20Sopenharmony_ci		    ViceFid     VFid;
8478c2ecf20Sopenharmony_ci		    char        *name;          /* Place holder for data. */
8488c2ecf20Sopenharmony_ci		} cfs_remove;
8498c2ecf20Sopenharmony_ci
8508c2ecf20Sopenharmony_ci
8518c2ecf20Sopenharmony_ci
8528c2ecf20Sopenharmony_ci     out
8538c2ecf20Sopenharmony_ci
8548c2ecf20Sopenharmony_ci	none
8558c2ecf20Sopenharmony_ci
8568c2ecf20Sopenharmony_ci  Description
8578c2ecf20Sopenharmony_ci    Remove file named cfs_remove_in.name in directory
8588c2ecf20Sopenharmony_ci    identified by   VFid.
8598c2ecf20Sopenharmony_ci
8608c2ecf20Sopenharmony_ci
8618c2ecf20Sopenharmony_ci  .. Note::
8628c2ecf20Sopenharmony_ci
8638c2ecf20Sopenharmony_ci     The attributes of the directory should be returned since its
8648c2ecf20Sopenharmony_ci     mtime and size may change.
8658c2ecf20Sopenharmony_ci
8668c2ecf20Sopenharmony_ci
8678c2ecf20Sopenharmony_ci4.13.  rmdir
8688c2ecf20Sopenharmony_ci------------
8698c2ecf20Sopenharmony_ci
8708c2ecf20Sopenharmony_ci
8718c2ecf20Sopenharmony_ci  Summary
8728c2ecf20Sopenharmony_ci    Remove a directory
8738c2ecf20Sopenharmony_ci
8748c2ecf20Sopenharmony_ci  Arguments
8758c2ecf20Sopenharmony_ci     in::
8768c2ecf20Sopenharmony_ci
8778c2ecf20Sopenharmony_ci		struct cfs_rmdir_in {
8788c2ecf20Sopenharmony_ci		    ViceFid     VFid;
8798c2ecf20Sopenharmony_ci		    char        *name;          /* Place holder for data. */
8808c2ecf20Sopenharmony_ci		} cfs_rmdir;
8818c2ecf20Sopenharmony_ci
8828c2ecf20Sopenharmony_ci
8838c2ecf20Sopenharmony_ci
8848c2ecf20Sopenharmony_ci     out
8858c2ecf20Sopenharmony_ci
8868c2ecf20Sopenharmony_ci	none
8878c2ecf20Sopenharmony_ci
8888c2ecf20Sopenharmony_ci  Description
8898c2ecf20Sopenharmony_ci    Remove the directory with name 'name' from the directory
8908c2ecf20Sopenharmony_ci    identified by VFid.
8918c2ecf20Sopenharmony_ci
8928c2ecf20Sopenharmony_ci  .. Note:: The attributes of the parent directory should be returned since
8938c2ecf20Sopenharmony_ci	    its mtime and size may change.
8948c2ecf20Sopenharmony_ci
8958c2ecf20Sopenharmony_ci
8968c2ecf20Sopenharmony_ci4.14.  readlink
8978c2ecf20Sopenharmony_ci---------------
8988c2ecf20Sopenharmony_ci
8998c2ecf20Sopenharmony_ci
9008c2ecf20Sopenharmony_ci  Summary
9018c2ecf20Sopenharmony_ci    Read the value of a symbolic link.
9028c2ecf20Sopenharmony_ci
9038c2ecf20Sopenharmony_ci  Arguments
9048c2ecf20Sopenharmony_ci     in::
9058c2ecf20Sopenharmony_ci
9068c2ecf20Sopenharmony_ci		struct cfs_readlink_in {
9078c2ecf20Sopenharmony_ci		    ViceFid VFid;
9088c2ecf20Sopenharmony_ci		} cfs_readlink;
9098c2ecf20Sopenharmony_ci
9108c2ecf20Sopenharmony_ci
9118c2ecf20Sopenharmony_ci
9128c2ecf20Sopenharmony_ci     out::
9138c2ecf20Sopenharmony_ci
9148c2ecf20Sopenharmony_ci		struct cfs_readlink_out {
9158c2ecf20Sopenharmony_ci		    int count;
9168c2ecf20Sopenharmony_ci		    caddr_t     data;           /* Place holder for data. */
9178c2ecf20Sopenharmony_ci		} cfs_readlink;
9188c2ecf20Sopenharmony_ci
9198c2ecf20Sopenharmony_ci
9208c2ecf20Sopenharmony_ci
9218c2ecf20Sopenharmony_ci  Description
9228c2ecf20Sopenharmony_ci    This routine reads the contents of symbolic link
9238c2ecf20Sopenharmony_ci    identified by VFid into the buffer data.  The buffer data must be able
9248c2ecf20Sopenharmony_ci    to hold any name up to CFS_MAXNAMLEN (PATH or NAM??).
9258c2ecf20Sopenharmony_ci
9268c2ecf20Sopenharmony_ci  Errors
9278c2ecf20Sopenharmony_ci    No unusual errors.
9288c2ecf20Sopenharmony_ci
9298c2ecf20Sopenharmony_ci
9308c2ecf20Sopenharmony_ci4.15.  open
9318c2ecf20Sopenharmony_ci-----------
9328c2ecf20Sopenharmony_ci
9338c2ecf20Sopenharmony_ci
9348c2ecf20Sopenharmony_ci  Summary
9358c2ecf20Sopenharmony_ci    Open a file.
9368c2ecf20Sopenharmony_ci
9378c2ecf20Sopenharmony_ci  Arguments
9388c2ecf20Sopenharmony_ci     in::
9398c2ecf20Sopenharmony_ci
9408c2ecf20Sopenharmony_ci		struct cfs_open_in {
9418c2ecf20Sopenharmony_ci		    ViceFid     VFid;
9428c2ecf20Sopenharmony_ci		    int flags;
9438c2ecf20Sopenharmony_ci		} cfs_open;
9448c2ecf20Sopenharmony_ci
9458c2ecf20Sopenharmony_ci
9468c2ecf20Sopenharmony_ci
9478c2ecf20Sopenharmony_ci     out::
9488c2ecf20Sopenharmony_ci
9498c2ecf20Sopenharmony_ci		struct cfs_open_out {
9508c2ecf20Sopenharmony_ci		    dev_t       dev;
9518c2ecf20Sopenharmony_ci		    ino_t       inode;
9528c2ecf20Sopenharmony_ci		} cfs_open;
9538c2ecf20Sopenharmony_ci
9548c2ecf20Sopenharmony_ci
9558c2ecf20Sopenharmony_ci
9568c2ecf20Sopenharmony_ci  Description
9578c2ecf20Sopenharmony_ci    This request asks Venus to place the file identified by
9588c2ecf20Sopenharmony_ci    VFid in its cache and to note that the calling process wishes to open
9598c2ecf20Sopenharmony_ci    it with flags as in open(2).  The return value to the kernel differs
9608c2ecf20Sopenharmony_ci    for Unix and Windows systems.  For Unix systems the Coda FS Driver is
9618c2ecf20Sopenharmony_ci    informed of the device and inode number of the container file in the
9628c2ecf20Sopenharmony_ci    fields dev and inode.  For Windows the path of the container file is
9638c2ecf20Sopenharmony_ci    returned to the kernel.
9648c2ecf20Sopenharmony_ci
9658c2ecf20Sopenharmony_ci
9668c2ecf20Sopenharmony_ci  .. Note::
9678c2ecf20Sopenharmony_ci
9688c2ecf20Sopenharmony_ci     Currently the cfs_open_out structure is not properly adapted to
9698c2ecf20Sopenharmony_ci     deal with the Windows case.  It might be best to implement two
9708c2ecf20Sopenharmony_ci     upcalls, one to open aiming at a container file name, the other at a
9718c2ecf20Sopenharmony_ci     container file inode.
9728c2ecf20Sopenharmony_ci
9738c2ecf20Sopenharmony_ci
9748c2ecf20Sopenharmony_ci4.16.  close
9758c2ecf20Sopenharmony_ci------------
9768c2ecf20Sopenharmony_ci
9778c2ecf20Sopenharmony_ci
9788c2ecf20Sopenharmony_ci  Summary
9798c2ecf20Sopenharmony_ci    Close a file, update it on the servers.
9808c2ecf20Sopenharmony_ci
9818c2ecf20Sopenharmony_ci  Arguments
9828c2ecf20Sopenharmony_ci     in::
9838c2ecf20Sopenharmony_ci
9848c2ecf20Sopenharmony_ci		struct cfs_close_in {
9858c2ecf20Sopenharmony_ci		    ViceFid     VFid;
9868c2ecf20Sopenharmony_ci		    int flags;
9878c2ecf20Sopenharmony_ci		} cfs_close;
9888c2ecf20Sopenharmony_ci
9898c2ecf20Sopenharmony_ci
9908c2ecf20Sopenharmony_ci
9918c2ecf20Sopenharmony_ci     out
9928c2ecf20Sopenharmony_ci
9938c2ecf20Sopenharmony_ci	none
9948c2ecf20Sopenharmony_ci
9958c2ecf20Sopenharmony_ci  Description
9968c2ecf20Sopenharmony_ci    Close the file identified by VFid.
9978c2ecf20Sopenharmony_ci
9988c2ecf20Sopenharmony_ci  .. Note::
9998c2ecf20Sopenharmony_ci
10008c2ecf20Sopenharmony_ci     The flags argument is bogus and not used.  However, Venus' code
10018c2ecf20Sopenharmony_ci     has room to deal with an execp input field, probably this field should
10028c2ecf20Sopenharmony_ci     be used to inform Venus that the file was closed but is still memory
10038c2ecf20Sopenharmony_ci     mapped for execution.  There are comments about fetching versus not
10048c2ecf20Sopenharmony_ci     fetching the data in Venus vproc_vfscalls.  This seems silly.  If a
10058c2ecf20Sopenharmony_ci     file is being closed, the data in the container file is to be the new
10068c2ecf20Sopenharmony_ci     data.  Here again the execp flag might be in play to create confusion:
10078c2ecf20Sopenharmony_ci     currently Venus might think a file can be flushed from the cache when
10088c2ecf20Sopenharmony_ci     it is still memory mapped.  This needs to be understood.
10098c2ecf20Sopenharmony_ci
10108c2ecf20Sopenharmony_ci
10118c2ecf20Sopenharmony_ci4.17.  ioctl
10128c2ecf20Sopenharmony_ci------------
10138c2ecf20Sopenharmony_ci
10148c2ecf20Sopenharmony_ci
10158c2ecf20Sopenharmony_ci  Summary
10168c2ecf20Sopenharmony_ci    Do an ioctl on a file. This includes the pioctl interface.
10178c2ecf20Sopenharmony_ci
10188c2ecf20Sopenharmony_ci  Arguments
10198c2ecf20Sopenharmony_ci     in::
10208c2ecf20Sopenharmony_ci
10218c2ecf20Sopenharmony_ci		struct cfs_ioctl_in {
10228c2ecf20Sopenharmony_ci		    ViceFid VFid;
10238c2ecf20Sopenharmony_ci		    int cmd;
10248c2ecf20Sopenharmony_ci		    int len;
10258c2ecf20Sopenharmony_ci		    int rwflag;
10268c2ecf20Sopenharmony_ci		    char *data;                 /* Place holder for data. */
10278c2ecf20Sopenharmony_ci		} cfs_ioctl;
10288c2ecf20Sopenharmony_ci
10298c2ecf20Sopenharmony_ci
10308c2ecf20Sopenharmony_ci
10318c2ecf20Sopenharmony_ci     out::
10328c2ecf20Sopenharmony_ci
10338c2ecf20Sopenharmony_ci
10348c2ecf20Sopenharmony_ci		struct cfs_ioctl_out {
10358c2ecf20Sopenharmony_ci		    int len;
10368c2ecf20Sopenharmony_ci		    caddr_t     data;           /* Place holder for data. */
10378c2ecf20Sopenharmony_ci		} cfs_ioctl;
10388c2ecf20Sopenharmony_ci
10398c2ecf20Sopenharmony_ci
10408c2ecf20Sopenharmony_ci
10418c2ecf20Sopenharmony_ci  Description
10428c2ecf20Sopenharmony_ci    Do an ioctl operation on a file.  The command, len and
10438c2ecf20Sopenharmony_ci    data arguments are filled as usual.  flags is not used by Venus.
10448c2ecf20Sopenharmony_ci
10458c2ecf20Sopenharmony_ci  .. Note::
10468c2ecf20Sopenharmony_ci
10478c2ecf20Sopenharmony_ci     Another bogus parameter.  flags is not used.  What is the
10488c2ecf20Sopenharmony_ci     business about PREFETCHING in the Venus code?
10498c2ecf20Sopenharmony_ci
10508c2ecf20Sopenharmony_ci
10518c2ecf20Sopenharmony_ci
10528c2ecf20Sopenharmony_ci4.18.  rename
10538c2ecf20Sopenharmony_ci-------------
10548c2ecf20Sopenharmony_ci
10558c2ecf20Sopenharmony_ci
10568c2ecf20Sopenharmony_ci  Summary
10578c2ecf20Sopenharmony_ci    Rename a fid.
10588c2ecf20Sopenharmony_ci
10598c2ecf20Sopenharmony_ci  Arguments
10608c2ecf20Sopenharmony_ci     in::
10618c2ecf20Sopenharmony_ci
10628c2ecf20Sopenharmony_ci		struct cfs_rename_in {
10638c2ecf20Sopenharmony_ci		    ViceFid     sourceFid;
10648c2ecf20Sopenharmony_ci		    char        *srcname;
10658c2ecf20Sopenharmony_ci		    ViceFid destFid;
10668c2ecf20Sopenharmony_ci		    char        *destname;
10678c2ecf20Sopenharmony_ci		} cfs_rename;
10688c2ecf20Sopenharmony_ci
10698c2ecf20Sopenharmony_ci
10708c2ecf20Sopenharmony_ci
10718c2ecf20Sopenharmony_ci     out
10728c2ecf20Sopenharmony_ci
10738c2ecf20Sopenharmony_ci	none
10748c2ecf20Sopenharmony_ci
10758c2ecf20Sopenharmony_ci  Description
10768c2ecf20Sopenharmony_ci    Rename the object with name srcname in directory
10778c2ecf20Sopenharmony_ci    sourceFid to destname in destFid.   It is important that the names
10788c2ecf20Sopenharmony_ci    srcname and destname are 0 terminated strings.  Strings in Unix
10798c2ecf20Sopenharmony_ci    kernels are not always null terminated.
10808c2ecf20Sopenharmony_ci
10818c2ecf20Sopenharmony_ci
10828c2ecf20Sopenharmony_ci4.19.  readdir
10838c2ecf20Sopenharmony_ci--------------
10848c2ecf20Sopenharmony_ci
10858c2ecf20Sopenharmony_ci
10868c2ecf20Sopenharmony_ci  Summary
10878c2ecf20Sopenharmony_ci    Read directory entries.
10888c2ecf20Sopenharmony_ci
10898c2ecf20Sopenharmony_ci  Arguments
10908c2ecf20Sopenharmony_ci     in::
10918c2ecf20Sopenharmony_ci
10928c2ecf20Sopenharmony_ci		struct cfs_readdir_in {
10938c2ecf20Sopenharmony_ci		    ViceFid     VFid;
10948c2ecf20Sopenharmony_ci		    int count;
10958c2ecf20Sopenharmony_ci		    int offset;
10968c2ecf20Sopenharmony_ci		} cfs_readdir;
10978c2ecf20Sopenharmony_ci
10988c2ecf20Sopenharmony_ci
10998c2ecf20Sopenharmony_ci
11008c2ecf20Sopenharmony_ci
11018c2ecf20Sopenharmony_ci     out::
11028c2ecf20Sopenharmony_ci
11038c2ecf20Sopenharmony_ci		struct cfs_readdir_out {
11048c2ecf20Sopenharmony_ci		    int size;
11058c2ecf20Sopenharmony_ci		    caddr_t     data;           /* Place holder for data. */
11068c2ecf20Sopenharmony_ci		} cfs_readdir;
11078c2ecf20Sopenharmony_ci
11088c2ecf20Sopenharmony_ci
11098c2ecf20Sopenharmony_ci
11108c2ecf20Sopenharmony_ci  Description
11118c2ecf20Sopenharmony_ci    Read directory entries from VFid starting at offset and
11128c2ecf20Sopenharmony_ci    read at most count bytes.  Returns the data in data and returns
11138c2ecf20Sopenharmony_ci    the size in size.
11148c2ecf20Sopenharmony_ci
11158c2ecf20Sopenharmony_ci
11168c2ecf20Sopenharmony_ci  .. Note::
11178c2ecf20Sopenharmony_ci
11188c2ecf20Sopenharmony_ci     This call is not used.  Readdir operations exploit container
11198c2ecf20Sopenharmony_ci     files.  We will re-evaluate this during the directory revamp which is
11208c2ecf20Sopenharmony_ci     about to take place.
11218c2ecf20Sopenharmony_ci
11228c2ecf20Sopenharmony_ci
11238c2ecf20Sopenharmony_ci4.20.  vget
11248c2ecf20Sopenharmony_ci-----------
11258c2ecf20Sopenharmony_ci
11268c2ecf20Sopenharmony_ci
11278c2ecf20Sopenharmony_ci  Summary
11288c2ecf20Sopenharmony_ci    instructs Venus to do an FSDB->Get.
11298c2ecf20Sopenharmony_ci
11308c2ecf20Sopenharmony_ci  Arguments
11318c2ecf20Sopenharmony_ci     in::
11328c2ecf20Sopenharmony_ci
11338c2ecf20Sopenharmony_ci		struct cfs_vget_in {
11348c2ecf20Sopenharmony_ci		    ViceFid VFid;
11358c2ecf20Sopenharmony_ci		} cfs_vget;
11368c2ecf20Sopenharmony_ci
11378c2ecf20Sopenharmony_ci
11388c2ecf20Sopenharmony_ci
11398c2ecf20Sopenharmony_ci     out::
11408c2ecf20Sopenharmony_ci
11418c2ecf20Sopenharmony_ci		struct cfs_vget_out {
11428c2ecf20Sopenharmony_ci		    ViceFid VFid;
11438c2ecf20Sopenharmony_ci		    int vtype;
11448c2ecf20Sopenharmony_ci		} cfs_vget;
11458c2ecf20Sopenharmony_ci
11468c2ecf20Sopenharmony_ci
11478c2ecf20Sopenharmony_ci
11488c2ecf20Sopenharmony_ci  Description
11498c2ecf20Sopenharmony_ci    This upcall asks Venus to do a get operation on an fsobj
11508c2ecf20Sopenharmony_ci    labelled by VFid.
11518c2ecf20Sopenharmony_ci
11528c2ecf20Sopenharmony_ci  .. Note::
11538c2ecf20Sopenharmony_ci
11548c2ecf20Sopenharmony_ci     This operation is not used.  However, it is extremely useful
11558c2ecf20Sopenharmony_ci     since it can be used to deal with read/write memory mapped files.
11568c2ecf20Sopenharmony_ci     These can be "pinned" in the Venus cache using vget and released with
11578c2ecf20Sopenharmony_ci     inactive.
11588c2ecf20Sopenharmony_ci
11598c2ecf20Sopenharmony_ci
11608c2ecf20Sopenharmony_ci4.21.  fsync
11618c2ecf20Sopenharmony_ci------------
11628c2ecf20Sopenharmony_ci
11638c2ecf20Sopenharmony_ci
11648c2ecf20Sopenharmony_ci  Summary
11658c2ecf20Sopenharmony_ci    Tell Venus to update the RVM attributes of a file.
11668c2ecf20Sopenharmony_ci
11678c2ecf20Sopenharmony_ci  Arguments
11688c2ecf20Sopenharmony_ci     in::
11698c2ecf20Sopenharmony_ci
11708c2ecf20Sopenharmony_ci		struct cfs_fsync_in {
11718c2ecf20Sopenharmony_ci		    ViceFid VFid;
11728c2ecf20Sopenharmony_ci		} cfs_fsync;
11738c2ecf20Sopenharmony_ci
11748c2ecf20Sopenharmony_ci
11758c2ecf20Sopenharmony_ci
11768c2ecf20Sopenharmony_ci     out
11778c2ecf20Sopenharmony_ci
11788c2ecf20Sopenharmony_ci	none
11798c2ecf20Sopenharmony_ci
11808c2ecf20Sopenharmony_ci  Description
11818c2ecf20Sopenharmony_ci    Ask Venus to update RVM attributes of object VFid. This
11828c2ecf20Sopenharmony_ci    should be called as part of kernel level fsync type calls.  The
11838c2ecf20Sopenharmony_ci    result indicates if the syncing was successful.
11848c2ecf20Sopenharmony_ci
11858c2ecf20Sopenharmony_ci  .. Note:: Linux does not implement this call. It should.
11868c2ecf20Sopenharmony_ci
11878c2ecf20Sopenharmony_ci
11888c2ecf20Sopenharmony_ci4.22.  inactive
11898c2ecf20Sopenharmony_ci---------------
11908c2ecf20Sopenharmony_ci
11918c2ecf20Sopenharmony_ci
11928c2ecf20Sopenharmony_ci  Summary
11938c2ecf20Sopenharmony_ci    Tell Venus a vnode is no longer in use.
11948c2ecf20Sopenharmony_ci
11958c2ecf20Sopenharmony_ci  Arguments
11968c2ecf20Sopenharmony_ci     in::
11978c2ecf20Sopenharmony_ci
11988c2ecf20Sopenharmony_ci		struct cfs_inactive_in {
11998c2ecf20Sopenharmony_ci		    ViceFid VFid;
12008c2ecf20Sopenharmony_ci		} cfs_inactive;
12018c2ecf20Sopenharmony_ci
12028c2ecf20Sopenharmony_ci
12038c2ecf20Sopenharmony_ci
12048c2ecf20Sopenharmony_ci     out
12058c2ecf20Sopenharmony_ci
12068c2ecf20Sopenharmony_ci	none
12078c2ecf20Sopenharmony_ci
12088c2ecf20Sopenharmony_ci  Description
12098c2ecf20Sopenharmony_ci    This operation returns EOPNOTSUPP.
12108c2ecf20Sopenharmony_ci
12118c2ecf20Sopenharmony_ci  .. Note:: This should perhaps be removed.
12128c2ecf20Sopenharmony_ci
12138c2ecf20Sopenharmony_ci
12148c2ecf20Sopenharmony_ci4.23.  rdwr
12158c2ecf20Sopenharmony_ci-----------
12168c2ecf20Sopenharmony_ci
12178c2ecf20Sopenharmony_ci
12188c2ecf20Sopenharmony_ci  Summary
12198c2ecf20Sopenharmony_ci    Read or write from a file
12208c2ecf20Sopenharmony_ci
12218c2ecf20Sopenharmony_ci  Arguments
12228c2ecf20Sopenharmony_ci     in::
12238c2ecf20Sopenharmony_ci
12248c2ecf20Sopenharmony_ci		struct cfs_rdwr_in {
12258c2ecf20Sopenharmony_ci		    ViceFid     VFid;
12268c2ecf20Sopenharmony_ci		    int rwflag;
12278c2ecf20Sopenharmony_ci		    int count;
12288c2ecf20Sopenharmony_ci		    int offset;
12298c2ecf20Sopenharmony_ci		    int ioflag;
12308c2ecf20Sopenharmony_ci		    caddr_t     data;           /* Place holder for data. */
12318c2ecf20Sopenharmony_ci		} cfs_rdwr;
12328c2ecf20Sopenharmony_ci
12338c2ecf20Sopenharmony_ci
12348c2ecf20Sopenharmony_ci
12358c2ecf20Sopenharmony_ci
12368c2ecf20Sopenharmony_ci     out::
12378c2ecf20Sopenharmony_ci
12388c2ecf20Sopenharmony_ci		struct cfs_rdwr_out {
12398c2ecf20Sopenharmony_ci		    int rwflag;
12408c2ecf20Sopenharmony_ci		    int count;
12418c2ecf20Sopenharmony_ci		    caddr_t     data;   /* Place holder for data. */
12428c2ecf20Sopenharmony_ci		} cfs_rdwr;
12438c2ecf20Sopenharmony_ci
12448c2ecf20Sopenharmony_ci
12458c2ecf20Sopenharmony_ci
12468c2ecf20Sopenharmony_ci  Description
12478c2ecf20Sopenharmony_ci    This upcall asks Venus to read or write from a file.
12488c2ecf20Sopenharmony_ci
12498c2ecf20Sopenharmony_ci
12508c2ecf20Sopenharmony_ci  .. Note::
12518c2ecf20Sopenharmony_ci
12528c2ecf20Sopenharmony_ci    It should be removed since it is against the Coda philosophy that
12538c2ecf20Sopenharmony_ci    read/write operations never reach Venus.  I have been told the
12548c2ecf20Sopenharmony_ci    operation does not work.  It is not currently used.
12558c2ecf20Sopenharmony_ci
12568c2ecf20Sopenharmony_ci
12578c2ecf20Sopenharmony_ci
12588c2ecf20Sopenharmony_ci4.24.  odymount
12598c2ecf20Sopenharmony_ci---------------
12608c2ecf20Sopenharmony_ci
12618c2ecf20Sopenharmony_ci
12628c2ecf20Sopenharmony_ci  Summary
12638c2ecf20Sopenharmony_ci    Allows mounting multiple Coda "filesystems" on one Unix mount point.
12648c2ecf20Sopenharmony_ci
12658c2ecf20Sopenharmony_ci  Arguments
12668c2ecf20Sopenharmony_ci     in::
12678c2ecf20Sopenharmony_ci
12688c2ecf20Sopenharmony_ci		struct ody_mount_in {
12698c2ecf20Sopenharmony_ci		    char        *name;          /* Place holder for data. */
12708c2ecf20Sopenharmony_ci		} ody_mount;
12718c2ecf20Sopenharmony_ci
12728c2ecf20Sopenharmony_ci
12738c2ecf20Sopenharmony_ci
12748c2ecf20Sopenharmony_ci     out::
12758c2ecf20Sopenharmony_ci
12768c2ecf20Sopenharmony_ci		struct ody_mount_out {
12778c2ecf20Sopenharmony_ci		    ViceFid VFid;
12788c2ecf20Sopenharmony_ci		} ody_mount;
12798c2ecf20Sopenharmony_ci
12808c2ecf20Sopenharmony_ci
12818c2ecf20Sopenharmony_ci
12828c2ecf20Sopenharmony_ci  Description
12838c2ecf20Sopenharmony_ci    Asks Venus to return the rootfid of a Coda system named
12848c2ecf20Sopenharmony_ci    name.  The fid is returned in VFid.
12858c2ecf20Sopenharmony_ci
12868c2ecf20Sopenharmony_ci  .. Note::
12878c2ecf20Sopenharmony_ci
12888c2ecf20Sopenharmony_ci     This call was used by David for dynamic sets.  It should be
12898c2ecf20Sopenharmony_ci     removed since it causes a jungle of pointers in the VFS mounting area.
12908c2ecf20Sopenharmony_ci     It is not used by Coda proper.  Call is not implemented by Venus.
12918c2ecf20Sopenharmony_ci
12928c2ecf20Sopenharmony_ci
12938c2ecf20Sopenharmony_ci4.25.  ody_lookup
12948c2ecf20Sopenharmony_ci-----------------
12958c2ecf20Sopenharmony_ci
12968c2ecf20Sopenharmony_ci
12978c2ecf20Sopenharmony_ci  Summary
12988c2ecf20Sopenharmony_ci    Looks up something.
12998c2ecf20Sopenharmony_ci
13008c2ecf20Sopenharmony_ci  Arguments
13018c2ecf20Sopenharmony_ci     in
13028c2ecf20Sopenharmony_ci
13038c2ecf20Sopenharmony_ci	irrelevant
13048c2ecf20Sopenharmony_ci
13058c2ecf20Sopenharmony_ci
13068c2ecf20Sopenharmony_ci     out
13078c2ecf20Sopenharmony_ci
13088c2ecf20Sopenharmony_ci	irrelevant
13098c2ecf20Sopenharmony_ci
13108c2ecf20Sopenharmony_ci
13118c2ecf20Sopenharmony_ci  .. Note:: Gut it. Call is not implemented by Venus.
13128c2ecf20Sopenharmony_ci
13138c2ecf20Sopenharmony_ci
13148c2ecf20Sopenharmony_ci4.26.  ody_expand
13158c2ecf20Sopenharmony_ci-----------------
13168c2ecf20Sopenharmony_ci
13178c2ecf20Sopenharmony_ci
13188c2ecf20Sopenharmony_ci  Summary
13198c2ecf20Sopenharmony_ci    expands something in a dynamic set.
13208c2ecf20Sopenharmony_ci
13218c2ecf20Sopenharmony_ci  Arguments
13228c2ecf20Sopenharmony_ci     in
13238c2ecf20Sopenharmony_ci
13248c2ecf20Sopenharmony_ci	irrelevant
13258c2ecf20Sopenharmony_ci
13268c2ecf20Sopenharmony_ci     out
13278c2ecf20Sopenharmony_ci
13288c2ecf20Sopenharmony_ci	irrelevant
13298c2ecf20Sopenharmony_ci
13308c2ecf20Sopenharmony_ci  .. Note:: Gut it. Call is not implemented by Venus.
13318c2ecf20Sopenharmony_ci
13328c2ecf20Sopenharmony_ci
13338c2ecf20Sopenharmony_ci4.27.  prefetch
13348c2ecf20Sopenharmony_ci---------------
13358c2ecf20Sopenharmony_ci
13368c2ecf20Sopenharmony_ci
13378c2ecf20Sopenharmony_ci  Summary
13388c2ecf20Sopenharmony_ci    Prefetch a dynamic set.
13398c2ecf20Sopenharmony_ci
13408c2ecf20Sopenharmony_ci  Arguments
13418c2ecf20Sopenharmony_ci
13428c2ecf20Sopenharmony_ci     in
13438c2ecf20Sopenharmony_ci
13448c2ecf20Sopenharmony_ci	Not documented.
13458c2ecf20Sopenharmony_ci
13468c2ecf20Sopenharmony_ci     out
13478c2ecf20Sopenharmony_ci
13488c2ecf20Sopenharmony_ci	Not documented.
13498c2ecf20Sopenharmony_ci
13508c2ecf20Sopenharmony_ci  Description
13518c2ecf20Sopenharmony_ci    Venus worker.cc has support for this call, although it is
13528c2ecf20Sopenharmony_ci    noted that it doesn't work.  Not surprising, since the kernel does not
13538c2ecf20Sopenharmony_ci    have support for it. (ODY_PREFETCH is not a defined operation).
13548c2ecf20Sopenharmony_ci
13558c2ecf20Sopenharmony_ci
13568c2ecf20Sopenharmony_ci  .. Note:: Gut it. It isn't working and isn't used by Coda.
13578c2ecf20Sopenharmony_ci
13588c2ecf20Sopenharmony_ci
13598c2ecf20Sopenharmony_ci
13608c2ecf20Sopenharmony_ci4.28.  signal
13618c2ecf20Sopenharmony_ci-------------
13628c2ecf20Sopenharmony_ci
13638c2ecf20Sopenharmony_ci
13648c2ecf20Sopenharmony_ci  Summary
13658c2ecf20Sopenharmony_ci    Send Venus a signal about an upcall.
13668c2ecf20Sopenharmony_ci
13678c2ecf20Sopenharmony_ci  Arguments
13688c2ecf20Sopenharmony_ci     in
13698c2ecf20Sopenharmony_ci
13708c2ecf20Sopenharmony_ci	none
13718c2ecf20Sopenharmony_ci
13728c2ecf20Sopenharmony_ci     out
13738c2ecf20Sopenharmony_ci
13748c2ecf20Sopenharmony_ci	not applicable.
13758c2ecf20Sopenharmony_ci
13768c2ecf20Sopenharmony_ci  Description
13778c2ecf20Sopenharmony_ci    This is an out-of-band upcall to Venus to inform Venus
13788c2ecf20Sopenharmony_ci    that the calling process received a signal after Venus read the
13798c2ecf20Sopenharmony_ci    message from the input queue.  Venus is supposed to clean up the
13808c2ecf20Sopenharmony_ci    operation.
13818c2ecf20Sopenharmony_ci
13828c2ecf20Sopenharmony_ci  Errors
13838c2ecf20Sopenharmony_ci    No reply is given.
13848c2ecf20Sopenharmony_ci
13858c2ecf20Sopenharmony_ci  .. Note::
13868c2ecf20Sopenharmony_ci
13878c2ecf20Sopenharmony_ci     We need to better understand what Venus needs to clean up and if
13888c2ecf20Sopenharmony_ci     it is doing this correctly.  Also we need to handle multiple upcall
13898c2ecf20Sopenharmony_ci     per system call situations correctly.  It would be important to know
13908c2ecf20Sopenharmony_ci     what state changes in Venus take place after an upcall for which the
13918c2ecf20Sopenharmony_ci     kernel is responsible for notifying Venus to clean up (e.g. open
13928c2ecf20Sopenharmony_ci     definitely is such a state change, but many others are maybe not).
13938c2ecf20Sopenharmony_ci
13948c2ecf20Sopenharmony_ci
13958c2ecf20Sopenharmony_ci5.  The minicache and downcalls
13968c2ecf20Sopenharmony_ci===============================
13978c2ecf20Sopenharmony_ci
13988c2ecf20Sopenharmony_ci
13998c2ecf20Sopenharmony_ci  The Coda FS Driver can cache results of lookup and access upcalls, to
14008c2ecf20Sopenharmony_ci  limit the frequency of upcalls.  Upcalls carry a price since a process
14018c2ecf20Sopenharmony_ci  context switch needs to take place.  The counterpart of caching the
14028c2ecf20Sopenharmony_ci  information is that Venus will notify the FS Driver that cached
14038c2ecf20Sopenharmony_ci  entries must be flushed or renamed.
14048c2ecf20Sopenharmony_ci
14058c2ecf20Sopenharmony_ci  The kernel code generally has to maintain a structure which links the
14068c2ecf20Sopenharmony_ci  internal file handles (called vnodes in BSD, inodes in Linux and
14078c2ecf20Sopenharmony_ci  FileHandles in Windows) with the ViceFid's which Venus maintains.  The
14088c2ecf20Sopenharmony_ci  reason is that frequent translations back and forth are needed in
14098c2ecf20Sopenharmony_ci  order to make upcalls and use the results of upcalls.  Such linking
14108c2ecf20Sopenharmony_ci  objects are called cnodes.
14118c2ecf20Sopenharmony_ci
14128c2ecf20Sopenharmony_ci  The current minicache implementations have cache entries which record
14138c2ecf20Sopenharmony_ci  the following:
14148c2ecf20Sopenharmony_ci
14158c2ecf20Sopenharmony_ci  1. the name of the file
14168c2ecf20Sopenharmony_ci
14178c2ecf20Sopenharmony_ci  2. the cnode of the directory containing the object
14188c2ecf20Sopenharmony_ci
14198c2ecf20Sopenharmony_ci  3. a list of CodaCred's for which the lookup is permitted.
14208c2ecf20Sopenharmony_ci
14218c2ecf20Sopenharmony_ci  4. the cnode of the object
14228c2ecf20Sopenharmony_ci
14238c2ecf20Sopenharmony_ci  The lookup call in the Coda FS Driver may request the cnode of the
14248c2ecf20Sopenharmony_ci  desired object from the cache, by passing its name, directory and the
14258c2ecf20Sopenharmony_ci  CodaCred's of the caller.  The cache will return the cnode or indicate
14268c2ecf20Sopenharmony_ci  that it cannot be found.  The Coda FS Driver must be careful to
14278c2ecf20Sopenharmony_ci  invalidate cache entries when it modifies or removes objects.
14288c2ecf20Sopenharmony_ci
14298c2ecf20Sopenharmony_ci  When Venus obtains information that indicates that cache entries are
14308c2ecf20Sopenharmony_ci  no longer valid, it will make a downcall to the kernel.  Downcalls are
14318c2ecf20Sopenharmony_ci  intercepted by the Coda FS Driver and lead to cache invalidations of
14328c2ecf20Sopenharmony_ci  the kind described below.  The Coda FS Driver does not return an error
14338c2ecf20Sopenharmony_ci  unless the downcall data could not be read into kernel memory.
14348c2ecf20Sopenharmony_ci
14358c2ecf20Sopenharmony_ci
14368c2ecf20Sopenharmony_ci5.1.  INVALIDATE
14378c2ecf20Sopenharmony_ci----------------
14388c2ecf20Sopenharmony_ci
14398c2ecf20Sopenharmony_ci
14408c2ecf20Sopenharmony_ci  No information is available on this call.
14418c2ecf20Sopenharmony_ci
14428c2ecf20Sopenharmony_ci
14438c2ecf20Sopenharmony_ci5.2.  FLUSH
14448c2ecf20Sopenharmony_ci-----------
14458c2ecf20Sopenharmony_ci
14468c2ecf20Sopenharmony_ci
14478c2ecf20Sopenharmony_ci
14488c2ecf20Sopenharmony_ci  Arguments
14498c2ecf20Sopenharmony_ci    None
14508c2ecf20Sopenharmony_ci
14518c2ecf20Sopenharmony_ci  Summary
14528c2ecf20Sopenharmony_ci    Flush the name cache entirely.
14538c2ecf20Sopenharmony_ci
14548c2ecf20Sopenharmony_ci  Description
14558c2ecf20Sopenharmony_ci    Venus issues this call upon startup and when it dies. This
14568c2ecf20Sopenharmony_ci    is to prevent stale cache information being held.  Some operating
14578c2ecf20Sopenharmony_ci    systems allow the kernel name cache to be switched off dynamically.
14588c2ecf20Sopenharmony_ci    When this is done, this downcall is made.
14598c2ecf20Sopenharmony_ci
14608c2ecf20Sopenharmony_ci
14618c2ecf20Sopenharmony_ci5.3.  PURGEUSER
14628c2ecf20Sopenharmony_ci---------------
14638c2ecf20Sopenharmony_ci
14648c2ecf20Sopenharmony_ci
14658c2ecf20Sopenharmony_ci  Arguments
14668c2ecf20Sopenharmony_ci    ::
14678c2ecf20Sopenharmony_ci
14688c2ecf20Sopenharmony_ci	  struct cfs_purgeuser_out {/* CFS_PURGEUSER is a venus->kernel call */
14698c2ecf20Sopenharmony_ci	      struct CodaCred cred;
14708c2ecf20Sopenharmony_ci	  } cfs_purgeuser;
14718c2ecf20Sopenharmony_ci
14728c2ecf20Sopenharmony_ci
14738c2ecf20Sopenharmony_ci
14748c2ecf20Sopenharmony_ci  Description
14758c2ecf20Sopenharmony_ci    Remove all entries in the cache carrying the Cred.  This
14768c2ecf20Sopenharmony_ci    call is issued when tokens for a user expire or are flushed.
14778c2ecf20Sopenharmony_ci
14788c2ecf20Sopenharmony_ci
14798c2ecf20Sopenharmony_ci5.4.  ZAPFILE
14808c2ecf20Sopenharmony_ci-------------
14818c2ecf20Sopenharmony_ci
14828c2ecf20Sopenharmony_ci
14838c2ecf20Sopenharmony_ci  Arguments
14848c2ecf20Sopenharmony_ci    ::
14858c2ecf20Sopenharmony_ci
14868c2ecf20Sopenharmony_ci	  struct cfs_zapfile_out {  /* CFS_ZAPFILE is a venus->kernel call */
14878c2ecf20Sopenharmony_ci	      ViceFid CodaFid;
14888c2ecf20Sopenharmony_ci	  } cfs_zapfile;
14898c2ecf20Sopenharmony_ci
14908c2ecf20Sopenharmony_ci
14918c2ecf20Sopenharmony_ci
14928c2ecf20Sopenharmony_ci  Description
14938c2ecf20Sopenharmony_ci    Remove all entries which have the (dir vnode, name) pair.
14948c2ecf20Sopenharmony_ci    This is issued as a result of an invalidation of cached attributes of
14958c2ecf20Sopenharmony_ci    a vnode.
14968c2ecf20Sopenharmony_ci
14978c2ecf20Sopenharmony_ci  .. Note::
14988c2ecf20Sopenharmony_ci
14998c2ecf20Sopenharmony_ci     Call is not named correctly in NetBSD and Mach.  The minicache
15008c2ecf20Sopenharmony_ci     zapfile routine takes different arguments. Linux does not implement
15018c2ecf20Sopenharmony_ci     the invalidation of attributes correctly.
15028c2ecf20Sopenharmony_ci
15038c2ecf20Sopenharmony_ci
15048c2ecf20Sopenharmony_ci
15058c2ecf20Sopenharmony_ci5.5.  ZAPDIR
15068c2ecf20Sopenharmony_ci------------
15078c2ecf20Sopenharmony_ci
15088c2ecf20Sopenharmony_ci
15098c2ecf20Sopenharmony_ci  Arguments
15108c2ecf20Sopenharmony_ci    ::
15118c2ecf20Sopenharmony_ci
15128c2ecf20Sopenharmony_ci	  struct cfs_zapdir_out {   /* CFS_ZAPDIR is a venus->kernel call */
15138c2ecf20Sopenharmony_ci	      ViceFid CodaFid;
15148c2ecf20Sopenharmony_ci	  } cfs_zapdir;
15158c2ecf20Sopenharmony_ci
15168c2ecf20Sopenharmony_ci
15178c2ecf20Sopenharmony_ci
15188c2ecf20Sopenharmony_ci  Description
15198c2ecf20Sopenharmony_ci    Remove all entries in the cache lying in a directory
15208c2ecf20Sopenharmony_ci    CodaFid, and all children of this directory. This call is issued when
15218c2ecf20Sopenharmony_ci    Venus receives a callback on the directory.
15228c2ecf20Sopenharmony_ci
15238c2ecf20Sopenharmony_ci
15248c2ecf20Sopenharmony_ci5.6.  ZAPVNODE
15258c2ecf20Sopenharmony_ci--------------
15268c2ecf20Sopenharmony_ci
15278c2ecf20Sopenharmony_ci
15288c2ecf20Sopenharmony_ci
15298c2ecf20Sopenharmony_ci  Arguments
15308c2ecf20Sopenharmony_ci    ::
15318c2ecf20Sopenharmony_ci
15328c2ecf20Sopenharmony_ci	  struct cfs_zapvnode_out { /* CFS_ZAPVNODE is a venus->kernel call */
15338c2ecf20Sopenharmony_ci	      struct CodaCred cred;
15348c2ecf20Sopenharmony_ci	      ViceFid VFid;
15358c2ecf20Sopenharmony_ci	  } cfs_zapvnode;
15368c2ecf20Sopenharmony_ci
15378c2ecf20Sopenharmony_ci
15388c2ecf20Sopenharmony_ci
15398c2ecf20Sopenharmony_ci  Description
15408c2ecf20Sopenharmony_ci    Remove all entries in the cache carrying the cred and VFid
15418c2ecf20Sopenharmony_ci    as in the arguments. This downcall is probably never issued.
15428c2ecf20Sopenharmony_ci
15438c2ecf20Sopenharmony_ci
15448c2ecf20Sopenharmony_ci5.7.  PURGEFID
15458c2ecf20Sopenharmony_ci--------------
15468c2ecf20Sopenharmony_ci
15478c2ecf20Sopenharmony_ci
15488c2ecf20Sopenharmony_ci  Arguments
15498c2ecf20Sopenharmony_ci    ::
15508c2ecf20Sopenharmony_ci
15518c2ecf20Sopenharmony_ci	  struct cfs_purgefid_out { /* CFS_PURGEFID is a venus->kernel call */
15528c2ecf20Sopenharmony_ci	      ViceFid CodaFid;
15538c2ecf20Sopenharmony_ci	  } cfs_purgefid;
15548c2ecf20Sopenharmony_ci
15558c2ecf20Sopenharmony_ci
15568c2ecf20Sopenharmony_ci
15578c2ecf20Sopenharmony_ci  Description
15588c2ecf20Sopenharmony_ci    Flush the attribute for the file. If it is a dir (odd
15598c2ecf20Sopenharmony_ci    vnode), purge its children from the namecache and remove the file from the
15608c2ecf20Sopenharmony_ci    namecache.
15618c2ecf20Sopenharmony_ci
15628c2ecf20Sopenharmony_ci
15638c2ecf20Sopenharmony_ci
15648c2ecf20Sopenharmony_ci5.8.  REPLACE
15658c2ecf20Sopenharmony_ci-------------
15668c2ecf20Sopenharmony_ci
15678c2ecf20Sopenharmony_ci
15688c2ecf20Sopenharmony_ci  Summary
15698c2ecf20Sopenharmony_ci    Replace the Fid's for a collection of names.
15708c2ecf20Sopenharmony_ci
15718c2ecf20Sopenharmony_ci  Arguments
15728c2ecf20Sopenharmony_ci    ::
15738c2ecf20Sopenharmony_ci
15748c2ecf20Sopenharmony_ci	  struct cfs_replace_out { /* cfs_replace is a venus->kernel call */
15758c2ecf20Sopenharmony_ci	      ViceFid NewFid;
15768c2ecf20Sopenharmony_ci	      ViceFid OldFid;
15778c2ecf20Sopenharmony_ci	  } cfs_replace;
15788c2ecf20Sopenharmony_ci
15798c2ecf20Sopenharmony_ci
15808c2ecf20Sopenharmony_ci
15818c2ecf20Sopenharmony_ci  Description
15828c2ecf20Sopenharmony_ci    This routine replaces a ViceFid in the name cache with
15838c2ecf20Sopenharmony_ci    another.  It is added to allow Venus during reintegration to replace
15848c2ecf20Sopenharmony_ci    locally allocated temp fids while disconnected with global fids even
15858c2ecf20Sopenharmony_ci    when the reference counts on those fids are not zero.
15868c2ecf20Sopenharmony_ci
15878c2ecf20Sopenharmony_ci
15888c2ecf20Sopenharmony_ci6.  Initialization and cleanup
15898c2ecf20Sopenharmony_ci==============================
15908c2ecf20Sopenharmony_ci
15918c2ecf20Sopenharmony_ci
15928c2ecf20Sopenharmony_ci  This section gives brief hints as to desirable features for the Coda
15938c2ecf20Sopenharmony_ci  FS Driver at startup and upon shutdown or Venus failures.  Before
15948c2ecf20Sopenharmony_ci  entering the discussion it is useful to repeat that the Coda FS Driver
15958c2ecf20Sopenharmony_ci  maintains the following data:
15968c2ecf20Sopenharmony_ci
15978c2ecf20Sopenharmony_ci
15988c2ecf20Sopenharmony_ci  1. message queues
15998c2ecf20Sopenharmony_ci
16008c2ecf20Sopenharmony_ci  2. cnodes
16018c2ecf20Sopenharmony_ci
16028c2ecf20Sopenharmony_ci  3. name cache entries
16038c2ecf20Sopenharmony_ci
16048c2ecf20Sopenharmony_ci     The name cache entries are entirely private to the driver, so they
16058c2ecf20Sopenharmony_ci     can easily be manipulated.   The message queues will generally have
16068c2ecf20Sopenharmony_ci     clear points of initialization and destruction.  The cnodes are
16078c2ecf20Sopenharmony_ci     much more delicate.  User processes hold reference counts in Coda
16088c2ecf20Sopenharmony_ci     filesystems and it can be difficult to clean up the cnodes.
16098c2ecf20Sopenharmony_ci
16108c2ecf20Sopenharmony_ci  It can expect requests through:
16118c2ecf20Sopenharmony_ci
16128c2ecf20Sopenharmony_ci  1. the message subsystem
16138c2ecf20Sopenharmony_ci
16148c2ecf20Sopenharmony_ci  2. the VFS layer
16158c2ecf20Sopenharmony_ci
16168c2ecf20Sopenharmony_ci  3. pioctl interface
16178c2ecf20Sopenharmony_ci
16188c2ecf20Sopenharmony_ci     Currently the pioctl passes through the VFS for Coda so we can
16198c2ecf20Sopenharmony_ci     treat these similarly.
16208c2ecf20Sopenharmony_ci
16218c2ecf20Sopenharmony_ci
16228c2ecf20Sopenharmony_ci6.1.  Requirements
16238c2ecf20Sopenharmony_ci------------------
16248c2ecf20Sopenharmony_ci
16258c2ecf20Sopenharmony_ci
16268c2ecf20Sopenharmony_ci  The following requirements should be accommodated:
16278c2ecf20Sopenharmony_ci
16288c2ecf20Sopenharmony_ci  1. The message queues should have open and close routines.  On Unix
16298c2ecf20Sopenharmony_ci     the opening of the character devices are such routines.
16308c2ecf20Sopenharmony_ci
16318c2ecf20Sopenharmony_ci    -  Before opening, no messages can be placed.
16328c2ecf20Sopenharmony_ci
16338c2ecf20Sopenharmony_ci    -  Opening will remove any old messages still pending.
16348c2ecf20Sopenharmony_ci
16358c2ecf20Sopenharmony_ci    -  Close will notify any sleeping processes that their upcall cannot
16368c2ecf20Sopenharmony_ci       be completed.
16378c2ecf20Sopenharmony_ci
16388c2ecf20Sopenharmony_ci    -  Close will free all memory allocated by the message queues.
16398c2ecf20Sopenharmony_ci
16408c2ecf20Sopenharmony_ci
16418c2ecf20Sopenharmony_ci  2. At open the namecache shall be initialized to empty state.
16428c2ecf20Sopenharmony_ci
16438c2ecf20Sopenharmony_ci  3. Before the message queues are open, all VFS operations will fail.
16448c2ecf20Sopenharmony_ci     Fortunately this can be achieved by making sure than mounting the
16458c2ecf20Sopenharmony_ci     Coda filesystem cannot succeed before opening.
16468c2ecf20Sopenharmony_ci
16478c2ecf20Sopenharmony_ci  4. After closing of the queues, no VFS operations can succeed.  Here
16488c2ecf20Sopenharmony_ci     one needs to be careful, since a few operations (lookup,
16498c2ecf20Sopenharmony_ci     read/write, readdir) can proceed without upcalls.  These must be
16508c2ecf20Sopenharmony_ci     explicitly blocked.
16518c2ecf20Sopenharmony_ci
16528c2ecf20Sopenharmony_ci  5. Upon closing the namecache shall be flushed and disabled.
16538c2ecf20Sopenharmony_ci
16548c2ecf20Sopenharmony_ci  6. All memory held by cnodes can be freed without relying on upcalls.
16558c2ecf20Sopenharmony_ci
16568c2ecf20Sopenharmony_ci  7. Unmounting the file system can be done without relying on upcalls.
16578c2ecf20Sopenharmony_ci
16588c2ecf20Sopenharmony_ci  8. Mounting the Coda filesystem should fail gracefully if Venus cannot
16598c2ecf20Sopenharmony_ci     get the rootfid or the attributes of the rootfid.  The latter is
16608c2ecf20Sopenharmony_ci     best implemented by Venus fetching these objects before attempting
16618c2ecf20Sopenharmony_ci     to mount.
16628c2ecf20Sopenharmony_ci
16638c2ecf20Sopenharmony_ci  .. Note::
16648c2ecf20Sopenharmony_ci
16658c2ecf20Sopenharmony_ci     NetBSD in particular but also Linux have not implemented the
16668c2ecf20Sopenharmony_ci     above requirements fully.  For smooth operation this needs to be
16678c2ecf20Sopenharmony_ci     corrected.
16688c2ecf20Sopenharmony_ci
16698c2ecf20Sopenharmony_ci
16708c2ecf20Sopenharmony_ci
1671