Hook ipmi_get_channel_medium() to new _ipmi_get_*() functions

Commit hooks ipmi_get_channel_medium() to new _ipmi_get_*() functions.
This commit is contained in:
Zdenek Styblik 2015-01-16 20:04:31 +01:00
parent 56aa025dc2
commit 0801b4588d

View File

@ -649,41 +649,28 @@ ipmi_get_channel_cipher_suites(struct ipmi_intf *intf, const char *payload_type,
return 0; return 0;
} }
uint8_t uint8_t
ipmi_get_channel_medium(struct ipmi_intf *intf, uint8_t channel) ipmi_get_channel_medium(struct ipmi_intf *intf, uint8_t channel)
{ {
struct ipmi_rs *rsp; struct channel_info_t channel_info = {0};
struct ipmi_rq req; int ccode = 0;
struct get_channel_info_rsp info;
memset(&req, 0, sizeof(req)); channel_info.channel = channel;
req.msg.netfn = IPMI_NETFN_APP; ccode = _ipmi_get_channel_info(intf, &channel_info);
req.msg.cmd = IPMI_GET_CHANNEL_INFO; if (ccode < 0) {
req.msg.data = &channel; eval_ccode(ccode);
req.msg.data_len = 1;
rsp = intf->sendrecv(intf, &req);
if (rsp == NULL) {
lprintf(LOG_ERR, "Get Channel Info command failed"); lprintf(LOG_ERR, "Get Channel Info command failed");
return 0; return 0;
} } else if (ccode = 0xCC) {
if (rsp->ccode > 0) { return IPMI_CHANNEL_MEDIUM_RESERVED;
if (rsp->ccode == 0xcc) { } else {
lprintf(LOG_ERR, "Get Channel Info command failed: %s",
val2str(ccode, completion_code_vals));
return IPMI_CHANNEL_MEDIUM_RESERVED; return IPMI_CHANNEL_MEDIUM_RESERVED;
} }
lprintf(LOG_INFO, "Get Channel Info command failed: %s",
val2str(rsp->ccode, completion_code_vals));
return IPMI_CHANNEL_MEDIUM_RESERVED;
}
memcpy(&info, rsp->data, sizeof(struct get_channel_info_rsp));
lprintf(LOG_DEBUG, "Channel type: %s", lprintf(LOG_DEBUG, "Channel type: %s",
val2str(info.channel_medium, ipmi_channel_medium_vals)); val2str(channel_info.medium, ipmi_channel_medium_vals));
return channel_info.medium;
return info.channel_medium;
} }
uint8_t uint8_t