Page MenuHomeFreeBSD

usr.sbin/sesutil: Check element type before setting LEDs

Authored by freqlabs on Feb 1 2019, 2:59 AM.



With rS319610, sesutil started twiddling the bits of every SES device.
Not everything is a disk slot, there are also fan controllers, temperature sensors, even power supplies, among other things controlled by SES.

Add a type check to make sure we are only operating on device slot and array device slot elements. Other type elements will be skipped, but it would be simple to add additional cases for controlling the ident LEDs of other element types (which are not necessarily the same bits).

Rather than doing raw bit manipulation of an unstructured byte array using unnamed numeric constants, leverage existing code abstractions.

Sponsored by: iXsystems, Inc.

Test Plan

I've tested this on a SES-capable machine.
Before the change, running sesutil locate all off for example would take a few minutes as the incorrect bits are being manipulated on the wrong hardware with unpredictable side effects.
After the change, the command runs in a fraction of a second, with the expected effect on slot LEDs. Likewise sesutil locate all on and the fault variations work as expected.

Diff Detail

rS FreeBSD src repository
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

This revision is now accepted and ready to land.Feb 1 2019, 4:14 AM
This revision was automatically updated to reflect the committed changes.