nm: Fix coding style

Fix whitespaces, line lengths, etc.

Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
This commit is contained in:
Alexander Amelkin 2019-02-21 20:35:10 +03:00
parent 75eada4859
commit e0811437a2
No known key found for this signature in database
GPG Key ID: E893587B5B74178D
2 changed files with 228 additions and 177 deletions

View File

@ -523,7 +523,8 @@ ipmi_dcmi_prnt_oobDiscover(struct ipmi_intf * intf)
{ {
# ifndef IPMI_INTF_LANPLUS # ifndef IPMI_INTF_LANPLUS
lprintf(LOG_ERR, lprintf(LOG_ERR,
"DCMI Discovery is available only when LANplus(IPMI v2.0) is enabled."); "DCMI Discovery is available only when "
"IPMI v2.0 (lanplus) support is compiled in.");
return (-1); return (-1);
# else # else
struct ipmi_session_params *p; struct ipmi_session_params *p;
@ -1692,7 +1693,9 @@ ipmi_dcmi_pwr_slimit(struct ipmi_intf * intf, const char * option,
/* no valid options */ /* no valid options */
return -1; return -1;
} }
lprintf(LOG_INFO, "DCMI OUT Limit=%d Correction=%d Action=%d Sample=%d\n", val.limit, val.correction, val.action, val.sample); lprintf(LOG_INFO,
"DCMI OUT Limit=%d Correction=%d Action=%d Sample=%d\n",
val.limit, val.correction, val.action, val.sample);
msg_data[0] = val.grp_id; /* Group Extension Identification */ msg_data[0] = val.grp_id; /* Group Extension Identification */
msg_data[1] = 0x00; /* reserved */ msg_data[1] = 0x00; /* reserved */
@ -1976,7 +1979,8 @@ ipmi_dcmi_thermalpolicy(struct ipmi_intf * intf, int argc, char **argv)
"Set thermalpolicy instance parameters: " "Set thermalpolicy instance parameters: "
"<volatile/nonvolatile/disabled> " "<volatile/nonvolatile/disabled> "
"<poweroff/nopoweroff/disabled> " "<poweroff/nopoweroff/disabled> "
"<sel/nosel/disabled> <templimitByte> <exceptionTime>", "<sel/nosel/disabled> <templimitByte> "
"<exceptionTime>",
LOG_ERR, 0); LOG_ERR, 0);
return -1; return -1;
} }
@ -1993,9 +1997,15 @@ ipmi_dcmi_thermalpolicy(struct ipmi_intf * intf, int argc, char **argv)
return (-1); return (-1);
} }
persistanceFlag = (uint8_t)dcmi_str2val(argv[4], dcmi_thermalpolicy_set_parameters_vals); persistanceFlag =
actionHardPowerOff = (uint8_t)dcmi_str2val(argv[5], dcmi_thermalpolicy_set_parameters_vals); (uint8_t)dcmi_str2val(argv[4],
actionLogToSEL = (uint8_t)dcmi_str2val(argv[6], dcmi_thermalpolicy_set_parameters_vals); dcmi_thermalpolicy_set_parameters_vals);
actionHardPowerOff =
(uint8_t)dcmi_str2val(argv[5],
dcmi_thermalpolicy_set_parameters_vals);
actionLogToSEL =
(uint8_t)dcmi_str2val(argv[6],
dcmi_thermalpolicy_set_parameters_vals);
if (str2uchar(argv[7], &tempLimit) != 0) { if (str2uchar(argv[7], &tempLimit) != 0) {
lprintf(LOG_ERR, lprintf(LOG_ERR,
@ -2184,7 +2194,8 @@ ipmi_dcmi_main(struct ipmi_intf * intf, int argc, char **argv)
return (-1); return (-1);
} }
rsp = ipmi_dcmi_setconfparam(intf, rsp = ipmi_dcmi_setconfparam(intf,
dcmi_str2val(argv[1], dcmi_conf_param_vals), dcmi_str2val(argv[1],
dcmi_conf_param_vals),
tmp_val); tmp_val);
} }
if (chk_rsp(rsp)) { if (chk_rsp(rsp)) {

View File

@ -42,6 +42,8 @@
******************************************************************************/ ******************************************************************************/
/* Primary Node Manager commands */ /* Primary Node Manager commands */
/* clang-format off */
const struct dcmi_cmd nm_cmd_vals[] = { const struct dcmi_cmd nm_cmd_vals[] = {
{ 0x00, "discover", "Discover Node Manager" }, { 0x00, "discover", "Discover Node Manager" },
{ 0x01, "capability", "Get Node Manager Capabilities" }, { 0x01, "capability", "Get Node Manager Capabilities" },
@ -281,6 +283,7 @@ const struct valstr nm_ccode_vals[] = {
{ 0xD6, "Command subfunction disabled or unavailable" }, { 0xD6, "Command subfunction disabled or unavailable" },
{ 0xFF, NULL }, { 0xFF, NULL },
}; };
/* clang-format on */
/* End strings */ /* End strings */
@ -377,8 +380,8 @@ _ipmi_nm_getcapabilities(struct ipmi_intf * intf, uint8_t domain,
} }
static int static int
_ipmi_nm_get_policy(struct ipmi_intf * intf, uint8_t domain, _ipmi_nm_get_policy(struct ipmi_intf *intf, uint8_t domain, uint8_t policy_id,
uint8_t policy_id, struct nm_get_policy *policy) struct nm_get_policy *policy)
{ {
struct ipmi_rq req; /* request data to send to the BMC */ struct ipmi_rq req; /* request data to send to the BMC */
struct ipmi_rs *rsp; struct ipmi_rs *rsp;
@ -694,7 +697,8 @@ _ipmi_nm_set_thresh(struct ipmi_intf * intf, struct nm_thresh * thresh)
*/ */
static int static int
_ipmi_nm_get_suspend(struct ipmi_intf *intf, uint8_t domain, _ipmi_nm_get_suspend(struct ipmi_intf *intf, uint8_t domain,
uint8_t policy_id, int *count, struct nm_period *periods) uint8_t policy_id, int *count,
struct nm_period *periods)
{ {
struct ipmi_rq req; /* request data to send to the BMC */ struct ipmi_rq req; /* request data to send to the BMC */
struct ipmi_rs *rsp; struct ipmi_rs *rsp;
@ -729,7 +733,8 @@ _ipmi_nm_set_suspend(struct ipmi_intf * intf, struct nm_suspend *suspend)
{ {
struct ipmi_rq req; /* request data to send to the BMC */ struct ipmi_rq req; /* request data to send to the BMC */
struct ipmi_rs *rsp; struct ipmi_rs *rsp;
uint8_t msg_data[21]; /* 6 control bytes + 5 suspend periods, 3 bytes per period */ uint8_t msg_data[21]; /* 6 control bytes + 5 suspend periods, 3 bytes per
period */
struct nm_period *periods; struct nm_period *periods;
int i; int i;
@ -869,7 +874,9 @@ ipmi_nm_get_policy(struct ipmi_intf * intf, int argc, char **argv)
break; break;
case 0x0B: /* policy id */ case 0x0B: /* policy id */
if (str2uchar(argv[1], &policy_id) < 0) { if (str2uchar(argv[1], &policy_id) < 0) {
lprintf(LOG_ERR," Policy ID must be a positive integer (0-255)\n"); lprintf(LOG_ERR,
" Policy ID must be a positive "
"integer (0-255)\n");
return -1; return -1;
} }
have_policy_id = TRUE; have_policy_id = TRUE;
@ -949,8 +956,8 @@ ipmi_nm_policy(struct ipmi_intf * intf, int argc, char **argv)
argv++; argv++;
argc--; argc--;
if (!argv[0] || if (!argv[0]
0xFF == (action = dcmi_str2val(argv[0], nm_policy_action))) || 0xFF == (action = dcmi_str2val(argv[0], nm_policy_action)))
{ {
dcmi_print_strs(nm_policy_action, "Policy commands", LOG_ERR, 0); dcmi_print_strs(nm_policy_action, "Policy commands", LOG_ERR, 0);
return -1; return -1;
@ -967,7 +974,8 @@ ipmi_nm_policy(struct ipmi_intf * intf, int argc, char **argv)
*/ */
while (--argc > 0) { while (--argc > 0) {
argv++; argv++;
if (!argv[0]) break; if (!argv[0])
break;
if ((option = dcmi_str2val(argv[0], nm_policy_options)) == 0xFF) { if ((option = dcmi_str2val(argv[0], nm_policy_options)) == 0xFF) {
dcmi_print_strs(nm_policy_options, "Policy options", LOG_ERR, 0); dcmi_print_strs(nm_policy_options, "Policy options", LOG_ERR, 0);
return -1; return -1;
@ -995,9 +1003,12 @@ ipmi_nm_policy(struct ipmi_intf * intf, int argc, char **argv)
policy.trigger_limit = inlet; policy.trigger_limit = inlet;
break; break;
case 0x06: /* get correction action */ case 0x06: /* get correction action */
if (action == 0x5) break; /* skip if this is a remove */ if (action == 0x5)
break; /* skip if this is a remove */
if ((correction = dcmi_str2val(argv[1], nm_correction)) == 0xFF) { if ((correction = dcmi_str2val(argv[1], nm_correction)) == 0xFF) {
dcmi_print_strs(nm_correction, "Correction Actions", LOG_ERR, 0); dcmi_print_strs(nm_correction,
"Correction Actions",
LOG_ERR, 0);
return -1; return -1;
} }
policy.policy_type |= (correction << 5); policy.policy_type |= (correction << 5);
@ -1020,7 +1031,8 @@ ipmi_nm_policy(struct ipmi_intf * intf, int argc, char **argv)
break; break;
case 0x0A: /* statistics period */ case 0x0A: /* statistics period */
if (str2ushort(argv[1], &period) < 0) { if (str2ushort(argv[1], &period) < 0) {
printf("Statistics Reporting Period must be positive integer.\n"); printf("Statistics Reporting Period must be a positive "
"integer.\n");
return -1; return -1;
} }
policy.stats_period = period; policy.stats_period = period;
@ -1086,25 +1098,28 @@ ipmi_nm_control(struct ipmi_intf * intf, int argc, char **argv)
argv++; argv++;
argc--; argc--;
/* nm_ctl_cmds returns 0 for disable, 1 for enable */ /* nm_ctl_cmds returns 0 for disable, 1 for enable */
if (!argv[0] || if (!argv[0]
0xFF == (action = dcmi_str2val(argv[0], nm_ctl_cmds))) || 0xFF == (action = dcmi_str2val(argv[0], nm_ctl_cmds)))
{ {
dcmi_print_strs(nm_ctl_cmds, "Control parameters:", LOG_ERR, 0); dcmi_print_strs(nm_ctl_cmds, "Control parameters:",
dcmi_print_strs(nm_ctl_domain, "control Scope (required):", LOG_ERR, 0); LOG_ERR, 0);
dcmi_print_strs(nm_ctl_domain, "control Scope (required):",
LOG_ERR, 0);
return -1; return -1;
} }
argv++; argv++;
while (--argc) { while (--argc) {
/* nm_ctl_domain returns correct bit field except for action */ /* nm_ctl_domain returns correct bit field except for action */
if (!argv[0] || if (!argv[0]
0xFF == (scope = dcmi_str2val(argv[0], nm_ctl_domain))) || 0xFF == (scope = dcmi_str2val(argv[0], nm_ctl_domain)))
{ {
dcmi_print_strs(nm_ctl_domain, dcmi_print_strs(nm_ctl_domain, "Control Scope (required):",
"Control Scope (required):", LOG_ERR, 0); LOG_ERR, 0);
return -1; return -1;
} }
argv++; argv++;
if (!argv[0]) break; if (!argv[0])
break;
if (scope == 0x02) { /* domain */ if (scope == 0x02) { /* domain */
if ((domain = dcmi_str2val(argv[0], nm_domain_vals)) == 0xFF) { if ((domain = dcmi_str2val(argv[0], nm_domain_vals)) == 0xFF) {
dcmi_print_strs(nm_domain_vals, "Domain Scope:", LOG_ERR, 0); dcmi_print_strs(nm_domain_vals, "Domain Scope:", LOG_ERR, 0);
@ -1112,7 +1127,8 @@ ipmi_nm_control(struct ipmi_intf * intf, int argc, char **argv)
} }
} else if (scope == 0x04) { /* per_policy */ } else if (scope == 0x04) { /* per_policy */
if (str2uchar(argv[0], &policy_id) < 0) { if (str2uchar(argv[0], &policy_id) < 0) {
lprintf(LOG_ERR,"Policy ID must be a positive integer (0-255)\n"); lprintf(LOG_ERR,
"Policy ID must be a positive integer (0-255)\n");
return -1; return -1;
} }
have_policy_id = TRUE; have_policy_id = TRUE;
@ -1144,15 +1160,16 @@ ipmi_nm_get_statistics(struct ipmi_intf * intf, int argc, char **argv)
struct nm_statistics stats; struct nm_statistics stats;
argv++; argv++;
if (!argv[0] || if (!argv[0]
0xFF == (mode = dcmi_str2val(argv[0], nm_stats_mode))) || 0xFF == (mode = dcmi_str2val(argv[0], nm_stats_mode)))
{ {
dcmi_print_strs(nm_stats_mode, "Statistics commands", LOG_ERR, 0); dcmi_print_strs(nm_stats_mode, "Statistics commands", LOG_ERR, 0);
return -1; return -1;
} }
while (--argc) { while (--argc) {
argv++; argv++;
if (!argv[0]) break; if (!argv[0])
break;
if ((option = dcmi_str2val(argv[0], nm_stats_opts)) == 0xFF) { if ((option = dcmi_str2val(argv[0], nm_stats_opts)) == 0xFF) {
dcmi_print_strs(nm_stats_opts, "Control Scope options", LOG_ERR, 0); dcmi_print_strs(nm_stats_opts, "Control Scope options", LOG_ERR, 0);
return -1; return -1;
@ -1166,7 +1183,8 @@ ipmi_nm_get_statistics(struct ipmi_intf * intf, int argc, char **argv)
break; break;
case 0x02: /* policy ID */ case 0x02: /* policy ID */
if (str2uchar(argv[1], &policy_id) < 0) { if (str2uchar(argv[1], &policy_id) < 0) {
lprintf(LOG_ERR,"Policy ID must be a positive integer (0-255)\n"); lprintf(LOG_ERR,
"Policy ID must be a positive integer (0-255)\n");
return -1; return -1;
} }
have_policy_id = TRUE; have_policy_id = TRUE;
@ -1265,15 +1283,16 @@ ipmi_nm_reset_statistics(struct ipmi_intf * intf, int argc, char **argv)
uint8_t have_policy_id = FALSE; uint8_t have_policy_id = FALSE;
argv++; argv++;
if (!argv[0] || if (!argv[0]
0xFF == (mode = dcmi_str2val(argv[0], nm_reset_mode))) || 0xFF == (mode = dcmi_str2val(argv[0], nm_reset_mode)))
{ {
dcmi_print_strs(nm_reset_mode, "Reset Statistics Modes:", LOG_ERR, 0); dcmi_print_strs(nm_reset_mode, "Reset Statistics Modes:", LOG_ERR, 0);
return -1; return -1;
} }
while (--argc) { while (--argc) {
argv++; argv++;
if (!argv[0]) break; if (!argv[0])
break;
if ((option = dcmi_str2val(argv[0], nm_stats_opts)) == 0xFF) { if ((option = dcmi_str2val(argv[0], nm_stats_opts)) == 0xFF) {
dcmi_print_strs(nm_stats_opts, "Reset Scope options", LOG_ERR, 0); dcmi_print_strs(nm_stats_opts, "Reset Scope options", LOG_ERR, 0);
return -1; return -1;
@ -1287,7 +1306,8 @@ ipmi_nm_reset_statistics(struct ipmi_intf * intf, int argc, char **argv)
break; break;
case 0x02: /* policy ID */ case 0x02: /* policy ID */
if (str2uchar(argv[1], &policy_id) < 0) { if (str2uchar(argv[1], &policy_id) < 0) {
lprintf(LOG_ERR,"Policy ID must be a positive integer (0-255)\n"); lprintf(LOG_ERR,
"Policy ID must be a positive integer (0-255)\n");
return -1; return -1;
} }
have_policy_id = TRUE; have_policy_id = TRUE;
@ -1403,8 +1423,8 @@ ipmi_nm_alert(struct ipmi_intf * intf, int argc, char **argv)
argv++; argv++;
argc--; argc--;
if (!argv[0] || if (!argv[0]
0xFF == (action = dcmi_str2val(argv[0], nm_alert_opts))) || 0xFF == (action = dcmi_str2val(argv[0], nm_alert_opts)))
{ {
dcmi_print_strs(nm_alert_opts, "Alert commands", LOG_ERR, 0); dcmi_print_strs(nm_alert_opts, "Alert commands", LOG_ERR, 0);
return -1; return -1;
@ -1415,7 +1435,8 @@ ipmi_nm_alert(struct ipmi_intf * intf, int argc, char **argv)
memset(&alert, 0, sizeof(alert)); memset(&alert, 0, sizeof(alert));
while (--argc) { while (--argc) {
argv++; argv++;
if (!argv[0]) break; if (!argv[0])
break;
if ((param = dcmi_str2val(argv[0], nm_set_alert_param)) == 0xFF) { if ((param = dcmi_str2val(argv[0], nm_set_alert_param)) == 0xFF) {
dcmi_print_strs(nm_set_alert_param, dcmi_print_strs(nm_set_alert_param,
"Set alert Parameters:", LOG_ERR, 0); "Set alert Parameters:", LOG_ERR, 0);
@ -1424,7 +1445,8 @@ ipmi_nm_alert(struct ipmi_intf * intf, int argc, char **argv)
switch (param) { switch (param) {
case 0x01: /* channel */ case 0x01: /* channel */
if (str2uchar(argv[1], &chan) < 0) { if (str2uchar(argv[1], &chan) < 0) {
lprintf(LOG_ERR,"Alert Lan chan must be a positive integer.\n"); lprintf(LOG_ERR,
"Alert Lan chan must be a positive integer.\n");
return -1; return -1;
} }
if (action == 0x03) /* Clear */ if (action == 0x03) /* Clear */
@ -1432,13 +1454,15 @@ ipmi_nm_alert(struct ipmi_intf * intf, int argc, char **argv)
break; break;
case 0x02: /* dest */ case 0x02: /* dest */
if (str2uchar(argv[1], &dest) < 0) { if (str2uchar(argv[1], &dest) < 0) {
lprintf(LOG_ERR,"Alert Destination must be a positive integer.\n"); lprintf(LOG_ERR,
"Alert Destination must be a positive integer.\n");
return -1; return -1;
} }
break; break;
case 0x03: /* string number */ case 0x03: /* string number */
if (str2uchar(argv[1], &string) < 0) { if (str2uchar(argv[1], &string) < 0) {
lprintf(LOG_ERR,"Alert String # must be a positive integer.\n"); lprintf(LOG_ERR,
"Alert String # must be a positive integer.\n");
return -1; return -1;
} }
string |= 0x80; /* set string select flag */ string |= 0x80; /* set string select flag */
@ -1452,7 +1476,8 @@ ipmi_nm_alert(struct ipmi_intf * intf, int argc, char **argv)
"Must set alert chan and dest params.", LOG_ERR, 0); "Must set alert chan and dest params.", LOG_ERR, 0);
return -1; return -1;
} }
if (string == 0xFF) string = 0; if (string == 0xFF)
string = 0;
alert.chan = chan; alert.chan = chan;
alert.dest = dest; alert.dest = dest;
alert.string = string; alert.string = string;
@ -1506,7 +1531,8 @@ ipmi_nm_thresh(struct ipmi_intf * intf, int argc, char **argv)
memset(&thresh, 0, sizeof(thresh)); memset(&thresh, 0, sizeof(thresh));
while (--argc) { while (--argc) {
argv++; argv++;
if (!argv[0]) break; if (!argv[0])
break;
option = dcmi_str2val(argv[0], nm_thresh_param); option = dcmi_str2val(argv[0], nm_thresh_param);
switch (option) { switch (option) {
case 0x01: /* get domain scope */ case 0x01: /* get domain scope */
@ -1519,7 +1545,8 @@ ipmi_nm_thresh(struct ipmi_intf * intf, int argc, char **argv)
break; break;
case 0x02: /* policy ID */ case 0x02: /* policy ID */
if (str2uchar(argv[1], &policy_id) < 0) { if (str2uchar(argv[1], &policy_id) < 0) {
lprintf(LOG_ERR,"Policy ID must be a positive integer (0-255)\n"); lprintf(LOG_ERR,
"Policy ID must be a positive integer (0-255)\n");
return -1; return -1;
} }
have_policy_id = TRUE; have_policy_id = TRUE;
@ -1528,11 +1555,15 @@ ipmi_nm_thresh(struct ipmi_intf * intf, int argc, char **argv)
break; break;
case 0xFF: case 0xFF:
if (i > 2) { if (i > 2) {
lprintf(LOG_ERR,"Set Threshold requires 1, 2, or 3 threshold integer values.\n"); lprintf(LOG_ERR, "Set Threshold requires 1, 2, or 3 "
"threshold integer values.\n");
return -1; return -1;
} }
if (str2ushort(argv[0], &thresh.thresholds[i++]) < 0) { if (str2ushort(argv[0], &thresh.thresholds[i++]) < 0) {
lprintf(LOG_ERR,"threshold value %d count must be a positive integer.\n", i); lprintf(LOG_ERR,
"threshold value %d count must be a positive "
"integer.\n",
i);
return -1; return -1;
} }
default: default:
@ -1557,15 +1588,18 @@ ipmi_nm_thresh(struct ipmi_intf * intf, int argc, char **argv)
static inline int static inline int
click2hour(int click) click2hour(int click)
{ {
if ((click*6) < 60) return 0; if ((click * 6) < 60)
return 0;
return ((click * 6) / 60); return ((click * 6) / 60);
} }
static inline int static inline int
click2min(int click) click2min(int click)
{ {
if (!click) return 0; if (!click)
if ((click*6) < 60) return click*6; return 0;
if ((click * 6) < 60)
return click * 6;
return (click * 6) % 60; return (click * 6) % 60;
} }
@ -1584,14 +1618,14 @@ ipmi_nm_get_suspend(struct ipmi_intf *intf, uint8_t domain, uint8_t policy_id)
printf(" Suspend Policy domain: %s\n", printf(" Suspend Policy domain: %s\n",
dcmi_val2str(domain, nm_domain_vals)); dcmi_val2str(domain, nm_domain_vals));
printf(" Suspend Policy Policy ID: %d\n", printf(" Suspend Policy Policy ID: %d\n", policy_id);
policy_id);
if (!count) { if (!count) {
printf(" No suspend Periods.\n"); printf(" No suspend Periods.\n");
return 0; return 0;
} }
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
printf(" Suspend Period %d: %02d:%02d to %02d:%02d", printf(" Suspend Period %d: %02d:%02d to "
"%02d:%02d",
i, click2hour(periods[i].start), click2min(periods[i].start), i, click2hour(periods[i].start), click2min(periods[i].start),
click2hour(periods[i].stop), click2min(periods[i].stop)); click2hour(periods[i].stop), click2min(periods[i].stop));
if (periods[i].repeat) if (periods[i].repeat)
@ -1618,8 +1652,8 @@ ipmi_nm_suspend(struct ipmi_intf * intf, int argc, char **argv)
argv++; argv++;
argc--; argc--;
/* set or get */ /* set or get */
if (!argv[0] || argc < 3 || if (!argv[0] || argc < 3
0xFF == (action = dcmi_str2val(argv[0], nm_suspend_cmds))) || 0xFF == (action = dcmi_str2val(argv[0], nm_suspend_cmds)))
{ {
dcmi_print_strs(nm_suspend_cmds, "Suspend commands", LOG_ERR, 0); dcmi_print_strs(nm_suspend_cmds, "Suspend commands", LOG_ERR, 0);
return -1; return -1;
@ -1627,7 +1661,8 @@ ipmi_nm_suspend(struct ipmi_intf * intf, int argc, char **argv)
memset(&suspend, 0, sizeof(suspend)); memset(&suspend, 0, sizeof(suspend));
while (--argc > 0) { while (--argc > 0) {
argv++; argv++;
if (!argv[0]) break; if (!argv[0])
break;
option = dcmi_str2val(argv[0], nm_thresh_param); option = dcmi_str2val(argv[0], nm_thresh_param);
switch (option) { switch (option) {
case 0x01: /* get domain scope */ case 0x01: /* get domain scope */
@ -1640,7 +1675,8 @@ ipmi_nm_suspend(struct ipmi_intf * intf, int argc, char **argv)
break; break;
case 0x02: /* policy ID */ case 0x02: /* policy ID */
if (str2uchar(argv[1], &policy_id) < 0) { if (str2uchar(argv[1], &policy_id) < 0) {
lprintf(LOG_ERR,"Policy ID must be a positive integer (0-255)\n"); lprintf(LOG_ERR,
"Policy ID must be a positive integer (0-255)\n");
return -1; return -1;
} }
have_policy_id = TRUE; have_policy_id = TRUE;
@ -1650,19 +1686,24 @@ ipmi_nm_suspend(struct ipmi_intf * intf, int argc, char **argv)
case 0xFF: /* process periods */ case 0xFF: /* process periods */
for (i = 0; count < IPMI_NM_SUSPEND_PERIOD_MAX; i += 3, count++) { for (i = 0; count < IPMI_NM_SUSPEND_PERIOD_MAX; i += 3, count++) {
if (argc < 3) { if (argc < 3) {
lprintf(LOG_ERR,"Error: suspend period requires a start, stop, and repeat values.\n"); lprintf(LOG_ERR, "Error: suspend period requires a "
"start, stop, and repeat values.\n");
return -1; return -1;
} }
if (str2uchar(argv[i + 0], &suspend.period[count].start) < 0) { if (str2uchar(argv[i + 0], &suspend.period[count].start) < 0) {
lprintf(LOG_ERR,"suspend start value %d must be 0-239.\n", count); lprintf(LOG_ERR, "suspend start value %d must be 0-239.\n",
count);
return -1; return -1;
} }
if (str2uchar(argv[i + 1], &suspend.period[count].stop) < 0) { if (str2uchar(argv[i + 1], &suspend.period[count].stop) < 0) {
lprintf(LOG_ERR,"suspend stop value %d must be 0-239.\n", count); lprintf(LOG_ERR, "suspend stop value %d must be 0-239.\n",
count);
return -1; return -1;
} }
if (str2uchar(argv[i + 2], &suspend.period[count].repeat) < 0) { if (str2uchar(argv[i + 2], &suspend.period[count].repeat) < 0) {
lprintf(LOG_ERR,"suspend repeat value %d unable to convert.\n", count); lprintf(LOG_ERR,
"suspend repeat value %d unable to convert.\n",
count);
return -1; return -1;
} }
argc -= 3; argc -= 3;
@ -1705,8 +1746,7 @@ ipmi_nm_main(struct ipmi_intf * intf, int argc, char **argv)
struct nm_discover disc; struct nm_discover disc;
if ((argc == 0) || (strncmp(argv[0], "help", 4) == 0)) { if ((argc == 0) || (strncmp(argv[0], "help", 4) == 0)) {
dcmi_print_strs(nm_cmd_vals, dcmi_print_strs(nm_cmd_vals, "Node Manager Interface commands",
"Node Manager Interface commands",
LOG_ERR, 0); LOG_ERR, 0);
return -1; return -1;
} }