NASD Programmer's Documentation
Drive structure

The drive is constructed in a fairly modular fashion. A lot of low-level functionality, such as threads, timing, et cetera, is provided by the general NASD API. Additionally, I/O modules provide low-level mechanisms for the drive to access the physical media. A caching module provides cache management, including tracking dirty blocks and writing them back asynchronously. Separate modules handle mapping, layout, tracing, and other functionality. The details of the various modules that compose the drive will be described in later sections.

There are two header files which most drive files include. nasd_od.h defines all of the datastructures and constants which are written directly to the storage media. For example, the inode structure is defined here. nasd_cache.h defines most of the shared software structures for the drive. Prototypes for most drive functions can be found in nasd_cache.h.

General-purpose disk management, including partition manipulation and start-of-day/end-of-day code, is found in nasd_diskman.c. At start-of-day, nasd_basic_init() is called. This function initializes various NASD-general modules that the drive will use (such as the memory and timeout modules), and creates a global shutdown list nasd_odc_shutdown. Later, nasd_setup_disk() is called. This function in turn initializes all drive-internal modules. These modules register any necessary cleanup on nasd_odc_shutdown. New modules which are added to the drive should call their initialization routine from nasd_setup_disk().

File-by-file

The majority of the drive code is in the drive/ subdirectory of the NASD tree, with a few key files in include/nasd/. Here's a list of some key files: Logically, some of the above are grouped into modules. Roughly, that grouping would be: Note that some modules are listed as part of more than one logical group. This indicates that their basic functionality participates in more than one part of the system.


<--- ---> ^<br>|<br>|
Drive operations Drive transport NASD Programmer's Documentation