dmi_platform_set_product

Synopsis

#include <opendmi/platform.h>

bool dmi_platform_set_product(dmi_platform_t *platform, const char *product);
bool dmi_platform_set_family(dmi_platform_t *platform, const char *family);

Description

The dmi_platform_set_product function sets the product name of a platform, and the dmi_platform_set_family function sets the code of its product family, as the vendor defines it, e.g. DMI_HPE_FAMILY_SERVER.

The platform holds copies of the strings, which it frees when they are set again or when it is destroyed, so the caller keeps its own. Passing nullptr clears the string.

The product name is told from the system information (type 1) as a context is opened, and the family by the vendor, from the product name. They are set by the caller for a platform given to a context with dmi_set_platform.

Parameters

platform

Platform to update.

product

Product name, or nullptr.

family

Family code, or nullptr.

Return value

Returns true on success, and false if platform is nullptr or memory is exhausted, in which case the string is left as it was.

Errors

DMI_ERROR_OUT_OF_MEMORY

Memory is exhausted, reported to the context of platform, if it has one.