Remove advertising header from share/
[dragonfly.git] / share / doc / papers / fsinterface / fsinterface.ms
1 .\" Copyright (c) 1986 The Regents of the University of California.
2 .\" All rights reserved.
3 .\"
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
6 .\" are met:
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\"    notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\"    notice, this list of conditions and the following disclaimer in the
11 .\"    documentation and/or other materials provided with the distribution.
12 .\" 3. Neither the name of the University nor the names of its contributors
13 .\"    may be used to endorse or promote products derived from this software
14 .\"    without specific prior written permission.
15 .\"
16 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 .\" SUCH DAMAGE.
27 .\"
28 .\"     @(#)fsinterface.ms      1.4 (Berkeley) 4/16/91
29 .\" $FreeBSD: src/share/doc/papers/fsinterface/fsinterface.ms,v 1.7.2.1 2000/11/27 18:18:15 ru Exp $
30 .\" $DragonFly: src/share/doc/papers/fsinterface/fsinterface.ms,v 1.2 2003/06/17 04:36:56 dillon Exp $
31 .\"
32 .nr UX 0
33 .de UX
34 .ie \\n(UX \s-1UNIX\s0\\$1
35 .el \{\
36 \s-1UNIX\s0\\$1\(dg
37 .FS
38 \(dg \s-1UNIX\s0 is a registered trademark of AT&T.
39 .FE
40 .nr UX 1
41 .\}
42 ..
43 .TL
44 Toward a Compatible Filesystem Interface
45 .AU
46 Michael J. Karels
47 Marshall Kirk McKusick
48 .AI
49 Computer Systems Research Group
50 Computer Science Division
51 Department of Electrical Engineering and Computer Science
52 University of California, Berkeley
53 Berkeley, California  94720
54 .AB
55 .LP
56 As network or remote filesystems have been implemented for
57 .UX ,
58 several stylized interfaces between the filesystem implementation
59 and the rest of the kernel have been developed.
60 .FS
61 This is an update of a paper originally presented
62 at the September 1986 conference of the European
63 .UX
64 Users' Group.
65 Last modified April 16, 1991.
66 .FE
67 Notable among these are Sun Microsystems' Virtual Filesystem interface (VFS)
68 using vnodes, Digital Equipment's Generic File System (GFS) architecture,
69 and AT&T's File System Switch (FSS).
70 Each design attempts to isolate filesystem-dependent details
71 below a generic interface and to provide a framework within which
72 new filesystems may be incorporated.
73 However, each of these interfaces is different from
74 and incompatible with the others.
75 Each of them addresses somewhat different design goals.
76 Each was based on a different starting version of
77 .UX ,
78 targetted a different set of filesystems with varying characteristics,
79 and uses a different set of primitive operations provided by the filesystem.
80 The current study compares the various filesystem interfaces.
81 Criteria for comparison include generality, completeness, robustness,
82 efficiency and esthetics.
83 Several of the underlying design issues are examined in detail.
84 As a result of this comparison, a proposal for a new filesystem interface
85 is advanced that includes the best features of the existing implementations.
86 The proposal adopts the calling convention for name lookup introduced
87 in 4.3BSD, but is otherwise closely related to Sun's VFS.
88 A prototype implementation is now being developed at Berkeley.
89 This proposal and the rationale underlying its development
90 have been presented to major software vendors
91 as an early step toward convergence on a compatible filesystem interface.
92 .AE
93 .NH
94 Introduction
95 .PP
96 As network communications and workstation environments
97 became common elements in
98 .UX
99 systems, several vendors of
100 .UX
101 systems have designed and built network file systems
102 that allow client process on one
103 .UX
104 machine to access files on a server machine.
105 Examples include Sun's Network File System, NFS [Sandberg85],
106 AT&T's recently-announced Remote File Sharing, RFS [Rifkin86],
107 the LOCUS distributed filesystem [Walker85],
108 and Masscomp's extended filesystem [Cole85].
109 Other remote filesystems have been implemented in research or university groups
110 for internal use, notably the network filesystem in the Eighth Edition
111 .UX
112 system [Weinberger84] and two different filesystems used at Carnegie-Mellon
113 University [Satyanarayanan85].
114 Numerous other remote file access methods have been devised for use
115 within individual
116 .UX
117 processes,
118 many of them by modifications to the C I/O library
119 similar to those in the Newcastle Connection [Brownbridge82].
120 .PP
121 Multiple network filesystems may frequently
122 be found in use within a single organization.
123 These circumstances make it highly desirable to be able to transport filesystem
124 implementations from one system to another.
125 Such portability is considerably enhanced by the use of a stylized interface
126 with carefully-defined entry points to separate the filesystem from the rest
127 of the operating system.
128 This interface should be similar to the interface between device drivers
129 and the kernel.
130 Although varying somewhat among the common versions of
131 .UX ,
132 the device driver interfaces are sufficiently similar that device drivers
133 may be moved from one system to another without major problems.
134 A clean, well-defined interface to the filesystem also allows a single
135 system to support multiple local filesystem types.
136 .PP
137 For reasons such as these, several filesystem interfaces have been used
138 when integrating new filesystems into the system.
139 The best-known of these are Sun Microsystems' Virtual File System interface,
140 VFS [Kleiman86], and AT&T's File System Switch, FSS.
141 Another interface, known as the Generic File System, GFS,
142 has been implemented for the ULTRIX\(dd
143 .FS
144 \(dd ULTRIX is a trademark of Digital Equipment Corp.
145 .FE
146 system by Digital [Rodriguez86].
147 There are numerous differences among these designs.
148 The differences may be understood from the varying philosophies
149 and design goals of the groups involved, from the systems under which
150 the implementations were done, and from the filesystems originally targetted
151 by the designs.
152 These differences are summarized in the following sections
153 within the limitations of the published specifications.
154 .NH
155 Design goals
156 .PP
157 There are several design goals which, in varying degrees,
158 have driven the various designs.
159 Each attempts to divide the filesystem into a filesystem-type-independent
160 layer and individual filesystem implementations.
161 The division between these layers occurs at somewhat different places
162 in these systems, reflecting different views of the diversity and types
163 of the filesystems that may be accommodated.
164 Compatibility with existing local filesystems has varying importance;
165 at the user-process level, each attempts to be completely transparent
166 except for a few filesystem-related system management programs.
167 The AT&T interface also makes a major effort to retain familiar internal
168 system interfaces, and even to retain object-file-level binary compatibility
169 with operating system modules such as device drivers.
170 Both Sun and DEC were willing to change internal data structures and interfaces
171 so that other operating system modules might require recompilation
172 or source-code modification.
173 .PP
174 AT&T's interface both allows and requires filesystems to support the full
175 and exact semantics of their previous filesystem,
176 including interruptions of system calls on slow operations.
177 System calls that deal with remote files are encapsulated
178 with their environment and sent to a server where execution continues.
179 The system call may be aborted by either client or server, returning
180 control to the client.
181 Most system calls that descend into the file-system dependent layer
182 of a filesystem other than the standard local filesystem do not return
183 to the higher-level kernel calling routines.
184 Instead, the filesystem-dependent code completes the requested
185 operation and then executes a non-local goto (\fIlongjmp\fP) to exit the
186 system call.
187 These efforts to avoid modification of main-line kernel code
188 indicate a far greater emphasis on internal compatibility than on modularity,
189 clean design, or efficiency.
190 .PP
191 In contrast, the Sun VFS interface makes major modifications to the internal
192 interfaces in the kernel, with a very clear separation
193 of filesystem-independent and -dependent data structures and operations.
194 The semantics of the filesystem are largely retained for local operations,
195 although this is achieved at some expense where it does not fit the internal
196 structuring well.
197 The filesystem implementations are not required to support the same
198 semantics as local
199 .UX
200 filesystems.
201 Several historical features of
202 .UX
203 filesystem behavior are difficult to achieve using the VFS interface,
204 including the atomicity of file and link creation and the use of open files
205 whose names have been removed.
206 .PP
207 A major design objective of Sun's network filesystem,
208 statelessness,
209 permeates the VFS interface.
210 No locking may be done in the filesystem-independent layer,
211 and locking in the filesystem-dependent layer may occur only during
212 a single call into that layer.
213 .PP
214 A final design goal of most implementors is performance.
215 For remote filesystems,
216 this goal tends to be in conflict with the goals of complete semantic
217 consistency, compatibility and modularity.
218 Sun has chosen performance over modularity in some areas,
219 but has emphasized clean separation of the layers within the filesystem
220 at the expense of performance.
221 Although the performance of RFS is yet to be seen,
222 AT&T seems to have considered compatibility far more important than modularity
223 or performance.
224 .NH
225 Differences among filesystem interfaces
226 .PP
227 The existing filesystem interfaces may be characterized
228 in several ways.
229 Each system is centered around a few data structures or objects,
230 along with a set of primitives for performing operations upon these objects.
231 In the original
232 .UX
233 filesystem [Ritchie74],
234 the basic object used by the filesystem is the inode, or index node.
235 The inode contains all of the information about a file except its name:
236 its type, identification, ownership, permissions, timestamps and location.
237 Inodes are identified by the filesystem device number and the index within
238 the filesystem.
239 The major entry points to the filesystem are \fInamei\fP,
240 which translates a filesystem pathname into the underlying inode,
241 and \fIiget\fP, which locates an inode by number and installs it in the in-core
242 inode table.
243 \fINamei\fP performs name translation by iterative lookup
244 of each component name in its directory to find its inumber,
245 then using \fIiget\fP to return the actual inode.
246 If the last component has been reached, this inode is returned;
247 otherwise, the inode describes the next directory to be searched.
248 The inode returned may be used in various ways by the caller;
249 it may be examined, the file may be read or written,
250 types and access may be checked, and fields may be modified.
251 Modified inodes are automatically written back to the filesystem
252 on disk when the last reference is released with \fIiput\fP.
253 Although the details are considerably different,
254 the same general scheme is used in the faster filesystem in 4.2BSD
255 .UX
256 [Mckusick85].
257 .PP
258 Both the AT&T interface and, to a lesser extent, the DEC interface
259 attempt to preserve the inode-oriented interface.
260 Each modify the inode to allow different varieties of the structure
261 for different filesystem types by separating the filesystem-dependent
262 parts of the inode into a separate structure or one arm of a union.
263 Both interfaces allow operations
264 equivalent to the \fInamei\fP and \fIiget\fP operations
265 of the old filesystem to be performed in the filesystem-independent
266 layer, with entry points to the individual filesystem implementations to support
267 the type-specific parts of these operations.  Implicit in this interface
268 is that files may be conveniently be named by and located using a single
269 index within a filesystem.
270 The GFS provides specific entry points to the filesystems
271 to change most file properties rather than allowing arbitrary changes
272 to be made to the generic part of the inode.
273 .PP
274 In contrast, the Sun VFS interface replaces the inode as the primary object
275 with the vnode.
276 The vnode contains no filesystem-dependent fields except the pointer
277 to the set of operations implemented by the filesystem.
278 Properties of a vnode that might be transient, such as the ownership,
279 permissions, size and timestamps, are maintained by the lower layer.
280 These properties may be presented in a generic format upon request;
281 callers are expected not to hold this information for any length of time,
282 as they may not be up-to-date later on.
283 The vnode operations do not include a corollary for \fIiget\fP;
284 the only external interface for obtaining vnodes for specific files
285 is the name lookup operation.
286 (Separate procedures are provided outside of this interface
287 that obtain a ``file handle'' for a vnode which may be given
288 to a client by a server, such that the vnode may be retrieved
289 upon later presentation of the file handle.)
290 .NH
291 Name translation issues
292 .PP
293 Each of the systems described include a mechanism for performing
294 pathname-to-internal-representation translation.
295 The style of the name translation function is very different in all
296 three systems.
297 As described above, the AT&T and DEC systems retain the \fInamei\fP function.
298 The two are quite different, however, as the ULTRIX interface uses
299 the \fInamei\fP calling convention introduced in 4.3BSD.
300 The parameters and context for the name lookup operation
301 are collected in a \fInameidata\fP structure which is passed to \fInamei\fP
302 for operation.
303 Intent to create or delete the named file is declared in advance,
304 so that the final directory scan in \fInamei\fP may retain information
305 such as the offset in the directory at which the modification will be made.
306 Filesystems that use such mechanisms to avoid redundant work
307 must therefore lock the directory to be modified so that it may not
308 be modified by another process before completion.
309 In the System V filesystem, as in previous versions of
310 .UX ,
311 this information is stored in the per-process \fIuser\fP structure
312 by \fInamei\fP for use by a low-level routine called after performing
313 the actual creation or deletion of the file itself.
314 In 4.3BSD and in the GFS interface, these side effects of \fInamei\fP
315 are stored in the \fInameidata\fP structure given as argument to \fInamei\fP,
316 which is also presented to the routine implementing file creation or deletion.
317 .PP
318 The ULTRIX \fInamei\fP routine is responsible for the generic
319 parts of the name translation process, such as copying the name into
320 an internal buffer, validating it, interpolating
321 the contents of symbolic links, and indirecting at mount points.
322 As in 4.3BSD, the name is copied into the buffer in a single call,
323 according to the location of the name.
324 After determining the type of the filesystem at the start of translation
325 (the current directory or root directory), it calls the filesystem's
326 \fInamei\fP entry with the same structure it received from its caller.
327 The filesystem-specific routine translates the name, component by component,
328 as long as no mount points are reached.
329 It may return after any number of components have been processed.
330 \fINamei\fP performs any processing at mount points, then calls
331 the correct translation routine for the next filesystem.
332 Network filesystems may pass the remaining pathname to a server for translation,
333 or they may look up the pathname components one at a time.
334 The former strategy would be more efficient,
335 but the latter scheme allows mount points within a remote filesystem
336 without server knowledge of all client mounts.
337 .PP
338 The AT&T \fInamei\fP interface is presumably the same as that in previous
339 .UX
340 systems, accepting the name of a routine to fetch pathname characters
341 and an operation (one of: lookup, lookup for creation, or lookup for deletion).
342 It translates, component by component, as before.
343 If it detects that a mount point crosses to a remote filesystem,
344 it passes the remainder of the pathname to the remote server.
345 A pathname-oriented request other than open may be completed
346 within the \fInamei\fP call,
347 avoiding return to the (unmodified) system call handler
348 that called \fInamei\fP.
349 .PP
350 In contrast to the first two systems, Sun's VFS interface has replaced
351 \fInamei\fP with \fIlookupname\fP.
352 This routine simply calls a new pathname-handling module to allocate
353 a pathname buffer and copy in the pathname (copying a character per call),
354 then calls \fIlookuppn\fP.
355 \fILookuppn\fP performs the iteration over the directories leading
356 to the destination file; it copies each pathname component to a local buffer,
357 then calls the filesystem \fIlookup\fP entry to locate the vnode
358 for that file in the current directory.
359 Per-filesystem \fIlookup\fP routines may translate only one component
360 per call.
361 For creation and deletion of new files, the lookup operation is unmodified;
362 the lookup of the final component only serves to check for the existence
363 of the file.
364 The subsequent creation or deletion call, if any, must repeat the final
365 name translation and associated directory scan.
366 For new file creation in particular, this is rather inefficient,
367 as file creation requires two complete scans of the directory.
368 .PP
369 Several of the important performance improvements in 4.3BSD
370 were related to the name translation process [McKusick85][Leffler84].
371 The following changes were made:
372 .IP 1. 4
373 A system-wide cache of recent translations is maintained.
374 The cache is separate from the inode cache, so that multiple names
375 for a file may be present in the cache.
376 The cache does not hold ``hard'' references to the inodes,
377 so that the normal reference pattern is not disturbed.
378 .IP 2.
379 A per-process cache is kept of the directory and offset
380 at which the last successful name lookup was done.
381 This allows sequential lookups of all the entries in a directory to be done
382 in linear time.
383 .IP 3.
384 The entire pathname is copied into a kernel buffer in a single operation,
385 rather than using two subroutine calls per character.
386 .IP 4.
387 A pool of pathname buffers are held by \fInamei\fP, avoiding allocation
388 overhead.
389 .LP
390 All of these performance improvements from 4.3BSD are well worth using
391 within a more generalized filesystem framework.
392 The generalization of the structure may otherwise make an already-expensive
393 function even more costly.
394 Most of these improvements are present in the GFS system, as it derives
395 from the beta-test version of 4.3BSD.
396 The Sun system uses a name-translation cache generally like that in 4.3BSD.
397 The name cache is a filesystem-independent facility provided for the use
398 of the filesystem-specific lookup routines.
399 The Sun cache, like that first used at Berkeley but unlike that in 4.3,
400 holds a ``hard'' reference to the vnode (increments the reference count).
401 The ``soft'' reference scheme in 4.3BSD cannot be used with the current
402 NFS implementation, as NFS allocates vnodes dynamically and frees them
403 when the reference count returns to zero rather than caching them.
404 As a result, fewer names may be held in the cache
405 than (local filesystem) vnodes, and the cache distorts the normal reference
406 patterns otherwise seen by the LRU cache.
407 As the name cache references overflow the local filesystem inode table,
408 the name cache must be purged to make room in the inode table.
409 Also, to determine whether a vnode is in use (for example,
410 before mounting upon it), the cache must be flushed to free any
411 cache reference.
412 These problems should be corrected
413 by the use of the soft cache reference scheme.
414 .PP
415 A final observation on the efficiency of name translation in the current
416 Sun VFS architecture is that the number of subroutine calls used
417 by a multi-component name lookup is dramatically larger
418 than in the other systems.
419 The name lookup scheme in GFS suffers from this problem much less,
420 at no expense in violation of layering.
421 .PP
422 A final problem to be considered is synchronization and consistency.
423 As the filesystem operations are more stylized and broken into separate
424 entry points for parts of operations, it is more difficult to guarantee
425 consistency throughout an operation and/or to synchronize with other
426 processes using the same filesystem objects.
427 The Sun interface suffers most severely from this,
428 as it forbids the filesystems from locking objects across calls
429 to the filesystem.
430 It is possible that a file may be created between the time that a lookup
431 is performed and a subsequent creation is requested.
432 Perhaps more strangely, after a lookup fails to find the target
433 of a creation attempt, the actual creation might find that the target
434 now exists and is a symbolic link.
435 The call will either fail unexpectedly, as the target is of the wrong type,
436 or the generic creation routine will have to note the error
437 and restart the operation from the lookup.
438 This problem will always exist in a stateless filesystem,
439 but the VFS interface forces all filesystems to share the problem.
440 This restriction against locking between calls also
441 forces duplication of work during file creation and deletion.
442 This is considered unacceptable.
443 .NH
444 Support facilities and other interactions
445 .PP
446 Several support facilities are used by the current
447 .UX
448 filesystem and require generalization for use by other filesystem types.
449 For filesystem implementations to be portable,
450 it is desirable that these modified support facilities
451 should also have a uniform interface and 
452 behave in a consistent manner in target systems.
453 A prominent example is the filesystem buffer cache.
454 The buffer cache in a standard (System V or 4.3BSD)
455 .UX
456 system contains physical disk blocks with no reference to the files containing
457 them.
458 This works well for the local filesystem, but has obvious problems
459 for remote filesystems.
460 Sun has modified the buffer cache routines to describe buffers by vnode
461 rather than by device.
462 For remote files, the vnode used is that of the file, and the block
463 numbers are virtual data blocks.
464 For local filesystems, a vnode for the block device is used for cache reference,
465 and the block numbers are filesystem physical blocks.
466 Use of per-file cache description does not easily accommodate
467 caching of indirect blocks, inode blocks, superblocks or cylinder group blocks.
468 However, the vnode describing the block device for the cache
469 is one created internally,
470 rather than the vnode for the device looked up when mounting,
471 and it is located by searching a private list of vnodes
472 rather than by holding it in the mount structure.
473 Although the Sun modification makes it possible to use the buffer
474 cache for data blocks of remote files, a better generalization
475 of the buffer cache is needed.
476 .PP
477 The RFS filesystem used by AT&T does not currently cache data blocks
478 on client systems, thus the buffer cache is probably unmodified.
479 The form of the buffer cache in ULTRIX is unknown to us.
480 .PP
481 Another subsystem that has a large interaction with the filesystem
482 is the virtual memory system.
483 The virtual memory system must read data from the filesystem
484 to satisfy fill-on-demand page faults.
485 For efficiency, this read call is arranged to place the data directly
486 into the physical pages assigned to the process (a ``raw'' read) to avoid
487 copying the data.
488 Although the read operation normally bypasses the filesystem buffer cache,
489 consistency must be maintained by checking the buffer cache and copying
490 or flushing modified data not yet stored on disk.
491 The 4.2BSD virtual memory system, like that of Sun and ULTRIX,
492 maintains its own cache of reusable text pages.
493 This creates additional complications.
494 As the virtual memory systems are redesigned, these problems should be
495 resolved by reading through the buffer cache, then mapping the cached
496 data into the user address space.
497 If the buffer cache or the process pages are changed while the other reference
498 remains, the data would have to be copied (``copy-on-write'').
499 .PP
500 In the meantime, the current virtual memory systems must be used
501 with the new filesystem framework.
502 Both the Sun and AT&T filesystem interfaces
503 provide entry points to the filesystem for optimization of the virtual
504 memory system by performing logical-to-physical block number translation
505 when setting up a fill-on-demand image for a process.
506 The VFS provides a vnode operation analogous to the \fIbmap\fP function of the
507 .UX
508 filesystem.
509 Given a vnode and logical block number, it returns a vnode and block number
510 which may be read to obtain the data.
511 If the filesystem is local, it returns the private vnode for the block device
512 and the physical block number.
513 As the \fIbmap\fP operations are all performed at one time, during process
514 startup, any indirect blocks for the file will remain in the cache
515 after they are once read.
516 In addition, the interface provides a \fIstrategy\fP entry that may be used
517 for ``raw'' reads from a filesystem device,
518 used to read data blocks into an address space without copying.
519 This entry uses a buffer header (\fIbuf\fP structure)
520 to describe the I/O operation
521 instead of a \fIuio\fP structure.
522 The buffer-style interface is the same as that used by disk drivers internally.
523 This difference allows the current \fIuio\fP primitives to be avoided,
524 as they copy all data to/from the current user process address space.
525 Instead, for local filesystems these operations could be done internally
526 with the standard raw disk read routines,
527 which use a \fIuio\fP interface.
528 When loading from a remote filesystems,
529 the data will be received in a network buffer.
530 If network buffers are suitably aligned,
531 the data may be mapped into the process address space by a page swap
532 without copying.
533 In either case, it should be possible to use the standard filesystem
534 read entry from the virtual memory system.
535 .PP
536 Other issues that must be considered in devising a portable
537 filesystem implementation include kernel memory allocation,
538 the implicit use of user-structure global context,
539 which may create problems with reentrancy,
540 the style of the system call interface,
541 and the conventions for synchronization
542 (sleep/wakeup, handling of interrupted system calls, semaphores).
543 .NH
544 The Berkeley Proposal
545 .PP
546 The Sun VFS interface has been most widely used of the three described here.
547 It is also the most general of the three, in that filesystem-specific
548 data and operations are best separated from the generic layer.
549 Although it has several disadvantages which were described above,
550 most of them may be corrected with minor changes to the interface
551 (and, in a few areas, philosophical changes).
552 The DEC GFS has other advantages, in particular the use of the 4.3BSD
553 \fInamei\fP interface and optimizations.
554 It allows single or multiple components of a pathname
555 to be translated in a single call to the specific filesystem
556 and thus accommodates filesystems with either preference.
557 The FSS is least well understood, as there is little public information
558 about the interface.
559 However, the design goals are the least consistent with those of the Berkeley
560 research groups.
561 Accordingly, a new filesystem interface has been devised to avoid
562 some of the problems in the other systems.
563 The proposed interface derives directly from Sun's VFS,
564 but, like GFS, uses a 4.3BSD-style name lookup interface.
565 Additional context information has been moved from the \fIuser\fP structure
566 to the \fInameidata\fP structure so that name translation may be independent
567 of the global context of a user process.
568 This is especially desired in any system where kernel-mode servers
569 operate as light-weight or interrupt-level processes,
570 or where a server may store or cache context for several clients.
571 This calling interface has the additional advantage
572 that the call parameters need not all be pushed onto the stack for each call
573 through the filesystem interface,
574 and they may be accessed using short offsets from a base pointer
575 (unlike global variables in the \fIuser\fP structure).
576 .PP
577 The proposed filesystem interface is described very tersely here.
578 For the most part, data structures and procedures are analogous
579 to those used by VFS, and only the changes will be treated here.
580 See [Kleiman86] for complete descriptions of the vfs and vnode operations
581 in Sun's interface.
582 .PP
583 The central data structure for name translation is the \fInameidata\fP
584 structure.
585 The same structure is used to pass parameters to \fInamei\fP,
586 to pass these same parameters to filesystem-specific lookup routines,
587 to communicate completion status from the lookup routines back to \fInamei\fP,
588 and to return completion status to the calling routine.
589 For creation or deletion requests, the parameters to the filesystem operation
590 to complete the request are also passed in this same structure.
591 The form of the \fInameidata\fP structure is:
592 .br
593 .ne 2i
594 .ID
595 .nf
596 .ta .5i +\w'caddr_t\0\0\0'u +\w'struct\0\0'u +\w'vnode *nc_prevdir;\0\0\0\0\0'u
597 /*
598  * Encapsulation of namei parameters.
599  * One of these is located in the u. area to
600  * minimize space allocated on the kernel stack
601  * and to retain per-process context.
602  */
603 struct nameidata {
604                 /* arguments to namei and related context: */
605         caddr_t ni_dirp;                /* pathname pointer */
606         enum    uio_seg ni_seg;         /* location of pathname */
607         short   ni_nameiop;             /* see below */
608         struct  vnode *ni_cdir;         /* current directory */
609         struct  vnode *ni_rdir;         /* root directory, if not normal root */
610         struct  ucred *ni_cred;         /* credentials */
611
612                 /* shared between namei, lookup routines and commit routines: */
613         caddr_t ni_pnbuf;               /* pathname buffer */
614         char    *ni_ptr;                /* current location in pathname */
615         int     ni_pathlen;             /* remaining chars in path */
616         short   ni_more;                /* more left to translate in pathname */
617         short   ni_loopcnt;             /* count of symlinks encountered */
618
619                 /* results: */
620         struct  vnode *ni_vp;           /* vnode of result */
621         struct  vnode *ni_dvp;          /* vnode of intermediate directory */
622
623 /* BEGIN UFS SPECIFIC */
624         struct diroffcache {            /* last successful directory search */
625                 struct  vnode *nc_prevdir;      /* terminal directory */
626                 long    nc_id;                  /* directory's unique id */
627                 off_t   nc_prevoffset;          /* where last entry found */
628         } ni_nc;
629 /* END UFS SPECIFIC */
630 };
631 .DE
632 .DS
633 .ta \w'#define\0\0'u +\w'WANTPARENT\0\0'u +\w'0x40\0\0\0\0\0\0\0'u
634 /*
635  * namei operations and modifiers
636  */
637 #define LOOKUP  0       /* perform name lookup only */
638 #define CREATE  1       /* setup for file creation */
639 #define DELETE  2       /* setup for file deletion */
640 #define WANTPARENT      0x10    /* return parent directory vnode also */
641 #define NOCACHE 0x20    /* name must not be left in cache */
642 #define FOLLOW  0x40    /* follow symbolic links */
643 #define NOFOLLOW        0x0     /* don't follow symbolic links (pseudo) */
644 .DE
645 As in current systems other than Sun's VFS, \fInamei\fP is called
646 with an operation request, one of LOOKUP, CREATE or DELETE.
647 For a LOOKUP, the operation is exactly like the lookup in VFS.
648 CREATE and DELETE allow the filesystem to ensure consistency
649 by locking the parent inode (private to the filesystem),
650 and (for the local filesystem) to avoid duplicate directory scans
651 by storing the new directory entry and its offset in the directory
652 in the \fIndirinfo\fP structure.
653 This is intended to be opaque to the filesystem-independent levels.
654 Not all lookups for creation or deletion are actually followed
655 by the intended operation; permission may be denied, the filesystem
656 may be read-only, etc.
657 Therefore, an entry point to the filesystem is provided
658 to abort a creation or deletion operation
659 and allow release of any locked internal data.
660 After a \fInamei\fP with a CREATE or DELETE flag, the pathname pointer
661 is set to point to the last filename component.
662 Filesystems that choose to implement creation or deletion entirely
663 within the subsequent call to a create or delete entry
664 are thus free to do so.
665 .PP
666 The \fInameidata\fP is used to store context used during name translation.
667 The current and root directories for the translation are stored here.
668 For the local filesystem, the per-process directory offset cache
669 is also kept here.
670 A file server could leave the directory offset cache empty,
671 could use a single cache for all clients,
672 or could hold caches for several recent clients.
673 .PP
674 Several other data structures are used in the filesystem operations.
675 One is the \fIucred\fP structure which describes a client's credentials
676 to the filesystem.
677 This is modified slightly from the Sun structure;
678 the ``accounting'' group ID has been merged into the groups array.
679 The actual number of groups in the array is given explicitly
680 to avoid use of a reserved group ID as a terminator.
681 Also, typedefs introduced in 4.3BSD for user and group ID's have been used.
682 The \fIucred\fP structure is thus:
683 .DS
684 .ta .5i +\w'caddr_t\0\0\0'u +\w'struct\0\0'u +\w'vnode *nc_prevdir;\0\0\0\0\0'u
685 /*
686  * Credentials.
687  */
688 struct ucred {
689         u_short cr_ref;                 /* reference count */
690         uid_t   cr_uid;                 /* effective user id */
691         short   cr_ngroups;             /* number of groups */
692         gid_t   cr_groups[NGROUPS];     /* groups */
693         /*
694          * The following either should not be here,
695          * or should be treated as opaque.
696          */
697         uid_t   cr_ruid;                /* real user id */
698         gid_t   cr_svgid;               /* saved set-group id */
699 };
700 .DE
701 .PP
702 A final structure used by the filesystem interface is the \fIuio\fP
703 structure mentioned earlier.
704 This structure describes the source or destination of an I/O
705 operation, with provision for scatter/gather I/O.
706 It is used in the read and write entries to the filesystem.
707 The \fIuio\fP structure presented here is modified from the one
708 used in 4.2BSD to specify the location of each vector of the operation
709 (user or kernel space)
710 and to allow an alternate function to be used to implement the data movement.
711 The alternate function might perform page remapping rather than a copy,
712 for example.
713 .DS
714 .ta .5i +\w'caddr_t\0\0\0'u +\w'struct\0\0'u +\w'vnode *nc_prevdir;\0\0\0\0\0'u
715 /*
716  * Description of an I/O operation which potentially
717  * involves scatter-gather, with individual sections
718  * described by iovec, below.  uio_resid is initially
719  * set to the total size of the operation, and is
720  * decremented as the operation proceeds.  uio_offset
721  * is incremented by the amount of each operation.
722  * uio_iov is incremented and uio_iovcnt is decremented
723  * after each vector is processed.
724  */
725 struct uio {
726         struct  iovec *uio_iov;
727         int     uio_iovcnt;
728         off_t   uio_offset;
729         int     uio_resid;
730         enum    uio_rw uio_rw;
731 };
732
733 enum    uio_rw { UIO_READ, UIO_WRITE };
734 .DE
735 .DS
736 .ta .5i +\w'caddr_t\0\0\0'u +\w'vnode *nc_prevdir;\0\0\0\0\0'u
737 /*
738  * Description of a contiguous section of an I/O operation.
739  * If iov_op is non-null, it is called to implement the copy
740  * operation, possibly by remapping, with the call
741  *      (*iov_op)(from, to, count);
742  * where from and to are caddr_t and count is int.
743  * Otherwise, the copy is done in the normal way,
744  * treating base as a user or kernel virtual address
745  * according to iov_segflg.
746  */
747 struct iovec {
748         caddr_t iov_base;
749         int     iov_len;
750         enum    uio_seg iov_segflg;
751         int     (*iov_op)();
752 };
753 .DE
754 .DS
755 .ta .5i +\w'UIO_USERISPACE\0\0\0\0\0'u
756 /*
757  * Segment flag values.
758  */
759 enum    uio_seg {
760         UIO_USERSPACE,          /* from user data space */
761         UIO_SYSSPACE,           /* from system space */
762         UIO_USERISPACE          /* from user I space */
763 };
764 .DE
765 .NH
766 File and filesystem operations
767 .PP
768 With the introduction of the data structures used by the filesystem
769 operations, the complete list of filesystem entry points may be listed.
770 As noted, they derive mostly from the Sun VFS interface.
771 Lines marked with \fB+\fP are additions to the Sun definitions;
772 lines marked with \fB!\fP are modified from VFS.
773 .PP
774 The structure describing the externally-visible features of a mounted
775 filesystem, \fIvfs\fP, is:
776 .DS
777 .ta .5i +\w'struct vfsops\0\0\0'u +\w'*vfs_vnodecovered;\0\0\0\0\0'u
778 /*
779  * Structure per mounted file system.
780  * Each mounted file system has an array of
781  * operations and an instance record.
782  * The file systems are put on a doubly linked list.
783  */
784 struct vfs {
785         struct vfs      *vfs_next;              /* next vfs in vfs list */
786 \fB+\fP struct vfs      *vfs_prev;              /* prev vfs in vfs list */
787         struct vfsops   *vfs_op;                /* operations on vfs */
788         struct vnode    *vfs_vnodecovered;      /* vnode we mounted on */
789         int     vfs_flag;               /* flags */
790 \fB!\fP int     vfs_fsize;              /* fundamental block size */
791 \fB+\fP int     vfs_bsize;              /* optimal transfer size */
792 \fB!\fP uid_t   vfs_exroot;             /* exported fs uid 0 mapping */
793         short   vfs_exflags;            /* exported fs flags */
794         caddr_t vfs_data;               /* private data */
795 };
796 .DE
797 .DS
798 .ta \w'\fB+\fP 'u +\w'#define\0\0'u +\w'VFS_EXPORTED\0\0'u +\w'0x40\0\0\0\0\0'u
799         /*
800          * vfs flags.
801          * VFS_MLOCK lock the vfs so that name lookup cannot proceed past the vfs.
802          * This keeps the subtree stable during mounts and unmounts.
803          */
804         #define VFS_RDONLY      0x01            /* read only vfs */
805 \fB+\fP #define VFS_NOEXEC      0x02            /* can't exec from filesystem */
806         #define VFS_MLOCK       0x04            /* lock vfs so that subtree is stable */
807         #define VFS_MWAIT       0x08            /* someone is waiting for lock */
808         #define VFS_NOSUID      0x10            /* don't honor setuid bits on vfs */
809         #define VFS_EXPORTED    0x20            /* file system is exported (NFS) */
810
811         /*
812          * exported vfs flags.
813          */
814         #define EX_RDONLY       0x01            /* exported read only */
815 .DE
816 .LP
817 The operations supported by the filesystem-specific layer
818 on an individual filesystem are:
819 .DS
820 .ta .5i +\w'struct vfsops\0\0\0'u +\w'*vfs_vnodecovered;\0\0\0\0\0'u
821 /*
822  * Operations supported on virtual file system.
823  */
824 struct vfsops {
825 \fB!\fP int     (*vfs_mount)(           /* vfs, path, data, datalen */ );
826 \fB!\fP int     (*vfs_unmount)(         /* vfs, forcibly */ );
827 \fB+\fP int     (*vfs_mountroot)();
828         int     (*vfs_root)(            /* vfs, vpp */ );
829 \fB!\fP int     (*vfs_statfs)(          /* vfs, vp, sbp */ );
830 \fB!\fP int     (*vfs_sync)(            /* vfs, waitfor */ );
831 \fB+\fP int     (*vfs_fhtovp)(          /* vfs, fhp, vpp */ );
832 \fB+\fP int     (*vfs_vptofh)(          /* vp, fhp */ );
833 };
834 .DE
835 .LP
836 The \fIvfs_statfs\fP entry returns a structure of the form:
837 .DS
838 .ta .5i +\w'struct vfsops\0\0\0'u +\w'*vfs_vnodecovered;\0\0\0\0\0'u
839 /*
840  * file system statistics
841  */
842 struct statfs {
843 \fB!\fP short   f_type;                 /* type of filesystem */
844 \fB+\fP short   f_flags;                /* copy of vfs (mount) flags */
845 \fB!\fP long    f_fsize;                /* fundamental file system block size */
846 \fB+\fP long    f_bsize;                /* optimal transfer block size */
847         long    f_blocks;               /* total data blocks in file system */
848         long    f_bfree;                /* free blocks in fs */
849         long    f_bavail;               /* free blocks avail to non-superuser */
850         long    f_files;                /* total file nodes in file system */
851         long    f_ffree;                /* free file nodes in fs */
852         fsid_t  f_fsid;                 /* file system id */
853 \fB+\fP char    *f_mntonname;           /* directory on which mounted */
854 \fB+\fP char    *f_mntfromname;         /* mounted filesystem */
855         long    f_spare[7];             /* spare for later */
856 };
857
858 typedef long fsid_t[2];                 /* file system id type */
859 .DE
860 .LP
861 The modifications to Sun's interface at this level are minor.
862 Additional arguments are present for the \fIvfs_mount\fP and \fIvfs_umount\fP
863 entries.
864 \fIvfs_statfs\fP accepts a vnode as well as filesystem identifier,
865 as the information may not be uniform throughout a filesystem.
866 For example,
867 if a client may mount a file tree that spans multiple physical
868 filesystems on a server, different sections may have different amounts
869 of free space.
870 (NFS does not allow remotely-mounted file trees to span physical filesystems
871 on the server.)
872 The final additions are the entries that support file handles.
873 \fIvfs_vptofh\fP is provided for the use of file servers,
874 which need to obtain an opaque
875 file handle to represent the current vnode for transmission to clients.
876 This file handle may later be used to relocate the vnode using \fIvfs_fhtovp\fP
877 without requiring the vnode to remain in memory.
878 .PP
879 Finally, the external form of a filesystem object, the \fIvnode\fP, is:
880 .DS
881 .ta .5i +\w'struct vnodeops\0\0'u +\w'*v_vfsmountedhere;\0\0\0'u
882 /*
883  * vnode types. VNON means no type.
884  */
885 enum vtype      { VNON, VREG, VDIR, VBLK, VCHR, VLNK, VSOCK };
886
887 struct vnode {
888         u_short v_flag;                 /* vnode flags (see below) */
889         u_short v_count;                /* reference count */
890         u_short v_shlockc;              /* count of shared locks */
891         u_short v_exlockc;              /* count of exclusive locks */
892         struct vfs      *v_vfsmountedhere;      /* ptr to vfs mounted here */
893         struct vfs      *v_vfsp;                /* ptr to vfs we are in */
894         struct vnodeops *v_op;                  /* vnode operations */
895 \fB+\fP struct text     *v_text;                /* text/mapped region */
896         enum vtype      v_type;                 /* vnode type */
897         caddr_t v_data;                 /* private data for fs */
898 };
899 .DE
900 .DS
901 .ta \w'#define\0\0'u +\w'NOFOLLOW\0\0'u +\w'0x40\0\0\0\0\0\0\0'u
902 /*
903  * vnode flags.
904  */
905 #define VROOT   0x01    /* root of its file system */
906 #define VTEXT   0x02    /* vnode is a pure text prototype */
907 #define VEXLOCK 0x10    /* exclusive lock */
908 #define VSHLOCK 0x20    /* shared lock */
909 #define VLWAIT  0x40    /* proc is waiting on shared or excl. lock */
910 .DE
911 .LP
912 The operations supported by the filesystems on individual \fIvnode\fP\^s
913 are:
914 .DS
915 .ta .5i +\w'int\0\0\0\0\0'u  +\w'(*vn_getattr)(\0\0\0\0\0'u
916 /*
917  * Operations on vnodes.
918  */
919 struct vnodeops {
920 \fB!\fP int     (*vn_lookup)(           /* ndp */ );
921 \fB!\fP int     (*vn_create)(           /* ndp, vap, fflags */ );
922 \fB+\fP int     (*vn_mknod)(            /* ndp, vap, fflags */ );
923 \fB!\fP int     (*vn_open)(             /* vp, fflags, cred */ );
924         int     (*vn_close)(            /* vp, fflags, cred */ );
925         int     (*vn_access)(           /* vp, fflags, cred */ );
926         int     (*vn_getattr)(          /* vp, vap, cred */ );
927         int     (*vn_setattr)(          /* vp, vap, cred */ );
928
929 \fB+\fP int     (*vn_read)(             /* vp, uiop, offp, ioflag, cred */ );
930 \fB+\fP int     (*vn_write)(            /* vp, uiop, offp, ioflag, cred */ );
931 \fB!\fP int     (*vn_ioctl)(            /* vp, com, data, fflag, cred */ );
932         int     (*vn_select)(           /* vp, which, cred */ );
933 \fB+\fP int     (*vn_mmap)(             /* vp, ..., cred */ );
934         int     (*vn_fsync)(            /* vp, cred */ );
935 \fB+\fP int     (*vn_seek)(             /* vp, offp, off, whence */ );
936
937 \fB!\fP int     (*vn_remove)(           /* ndp */ );
938 \fB!\fP int     (*vn_link)(             /* vp, ndp */ );
939 \fB!\fP int     (*vn_rename)(           /* src ndp, target ndp */ );
940 \fB!\fP int     (*vn_mkdir)(            /* ndp, vap */ );
941 \fB!\fP int     (*vn_rmdir)(            /* ndp */ );
942 \fB!\fP int     (*vn_symlink)(          /* ndp, vap, nm */ );
943         int     (*vn_readdir)(          /* vp, uiop, offp, ioflag, cred */ );
944         int     (*vn_readlink)(         /* vp, uiop, ioflag, cred */ );
945
946 \fB+\fP int     (*vn_abortop)(          /* ndp */ );
947 \fB+\fP int     (*vn_lock)(             /* vp */ );
948 \fB+\fP int     (*vn_unlock)(           /* vp */ );
949 \fB!\fP int     (*vn_inactive)(         /* vp */ );
950 };
951 .DE
952 .DS
953 .ta \w'#define\0\0'u +\w'NOFOLLOW\0\0'u +\w'0x40\0\0\0\0\0'u
954 /*
955  * flags for ioflag
956  */
957 #define IO_UNIT 0x01            /* do io as atomic unit for VOP_RDWR */
958 #define IO_APPEND       0x02            /* append write for VOP_RDWR */
959 #define IO_SYNC 0x04            /* sync io for VOP_RDWR */
960 .DE
961 .LP
962 The argument types listed in the comments following each operation are:
963 .sp
964 .IP ndp 10
965 A pointer to a \fInameidata\fP structure.
966 .IP vap
967 A pointer to a \fIvattr\fP structure (vnode attributes; see below).
968 .IP fflags
969 File open flags, possibly including O_APPEND, O_CREAT, O_TRUNC and O_EXCL.
970 .IP vp
971 A pointer to a \fIvnode\fP previously obtained with \fIvn_lookup\fP.
972 .IP cred
973 A pointer to a \fIucred\fP credentials structure.
974 .IP uiop
975 A pointer to a \fIuio\fP structure.
976 .IP ioflag
977 Any of the IO flags defined above.
978 .IP com
979 An \fIioctl\fP command, with type \fIunsigned long\fP.
980 .IP data
981 A pointer to a character buffer used to pass data to or from an \fIioctl\fP.
982 .IP which
983 One of FREAD, FWRITE or 0 (select for exceptional conditions).
984 .IP off
985 A file offset of type \fIoff_t\fP.
986 .IP offp
987 A pointer to file offset of type \fIoff_t\fP.
988 .IP whence
989 One of L_SET, L_INCR, or L_XTND.
990 .IP fhp
991 A pointer to a file handle buffer.
992 .sp
993 .PP
994 Several changes have been made to Sun's set of vnode operations.
995 Most obviously, the \fIvn_lookup\fP receives a \fInameidata\fP structure
996 containing its arguments and context as described.
997 The same structure is also passed to one of the creation or deletion
998 entries if the lookup operation is for CREATE or DELETE to complete
999 an operation, or to the \fIvn_abortop\fP entry if no operation
1000 is undertaken.
1001 For filesystems that perform no locking between lookup for creation
1002 or deletion and the call to implement that action,
1003 the final pathname component may be left untranslated by the lookup
1004 routine.
1005 In any case, the pathname pointer points at the final name component,
1006 and the \fInameidata\fP contains a reference to the vnode of the parent
1007 directory.
1008 The interface is thus flexible enough to accommodate filesystems
1009 that are fully stateful or fully stateless, while avoiding redundant
1010 operations whenever possible.
1011 One operation remains problematical, the \fIvn_rename\fP call.
1012 It is tempting to look up the source of the rename for deletion
1013 and the target for creation.
1014 However, filesystems that lock directories during such lookups must avoid
1015 deadlock if the two paths cross.
1016 For that reason, the source is translated for LOOKUP only,
1017 with the WANTPARENT flag set;
1018 the target is then translated with an operation of CREATE.
1019 .PP
1020 In addition to the changes concerned with the \fInameidata\fP interface,
1021 several other changes were made in the vnode operations.
1022 The \fIvn_rdrw\fP entry was split into \fIvn_read\fP and \fIvn_write\fP;
1023 frequently, the read/write entry amounts to a routine that checks
1024 the direction flag, then calls either a read routine or a write routine.
1025 The two entries may be identical for any given filesystem;
1026 the direction flag is contained in the \fIuio\fP given as an argument.
1027 .PP
1028 All of the read and write operations use a \fIuio\fP to describe
1029 the file offset and buffer locations.
1030 All of these fields must be updated before return.
1031 In particular, the \fIvn_readdir\fP entry uses this
1032 to return a new file offset token for its current location.
1033 .PP
1034 Several new operations have been added.
1035 The first, \fIvn_seek\fP, is a concession to record-oriented files
1036 such as directories.
1037 It allows the filesystem to verify that a seek leaves a file at a sensible
1038 offset, or to return a new offset token relative to an earlier one.
1039 For most filesystems and files, this operation amounts to performing
1040 simple arithmetic.
1041 Another new entry point is \fIvn_mmap\fP, for use in mapping device memory
1042 into a user process address space.
1043 Its semantics are not yet decided.
1044 The final additions are the \fIvn_lock\fP and \fIvn_unlock\fP entries.
1045 These are used to request that the underlying file be locked against
1046 changes for short periods of time if the filesystem implementation allows it.
1047 They are used to maintain consistency
1048 during internal operations such as \fIexec\fP,
1049 and may not be used to construct atomic operations from other filesystem
1050 operations.
1051 .PP
1052 The attributes of a vnode are not stored in the vnode,
1053 as they might change with time and may need to be read from a remote
1054 source.
1055 Attributes have the form:
1056 .DS
1057 .ta .5i +\w'struct vnodeops\0\0'u +\w'*v_vfsmountedhere;\0\0\0'u
1058 /*
1059  * Vnode attributes.  A field value of -1
1060  * represents a field whose value is unavailable
1061  * (getattr) or which is not to be changed (setattr).
1062  */
1063 struct vattr {
1064         enum vtype      va_type;        /* vnode type (for create) */
1065         u_short va_mode;        /* files access mode and type */
1066 \fB!\fP uid_t   va_uid;         /* owner user id */
1067 \fB!\fP gid_t   va_gid;         /* owner group id */
1068         long    va_fsid;        /* file system id (dev for now) */
1069 \fB!\fP long    va_fileid;      /* file id */
1070         short   va_nlink;       /* number of references to file */
1071         u_long  va_size;        /* file size in bytes (quad?) */
1072 \fB+\fP u_long  va_size1;       /* reserved if not quad */
1073         long    va_blocksize;   /* blocksize preferred for i/o */
1074         struct timeval  va_atime;       /* time of last access */
1075         struct timeval  va_mtime;       /* time of last modification */
1076         struct timeval  va_ctime;       /* time file changed */
1077         dev_t   va_rdev;        /* device the file represents */
1078         u_long  va_bytes;       /* bytes of disk space held by file */
1079 \fB+\fP u_long  va_bytes1;      /* reserved if va_bytes not a quad */
1080 };
1081 .DE
1082 .NH
1083 Conclusions
1084 .PP
1085 The Sun VFS filesystem interface is the most widely used generic
1086 filesystem interface.
1087 Of the interfaces examined, it creates the cleanest separation
1088 between the filesystem-independent and -dependent layers and data structures.
1089 It has several flaws, but it is felt that certain changes in the interface
1090 can ameliorate most of them.
1091 The interface proposed here includes those changes.
1092 The proposed interface is now being implemented by the Computer Systems
1093 Research Group at Berkeley.
1094 If the design succeeds in improving the flexibility and performance
1095 of the filesystem layering, it will be advanced as a model interface.
1096 .NH
1097 Acknowledgements
1098 .PP
1099 The filesystem interface described here is derived from Sun's VFS interface.
1100 It also includes features similar to those of DEC's GFS interface.
1101 We are indebted to members of the Sun and DEC system groups
1102 for long discussions of the issues involved.
1103 .br
1104 .ne 2i
1105 .NH
1106 References
1107
1108 .IP Brownbridge82 \w'Satyanarayanan85\0\0'u
1109 Brownbridge, D.R., L.F. Marshall, B. Randell,
1110 ``The Newcastle Connection, or UNIXes of the World Unite!,''
1111 \fISoftware\- Practice and Experience\fP, Vol. 12, pp. 1147-1162, 1982.
1112
1113 .IP Cole85
1114 Cole, C.T., P.B. Flinn, A.B. Atlas,
1115 ``An Implementation of an Extended File System for UNIX,''
1116 \fIUsenix Conference Proceedings\fP,
1117 pp. 131-150, June, 1985.
1118
1119 .IP Kleiman86
1120 ``Vnodes: An Architecture for Multiple File System Types in Sun UNIX,''
1121 \fIUsenix Conference Proceedings\fP,
1122 pp. 238-247, June, 1986.
1123
1124 .IP Leffler84
1125 Leffler, S., M.K. McKusick, M. Karels,
1126 ``Measuring and Improving the Performance of 4.2BSD,''
1127 \fIUsenix Conference Proceedings\fP, pp. 237-252, June, 1984.
1128
1129 .IP McKusick84
1130 McKusick, M.K., W.N. Joy, S.J. Leffler, R.S. Fabry,
1131 ``A Fast File System for UNIX,'' \fITransactions on Computer Systems\fP,
1132 Vol. 2, pp. 181-197,
1133 ACM, August, 1984.
1134
1135 .IP McKusick85
1136 McKusick, M.K., M. Karels, S. Leffler,
1137 ``Performance Improvements and Functional Enhancements in 4.3BSD,''
1138 \fIUsenix Conference Proceedings\fP, pp. 519-531, June, 1985.
1139
1140 .IP Rifkin86
1141 Rifkin, A.P., M.P. Forbes, R.L. Hamilton, M. Sabrio, S. Shah, and K. Yueh,
1142 ``RFS Architectural Overview,'' \fIUsenix Conference Proceedings\fP,
1143 pp. 248-259, June, 1986.
1144
1145 .IP Ritchie74
1146 Ritchie, D.M. and K. Thompson, ``The Unix Time-Sharing System,''
1147 \fICommunications of the ACM\fP, Vol. 17, pp. 365-375, July, 1974.
1148
1149 .IP Rodriguez86
1150 Rodriguez, R., M. Koehler, R. Hyde,
1151 ``The Generic File System,'' \fIUsenix Conference Proceedings\fP,
1152 pp. 260-269, June, 1986.
1153
1154 .IP Sandberg85
1155 Sandberg, R., D. Goldberg, S. Kleiman, D. Walsh, B. Lyon,
1156 ``Design and Implementation of the Sun Network Filesystem,''
1157 \fIUsenix Conference Proceedings\fP,
1158 pp. 119-130, June, 1985.
1159
1160 .IP Satyanarayanan85
1161 Satyanarayanan, M., \fIet al.\fP,
1162 ``The ITC Distributed File System: Principles and Design,''
1163 \fIProc. 10th Symposium on Operating Systems Principles\fP, pp. 35-50,
1164 ACM, December, 1985.
1165
1166 .IP Walker85
1167 Walker, B.J. and S.H. Kiser, ``The LOCUS Distributed Filesystem,''
1168 \fIThe LOCUS Distributed System Architecture\fP,
1169 G.J. Popek and B.J. Walker, ed., The MIT Press, Cambridge, MA, 1985.
1170
1171 .IP Weinberger84
1172 Weinberger, P.J., ``The Version 8 Network File System,''
1173 \fIUsenix Conference presentation\fP,
1174 June, 1984.