Project

General

Profile

Actions

Feature #16577

open

libtopo sensor property translations truncate values

Added by Robert Mustacchi 25 days ago. Updated 25 days ago.

Status:
New
Priority:
Normal
Category:
lib - userland libraries
Start date:
Due date:
% Done:

0%

Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:
External Bug:

Description

libtopo has several of its base enumerations such as topo_sensor_unit_t and the constants for TOPO_SENSOR_TYPE_ follow the IPMI spec and creates a gap above which the rest come in. The best example of this is in the topo_sensor_unit_t which defines TOPO_SENSOR_UNITS_PERCENT = 512, which I followed with TOPO_SENSOR_UNITS_NONE.

While testing #16573 which used this new sensor type, I saw that it was showing up as being in degrees C. After confirming I returned the right value, I saw that the problem was the way that fmtopo was translating these. In particular, it used the following function signature:

void topo_sensor_units_name(uint8_t type, char *buf, size_t len);

Well, 513 is definitely greater than a uint8_t and got truncated to type 1, which was TOPO_SENSOR_UNITS_DEGREES_C. All of these properties in this group are actually uint32_t values and therefore the topo APIs should reflect this. This impacts:

  • topo_sensor_units_name()
  • topo_led_type_name()
  • topo_led_state_name()
  • topo_sensor_state_name()

Related issues

Related to illumos gate - Bug #16573: smntemp Tctl is not degrees CNewRobert Mustacchi

Actions
Related to illumos gate - Feature #16575: ksensor/topo support for synthetic sensorsNewRobert Mustacchi

Actions
Actions #1

Updated by Robert Mustacchi 25 days ago

  • Related to Bug #16573: smntemp Tctl is not degrees C added
  • Related to Feature #16575: ksensor/topo support for synthetic sensors added
Actions #2

Updated by Electric Monk 25 days ago

  • Gerrit CR set to 3526
Actions

Also available in: Atom PDF