Values
Values of the attributes are written by their codes, the way a program
matches them, unless the --pretty option is given, which writes them the way
opendmi show prints them for a person. The codes do not change with the
locale, and are what this chapter describes. Which of the values a format
writes as numbers or booleans of its own, rather than as strings, is described
by the chapter about the format.
1. Kinds of values
The value of an attribute is written according to its kind:
| Kind | Written as | Example |
|---|---|---|
String |
String of the structure, as it is. |
|
Boolean |
|
|
Integer |
Decimal number, or hexadecimal one with the |
|
Fixed-point number |
Decimal number with as many fractional digits as it needs, and at least one. |
|
Size |
Number of bytes. |
|
Address |
Hexadecimal number with the |
|
Handle |
Hexadecimal number with the |
|
Enumeration |
Code of the value, or the value as a hexadecimal number if the specification does not define it. |
|
Set of flags |
Every flag the attribute knows, by its code, with a boolean telling if it is set. XML documents give the value of the whole set as a hexadecimal number too. |
|
Version |
Numbers of the version separated by dots. |
|
Date |
Date in the ISO 8601 format. |
|
UUID |
UUID in the canonical format, with uppercase digits. |
|
Binary data |
Hexadecimal digits of the bytes in their order, a MAC address with colons between the bytes, and an IP address in its usual notation. |
|
Structure |
Mapping of the codes of the nested attributes to their values. |
|
Array |
Sequence of the values of the items. |
|
Two values are written the same way whatever the kind of the attribute is:
- Not specified
-
The value the data says is not given, e.g. string 0, or the value the specification reserves for that, is written as null, or as an empty element in XML.
- Unknown
-
The value the specification reserves for a value which is not known, where it reserves one, is written as the string
unknown.
2. Units
Numbers are written in the units the attribute is measured in, which are not
written in the value: an XML element carries them in its units attribute,
e.g. mhz, and the other formats do not write them. Sizes are always written
in bytes.
3. Values for a person
With --pretty, values are written the way a person reads them: enumerations
and booleans by their names, e.g. Write-back and yes, sizes in the largest
unit which keeps them whole, e.g. 1280 KiB, binary data with uppercase
digits separated by spaces, and numbers along with the names of their units,
e.g. 4300 MHz, which XML writes in the units attribute instead. Names of
the attributes, handles and sets of flags are written the same way as without
the option.