Bug #5231
::printf doesn't handle enums
Start date:
2014-10-15
Due date:
% Done:
100%
Estimated time:
Difficulty:
Medium
Tags:
needs-triage
Gerrit CR:
Description
If you want to ::printf an enum member of a structure, you end up with an error. It would make sense if %d and %s both worked on enums (printing the numeric and symbolic values, respectively).
Here's an example of current behavior:
> ::walk spa | ::head -1 | ::printf "%d\\n" spa_t spa_state mdb: expected integer type mdb: failed to print member 'spa_state' > ::walk spa | ::head -1 | ::printf "%s\\n" spa_t spa_state mdb: exepected pointer or array type mdb: failed to print member 'spa_state'
For completeness, ::print works so CTF info is correct:
> ::walk spa | ::head -1 | ::print spa_t spa_state spa_state = 0 (POOL_STATE_ACTIVE)
Updated by Electric Monk over 6 years ago
- Status changed from New to Closed
- % Done changed from 0 to 100
git commit 38ce19d2fe6359bf2fe9536f075f30cc972d2b50
commit 38ce19d2fe6359bf2fe9536f075f30cc972d2b50 Author: Josef 'Jeff' Sipek <josef.sipek@nexenta.com> Date: 2014-10-24T23:16:43.000Z 5231 ::printf doesn't handle enums Reviewed by: Robert Mustacchi <rm@joyent.com> Reviewed by: Richard Lowe <richlowe@richlowe.net> Reviewed by: Alex Reece <alex@delphix.com> Approved by: Robert Mustacchi <rm@joyent.com>