channel: Refactor set_user_access option processing

Reduce code duplication by extracting option names, types,
and value ranges into a separate structure, and rewriting
the option parsing code without mixing it with the data.

Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
This commit is contained in:
Alexander Amelkin
2020-06-10 00:54:15 +03:00
committed by Alexander Amelkin
parent 6e037d6bfb
commit e3fc775d26
3 changed files with 62 additions and 29 deletions

View File

@ -1031,8 +1031,8 @@ const struct valstr ipmi_privlvl_vals[] = {
{ IPMI_SESSION_PRIV_OPERATOR, "OPERATOR" },
{ IPMI_SESSION_PRIV_ADMIN, "ADMINISTRATOR" },
{ IPMI_SESSION_PRIV_OEM, "OEM" },
{ 0xF, "NO ACCESS" },
{ 0xFF, NULL },
{ IPMI_SESSION_PRIV_NOACCESS, "NO ACCESS" },
{ UINT8_MAX, NULL },
};