dmi_version
Synopsis
#include <opendmi/utils/version.h>
typedef uint32_t dmi_version_t;
#define DMI_VERSION(major, minor, revision) ...
#define DMI_VERSION_NONE DMI_VERSION(0, 0, 0)
dmi_version_t dmi_version(unsigned int major, unsigned int minor,
unsigned int revision);
unsigned int dmi_version_major(dmi_version_t version);
unsigned int dmi_version_minor(dmi_version_t version);
unsigned int dmi_version_revision(dmi_version_t version);
Description
A dmi_version_t value is a version number of the SMBIOS specification, or
of another specification a structure refers to, e.g. the IPMI specification
a management controller conforms to. The major version is held in bits 16 to
23, the minor version in bits 8 to 15, and the revision in bits 0 to 7, so
version numbers compare the way the versions do, e.g. version >=
DMI_VERSION(3, 0, 0).
The dmi_version function and the DMI_VERSION macro construct a version
number from its components, each of which is cut to its eight low bits. The
macro is a constant expression, and is used where one is required, e.g. in
the initializers of static variables.
The dmi_version_major, dmi_version_minor and dmi_version_revision
functions give the components of a version number back.
DMI_VERSION_NONE, which is zero, stands for a version which is unknown or
not given, e.g. by a field present in every version of a structure.
These functions are defined in the header rather than in the library, as
inline functions in C, and as constexpr functions in C++, where they are
used in constant expressions too.
Return value
The dmi_version function returns the version number constructed.
The dmi_version_major, dmi_version_minor and dmi_version_revision
functions return the component of the version number, from 0 to 255.
Examples
dmi_version_t version = dmi_version(3, 4, 0);
if (version >= DMI_VERSION(3, 0, 0))
printf("SMBIOS %u.%u\n", dmi_version_major(version), dmi_version_minor(version));