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