As a computer's hardware and software configuration is quite complex, the SCR organizes all data in form of a tree. It resembles very much a file system with its folders, sub-folders and files whereby the tree structure reflects the thematic separation of the various configuration categories.
The SCR-tree consists of two different kinds of nodes:
Table 2.1. SCR Node Types
Data nodes |
Data nodes represent single pieces of data, for example a
sysconfig -entry or a mountpoint of a
file system in /etc/fstab . They are the
leaves of the tree and stand for actual
data to be handled.
|
Map nodes | Map nodes allow for navigation to the leaves just like the path components in the directory structure of a file system. This way map nodes are used to structure the data in a suitable manner. |
The names of the nodes in the SCR-tree can be concatenated resulting in
the creation of an SCR-path. An SCR-path is a
description were to find a node in the SCR-tree. It is a sequence of
path components each of them being a string. As we have seen in the
section Data type path YCP
-paths are prepended by
dots (.) which act as separators in compound paths. So
.foo.bar
is a valid YCP
-path. If
bar
is an SCR data node, then
SCR::Read(.foo.bar)
would render some data. If
bar
is a map node, then
SCR::Dir(.foo.bar)
would reveal the immediate
sub-nodes in the SCR-tree, e.g. ["big", "brown",
"fox"]
. The single dot (.) is also valid and denotes the
root of the whole SCR-tree. Consequently SCR::Dir(.)
will return a list of all the top-nodes in the SCR-tree.
In the figure below we see a (very small) cut-out of the SCR-tree that is related to hardware-specific information.
The light gray nodes are SCR-map-nodes denoting the path to the data.
They can be used with SCR::Dir(...)
to find out what
is below. So in the figure above SCR::Dir(.probe)
would return a list as [..."has_smp", "boot_arch",
"has_apm"...]
.
The dark grey nodes are SCR-data-nodes that stand for the actual data.
What can be done with them depends on the actual node (reading,
writing, executing), but usually SCR::Read(...)
is
possible. As is shown above
SCR::Read(.probe.boot_arch)
would return
"grub"
.