162306a36Sopenharmony_ci.. SPDX-License-Identifier: GPL-2.0 262306a36Sopenharmony_ci 362306a36Sopenharmony_ci=========================== 462306a36Sopenharmony_ciCoda Kernel-Venus Interface 562306a36Sopenharmony_ci=========================== 662306a36Sopenharmony_ci 762306a36Sopenharmony_ci.. Note:: 862306a36Sopenharmony_ci 962306a36Sopenharmony_ci This is one of the technical documents describing a component of 1062306a36Sopenharmony_ci Coda -- this document describes the client kernel-Venus interface. 1162306a36Sopenharmony_ci 1262306a36Sopenharmony_ciFor more information: 1362306a36Sopenharmony_ci 1462306a36Sopenharmony_ci http://www.coda.cs.cmu.edu 1562306a36Sopenharmony_ci 1662306a36Sopenharmony_ciFor user level software needed to run Coda: 1762306a36Sopenharmony_ci 1862306a36Sopenharmony_ci ftp://ftp.coda.cs.cmu.edu 1962306a36Sopenharmony_ci 2062306a36Sopenharmony_ciTo run Coda you need to get a user level cache manager for the client, 2162306a36Sopenharmony_cinamed Venus, as well as tools to manipulate ACLs, to log in, etc. The 2262306a36Sopenharmony_ciclient needs to have the Coda filesystem selected in the kernel 2362306a36Sopenharmony_ciconfiguration. 2462306a36Sopenharmony_ci 2562306a36Sopenharmony_ciThe server needs a user level server and at present does not depend on 2662306a36Sopenharmony_cikernel support. 2762306a36Sopenharmony_ci 2862306a36Sopenharmony_ci The Venus kernel interface 2962306a36Sopenharmony_ci 3062306a36Sopenharmony_ci Peter J. Braam 3162306a36Sopenharmony_ci 3262306a36Sopenharmony_ci v1.0, Nov 9, 1997 3362306a36Sopenharmony_ci 3462306a36Sopenharmony_ci This document describes the communication between Venus and kernel 3562306a36Sopenharmony_ci level filesystem code needed for the operation of the Coda file sys- 3662306a36Sopenharmony_ci tem. This document version is meant to describe the current interface 3762306a36Sopenharmony_ci (version 1.0) as well as improvements we envisage. 3862306a36Sopenharmony_ci 3962306a36Sopenharmony_ci.. Table of Contents 4062306a36Sopenharmony_ci 4162306a36Sopenharmony_ci 1. Introduction 4262306a36Sopenharmony_ci 4362306a36Sopenharmony_ci 2. Servicing Coda filesystem calls 4462306a36Sopenharmony_ci 4562306a36Sopenharmony_ci 3. The message layer 4662306a36Sopenharmony_ci 4762306a36Sopenharmony_ci 3.1 Implementation details 4862306a36Sopenharmony_ci 4962306a36Sopenharmony_ci 4. The interface at the call level 5062306a36Sopenharmony_ci 5162306a36Sopenharmony_ci 4.1 Data structures shared by the kernel and Venus 5262306a36Sopenharmony_ci 4.2 The pioctl interface 5362306a36Sopenharmony_ci 4.3 root 5462306a36Sopenharmony_ci 4.4 lookup 5562306a36Sopenharmony_ci 4.5 getattr 5662306a36Sopenharmony_ci 4.6 setattr 5762306a36Sopenharmony_ci 4.7 access 5862306a36Sopenharmony_ci 4.8 create 5962306a36Sopenharmony_ci 4.9 mkdir 6062306a36Sopenharmony_ci 4.10 link 6162306a36Sopenharmony_ci 4.11 symlink 6262306a36Sopenharmony_ci 4.12 remove 6362306a36Sopenharmony_ci 4.13 rmdir 6462306a36Sopenharmony_ci 4.14 readlink 6562306a36Sopenharmony_ci 4.15 open 6662306a36Sopenharmony_ci 4.16 close 6762306a36Sopenharmony_ci 4.17 ioctl 6862306a36Sopenharmony_ci 4.18 rename 6962306a36Sopenharmony_ci 4.19 readdir 7062306a36Sopenharmony_ci 4.20 vget 7162306a36Sopenharmony_ci 4.21 fsync 7262306a36Sopenharmony_ci 4.22 inactive 7362306a36Sopenharmony_ci 4.23 rdwr 7462306a36Sopenharmony_ci 4.24 odymount 7562306a36Sopenharmony_ci 4.25 ody_lookup 7662306a36Sopenharmony_ci 4.26 ody_expand 7762306a36Sopenharmony_ci 4.27 prefetch 7862306a36Sopenharmony_ci 4.28 signal 7962306a36Sopenharmony_ci 8062306a36Sopenharmony_ci 5. The minicache and downcalls 8162306a36Sopenharmony_ci 8262306a36Sopenharmony_ci 5.1 INVALIDATE 8362306a36Sopenharmony_ci 5.2 FLUSH 8462306a36Sopenharmony_ci 5.3 PURGEUSER 8562306a36Sopenharmony_ci 5.4 ZAPFILE 8662306a36Sopenharmony_ci 5.5 ZAPDIR 8762306a36Sopenharmony_ci 5.6 ZAPVNODE 8862306a36Sopenharmony_ci 5.7 PURGEFID 8962306a36Sopenharmony_ci 5.8 REPLACE 9062306a36Sopenharmony_ci 9162306a36Sopenharmony_ci 6. Initialization and cleanup 9262306a36Sopenharmony_ci 9362306a36Sopenharmony_ci 6.1 Requirements 9462306a36Sopenharmony_ci 9562306a36Sopenharmony_ci1. Introduction 9662306a36Sopenharmony_ci=============== 9762306a36Sopenharmony_ci 9862306a36Sopenharmony_ci A key component in the Coda Distributed File System is the cache 9962306a36Sopenharmony_ci manager, Venus. 10062306a36Sopenharmony_ci 10162306a36Sopenharmony_ci When processes on a Coda enabled system access files in the Coda 10262306a36Sopenharmony_ci filesystem, requests are directed at the filesystem layer in the 10362306a36Sopenharmony_ci operating system. The operating system will communicate with Venus to 10462306a36Sopenharmony_ci service the request for the process. Venus manages a persistent 10562306a36Sopenharmony_ci client cache and makes remote procedure calls to Coda file servers and 10662306a36Sopenharmony_ci related servers (such as authentication servers) to service these 10762306a36Sopenharmony_ci requests it receives from the operating system. When Venus has 10862306a36Sopenharmony_ci serviced a request it replies to the operating system with appropriate 10962306a36Sopenharmony_ci return codes, and other data related to the request. Optionally the 11062306a36Sopenharmony_ci kernel support for Coda may maintain a minicache of recently processed 11162306a36Sopenharmony_ci requests to limit the number of interactions with Venus. Venus 11262306a36Sopenharmony_ci possesses the facility to inform the kernel when elements from its 11362306a36Sopenharmony_ci minicache are no longer valid. 11462306a36Sopenharmony_ci 11562306a36Sopenharmony_ci This document describes precisely this communication between the 11662306a36Sopenharmony_ci kernel and Venus. The definitions of so called upcalls and downcalls 11762306a36Sopenharmony_ci will be given with the format of the data they handle. We shall also 11862306a36Sopenharmony_ci describe the semantic invariants resulting from the calls. 11962306a36Sopenharmony_ci 12062306a36Sopenharmony_ci Historically Coda was implemented in a BSD file system in Mach 2.6. 12162306a36Sopenharmony_ci The interface between the kernel and Venus is very similar to the BSD 12262306a36Sopenharmony_ci VFS interface. Similar functionality is provided, and the format of 12362306a36Sopenharmony_ci the parameters and returned data is very similar to the BSD VFS. This 12462306a36Sopenharmony_ci leads to an almost natural environment for implementing a kernel-level 12562306a36Sopenharmony_ci filesystem driver for Coda in a BSD system. However, other operating 12662306a36Sopenharmony_ci systems such as Linux and Windows 95 and NT have virtual filesystem 12762306a36Sopenharmony_ci with different interfaces. 12862306a36Sopenharmony_ci 12962306a36Sopenharmony_ci To implement Coda on these systems some reverse engineering of the 13062306a36Sopenharmony_ci Venus/Kernel protocol is necessary. Also it came to light that other 13162306a36Sopenharmony_ci systems could profit significantly from certain small optimizations 13262306a36Sopenharmony_ci and modifications to the protocol. To facilitate this work as well as 13362306a36Sopenharmony_ci to make future ports easier, communication between Venus and the 13462306a36Sopenharmony_ci kernel should be documented in great detail. This is the aim of this 13562306a36Sopenharmony_ci document. 13662306a36Sopenharmony_ci 13762306a36Sopenharmony_ci2. Servicing Coda filesystem calls 13862306a36Sopenharmony_ci=================================== 13962306a36Sopenharmony_ci 14062306a36Sopenharmony_ci The service of a request for a Coda file system service originates in 14162306a36Sopenharmony_ci a process P which accessing a Coda file. It makes a system call which 14262306a36Sopenharmony_ci traps to the OS kernel. Examples of such calls trapping to the kernel 14362306a36Sopenharmony_ci are ``read``, ``write``, ``open``, ``close``, ``create``, ``mkdir``, 14462306a36Sopenharmony_ci ``rmdir``, ``chmod`` in a Unix ontext. Similar calls exist in the Win32 14562306a36Sopenharmony_ci environment, and are named ``CreateFile``. 14662306a36Sopenharmony_ci 14762306a36Sopenharmony_ci Generally the operating system handles the request in a virtual 14862306a36Sopenharmony_ci filesystem (VFS) layer, which is named I/O Manager in NT and IFS 14962306a36Sopenharmony_ci manager in Windows 95. The VFS is responsible for partial processing 15062306a36Sopenharmony_ci of the request and for locating the specific filesystem(s) which will 15162306a36Sopenharmony_ci service parts of the request. Usually the information in the path 15262306a36Sopenharmony_ci assists in locating the correct FS drivers. Sometimes after extensive 15362306a36Sopenharmony_ci pre-processing, the VFS starts invoking exported routines in the FS 15462306a36Sopenharmony_ci driver. This is the point where the FS specific processing of the 15562306a36Sopenharmony_ci request starts, and here the Coda specific kernel code comes into 15662306a36Sopenharmony_ci play. 15762306a36Sopenharmony_ci 15862306a36Sopenharmony_ci The FS layer for Coda must expose and implement several interfaces. 15962306a36Sopenharmony_ci First and foremost the VFS must be able to make all necessary calls to 16062306a36Sopenharmony_ci the Coda FS layer, so the Coda FS driver must expose the VFS interface 16162306a36Sopenharmony_ci as applicable in the operating system. These differ very significantly 16262306a36Sopenharmony_ci among operating systems, but share features such as facilities to 16362306a36Sopenharmony_ci read/write and create and remove objects. The Coda FS layer services 16462306a36Sopenharmony_ci such VFS requests by invoking one or more well defined services 16562306a36Sopenharmony_ci offered by the cache manager Venus. When the replies from Venus have 16662306a36Sopenharmony_ci come back to the FS driver, servicing of the VFS call continues and 16762306a36Sopenharmony_ci finishes with a reply to the kernel's VFS. Finally the VFS layer 16862306a36Sopenharmony_ci returns to the process. 16962306a36Sopenharmony_ci 17062306a36Sopenharmony_ci As a result of this design a basic interface exposed by the FS driver 17162306a36Sopenharmony_ci must allow Venus to manage message traffic. In particular Venus must 17262306a36Sopenharmony_ci be able to retrieve and place messages and to be notified of the 17362306a36Sopenharmony_ci arrival of a new message. The notification must be through a mechanism 17462306a36Sopenharmony_ci which does not block Venus since Venus must attend to other tasks even 17562306a36Sopenharmony_ci when no messages are waiting or being processed. 17662306a36Sopenharmony_ci 17762306a36Sopenharmony_ci **Interfaces of the Coda FS Driver** 17862306a36Sopenharmony_ci 17962306a36Sopenharmony_ci Furthermore the FS layer provides for a special path of communication 18062306a36Sopenharmony_ci between a user process and Venus, called the pioctl interface. The 18162306a36Sopenharmony_ci pioctl interface is used for Coda specific services, such as 18262306a36Sopenharmony_ci requesting detailed information about the persistent cache managed by 18362306a36Sopenharmony_ci Venus. Here the involvement of the kernel is minimal. It identifies 18462306a36Sopenharmony_ci the calling process and passes the information on to Venus. When 18562306a36Sopenharmony_ci Venus replies the response is passed back to the caller in unmodified 18662306a36Sopenharmony_ci form. 18762306a36Sopenharmony_ci 18862306a36Sopenharmony_ci Finally Venus allows the kernel FS driver to cache the results from 18962306a36Sopenharmony_ci certain services. This is done to avoid excessive context switches 19062306a36Sopenharmony_ci and results in an efficient system. However, Venus may acquire 19162306a36Sopenharmony_ci information, for example from the network which implies that cached 19262306a36Sopenharmony_ci information must be flushed or replaced. Venus then makes a downcall 19362306a36Sopenharmony_ci to the Coda FS layer to request flushes or updates in the cache. The 19462306a36Sopenharmony_ci kernel FS driver handles such requests synchronously. 19562306a36Sopenharmony_ci 19662306a36Sopenharmony_ci Among these interfaces the VFS interface and the facility to place, 19762306a36Sopenharmony_ci receive and be notified of messages are platform specific. We will 19862306a36Sopenharmony_ci not go into the calls exported to the VFS layer but we will state the 19962306a36Sopenharmony_ci requirements of the message exchange mechanism. 20062306a36Sopenharmony_ci 20162306a36Sopenharmony_ci 20262306a36Sopenharmony_ci3. The message layer 20362306a36Sopenharmony_ci===================== 20462306a36Sopenharmony_ci 20562306a36Sopenharmony_ci At the lowest level the communication between Venus and the FS driver 20662306a36Sopenharmony_ci proceeds through messages. The synchronization between processes 20762306a36Sopenharmony_ci requesting Coda file service and Venus relies on blocking and waking 20862306a36Sopenharmony_ci up processes. The Coda FS driver processes VFS- and pioctl-requests 20962306a36Sopenharmony_ci on behalf of a process P, creates messages for Venus, awaits replies 21062306a36Sopenharmony_ci and finally returns to the caller. The implementation of the exchange 21162306a36Sopenharmony_ci of messages is platform specific, but the semantics have (so far) 21262306a36Sopenharmony_ci appeared to be generally applicable. Data buffers are created by the 21362306a36Sopenharmony_ci FS Driver in kernel memory on behalf of P and copied to user memory in 21462306a36Sopenharmony_ci Venus. 21562306a36Sopenharmony_ci 21662306a36Sopenharmony_ci The FS Driver while servicing P makes upcalls to Venus. Such an 21762306a36Sopenharmony_ci upcall is dispatched to Venus by creating a message structure. The 21862306a36Sopenharmony_ci structure contains the identification of P, the message sequence 21962306a36Sopenharmony_ci number, the size of the request and a pointer to the data in kernel 22062306a36Sopenharmony_ci memory for the request. Since the data buffer is re-used to hold the 22162306a36Sopenharmony_ci reply from Venus, there is a field for the size of the reply. A flags 22262306a36Sopenharmony_ci field is used in the message to precisely record the status of the 22362306a36Sopenharmony_ci message. Additional platform dependent structures involve pointers to 22462306a36Sopenharmony_ci determine the position of the message on queues and pointers to 22562306a36Sopenharmony_ci synchronization objects. In the upcall routine the message structure 22662306a36Sopenharmony_ci is filled in, flags are set to 0, and it is placed on the *pending* 22762306a36Sopenharmony_ci queue. The routine calling upcall is responsible for allocating the 22862306a36Sopenharmony_ci data buffer; its structure will be described in the next section. 22962306a36Sopenharmony_ci 23062306a36Sopenharmony_ci A facility must exist to notify Venus that the message has been 23162306a36Sopenharmony_ci created, and implemented using available synchronization objects in 23262306a36Sopenharmony_ci the OS. This notification is done in the upcall context of the process 23362306a36Sopenharmony_ci P. When the message is on the pending queue, process P cannot proceed 23462306a36Sopenharmony_ci in upcall. The (kernel mode) processing of P in the filesystem 23562306a36Sopenharmony_ci request routine must be suspended until Venus has replied. Therefore 23662306a36Sopenharmony_ci the calling thread in P is blocked in upcall. A pointer in the 23762306a36Sopenharmony_ci message structure will locate the synchronization object on which P is 23862306a36Sopenharmony_ci sleeping. 23962306a36Sopenharmony_ci 24062306a36Sopenharmony_ci Venus detects the notification that a message has arrived, and the FS 24162306a36Sopenharmony_ci driver allow Venus to retrieve the message with a getmsg_from_kernel 24262306a36Sopenharmony_ci call. This action finishes in the kernel by putting the message on the 24362306a36Sopenharmony_ci queue of processing messages and setting flags to READ. Venus is 24462306a36Sopenharmony_ci passed the contents of the data buffer. The getmsg_from_kernel call 24562306a36Sopenharmony_ci now returns and Venus processes the request. 24662306a36Sopenharmony_ci 24762306a36Sopenharmony_ci At some later point the FS driver receives a message from Venus, 24862306a36Sopenharmony_ci namely when Venus calls sendmsg_to_kernel. At this moment the Coda FS 24962306a36Sopenharmony_ci driver looks at the contents of the message and decides if: 25062306a36Sopenharmony_ci 25162306a36Sopenharmony_ci 25262306a36Sopenharmony_ci * the message is a reply for a suspended thread P. If so it removes 25362306a36Sopenharmony_ci the message from the processing queue and marks the message as 25462306a36Sopenharmony_ci WRITTEN. Finally, the FS driver unblocks P (still in the kernel 25562306a36Sopenharmony_ci mode context of Venus) and the sendmsg_to_kernel call returns to 25662306a36Sopenharmony_ci Venus. The process P will be scheduled at some point and continues 25762306a36Sopenharmony_ci processing its upcall with the data buffer replaced with the reply 25862306a36Sopenharmony_ci from Venus. 25962306a36Sopenharmony_ci 26062306a36Sopenharmony_ci * The message is a ``downcall``. A downcall is a request from Venus to 26162306a36Sopenharmony_ci the FS Driver. The FS driver processes the request immediately 26262306a36Sopenharmony_ci (usually a cache eviction or replacement) and when it finishes 26362306a36Sopenharmony_ci sendmsg_to_kernel returns. 26462306a36Sopenharmony_ci 26562306a36Sopenharmony_ci Now P awakes and continues processing upcall. There are some 26662306a36Sopenharmony_ci subtleties to take account of. First P will determine if it was woken 26762306a36Sopenharmony_ci up in upcall by a signal from some other source (for example an 26862306a36Sopenharmony_ci attempt to terminate P) or as is normally the case by Venus in its 26962306a36Sopenharmony_ci sendmsg_to_kernel call. In the normal case, the upcall routine will 27062306a36Sopenharmony_ci deallocate the message structure and return. The FS routine can proceed 27162306a36Sopenharmony_ci with its processing. 27262306a36Sopenharmony_ci 27362306a36Sopenharmony_ci 27462306a36Sopenharmony_ci **Sleeping and IPC arrangements** 27562306a36Sopenharmony_ci 27662306a36Sopenharmony_ci In case P is woken up by a signal and not by Venus, it will first look 27762306a36Sopenharmony_ci at the flags field. If the message is not yet READ, the process P can 27862306a36Sopenharmony_ci handle its signal without notifying Venus. If Venus has READ, and 27962306a36Sopenharmony_ci the request should not be processed, P can send Venus a signal message 28062306a36Sopenharmony_ci to indicate that it should disregard the previous message. Such 28162306a36Sopenharmony_ci signals are put in the queue at the head, and read first by Venus. If 28262306a36Sopenharmony_ci the message is already marked as WRITTEN it is too late to stop the 28362306a36Sopenharmony_ci processing. The VFS routine will now continue. (-- If a VFS request 28462306a36Sopenharmony_ci involves more than one upcall, this can lead to complicated state, an 28562306a36Sopenharmony_ci extra field "handle_signals" could be added in the message structure 28662306a36Sopenharmony_ci to indicate points of no return have been passed.--) 28762306a36Sopenharmony_ci 28862306a36Sopenharmony_ci 28962306a36Sopenharmony_ci 29062306a36Sopenharmony_ci3.1. Implementation details 29162306a36Sopenharmony_ci---------------------------- 29262306a36Sopenharmony_ci 29362306a36Sopenharmony_ci The Unix implementation of this mechanism has been through the 29462306a36Sopenharmony_ci implementation of a character device associated with Coda. Venus 29562306a36Sopenharmony_ci retrieves messages by doing a read on the device, replies are sent 29662306a36Sopenharmony_ci with a write and notification is through the select system call on the 29762306a36Sopenharmony_ci file descriptor for the device. The process P is kept waiting on an 29862306a36Sopenharmony_ci interruptible wait queue object. 29962306a36Sopenharmony_ci 30062306a36Sopenharmony_ci In Windows NT and the DPMI Windows 95 implementation a DeviceIoControl 30162306a36Sopenharmony_ci call is used. The DeviceIoControl call is designed to copy buffers 30262306a36Sopenharmony_ci from user memory to kernel memory with OPCODES. The sendmsg_to_kernel 30362306a36Sopenharmony_ci is issued as a synchronous call, while the getmsg_from_kernel call is 30462306a36Sopenharmony_ci asynchronous. Windows EventObjects are used for notification of 30562306a36Sopenharmony_ci message arrival. The process P is kept waiting on a KernelEvent 30662306a36Sopenharmony_ci object in NT and a semaphore in Windows 95. 30762306a36Sopenharmony_ci 30862306a36Sopenharmony_ci 30962306a36Sopenharmony_ci4. The interface at the call level 31062306a36Sopenharmony_ci=================================== 31162306a36Sopenharmony_ci 31262306a36Sopenharmony_ci 31362306a36Sopenharmony_ci This section describes the upcalls a Coda FS driver can make to Venus. 31462306a36Sopenharmony_ci Each of these upcalls make use of two structures: inputArgs and 31562306a36Sopenharmony_ci outputArgs. In pseudo BNF form the structures take the following 31662306a36Sopenharmony_ci form:: 31762306a36Sopenharmony_ci 31862306a36Sopenharmony_ci 31962306a36Sopenharmony_ci struct inputArgs { 32062306a36Sopenharmony_ci u_long opcode; 32162306a36Sopenharmony_ci u_long unique; /* Keep multiple outstanding msgs distinct */ 32262306a36Sopenharmony_ci u_short pid; /* Common to all */ 32362306a36Sopenharmony_ci u_short pgid; /* Common to all */ 32462306a36Sopenharmony_ci struct CodaCred cred; /* Common to all */ 32562306a36Sopenharmony_ci 32662306a36Sopenharmony_ci <union "in" of call dependent parts of inputArgs> 32762306a36Sopenharmony_ci }; 32862306a36Sopenharmony_ci 32962306a36Sopenharmony_ci struct outputArgs { 33062306a36Sopenharmony_ci u_long opcode; 33162306a36Sopenharmony_ci u_long unique; /* Keep multiple outstanding msgs distinct */ 33262306a36Sopenharmony_ci u_long result; 33362306a36Sopenharmony_ci 33462306a36Sopenharmony_ci <union "out" of call dependent parts of inputArgs> 33562306a36Sopenharmony_ci }; 33662306a36Sopenharmony_ci 33762306a36Sopenharmony_ci 33862306a36Sopenharmony_ci 33962306a36Sopenharmony_ci Before going on let us elucidate the role of the various fields. The 34062306a36Sopenharmony_ci inputArgs start with the opcode which defines the type of service 34162306a36Sopenharmony_ci requested from Venus. There are approximately 30 upcalls at present 34262306a36Sopenharmony_ci which we will discuss. The unique field labels the inputArg with a 34362306a36Sopenharmony_ci unique number which will identify the message uniquely. A process and 34462306a36Sopenharmony_ci process group id are passed. Finally the credentials of the caller 34562306a36Sopenharmony_ci are included. 34662306a36Sopenharmony_ci 34762306a36Sopenharmony_ci Before delving into the specific calls we need to discuss a variety of 34862306a36Sopenharmony_ci data structures shared by the kernel and Venus. 34962306a36Sopenharmony_ci 35062306a36Sopenharmony_ci 35162306a36Sopenharmony_ci 35262306a36Sopenharmony_ci 35362306a36Sopenharmony_ci4.1. Data structures shared by the kernel and Venus 35462306a36Sopenharmony_ci---------------------------------------------------- 35562306a36Sopenharmony_ci 35662306a36Sopenharmony_ci 35762306a36Sopenharmony_ci The CodaCred structure defines a variety of user and group ids as 35862306a36Sopenharmony_ci they are set for the calling process. The vuid_t and vgid_t are 32 bit 35962306a36Sopenharmony_ci unsigned integers. It also defines group membership in an array. On 36062306a36Sopenharmony_ci Unix the CodaCred has proven sufficient to implement good security 36162306a36Sopenharmony_ci semantics for Coda but the structure may have to undergo modification 36262306a36Sopenharmony_ci for the Windows environment when these mature:: 36362306a36Sopenharmony_ci 36462306a36Sopenharmony_ci struct CodaCred { 36562306a36Sopenharmony_ci vuid_t cr_uid, cr_euid, cr_suid, cr_fsuid; /* Real, effective, set, fs uid */ 36662306a36Sopenharmony_ci vgid_t cr_gid, cr_egid, cr_sgid, cr_fsgid; /* same for groups */ 36762306a36Sopenharmony_ci vgid_t cr_groups[NGROUPS]; /* Group membership for caller */ 36862306a36Sopenharmony_ci }; 36962306a36Sopenharmony_ci 37062306a36Sopenharmony_ci 37162306a36Sopenharmony_ci .. Note:: 37262306a36Sopenharmony_ci 37362306a36Sopenharmony_ci It is questionable if we need CodaCreds in Venus. Finally Venus 37462306a36Sopenharmony_ci doesn't know about groups, although it does create files with the 37562306a36Sopenharmony_ci default uid/gid. Perhaps the list of group membership is superfluous. 37662306a36Sopenharmony_ci 37762306a36Sopenharmony_ci 37862306a36Sopenharmony_ci The next item is the fundamental identifier used to identify Coda 37962306a36Sopenharmony_ci files, the ViceFid. A fid of a file uniquely defines a file or 38062306a36Sopenharmony_ci directory in the Coda filesystem within a cell [1]_:: 38162306a36Sopenharmony_ci 38262306a36Sopenharmony_ci typedef struct ViceFid { 38362306a36Sopenharmony_ci VolumeId Volume; 38462306a36Sopenharmony_ci VnodeId Vnode; 38562306a36Sopenharmony_ci Unique_t Unique; 38662306a36Sopenharmony_ci } ViceFid; 38762306a36Sopenharmony_ci 38862306a36Sopenharmony_ci .. [1] A cell is agroup of Coda servers acting under the aegis of a single 38962306a36Sopenharmony_ci system control machine or SCM. See the Coda Administration manual 39062306a36Sopenharmony_ci for a detailed description of the role of the SCM. 39162306a36Sopenharmony_ci 39262306a36Sopenharmony_ci Each of the constituent fields: VolumeId, VnodeId and Unique_t are 39362306a36Sopenharmony_ci unsigned 32 bit integers. We envisage that a further field will need 39462306a36Sopenharmony_ci to be prefixed to identify the Coda cell; this will probably take the 39562306a36Sopenharmony_ci form of a Ipv6 size IP address naming the Coda cell through DNS. 39662306a36Sopenharmony_ci 39762306a36Sopenharmony_ci The next important structure shared between Venus and the kernel is 39862306a36Sopenharmony_ci the attributes of the file. The following structure is used to 39962306a36Sopenharmony_ci exchange information. It has room for future extensions such as 40062306a36Sopenharmony_ci support for device files (currently not present in Coda):: 40162306a36Sopenharmony_ci 40262306a36Sopenharmony_ci 40362306a36Sopenharmony_ci struct coda_timespec { 40462306a36Sopenharmony_ci int64_t tv_sec; /* seconds */ 40562306a36Sopenharmony_ci long tv_nsec; /* nanoseconds */ 40662306a36Sopenharmony_ci }; 40762306a36Sopenharmony_ci 40862306a36Sopenharmony_ci struct coda_vattr { 40962306a36Sopenharmony_ci enum coda_vtype va_type; /* vnode type (for create) */ 41062306a36Sopenharmony_ci u_short va_mode; /* files access mode and type */ 41162306a36Sopenharmony_ci short va_nlink; /* number of references to file */ 41262306a36Sopenharmony_ci vuid_t va_uid; /* owner user id */ 41362306a36Sopenharmony_ci vgid_t va_gid; /* owner group id */ 41462306a36Sopenharmony_ci long va_fsid; /* file system id (dev for now) */ 41562306a36Sopenharmony_ci long va_fileid; /* file id */ 41662306a36Sopenharmony_ci u_quad_t va_size; /* file size in bytes */ 41762306a36Sopenharmony_ci long va_blocksize; /* blocksize preferred for i/o */ 41862306a36Sopenharmony_ci struct coda_timespec va_atime; /* time of last access */ 41962306a36Sopenharmony_ci struct coda_timespec va_mtime; /* time of last modification */ 42062306a36Sopenharmony_ci struct coda_timespec va_ctime; /* time file changed */ 42162306a36Sopenharmony_ci u_long va_gen; /* generation number of file */ 42262306a36Sopenharmony_ci u_long va_flags; /* flags defined for file */ 42362306a36Sopenharmony_ci dev_t va_rdev; /* device special file represents */ 42462306a36Sopenharmony_ci u_quad_t va_bytes; /* bytes of disk space held by file */ 42562306a36Sopenharmony_ci u_quad_t va_filerev; /* file modification number */ 42662306a36Sopenharmony_ci u_int va_vaflags; /* operations flags, see below */ 42762306a36Sopenharmony_ci long va_spare; /* remain quad aligned */ 42862306a36Sopenharmony_ci }; 42962306a36Sopenharmony_ci 43062306a36Sopenharmony_ci 43162306a36Sopenharmony_ci4.2. The pioctl interface 43262306a36Sopenharmony_ci-------------------------- 43362306a36Sopenharmony_ci 43462306a36Sopenharmony_ci 43562306a36Sopenharmony_ci Coda specific requests can be made by application through the pioctl 43662306a36Sopenharmony_ci interface. The pioctl is implemented as an ordinary ioctl on a 43762306a36Sopenharmony_ci fictitious file /coda/.CONTROL. The pioctl call opens this file, gets 43862306a36Sopenharmony_ci a file handle and makes the ioctl call. Finally it closes the file. 43962306a36Sopenharmony_ci 44062306a36Sopenharmony_ci The kernel involvement in this is limited to providing the facility to 44162306a36Sopenharmony_ci open and close and pass the ioctl message and to verify that a path in 44262306a36Sopenharmony_ci the pioctl data buffers is a file in a Coda filesystem. 44362306a36Sopenharmony_ci 44462306a36Sopenharmony_ci The kernel is handed a data packet of the form:: 44562306a36Sopenharmony_ci 44662306a36Sopenharmony_ci struct { 44762306a36Sopenharmony_ci const char *path; 44862306a36Sopenharmony_ci struct ViceIoctl vidata; 44962306a36Sopenharmony_ci int follow; 45062306a36Sopenharmony_ci } data; 45162306a36Sopenharmony_ci 45262306a36Sopenharmony_ci 45362306a36Sopenharmony_ci 45462306a36Sopenharmony_ci where:: 45562306a36Sopenharmony_ci 45662306a36Sopenharmony_ci 45762306a36Sopenharmony_ci struct ViceIoctl { 45862306a36Sopenharmony_ci caddr_t in, out; /* Data to be transferred in, or out */ 45962306a36Sopenharmony_ci short in_size; /* Size of input buffer <= 2K */ 46062306a36Sopenharmony_ci short out_size; /* Maximum size of output buffer, <= 2K */ 46162306a36Sopenharmony_ci }; 46262306a36Sopenharmony_ci 46362306a36Sopenharmony_ci 46462306a36Sopenharmony_ci 46562306a36Sopenharmony_ci The path must be a Coda file, otherwise the ioctl upcall will not be 46662306a36Sopenharmony_ci made. 46762306a36Sopenharmony_ci 46862306a36Sopenharmony_ci .. Note:: The data structures and code are a mess. We need to clean this up. 46962306a36Sopenharmony_ci 47062306a36Sopenharmony_ci 47162306a36Sopenharmony_ci**We now proceed to document the individual calls**: 47262306a36Sopenharmony_ci 47362306a36Sopenharmony_ci 47462306a36Sopenharmony_ci4.3. root 47562306a36Sopenharmony_ci---------- 47662306a36Sopenharmony_ci 47762306a36Sopenharmony_ci 47862306a36Sopenharmony_ci Arguments 47962306a36Sopenharmony_ci in 48062306a36Sopenharmony_ci 48162306a36Sopenharmony_ci empty 48262306a36Sopenharmony_ci 48362306a36Sopenharmony_ci out:: 48462306a36Sopenharmony_ci 48562306a36Sopenharmony_ci struct cfs_root_out { 48662306a36Sopenharmony_ci ViceFid VFid; 48762306a36Sopenharmony_ci } cfs_root; 48862306a36Sopenharmony_ci 48962306a36Sopenharmony_ci 49062306a36Sopenharmony_ci 49162306a36Sopenharmony_ci Description 49262306a36Sopenharmony_ci This call is made to Venus during the initialization of 49362306a36Sopenharmony_ci the Coda filesystem. If the result is zero, the cfs_root structure 49462306a36Sopenharmony_ci contains the ViceFid of the root of the Coda filesystem. If a non-zero 49562306a36Sopenharmony_ci result is generated, its value is a platform dependent error code 49662306a36Sopenharmony_ci indicating the difficulty Venus encountered in locating the root of 49762306a36Sopenharmony_ci the Coda filesystem. 49862306a36Sopenharmony_ci 49962306a36Sopenharmony_ci4.4. lookup 50062306a36Sopenharmony_ci------------ 50162306a36Sopenharmony_ci 50262306a36Sopenharmony_ci 50362306a36Sopenharmony_ci Summary 50462306a36Sopenharmony_ci Find the ViceFid and type of an object in a directory if it exists. 50562306a36Sopenharmony_ci 50662306a36Sopenharmony_ci Arguments 50762306a36Sopenharmony_ci in:: 50862306a36Sopenharmony_ci 50962306a36Sopenharmony_ci struct cfs_lookup_in { 51062306a36Sopenharmony_ci ViceFid VFid; 51162306a36Sopenharmony_ci char *name; /* Place holder for data. */ 51262306a36Sopenharmony_ci } cfs_lookup; 51362306a36Sopenharmony_ci 51462306a36Sopenharmony_ci 51562306a36Sopenharmony_ci 51662306a36Sopenharmony_ci out:: 51762306a36Sopenharmony_ci 51862306a36Sopenharmony_ci struct cfs_lookup_out { 51962306a36Sopenharmony_ci ViceFid VFid; 52062306a36Sopenharmony_ci int vtype; 52162306a36Sopenharmony_ci } cfs_lookup; 52262306a36Sopenharmony_ci 52362306a36Sopenharmony_ci 52462306a36Sopenharmony_ci 52562306a36Sopenharmony_ci Description 52662306a36Sopenharmony_ci This call is made to determine the ViceFid and filetype of 52762306a36Sopenharmony_ci a directory entry. The directory entry requested carries name 'name' 52862306a36Sopenharmony_ci and Venus will search the directory identified by cfs_lookup_in.VFid. 52962306a36Sopenharmony_ci The result may indicate that the name does not exist, or that 53062306a36Sopenharmony_ci difficulty was encountered in finding it (e.g. due to disconnection). 53162306a36Sopenharmony_ci If the result is zero, the field cfs_lookup_out.VFid contains the 53262306a36Sopenharmony_ci targets ViceFid and cfs_lookup_out.vtype the coda_vtype giving the 53362306a36Sopenharmony_ci type of object the name designates. 53462306a36Sopenharmony_ci 53562306a36Sopenharmony_ci The name of the object is an 8 bit character string of maximum length 53662306a36Sopenharmony_ci CFS_MAXNAMLEN, currently set to 256 (including a 0 terminator.) 53762306a36Sopenharmony_ci 53862306a36Sopenharmony_ci It is extremely important to realize that Venus bitwise ors the field 53962306a36Sopenharmony_ci cfs_lookup.vtype with CFS_NOCACHE to indicate that the object should 54062306a36Sopenharmony_ci not be put in the kernel name cache. 54162306a36Sopenharmony_ci 54262306a36Sopenharmony_ci .. Note:: 54362306a36Sopenharmony_ci 54462306a36Sopenharmony_ci The type of the vtype is currently wrong. It should be 54562306a36Sopenharmony_ci coda_vtype. Linux does not take note of CFS_NOCACHE. It should. 54662306a36Sopenharmony_ci 54762306a36Sopenharmony_ci 54862306a36Sopenharmony_ci4.5. getattr 54962306a36Sopenharmony_ci------------- 55062306a36Sopenharmony_ci 55162306a36Sopenharmony_ci 55262306a36Sopenharmony_ci Summary Get the attributes of a file. 55362306a36Sopenharmony_ci 55462306a36Sopenharmony_ci Arguments 55562306a36Sopenharmony_ci in:: 55662306a36Sopenharmony_ci 55762306a36Sopenharmony_ci struct cfs_getattr_in { 55862306a36Sopenharmony_ci ViceFid VFid; 55962306a36Sopenharmony_ci struct coda_vattr attr; /* XXXXX */ 56062306a36Sopenharmony_ci } cfs_getattr; 56162306a36Sopenharmony_ci 56262306a36Sopenharmony_ci 56362306a36Sopenharmony_ci 56462306a36Sopenharmony_ci out:: 56562306a36Sopenharmony_ci 56662306a36Sopenharmony_ci struct cfs_getattr_out { 56762306a36Sopenharmony_ci struct coda_vattr attr; 56862306a36Sopenharmony_ci } cfs_getattr; 56962306a36Sopenharmony_ci 57062306a36Sopenharmony_ci 57162306a36Sopenharmony_ci 57262306a36Sopenharmony_ci Description 57362306a36Sopenharmony_ci This call returns the attributes of the file identified by fid. 57462306a36Sopenharmony_ci 57562306a36Sopenharmony_ci Errors 57662306a36Sopenharmony_ci Errors can occur if the object with fid does not exist, is 57762306a36Sopenharmony_ci unaccessible or if the caller does not have permission to fetch 57862306a36Sopenharmony_ci attributes. 57962306a36Sopenharmony_ci 58062306a36Sopenharmony_ci .. Note:: 58162306a36Sopenharmony_ci 58262306a36Sopenharmony_ci Many kernel FS drivers (Linux, NT and Windows 95) need to acquire 58362306a36Sopenharmony_ci the attributes as well as the Fid for the instantiation of an internal 58462306a36Sopenharmony_ci "inode" or "FileHandle". A significant improvement in performance on 58562306a36Sopenharmony_ci such systems could be made by combining the lookup and getattr calls 58662306a36Sopenharmony_ci both at the Venus/kernel interaction level and at the RPC level. 58762306a36Sopenharmony_ci 58862306a36Sopenharmony_ci The vattr structure included in the input arguments is superfluous and 58962306a36Sopenharmony_ci should be removed. 59062306a36Sopenharmony_ci 59162306a36Sopenharmony_ci 59262306a36Sopenharmony_ci4.6. setattr 59362306a36Sopenharmony_ci------------- 59462306a36Sopenharmony_ci 59562306a36Sopenharmony_ci 59662306a36Sopenharmony_ci Summary 59762306a36Sopenharmony_ci Set the attributes of a file. 59862306a36Sopenharmony_ci 59962306a36Sopenharmony_ci Arguments 60062306a36Sopenharmony_ci in:: 60162306a36Sopenharmony_ci 60262306a36Sopenharmony_ci struct cfs_setattr_in { 60362306a36Sopenharmony_ci ViceFid VFid; 60462306a36Sopenharmony_ci struct coda_vattr attr; 60562306a36Sopenharmony_ci } cfs_setattr; 60662306a36Sopenharmony_ci 60762306a36Sopenharmony_ci 60862306a36Sopenharmony_ci 60962306a36Sopenharmony_ci 61062306a36Sopenharmony_ci out 61162306a36Sopenharmony_ci 61262306a36Sopenharmony_ci empty 61362306a36Sopenharmony_ci 61462306a36Sopenharmony_ci Description 61562306a36Sopenharmony_ci The structure attr is filled with attributes to be changed 61662306a36Sopenharmony_ci in BSD style. Attributes not to be changed are set to -1, apart from 61762306a36Sopenharmony_ci vtype which is set to VNON. Other are set to the value to be assigned. 61862306a36Sopenharmony_ci The only attributes which the FS driver may request to change are the 61962306a36Sopenharmony_ci mode, owner, groupid, atime, mtime and ctime. The return value 62062306a36Sopenharmony_ci indicates success or failure. 62162306a36Sopenharmony_ci 62262306a36Sopenharmony_ci Errors 62362306a36Sopenharmony_ci A variety of errors can occur. The object may not exist, may 62462306a36Sopenharmony_ci be inaccessible, or permission may not be granted by Venus. 62562306a36Sopenharmony_ci 62662306a36Sopenharmony_ci 62762306a36Sopenharmony_ci4.7. access 62862306a36Sopenharmony_ci------------ 62962306a36Sopenharmony_ci 63062306a36Sopenharmony_ci 63162306a36Sopenharmony_ci Arguments 63262306a36Sopenharmony_ci in:: 63362306a36Sopenharmony_ci 63462306a36Sopenharmony_ci struct cfs_access_in { 63562306a36Sopenharmony_ci ViceFid VFid; 63662306a36Sopenharmony_ci int flags; 63762306a36Sopenharmony_ci } cfs_access; 63862306a36Sopenharmony_ci 63962306a36Sopenharmony_ci 64062306a36Sopenharmony_ci 64162306a36Sopenharmony_ci out 64262306a36Sopenharmony_ci 64362306a36Sopenharmony_ci empty 64462306a36Sopenharmony_ci 64562306a36Sopenharmony_ci Description 64662306a36Sopenharmony_ci Verify if access to the object identified by VFid for 64762306a36Sopenharmony_ci operations described by flags is permitted. The result indicates if 64862306a36Sopenharmony_ci access will be granted. It is important to remember that Coda uses 64962306a36Sopenharmony_ci ACLs to enforce protection and that ultimately the servers, not the 65062306a36Sopenharmony_ci clients enforce the security of the system. The result of this call 65162306a36Sopenharmony_ci will depend on whether a token is held by the user. 65262306a36Sopenharmony_ci 65362306a36Sopenharmony_ci Errors 65462306a36Sopenharmony_ci The object may not exist, or the ACL describing the protection 65562306a36Sopenharmony_ci may not be accessible. 65662306a36Sopenharmony_ci 65762306a36Sopenharmony_ci 65862306a36Sopenharmony_ci4.8. create 65962306a36Sopenharmony_ci------------ 66062306a36Sopenharmony_ci 66162306a36Sopenharmony_ci 66262306a36Sopenharmony_ci Summary 66362306a36Sopenharmony_ci Invoked to create a file 66462306a36Sopenharmony_ci 66562306a36Sopenharmony_ci Arguments 66662306a36Sopenharmony_ci in:: 66762306a36Sopenharmony_ci 66862306a36Sopenharmony_ci struct cfs_create_in { 66962306a36Sopenharmony_ci ViceFid VFid; 67062306a36Sopenharmony_ci struct coda_vattr attr; 67162306a36Sopenharmony_ci int excl; 67262306a36Sopenharmony_ci int mode; 67362306a36Sopenharmony_ci char *name; /* Place holder for data. */ 67462306a36Sopenharmony_ci } cfs_create; 67562306a36Sopenharmony_ci 67662306a36Sopenharmony_ci 67762306a36Sopenharmony_ci 67862306a36Sopenharmony_ci 67962306a36Sopenharmony_ci out:: 68062306a36Sopenharmony_ci 68162306a36Sopenharmony_ci struct cfs_create_out { 68262306a36Sopenharmony_ci ViceFid VFid; 68362306a36Sopenharmony_ci struct coda_vattr attr; 68462306a36Sopenharmony_ci } cfs_create; 68562306a36Sopenharmony_ci 68662306a36Sopenharmony_ci 68762306a36Sopenharmony_ci 68862306a36Sopenharmony_ci Description 68962306a36Sopenharmony_ci This upcall is invoked to request creation of a file. 69062306a36Sopenharmony_ci The file will be created in the directory identified by VFid, its name 69162306a36Sopenharmony_ci will be name, and the mode will be mode. If excl is set an error will 69262306a36Sopenharmony_ci be returned if the file already exists. If the size field in attr is 69362306a36Sopenharmony_ci set to zero the file will be truncated. The uid and gid of the file 69462306a36Sopenharmony_ci are set by converting the CodaCred to a uid using a macro CRTOUID 69562306a36Sopenharmony_ci (this macro is platform dependent). Upon success the VFid and 69662306a36Sopenharmony_ci attributes of the file are returned. The Coda FS Driver will normally 69762306a36Sopenharmony_ci instantiate a vnode, inode or file handle at kernel level for the new 69862306a36Sopenharmony_ci object. 69962306a36Sopenharmony_ci 70062306a36Sopenharmony_ci 70162306a36Sopenharmony_ci Errors 70262306a36Sopenharmony_ci A variety of errors can occur. Permissions may be insufficient. 70362306a36Sopenharmony_ci If the object exists and is not a file the error EISDIR is returned 70462306a36Sopenharmony_ci under Unix. 70562306a36Sopenharmony_ci 70662306a36Sopenharmony_ci .. Note:: 70762306a36Sopenharmony_ci 70862306a36Sopenharmony_ci The packing of parameters is very inefficient and appears to 70962306a36Sopenharmony_ci indicate confusion between the system call creat and the VFS operation 71062306a36Sopenharmony_ci create. The VFS operation create is only called to create new objects. 71162306a36Sopenharmony_ci This create call differs from the Unix one in that it is not invoked 71262306a36Sopenharmony_ci to return a file descriptor. The truncate and exclusive options, 71362306a36Sopenharmony_ci together with the mode, could simply be part of the mode as it is 71462306a36Sopenharmony_ci under Unix. There should be no flags argument; this is used in open 71562306a36Sopenharmony_ci (2) to return a file descriptor for READ or WRITE mode. 71662306a36Sopenharmony_ci 71762306a36Sopenharmony_ci The attributes of the directory should be returned too, since the size 71862306a36Sopenharmony_ci and mtime changed. 71962306a36Sopenharmony_ci 72062306a36Sopenharmony_ci 72162306a36Sopenharmony_ci4.9. mkdir 72262306a36Sopenharmony_ci----------- 72362306a36Sopenharmony_ci 72462306a36Sopenharmony_ci 72562306a36Sopenharmony_ci Summary 72662306a36Sopenharmony_ci Create a new directory. 72762306a36Sopenharmony_ci 72862306a36Sopenharmony_ci Arguments 72962306a36Sopenharmony_ci in:: 73062306a36Sopenharmony_ci 73162306a36Sopenharmony_ci struct cfs_mkdir_in { 73262306a36Sopenharmony_ci ViceFid VFid; 73362306a36Sopenharmony_ci struct coda_vattr attr; 73462306a36Sopenharmony_ci char *name; /* Place holder for data. */ 73562306a36Sopenharmony_ci } cfs_mkdir; 73662306a36Sopenharmony_ci 73762306a36Sopenharmony_ci 73862306a36Sopenharmony_ci 73962306a36Sopenharmony_ci out:: 74062306a36Sopenharmony_ci 74162306a36Sopenharmony_ci struct cfs_mkdir_out { 74262306a36Sopenharmony_ci ViceFid VFid; 74362306a36Sopenharmony_ci struct coda_vattr attr; 74462306a36Sopenharmony_ci } cfs_mkdir; 74562306a36Sopenharmony_ci 74662306a36Sopenharmony_ci 74762306a36Sopenharmony_ci 74862306a36Sopenharmony_ci 74962306a36Sopenharmony_ci Description 75062306a36Sopenharmony_ci This call is similar to create but creates a directory. 75162306a36Sopenharmony_ci Only the mode field in the input parameters is used for creation. 75262306a36Sopenharmony_ci Upon successful creation, the attr returned contains the attributes of 75362306a36Sopenharmony_ci the new directory. 75462306a36Sopenharmony_ci 75562306a36Sopenharmony_ci Errors 75662306a36Sopenharmony_ci As for create. 75762306a36Sopenharmony_ci 75862306a36Sopenharmony_ci .. Note:: 75962306a36Sopenharmony_ci 76062306a36Sopenharmony_ci The input parameter should be changed to mode instead of 76162306a36Sopenharmony_ci attributes. 76262306a36Sopenharmony_ci 76362306a36Sopenharmony_ci The attributes of the parent should be returned since the size and 76462306a36Sopenharmony_ci mtime changes. 76562306a36Sopenharmony_ci 76662306a36Sopenharmony_ci 76762306a36Sopenharmony_ci4.10. link 76862306a36Sopenharmony_ci----------- 76962306a36Sopenharmony_ci 77062306a36Sopenharmony_ci 77162306a36Sopenharmony_ci Summary 77262306a36Sopenharmony_ci Create a link to an existing file. 77362306a36Sopenharmony_ci 77462306a36Sopenharmony_ci Arguments 77562306a36Sopenharmony_ci in:: 77662306a36Sopenharmony_ci 77762306a36Sopenharmony_ci struct cfs_link_in { 77862306a36Sopenharmony_ci ViceFid sourceFid; /* cnode to link *to* */ 77962306a36Sopenharmony_ci ViceFid destFid; /* Directory in which to place link */ 78062306a36Sopenharmony_ci char *tname; /* Place holder for data. */ 78162306a36Sopenharmony_ci } cfs_link; 78262306a36Sopenharmony_ci 78362306a36Sopenharmony_ci 78462306a36Sopenharmony_ci 78562306a36Sopenharmony_ci out 78662306a36Sopenharmony_ci 78762306a36Sopenharmony_ci empty 78862306a36Sopenharmony_ci 78962306a36Sopenharmony_ci Description 79062306a36Sopenharmony_ci This call creates a link to the sourceFid in the directory 79162306a36Sopenharmony_ci identified by destFid with name tname. The source must reside in the 79262306a36Sopenharmony_ci target's parent, i.e. the source must be have parent destFid, i.e. Coda 79362306a36Sopenharmony_ci does not support cross directory hard links. Only the return value is 79462306a36Sopenharmony_ci relevant. It indicates success or the type of failure. 79562306a36Sopenharmony_ci 79662306a36Sopenharmony_ci Errors 79762306a36Sopenharmony_ci The usual errors can occur. 79862306a36Sopenharmony_ci 79962306a36Sopenharmony_ci 80062306a36Sopenharmony_ci4.11. symlink 80162306a36Sopenharmony_ci-------------- 80262306a36Sopenharmony_ci 80362306a36Sopenharmony_ci 80462306a36Sopenharmony_ci Summary 80562306a36Sopenharmony_ci create a symbolic link 80662306a36Sopenharmony_ci 80762306a36Sopenharmony_ci Arguments 80862306a36Sopenharmony_ci in:: 80962306a36Sopenharmony_ci 81062306a36Sopenharmony_ci struct cfs_symlink_in { 81162306a36Sopenharmony_ci ViceFid VFid; /* Directory to put symlink in */ 81262306a36Sopenharmony_ci char *srcname; 81362306a36Sopenharmony_ci struct coda_vattr attr; 81462306a36Sopenharmony_ci char *tname; 81562306a36Sopenharmony_ci } cfs_symlink; 81662306a36Sopenharmony_ci 81762306a36Sopenharmony_ci 81862306a36Sopenharmony_ci 81962306a36Sopenharmony_ci out 82062306a36Sopenharmony_ci 82162306a36Sopenharmony_ci none 82262306a36Sopenharmony_ci 82362306a36Sopenharmony_ci Description 82462306a36Sopenharmony_ci Create a symbolic link. The link is to be placed in the 82562306a36Sopenharmony_ci directory identified by VFid and named tname. It should point to the 82662306a36Sopenharmony_ci pathname srcname. The attributes of the newly created object are to 82762306a36Sopenharmony_ci be set to attr. 82862306a36Sopenharmony_ci 82962306a36Sopenharmony_ci .. Note:: 83062306a36Sopenharmony_ci 83162306a36Sopenharmony_ci The attributes of the target directory should be returned since 83262306a36Sopenharmony_ci its size changed. 83362306a36Sopenharmony_ci 83462306a36Sopenharmony_ci 83562306a36Sopenharmony_ci4.12. remove 83662306a36Sopenharmony_ci------------- 83762306a36Sopenharmony_ci 83862306a36Sopenharmony_ci 83962306a36Sopenharmony_ci Summary 84062306a36Sopenharmony_ci Remove a file 84162306a36Sopenharmony_ci 84262306a36Sopenharmony_ci Arguments 84362306a36Sopenharmony_ci in:: 84462306a36Sopenharmony_ci 84562306a36Sopenharmony_ci struct cfs_remove_in { 84662306a36Sopenharmony_ci ViceFid VFid; 84762306a36Sopenharmony_ci char *name; /* Place holder for data. */ 84862306a36Sopenharmony_ci } cfs_remove; 84962306a36Sopenharmony_ci 85062306a36Sopenharmony_ci 85162306a36Sopenharmony_ci 85262306a36Sopenharmony_ci out 85362306a36Sopenharmony_ci 85462306a36Sopenharmony_ci none 85562306a36Sopenharmony_ci 85662306a36Sopenharmony_ci Description 85762306a36Sopenharmony_ci Remove file named cfs_remove_in.name in directory 85862306a36Sopenharmony_ci identified by VFid. 85962306a36Sopenharmony_ci 86062306a36Sopenharmony_ci 86162306a36Sopenharmony_ci .. Note:: 86262306a36Sopenharmony_ci 86362306a36Sopenharmony_ci The attributes of the directory should be returned since its 86462306a36Sopenharmony_ci mtime and size may change. 86562306a36Sopenharmony_ci 86662306a36Sopenharmony_ci 86762306a36Sopenharmony_ci4.13. rmdir 86862306a36Sopenharmony_ci------------ 86962306a36Sopenharmony_ci 87062306a36Sopenharmony_ci 87162306a36Sopenharmony_ci Summary 87262306a36Sopenharmony_ci Remove a directory 87362306a36Sopenharmony_ci 87462306a36Sopenharmony_ci Arguments 87562306a36Sopenharmony_ci in:: 87662306a36Sopenharmony_ci 87762306a36Sopenharmony_ci struct cfs_rmdir_in { 87862306a36Sopenharmony_ci ViceFid VFid; 87962306a36Sopenharmony_ci char *name; /* Place holder for data. */ 88062306a36Sopenharmony_ci } cfs_rmdir; 88162306a36Sopenharmony_ci 88262306a36Sopenharmony_ci 88362306a36Sopenharmony_ci 88462306a36Sopenharmony_ci out 88562306a36Sopenharmony_ci 88662306a36Sopenharmony_ci none 88762306a36Sopenharmony_ci 88862306a36Sopenharmony_ci Description 88962306a36Sopenharmony_ci Remove the directory with name 'name' from the directory 89062306a36Sopenharmony_ci identified by VFid. 89162306a36Sopenharmony_ci 89262306a36Sopenharmony_ci .. Note:: The attributes of the parent directory should be returned since 89362306a36Sopenharmony_ci its mtime and size may change. 89462306a36Sopenharmony_ci 89562306a36Sopenharmony_ci 89662306a36Sopenharmony_ci4.14. readlink 89762306a36Sopenharmony_ci--------------- 89862306a36Sopenharmony_ci 89962306a36Sopenharmony_ci 90062306a36Sopenharmony_ci Summary 90162306a36Sopenharmony_ci Read the value of a symbolic link. 90262306a36Sopenharmony_ci 90362306a36Sopenharmony_ci Arguments 90462306a36Sopenharmony_ci in:: 90562306a36Sopenharmony_ci 90662306a36Sopenharmony_ci struct cfs_readlink_in { 90762306a36Sopenharmony_ci ViceFid VFid; 90862306a36Sopenharmony_ci } cfs_readlink; 90962306a36Sopenharmony_ci 91062306a36Sopenharmony_ci 91162306a36Sopenharmony_ci 91262306a36Sopenharmony_ci out:: 91362306a36Sopenharmony_ci 91462306a36Sopenharmony_ci struct cfs_readlink_out { 91562306a36Sopenharmony_ci int count; 91662306a36Sopenharmony_ci caddr_t data; /* Place holder for data. */ 91762306a36Sopenharmony_ci } cfs_readlink; 91862306a36Sopenharmony_ci 91962306a36Sopenharmony_ci 92062306a36Sopenharmony_ci 92162306a36Sopenharmony_ci Description 92262306a36Sopenharmony_ci This routine reads the contents of symbolic link 92362306a36Sopenharmony_ci identified by VFid into the buffer data. The buffer data must be able 92462306a36Sopenharmony_ci to hold any name up to CFS_MAXNAMLEN (PATH or NAM??). 92562306a36Sopenharmony_ci 92662306a36Sopenharmony_ci Errors 92762306a36Sopenharmony_ci No unusual errors. 92862306a36Sopenharmony_ci 92962306a36Sopenharmony_ci 93062306a36Sopenharmony_ci4.15. open 93162306a36Sopenharmony_ci----------- 93262306a36Sopenharmony_ci 93362306a36Sopenharmony_ci 93462306a36Sopenharmony_ci Summary 93562306a36Sopenharmony_ci Open a file. 93662306a36Sopenharmony_ci 93762306a36Sopenharmony_ci Arguments 93862306a36Sopenharmony_ci in:: 93962306a36Sopenharmony_ci 94062306a36Sopenharmony_ci struct cfs_open_in { 94162306a36Sopenharmony_ci ViceFid VFid; 94262306a36Sopenharmony_ci int flags; 94362306a36Sopenharmony_ci } cfs_open; 94462306a36Sopenharmony_ci 94562306a36Sopenharmony_ci 94662306a36Sopenharmony_ci 94762306a36Sopenharmony_ci out:: 94862306a36Sopenharmony_ci 94962306a36Sopenharmony_ci struct cfs_open_out { 95062306a36Sopenharmony_ci dev_t dev; 95162306a36Sopenharmony_ci ino_t inode; 95262306a36Sopenharmony_ci } cfs_open; 95362306a36Sopenharmony_ci 95462306a36Sopenharmony_ci 95562306a36Sopenharmony_ci 95662306a36Sopenharmony_ci Description 95762306a36Sopenharmony_ci This request asks Venus to place the file identified by 95862306a36Sopenharmony_ci VFid in its cache and to note that the calling process wishes to open 95962306a36Sopenharmony_ci it with flags as in open(2). The return value to the kernel differs 96062306a36Sopenharmony_ci for Unix and Windows systems. For Unix systems the Coda FS Driver is 96162306a36Sopenharmony_ci informed of the device and inode number of the container file in the 96262306a36Sopenharmony_ci fields dev and inode. For Windows the path of the container file is 96362306a36Sopenharmony_ci returned to the kernel. 96462306a36Sopenharmony_ci 96562306a36Sopenharmony_ci 96662306a36Sopenharmony_ci .. Note:: 96762306a36Sopenharmony_ci 96862306a36Sopenharmony_ci Currently the cfs_open_out structure is not properly adapted to 96962306a36Sopenharmony_ci deal with the Windows case. It might be best to implement two 97062306a36Sopenharmony_ci upcalls, one to open aiming at a container file name, the other at a 97162306a36Sopenharmony_ci container file inode. 97262306a36Sopenharmony_ci 97362306a36Sopenharmony_ci 97462306a36Sopenharmony_ci4.16. close 97562306a36Sopenharmony_ci------------ 97662306a36Sopenharmony_ci 97762306a36Sopenharmony_ci 97862306a36Sopenharmony_ci Summary 97962306a36Sopenharmony_ci Close a file, update it on the servers. 98062306a36Sopenharmony_ci 98162306a36Sopenharmony_ci Arguments 98262306a36Sopenharmony_ci in:: 98362306a36Sopenharmony_ci 98462306a36Sopenharmony_ci struct cfs_close_in { 98562306a36Sopenharmony_ci ViceFid VFid; 98662306a36Sopenharmony_ci int flags; 98762306a36Sopenharmony_ci } cfs_close; 98862306a36Sopenharmony_ci 98962306a36Sopenharmony_ci 99062306a36Sopenharmony_ci 99162306a36Sopenharmony_ci out 99262306a36Sopenharmony_ci 99362306a36Sopenharmony_ci none 99462306a36Sopenharmony_ci 99562306a36Sopenharmony_ci Description 99662306a36Sopenharmony_ci Close the file identified by VFid. 99762306a36Sopenharmony_ci 99862306a36Sopenharmony_ci .. Note:: 99962306a36Sopenharmony_ci 100062306a36Sopenharmony_ci The flags argument is bogus and not used. However, Venus' code 100162306a36Sopenharmony_ci has room to deal with an execp input field, probably this field should 100262306a36Sopenharmony_ci be used to inform Venus that the file was closed but is still memory 100362306a36Sopenharmony_ci mapped for execution. There are comments about fetching versus not 100462306a36Sopenharmony_ci fetching the data in Venus vproc_vfscalls. This seems silly. If a 100562306a36Sopenharmony_ci file is being closed, the data in the container file is to be the new 100662306a36Sopenharmony_ci data. Here again the execp flag might be in play to create confusion: 100762306a36Sopenharmony_ci currently Venus might think a file can be flushed from the cache when 100862306a36Sopenharmony_ci it is still memory mapped. This needs to be understood. 100962306a36Sopenharmony_ci 101062306a36Sopenharmony_ci 101162306a36Sopenharmony_ci4.17. ioctl 101262306a36Sopenharmony_ci------------ 101362306a36Sopenharmony_ci 101462306a36Sopenharmony_ci 101562306a36Sopenharmony_ci Summary 101662306a36Sopenharmony_ci Do an ioctl on a file. This includes the pioctl interface. 101762306a36Sopenharmony_ci 101862306a36Sopenharmony_ci Arguments 101962306a36Sopenharmony_ci in:: 102062306a36Sopenharmony_ci 102162306a36Sopenharmony_ci struct cfs_ioctl_in { 102262306a36Sopenharmony_ci ViceFid VFid; 102362306a36Sopenharmony_ci int cmd; 102462306a36Sopenharmony_ci int len; 102562306a36Sopenharmony_ci int rwflag; 102662306a36Sopenharmony_ci char *data; /* Place holder for data. */ 102762306a36Sopenharmony_ci } cfs_ioctl; 102862306a36Sopenharmony_ci 102962306a36Sopenharmony_ci 103062306a36Sopenharmony_ci 103162306a36Sopenharmony_ci out:: 103262306a36Sopenharmony_ci 103362306a36Sopenharmony_ci 103462306a36Sopenharmony_ci struct cfs_ioctl_out { 103562306a36Sopenharmony_ci int len; 103662306a36Sopenharmony_ci caddr_t data; /* Place holder for data. */ 103762306a36Sopenharmony_ci } cfs_ioctl; 103862306a36Sopenharmony_ci 103962306a36Sopenharmony_ci 104062306a36Sopenharmony_ci 104162306a36Sopenharmony_ci Description 104262306a36Sopenharmony_ci Do an ioctl operation on a file. The command, len and 104362306a36Sopenharmony_ci data arguments are filled as usual. flags is not used by Venus. 104462306a36Sopenharmony_ci 104562306a36Sopenharmony_ci .. Note:: 104662306a36Sopenharmony_ci 104762306a36Sopenharmony_ci Another bogus parameter. flags is not used. What is the 104862306a36Sopenharmony_ci business about PREFETCHING in the Venus code? 104962306a36Sopenharmony_ci 105062306a36Sopenharmony_ci 105162306a36Sopenharmony_ci 105262306a36Sopenharmony_ci4.18. rename 105362306a36Sopenharmony_ci------------- 105462306a36Sopenharmony_ci 105562306a36Sopenharmony_ci 105662306a36Sopenharmony_ci Summary 105762306a36Sopenharmony_ci Rename a fid. 105862306a36Sopenharmony_ci 105962306a36Sopenharmony_ci Arguments 106062306a36Sopenharmony_ci in:: 106162306a36Sopenharmony_ci 106262306a36Sopenharmony_ci struct cfs_rename_in { 106362306a36Sopenharmony_ci ViceFid sourceFid; 106462306a36Sopenharmony_ci char *srcname; 106562306a36Sopenharmony_ci ViceFid destFid; 106662306a36Sopenharmony_ci char *destname; 106762306a36Sopenharmony_ci } cfs_rename; 106862306a36Sopenharmony_ci 106962306a36Sopenharmony_ci 107062306a36Sopenharmony_ci 107162306a36Sopenharmony_ci out 107262306a36Sopenharmony_ci 107362306a36Sopenharmony_ci none 107462306a36Sopenharmony_ci 107562306a36Sopenharmony_ci Description 107662306a36Sopenharmony_ci Rename the object with name srcname in directory 107762306a36Sopenharmony_ci sourceFid to destname in destFid. It is important that the names 107862306a36Sopenharmony_ci srcname and destname are 0 terminated strings. Strings in Unix 107962306a36Sopenharmony_ci kernels are not always null terminated. 108062306a36Sopenharmony_ci 108162306a36Sopenharmony_ci 108262306a36Sopenharmony_ci4.19. readdir 108362306a36Sopenharmony_ci-------------- 108462306a36Sopenharmony_ci 108562306a36Sopenharmony_ci 108662306a36Sopenharmony_ci Summary 108762306a36Sopenharmony_ci Read directory entries. 108862306a36Sopenharmony_ci 108962306a36Sopenharmony_ci Arguments 109062306a36Sopenharmony_ci in:: 109162306a36Sopenharmony_ci 109262306a36Sopenharmony_ci struct cfs_readdir_in { 109362306a36Sopenharmony_ci ViceFid VFid; 109462306a36Sopenharmony_ci int count; 109562306a36Sopenharmony_ci int offset; 109662306a36Sopenharmony_ci } cfs_readdir; 109762306a36Sopenharmony_ci 109862306a36Sopenharmony_ci 109962306a36Sopenharmony_ci 110062306a36Sopenharmony_ci 110162306a36Sopenharmony_ci out:: 110262306a36Sopenharmony_ci 110362306a36Sopenharmony_ci struct cfs_readdir_out { 110462306a36Sopenharmony_ci int size; 110562306a36Sopenharmony_ci caddr_t data; /* Place holder for data. */ 110662306a36Sopenharmony_ci } cfs_readdir; 110762306a36Sopenharmony_ci 110862306a36Sopenharmony_ci 110962306a36Sopenharmony_ci 111062306a36Sopenharmony_ci Description 111162306a36Sopenharmony_ci Read directory entries from VFid starting at offset and 111262306a36Sopenharmony_ci read at most count bytes. Returns the data in data and returns 111362306a36Sopenharmony_ci the size in size. 111462306a36Sopenharmony_ci 111562306a36Sopenharmony_ci 111662306a36Sopenharmony_ci .. Note:: 111762306a36Sopenharmony_ci 111862306a36Sopenharmony_ci This call is not used. Readdir operations exploit container 111962306a36Sopenharmony_ci files. We will re-evaluate this during the directory revamp which is 112062306a36Sopenharmony_ci about to take place. 112162306a36Sopenharmony_ci 112262306a36Sopenharmony_ci 112362306a36Sopenharmony_ci4.20. vget 112462306a36Sopenharmony_ci----------- 112562306a36Sopenharmony_ci 112662306a36Sopenharmony_ci 112762306a36Sopenharmony_ci Summary 112862306a36Sopenharmony_ci instructs Venus to do an FSDB->Get. 112962306a36Sopenharmony_ci 113062306a36Sopenharmony_ci Arguments 113162306a36Sopenharmony_ci in:: 113262306a36Sopenharmony_ci 113362306a36Sopenharmony_ci struct cfs_vget_in { 113462306a36Sopenharmony_ci ViceFid VFid; 113562306a36Sopenharmony_ci } cfs_vget; 113662306a36Sopenharmony_ci 113762306a36Sopenharmony_ci 113862306a36Sopenharmony_ci 113962306a36Sopenharmony_ci out:: 114062306a36Sopenharmony_ci 114162306a36Sopenharmony_ci struct cfs_vget_out { 114262306a36Sopenharmony_ci ViceFid VFid; 114362306a36Sopenharmony_ci int vtype; 114462306a36Sopenharmony_ci } cfs_vget; 114562306a36Sopenharmony_ci 114662306a36Sopenharmony_ci 114762306a36Sopenharmony_ci 114862306a36Sopenharmony_ci Description 114962306a36Sopenharmony_ci This upcall asks Venus to do a get operation on an fsobj 115062306a36Sopenharmony_ci labelled by VFid. 115162306a36Sopenharmony_ci 115262306a36Sopenharmony_ci .. Note:: 115362306a36Sopenharmony_ci 115462306a36Sopenharmony_ci This operation is not used. However, it is extremely useful 115562306a36Sopenharmony_ci since it can be used to deal with read/write memory mapped files. 115662306a36Sopenharmony_ci These can be "pinned" in the Venus cache using vget and released with 115762306a36Sopenharmony_ci inactive. 115862306a36Sopenharmony_ci 115962306a36Sopenharmony_ci 116062306a36Sopenharmony_ci4.21. fsync 116162306a36Sopenharmony_ci------------ 116262306a36Sopenharmony_ci 116362306a36Sopenharmony_ci 116462306a36Sopenharmony_ci Summary 116562306a36Sopenharmony_ci Tell Venus to update the RVM attributes of a file. 116662306a36Sopenharmony_ci 116762306a36Sopenharmony_ci Arguments 116862306a36Sopenharmony_ci in:: 116962306a36Sopenharmony_ci 117062306a36Sopenharmony_ci struct cfs_fsync_in { 117162306a36Sopenharmony_ci ViceFid VFid; 117262306a36Sopenharmony_ci } cfs_fsync; 117362306a36Sopenharmony_ci 117462306a36Sopenharmony_ci 117562306a36Sopenharmony_ci 117662306a36Sopenharmony_ci out 117762306a36Sopenharmony_ci 117862306a36Sopenharmony_ci none 117962306a36Sopenharmony_ci 118062306a36Sopenharmony_ci Description 118162306a36Sopenharmony_ci Ask Venus to update RVM attributes of object VFid. This 118262306a36Sopenharmony_ci should be called as part of kernel level fsync type calls. The 118362306a36Sopenharmony_ci result indicates if the syncing was successful. 118462306a36Sopenharmony_ci 118562306a36Sopenharmony_ci .. Note:: Linux does not implement this call. It should. 118662306a36Sopenharmony_ci 118762306a36Sopenharmony_ci 118862306a36Sopenharmony_ci4.22. inactive 118962306a36Sopenharmony_ci--------------- 119062306a36Sopenharmony_ci 119162306a36Sopenharmony_ci 119262306a36Sopenharmony_ci Summary 119362306a36Sopenharmony_ci Tell Venus a vnode is no longer in use. 119462306a36Sopenharmony_ci 119562306a36Sopenharmony_ci Arguments 119662306a36Sopenharmony_ci in:: 119762306a36Sopenharmony_ci 119862306a36Sopenharmony_ci struct cfs_inactive_in { 119962306a36Sopenharmony_ci ViceFid VFid; 120062306a36Sopenharmony_ci } cfs_inactive; 120162306a36Sopenharmony_ci 120262306a36Sopenharmony_ci 120362306a36Sopenharmony_ci 120462306a36Sopenharmony_ci out 120562306a36Sopenharmony_ci 120662306a36Sopenharmony_ci none 120762306a36Sopenharmony_ci 120862306a36Sopenharmony_ci Description 120962306a36Sopenharmony_ci This operation returns EOPNOTSUPP. 121062306a36Sopenharmony_ci 121162306a36Sopenharmony_ci .. Note:: This should perhaps be removed. 121262306a36Sopenharmony_ci 121362306a36Sopenharmony_ci 121462306a36Sopenharmony_ci4.23. rdwr 121562306a36Sopenharmony_ci----------- 121662306a36Sopenharmony_ci 121762306a36Sopenharmony_ci 121862306a36Sopenharmony_ci Summary 121962306a36Sopenharmony_ci Read or write from a file 122062306a36Sopenharmony_ci 122162306a36Sopenharmony_ci Arguments 122262306a36Sopenharmony_ci in:: 122362306a36Sopenharmony_ci 122462306a36Sopenharmony_ci struct cfs_rdwr_in { 122562306a36Sopenharmony_ci ViceFid VFid; 122662306a36Sopenharmony_ci int rwflag; 122762306a36Sopenharmony_ci int count; 122862306a36Sopenharmony_ci int offset; 122962306a36Sopenharmony_ci int ioflag; 123062306a36Sopenharmony_ci caddr_t data; /* Place holder for data. */ 123162306a36Sopenharmony_ci } cfs_rdwr; 123262306a36Sopenharmony_ci 123362306a36Sopenharmony_ci 123462306a36Sopenharmony_ci 123562306a36Sopenharmony_ci 123662306a36Sopenharmony_ci out:: 123762306a36Sopenharmony_ci 123862306a36Sopenharmony_ci struct cfs_rdwr_out { 123962306a36Sopenharmony_ci int rwflag; 124062306a36Sopenharmony_ci int count; 124162306a36Sopenharmony_ci caddr_t data; /* Place holder for data. */ 124262306a36Sopenharmony_ci } cfs_rdwr; 124362306a36Sopenharmony_ci 124462306a36Sopenharmony_ci 124562306a36Sopenharmony_ci 124662306a36Sopenharmony_ci Description 124762306a36Sopenharmony_ci This upcall asks Venus to read or write from a file. 124862306a36Sopenharmony_ci 124962306a36Sopenharmony_ci 125062306a36Sopenharmony_ci .. Note:: 125162306a36Sopenharmony_ci 125262306a36Sopenharmony_ci It should be removed since it is against the Coda philosophy that 125362306a36Sopenharmony_ci read/write operations never reach Venus. I have been told the 125462306a36Sopenharmony_ci operation does not work. It is not currently used. 125562306a36Sopenharmony_ci 125662306a36Sopenharmony_ci 125762306a36Sopenharmony_ci 125862306a36Sopenharmony_ci4.24. odymount 125962306a36Sopenharmony_ci--------------- 126062306a36Sopenharmony_ci 126162306a36Sopenharmony_ci 126262306a36Sopenharmony_ci Summary 126362306a36Sopenharmony_ci Allows mounting multiple Coda "filesystems" on one Unix mount point. 126462306a36Sopenharmony_ci 126562306a36Sopenharmony_ci Arguments 126662306a36Sopenharmony_ci in:: 126762306a36Sopenharmony_ci 126862306a36Sopenharmony_ci struct ody_mount_in { 126962306a36Sopenharmony_ci char *name; /* Place holder for data. */ 127062306a36Sopenharmony_ci } ody_mount; 127162306a36Sopenharmony_ci 127262306a36Sopenharmony_ci 127362306a36Sopenharmony_ci 127462306a36Sopenharmony_ci out:: 127562306a36Sopenharmony_ci 127662306a36Sopenharmony_ci struct ody_mount_out { 127762306a36Sopenharmony_ci ViceFid VFid; 127862306a36Sopenharmony_ci } ody_mount; 127962306a36Sopenharmony_ci 128062306a36Sopenharmony_ci 128162306a36Sopenharmony_ci 128262306a36Sopenharmony_ci Description 128362306a36Sopenharmony_ci Asks Venus to return the rootfid of a Coda system named 128462306a36Sopenharmony_ci name. The fid is returned in VFid. 128562306a36Sopenharmony_ci 128662306a36Sopenharmony_ci .. Note:: 128762306a36Sopenharmony_ci 128862306a36Sopenharmony_ci This call was used by David for dynamic sets. It should be 128962306a36Sopenharmony_ci removed since it causes a jungle of pointers in the VFS mounting area. 129062306a36Sopenharmony_ci It is not used by Coda proper. Call is not implemented by Venus. 129162306a36Sopenharmony_ci 129262306a36Sopenharmony_ci 129362306a36Sopenharmony_ci4.25. ody_lookup 129462306a36Sopenharmony_ci----------------- 129562306a36Sopenharmony_ci 129662306a36Sopenharmony_ci 129762306a36Sopenharmony_ci Summary 129862306a36Sopenharmony_ci Looks up something. 129962306a36Sopenharmony_ci 130062306a36Sopenharmony_ci Arguments 130162306a36Sopenharmony_ci in 130262306a36Sopenharmony_ci 130362306a36Sopenharmony_ci irrelevant 130462306a36Sopenharmony_ci 130562306a36Sopenharmony_ci 130662306a36Sopenharmony_ci out 130762306a36Sopenharmony_ci 130862306a36Sopenharmony_ci irrelevant 130962306a36Sopenharmony_ci 131062306a36Sopenharmony_ci 131162306a36Sopenharmony_ci .. Note:: Gut it. Call is not implemented by Venus. 131262306a36Sopenharmony_ci 131362306a36Sopenharmony_ci 131462306a36Sopenharmony_ci4.26. ody_expand 131562306a36Sopenharmony_ci----------------- 131662306a36Sopenharmony_ci 131762306a36Sopenharmony_ci 131862306a36Sopenharmony_ci Summary 131962306a36Sopenharmony_ci expands something in a dynamic set. 132062306a36Sopenharmony_ci 132162306a36Sopenharmony_ci Arguments 132262306a36Sopenharmony_ci in 132362306a36Sopenharmony_ci 132462306a36Sopenharmony_ci irrelevant 132562306a36Sopenharmony_ci 132662306a36Sopenharmony_ci out 132762306a36Sopenharmony_ci 132862306a36Sopenharmony_ci irrelevant 132962306a36Sopenharmony_ci 133062306a36Sopenharmony_ci .. Note:: Gut it. Call is not implemented by Venus. 133162306a36Sopenharmony_ci 133262306a36Sopenharmony_ci 133362306a36Sopenharmony_ci4.27. prefetch 133462306a36Sopenharmony_ci--------------- 133562306a36Sopenharmony_ci 133662306a36Sopenharmony_ci 133762306a36Sopenharmony_ci Summary 133862306a36Sopenharmony_ci Prefetch a dynamic set. 133962306a36Sopenharmony_ci 134062306a36Sopenharmony_ci Arguments 134162306a36Sopenharmony_ci 134262306a36Sopenharmony_ci in 134362306a36Sopenharmony_ci 134462306a36Sopenharmony_ci Not documented. 134562306a36Sopenharmony_ci 134662306a36Sopenharmony_ci out 134762306a36Sopenharmony_ci 134862306a36Sopenharmony_ci Not documented. 134962306a36Sopenharmony_ci 135062306a36Sopenharmony_ci Description 135162306a36Sopenharmony_ci Venus worker.cc has support for this call, although it is 135262306a36Sopenharmony_ci noted that it doesn't work. Not surprising, since the kernel does not 135362306a36Sopenharmony_ci have support for it. (ODY_PREFETCH is not a defined operation). 135462306a36Sopenharmony_ci 135562306a36Sopenharmony_ci 135662306a36Sopenharmony_ci .. Note:: Gut it. It isn't working and isn't used by Coda. 135762306a36Sopenharmony_ci 135862306a36Sopenharmony_ci 135962306a36Sopenharmony_ci 136062306a36Sopenharmony_ci4.28. signal 136162306a36Sopenharmony_ci------------- 136262306a36Sopenharmony_ci 136362306a36Sopenharmony_ci 136462306a36Sopenharmony_ci Summary 136562306a36Sopenharmony_ci Send Venus a signal about an upcall. 136662306a36Sopenharmony_ci 136762306a36Sopenharmony_ci Arguments 136862306a36Sopenharmony_ci in 136962306a36Sopenharmony_ci 137062306a36Sopenharmony_ci none 137162306a36Sopenharmony_ci 137262306a36Sopenharmony_ci out 137362306a36Sopenharmony_ci 137462306a36Sopenharmony_ci not applicable. 137562306a36Sopenharmony_ci 137662306a36Sopenharmony_ci Description 137762306a36Sopenharmony_ci This is an out-of-band upcall to Venus to inform Venus 137862306a36Sopenharmony_ci that the calling process received a signal after Venus read the 137962306a36Sopenharmony_ci message from the input queue. Venus is supposed to clean up the 138062306a36Sopenharmony_ci operation. 138162306a36Sopenharmony_ci 138262306a36Sopenharmony_ci Errors 138362306a36Sopenharmony_ci No reply is given. 138462306a36Sopenharmony_ci 138562306a36Sopenharmony_ci .. Note:: 138662306a36Sopenharmony_ci 138762306a36Sopenharmony_ci We need to better understand what Venus needs to clean up and if 138862306a36Sopenharmony_ci it is doing this correctly. Also we need to handle multiple upcall 138962306a36Sopenharmony_ci per system call situations correctly. It would be important to know 139062306a36Sopenharmony_ci what state changes in Venus take place after an upcall for which the 139162306a36Sopenharmony_ci kernel is responsible for notifying Venus to clean up (e.g. open 139262306a36Sopenharmony_ci definitely is such a state change, but many others are maybe not). 139362306a36Sopenharmony_ci 139462306a36Sopenharmony_ci 139562306a36Sopenharmony_ci5. The minicache and downcalls 139662306a36Sopenharmony_ci=============================== 139762306a36Sopenharmony_ci 139862306a36Sopenharmony_ci 139962306a36Sopenharmony_ci The Coda FS Driver can cache results of lookup and access upcalls, to 140062306a36Sopenharmony_ci limit the frequency of upcalls. Upcalls carry a price since a process 140162306a36Sopenharmony_ci context switch needs to take place. The counterpart of caching the 140262306a36Sopenharmony_ci information is that Venus will notify the FS Driver that cached 140362306a36Sopenharmony_ci entries must be flushed or renamed. 140462306a36Sopenharmony_ci 140562306a36Sopenharmony_ci The kernel code generally has to maintain a structure which links the 140662306a36Sopenharmony_ci internal file handles (called vnodes in BSD, inodes in Linux and 140762306a36Sopenharmony_ci FileHandles in Windows) with the ViceFid's which Venus maintains. The 140862306a36Sopenharmony_ci reason is that frequent translations back and forth are needed in 140962306a36Sopenharmony_ci order to make upcalls and use the results of upcalls. Such linking 141062306a36Sopenharmony_ci objects are called cnodes. 141162306a36Sopenharmony_ci 141262306a36Sopenharmony_ci The current minicache implementations have cache entries which record 141362306a36Sopenharmony_ci the following: 141462306a36Sopenharmony_ci 141562306a36Sopenharmony_ci 1. the name of the file 141662306a36Sopenharmony_ci 141762306a36Sopenharmony_ci 2. the cnode of the directory containing the object 141862306a36Sopenharmony_ci 141962306a36Sopenharmony_ci 3. a list of CodaCred's for which the lookup is permitted. 142062306a36Sopenharmony_ci 142162306a36Sopenharmony_ci 4. the cnode of the object 142262306a36Sopenharmony_ci 142362306a36Sopenharmony_ci The lookup call in the Coda FS Driver may request the cnode of the 142462306a36Sopenharmony_ci desired object from the cache, by passing its name, directory and the 142562306a36Sopenharmony_ci CodaCred's of the caller. The cache will return the cnode or indicate 142662306a36Sopenharmony_ci that it cannot be found. The Coda FS Driver must be careful to 142762306a36Sopenharmony_ci invalidate cache entries when it modifies or removes objects. 142862306a36Sopenharmony_ci 142962306a36Sopenharmony_ci When Venus obtains information that indicates that cache entries are 143062306a36Sopenharmony_ci no longer valid, it will make a downcall to the kernel. Downcalls are 143162306a36Sopenharmony_ci intercepted by the Coda FS Driver and lead to cache invalidations of 143262306a36Sopenharmony_ci the kind described below. The Coda FS Driver does not return an error 143362306a36Sopenharmony_ci unless the downcall data could not be read into kernel memory. 143462306a36Sopenharmony_ci 143562306a36Sopenharmony_ci 143662306a36Sopenharmony_ci5.1. INVALIDATE 143762306a36Sopenharmony_ci---------------- 143862306a36Sopenharmony_ci 143962306a36Sopenharmony_ci 144062306a36Sopenharmony_ci No information is available on this call. 144162306a36Sopenharmony_ci 144262306a36Sopenharmony_ci 144362306a36Sopenharmony_ci5.2. FLUSH 144462306a36Sopenharmony_ci----------- 144562306a36Sopenharmony_ci 144662306a36Sopenharmony_ci 144762306a36Sopenharmony_ci 144862306a36Sopenharmony_ci Arguments 144962306a36Sopenharmony_ci None 145062306a36Sopenharmony_ci 145162306a36Sopenharmony_ci Summary 145262306a36Sopenharmony_ci Flush the name cache entirely. 145362306a36Sopenharmony_ci 145462306a36Sopenharmony_ci Description 145562306a36Sopenharmony_ci Venus issues this call upon startup and when it dies. This 145662306a36Sopenharmony_ci is to prevent stale cache information being held. Some operating 145762306a36Sopenharmony_ci systems allow the kernel name cache to be switched off dynamically. 145862306a36Sopenharmony_ci When this is done, this downcall is made. 145962306a36Sopenharmony_ci 146062306a36Sopenharmony_ci 146162306a36Sopenharmony_ci5.3. PURGEUSER 146262306a36Sopenharmony_ci--------------- 146362306a36Sopenharmony_ci 146462306a36Sopenharmony_ci 146562306a36Sopenharmony_ci Arguments 146662306a36Sopenharmony_ci :: 146762306a36Sopenharmony_ci 146862306a36Sopenharmony_ci struct cfs_purgeuser_out {/* CFS_PURGEUSER is a venus->kernel call */ 146962306a36Sopenharmony_ci struct CodaCred cred; 147062306a36Sopenharmony_ci } cfs_purgeuser; 147162306a36Sopenharmony_ci 147262306a36Sopenharmony_ci 147362306a36Sopenharmony_ci 147462306a36Sopenharmony_ci Description 147562306a36Sopenharmony_ci Remove all entries in the cache carrying the Cred. This 147662306a36Sopenharmony_ci call is issued when tokens for a user expire or are flushed. 147762306a36Sopenharmony_ci 147862306a36Sopenharmony_ci 147962306a36Sopenharmony_ci5.4. ZAPFILE 148062306a36Sopenharmony_ci------------- 148162306a36Sopenharmony_ci 148262306a36Sopenharmony_ci 148362306a36Sopenharmony_ci Arguments 148462306a36Sopenharmony_ci :: 148562306a36Sopenharmony_ci 148662306a36Sopenharmony_ci struct cfs_zapfile_out { /* CFS_ZAPFILE is a venus->kernel call */ 148762306a36Sopenharmony_ci ViceFid CodaFid; 148862306a36Sopenharmony_ci } cfs_zapfile; 148962306a36Sopenharmony_ci 149062306a36Sopenharmony_ci 149162306a36Sopenharmony_ci 149262306a36Sopenharmony_ci Description 149362306a36Sopenharmony_ci Remove all entries which have the (dir vnode, name) pair. 149462306a36Sopenharmony_ci This is issued as a result of an invalidation of cached attributes of 149562306a36Sopenharmony_ci a vnode. 149662306a36Sopenharmony_ci 149762306a36Sopenharmony_ci .. Note:: 149862306a36Sopenharmony_ci 149962306a36Sopenharmony_ci Call is not named correctly in NetBSD and Mach. The minicache 150062306a36Sopenharmony_ci zapfile routine takes different arguments. Linux does not implement 150162306a36Sopenharmony_ci the invalidation of attributes correctly. 150262306a36Sopenharmony_ci 150362306a36Sopenharmony_ci 150462306a36Sopenharmony_ci 150562306a36Sopenharmony_ci5.5. ZAPDIR 150662306a36Sopenharmony_ci------------ 150762306a36Sopenharmony_ci 150862306a36Sopenharmony_ci 150962306a36Sopenharmony_ci Arguments 151062306a36Sopenharmony_ci :: 151162306a36Sopenharmony_ci 151262306a36Sopenharmony_ci struct cfs_zapdir_out { /* CFS_ZAPDIR is a venus->kernel call */ 151362306a36Sopenharmony_ci ViceFid CodaFid; 151462306a36Sopenharmony_ci } cfs_zapdir; 151562306a36Sopenharmony_ci 151662306a36Sopenharmony_ci 151762306a36Sopenharmony_ci 151862306a36Sopenharmony_ci Description 151962306a36Sopenharmony_ci Remove all entries in the cache lying in a directory 152062306a36Sopenharmony_ci CodaFid, and all children of this directory. This call is issued when 152162306a36Sopenharmony_ci Venus receives a callback on the directory. 152262306a36Sopenharmony_ci 152362306a36Sopenharmony_ci 152462306a36Sopenharmony_ci5.6. ZAPVNODE 152562306a36Sopenharmony_ci-------------- 152662306a36Sopenharmony_ci 152762306a36Sopenharmony_ci 152862306a36Sopenharmony_ci 152962306a36Sopenharmony_ci Arguments 153062306a36Sopenharmony_ci :: 153162306a36Sopenharmony_ci 153262306a36Sopenharmony_ci struct cfs_zapvnode_out { /* CFS_ZAPVNODE is a venus->kernel call */ 153362306a36Sopenharmony_ci struct CodaCred cred; 153462306a36Sopenharmony_ci ViceFid VFid; 153562306a36Sopenharmony_ci } cfs_zapvnode; 153662306a36Sopenharmony_ci 153762306a36Sopenharmony_ci 153862306a36Sopenharmony_ci 153962306a36Sopenharmony_ci Description 154062306a36Sopenharmony_ci Remove all entries in the cache carrying the cred and VFid 154162306a36Sopenharmony_ci as in the arguments. This downcall is probably never issued. 154262306a36Sopenharmony_ci 154362306a36Sopenharmony_ci 154462306a36Sopenharmony_ci5.7. PURGEFID 154562306a36Sopenharmony_ci-------------- 154662306a36Sopenharmony_ci 154762306a36Sopenharmony_ci 154862306a36Sopenharmony_ci Arguments 154962306a36Sopenharmony_ci :: 155062306a36Sopenharmony_ci 155162306a36Sopenharmony_ci struct cfs_purgefid_out { /* CFS_PURGEFID is a venus->kernel call */ 155262306a36Sopenharmony_ci ViceFid CodaFid; 155362306a36Sopenharmony_ci } cfs_purgefid; 155462306a36Sopenharmony_ci 155562306a36Sopenharmony_ci 155662306a36Sopenharmony_ci 155762306a36Sopenharmony_ci Description 155862306a36Sopenharmony_ci Flush the attribute for the file. If it is a dir (odd 155962306a36Sopenharmony_ci vnode), purge its children from the namecache and remove the file from the 156062306a36Sopenharmony_ci namecache. 156162306a36Sopenharmony_ci 156262306a36Sopenharmony_ci 156362306a36Sopenharmony_ci 156462306a36Sopenharmony_ci5.8. REPLACE 156562306a36Sopenharmony_ci------------- 156662306a36Sopenharmony_ci 156762306a36Sopenharmony_ci 156862306a36Sopenharmony_ci Summary 156962306a36Sopenharmony_ci Replace the Fid's for a collection of names. 157062306a36Sopenharmony_ci 157162306a36Sopenharmony_ci Arguments 157262306a36Sopenharmony_ci :: 157362306a36Sopenharmony_ci 157462306a36Sopenharmony_ci struct cfs_replace_out { /* cfs_replace is a venus->kernel call */ 157562306a36Sopenharmony_ci ViceFid NewFid; 157662306a36Sopenharmony_ci ViceFid OldFid; 157762306a36Sopenharmony_ci } cfs_replace; 157862306a36Sopenharmony_ci 157962306a36Sopenharmony_ci 158062306a36Sopenharmony_ci 158162306a36Sopenharmony_ci Description 158262306a36Sopenharmony_ci This routine replaces a ViceFid in the name cache with 158362306a36Sopenharmony_ci another. It is added to allow Venus during reintegration to replace 158462306a36Sopenharmony_ci locally allocated temp fids while disconnected with global fids even 158562306a36Sopenharmony_ci when the reference counts on those fids are not zero. 158662306a36Sopenharmony_ci 158762306a36Sopenharmony_ci 158862306a36Sopenharmony_ci6. Initialization and cleanup 158962306a36Sopenharmony_ci============================== 159062306a36Sopenharmony_ci 159162306a36Sopenharmony_ci 159262306a36Sopenharmony_ci This section gives brief hints as to desirable features for the Coda 159362306a36Sopenharmony_ci FS Driver at startup and upon shutdown or Venus failures. Before 159462306a36Sopenharmony_ci entering the discussion it is useful to repeat that the Coda FS Driver 159562306a36Sopenharmony_ci maintains the following data: 159662306a36Sopenharmony_ci 159762306a36Sopenharmony_ci 159862306a36Sopenharmony_ci 1. message queues 159962306a36Sopenharmony_ci 160062306a36Sopenharmony_ci 2. cnodes 160162306a36Sopenharmony_ci 160262306a36Sopenharmony_ci 3. name cache entries 160362306a36Sopenharmony_ci 160462306a36Sopenharmony_ci The name cache entries are entirely private to the driver, so they 160562306a36Sopenharmony_ci can easily be manipulated. The message queues will generally have 160662306a36Sopenharmony_ci clear points of initialization and destruction. The cnodes are 160762306a36Sopenharmony_ci much more delicate. User processes hold reference counts in Coda 160862306a36Sopenharmony_ci filesystems and it can be difficult to clean up the cnodes. 160962306a36Sopenharmony_ci 161062306a36Sopenharmony_ci It can expect requests through: 161162306a36Sopenharmony_ci 161262306a36Sopenharmony_ci 1. the message subsystem 161362306a36Sopenharmony_ci 161462306a36Sopenharmony_ci 2. the VFS layer 161562306a36Sopenharmony_ci 161662306a36Sopenharmony_ci 3. pioctl interface 161762306a36Sopenharmony_ci 161862306a36Sopenharmony_ci Currently the pioctl passes through the VFS for Coda so we can 161962306a36Sopenharmony_ci treat these similarly. 162062306a36Sopenharmony_ci 162162306a36Sopenharmony_ci 162262306a36Sopenharmony_ci6.1. Requirements 162362306a36Sopenharmony_ci------------------ 162462306a36Sopenharmony_ci 162562306a36Sopenharmony_ci 162662306a36Sopenharmony_ci The following requirements should be accommodated: 162762306a36Sopenharmony_ci 162862306a36Sopenharmony_ci 1. The message queues should have open and close routines. On Unix 162962306a36Sopenharmony_ci the opening of the character devices are such routines. 163062306a36Sopenharmony_ci 163162306a36Sopenharmony_ci - Before opening, no messages can be placed. 163262306a36Sopenharmony_ci 163362306a36Sopenharmony_ci - Opening will remove any old messages still pending. 163462306a36Sopenharmony_ci 163562306a36Sopenharmony_ci - Close will notify any sleeping processes that their upcall cannot 163662306a36Sopenharmony_ci be completed. 163762306a36Sopenharmony_ci 163862306a36Sopenharmony_ci - Close will free all memory allocated by the message queues. 163962306a36Sopenharmony_ci 164062306a36Sopenharmony_ci 164162306a36Sopenharmony_ci 2. At open the namecache shall be initialized to empty state. 164262306a36Sopenharmony_ci 164362306a36Sopenharmony_ci 3. Before the message queues are open, all VFS operations will fail. 164462306a36Sopenharmony_ci Fortunately this can be achieved by making sure than mounting the 164562306a36Sopenharmony_ci Coda filesystem cannot succeed before opening. 164662306a36Sopenharmony_ci 164762306a36Sopenharmony_ci 4. After closing of the queues, no VFS operations can succeed. Here 164862306a36Sopenharmony_ci one needs to be careful, since a few operations (lookup, 164962306a36Sopenharmony_ci read/write, readdir) can proceed without upcalls. These must be 165062306a36Sopenharmony_ci explicitly blocked. 165162306a36Sopenharmony_ci 165262306a36Sopenharmony_ci 5. Upon closing the namecache shall be flushed and disabled. 165362306a36Sopenharmony_ci 165462306a36Sopenharmony_ci 6. All memory held by cnodes can be freed without relying on upcalls. 165562306a36Sopenharmony_ci 165662306a36Sopenharmony_ci 7. Unmounting the file system can be done without relying on upcalls. 165762306a36Sopenharmony_ci 165862306a36Sopenharmony_ci 8. Mounting the Coda filesystem should fail gracefully if Venus cannot 165962306a36Sopenharmony_ci get the rootfid or the attributes of the rootfid. The latter is 166062306a36Sopenharmony_ci best implemented by Venus fetching these objects before attempting 166162306a36Sopenharmony_ci to mount. 166262306a36Sopenharmony_ci 166362306a36Sopenharmony_ci .. Note:: 166462306a36Sopenharmony_ci 166562306a36Sopenharmony_ci NetBSD in particular but also Linux have not implemented the 166662306a36Sopenharmony_ci above requirements fully. For smooth operation this needs to be 166762306a36Sopenharmony_ci corrected. 166862306a36Sopenharmony_ci 166962306a36Sopenharmony_ci 167062306a36Sopenharmony_ci 1671