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