The Media
layer sits below the NVRAM layer and is the reimplementation of the
current "ifs" code that provides file services to the many types of
storage media supported by the IOS.
NVRAM is fundamentally different from other types of storage in
that it is limited, local and non-removable memory used for specialized
data.
For this reason it will have it's own version of the drivers, and NVRAM
will be modular enough to support different types of media drivers.
Note that in all cases the functionality of a media type will include
managing a pool of memory blocks. In some cases the pool can be used to
distribute physical memory
usage for devices that have a limited number of write cycles.
The Media layer is accessed, and makes accesses, through
well defined API's, and all dependencies resolve to higher layers.
The Platform drivers are currently modularized and are accessed by the
"ifs" code through a vector table. This code is commonly used
throughout the IOS and will not be changed. |
![NVRAM Layers](images/nvram_layers) |
2.2 Implementation Phases
The reimlementation of NVRAM can be done in phases by coding, testing
and committing the layers separately. Phase one will consist of the new
NVRAM and API layers, with some small supporting changes to the media
layer. Phase two will be a full Media layer implementation. As stated
earlier, the Platform layer already exists as a clean module and so
will not be reimplemented.
2.3 Managing Dependencies
The architecture of dependencies between layers is a uni-directional
hierarchy that forwards dependencies from top to bottom. In practice
this means that the lower layers "include" references from higher
layers but never the other way around. If a higher layer needs
something that's defined below, it must define a common structure and
pass it to a "callback" function that was previously initialized, and
which
will pass the info back through the common data structure.
Structure pointers will appear opaque to lower layers where they are
declared but not defined, and local elements can be hidden from the
upper layers by passing void pointers which are cast to reveal only the
elements that are relevant to the higher layer, i.e. overloading.
Using these simple techniques will keep dependencies from "pointing" in
the wrong direction and help to enforce the boundaries defined by the
API's.