zuloofc.blogg.se

Lea level of indirection
Lea level of indirection












lea level of indirection
  1. LEA LEVEL OF INDIRECTION SERIAL
  2. LEA LEVEL OF INDIRECTION CODE
  3. LEA LEVEL OF INDIRECTION PC
  4. LEA LEVEL OF INDIRECTION FREE
  5. LEA LEVEL OF INDIRECTION WINDOWS
lea level of indirection

As an example, the vop_write field is left undefined (getting a value of NULL) because writing to files is not supported on ISO-9660 CD-ROMs. field = value syntax is a nifty C99 feature that allows fields of a structure to be initialized in an arbitrary order and in a readable way.) Note that although the complete vop_vector structure contains 52 fields, only 16 are defined in the preceding code. Int (*vop_access)(struct vop_access_args *) Īnd here is how the ISO-9660 filesystem initializes the structure: Here are some fields of the vop_vector structure: Each filesystem defines the operations that it supports as functions and then initializes a vop_vector structure with pointers to them.

LEA LEVEL OF INDIRECTION CODE

Consider how the FreeBSD operating system-a code base I admire for the maturity of its engineering-solves these problems. Moreover, adding a processing step to all the operations of a filesystem (for example, the mapping of remote user credentials) would also require the error-prone modification of each operation with the same boilerplate code.Īs you might have guessed, our task at hand calls for some additional levels of indirection. Worse, adding support for a new filesystem type would require modifying the code of each system call implementation and recompiling the kernel. This approach would bundle together code for the various filesystems, limiting modularity. Struct ucred *cred) /* User's credentials */Ĭase FS_ISO9660: /* ISO-9660-specific code */Ĭase FS_FAT32: /* FAT-32-specific code */ Struct uio *uio, /* Buffer specification */ Struct vnode *vp, /* File to read from */ Its kernel-side interface would look as follows: Consider as an example a hypothetical implementation of the read system call under the FreeBSD operating system. One approach would be to employ a switch statement for each operation. Let's consider how the operating system would structure the code for accessing the different filesystems.

LEA LEVEL OF INDIRECTION PC

Therefore, the ability to read on my PC a flash card written on my camera never ceases to amaze me.

LEA LEVEL OF INDIRECTION SERIAL

I grew up in an era where different computers more often than not had incompatible filesystems, forcing me to transfer data from one machine to another over serial links. Therefore, each filesystem requires different code for each operation on a file ( open, read, write, seek, close, delete, and so on).

LEA LEVEL OF INDIRECTION FREE

Each filesystem uses different data structures for managing free space, for storing file metadata, and for organizing files into directories.

LEA LEVEL OF INDIRECTION WINDOWS

These storage devices may, in turn, employ different filesystem organizations: NTFS or ext3fs for a Windows or Linux native filesystem, ISO-9660 for the CD-ROM, and, often, the legacy FAT-32 filesystem for the USB stick.

lea level of indirection

An operating system may use data residing on its native filesystem, a CD-ROM, or a USB stick. Let's start this particular journey by considering the problem of a typical operating system that supports disparate filesystem formats. The quote rings in my head on various occasions: when I am forced to talk to a secretary instead of the person I wish to communicate with, when I first travel east to Frankfurt in order to finally fly west to Shanghai or Bangalore, and-yes-when I examine a complex system's source code. Layers Forever?Īll problems in computer science can be solved by another level of indirection," is a famous quote attributed to Butler Lampson, the scientist who in 1972 envisioned the modern personal computer. From Code to a Domain-Specific Language 17.5. From Filesystems to Filesystem Layers 17.4. From Function Arguments to Argument Pointers 17.3. Works may not be reposted without the explicit permission of the All personsĬopying this information are expected to adhere to the terms andĬonstraints invoked by each author's copyright. Retained by authors or by other copyright holders. This material is presented to ensure timely dissemination of The document's metadata is available in BibTeX format. The publication should always be cited in preference to thisīeautiful Code: Leading Programmers Explain How They Think,Ĭhapter 17, pages 279–291. This is an HTML rendering of a working paper draft that Beautiful Code: Another Level of Indirection














Lea level of indirection