


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.
MULTI LEVEL INDIRECTION CODE
Let's consider how the operating system would structure the code for accessing the different filesystems. Therefore, the ability to read on my PC a flash card written on my camera never ceases to amaze me.
MULTI LEVEL 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). Each filesystem uses different data structures for managing free space, for storing file metadata, and for organizing files into directories. 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. 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
