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