dmi_type_find

Synopsis

#include <opendmi/entity.h>

dmi_type_id_t dmi_type_find(dmi_context_t *context, const char *code);

Description

The dmi_type_find function returns the type number at which the structures of the specification whose code is code, e.g. system or hpe-proliant-info, are found in a context. It is the reverse of dmi_type_spec, e.g. to select structures by the code of their type given on the command line.

The number is the one the specification is mapped to in the context, which relocations of the vendor modules may make different from the number of the type member of the specification. Only the specifications mapped in the context are found, so the result depends on the modules enabled in it, see dmi_type_spec: the code of a module which is not enabled is not found, and the code of a module enabled for the platform only after the data has been read by dmi_open.

Every specification mapped to a number is searched, including the ones told apart by signatures. If the specification is mapped to several numbers, the lowest one is returned. Codes are compared exactly, case included.

Parameters

context

Context the specification is looked up in.

code

Code of the specification.

Return value

Returns the type number, or DMI_TYPE_ID_INVALID if context or code is nullptr, or if no specification with the code is mapped in the context.

Errors

DMI_ERROR_ARGUMENT_NULL

code is nullptr.

A code which is not found is not an error.