diff options
Diffstat (limited to 'lib/ipmi_vita.c')
-rw-r--r-- | lib/ipmi_vita.c | 86 |
1 files changed, 43 insertions, 43 deletions
diff --git a/lib/ipmi_vita.c b/lib/ipmi_vita.c index 3900974..2771809 100644 --- a/lib/ipmi_vita.c +++ b/lib/ipmi_vita.c @@ -190,7 +190,7 @@ vita_discover(struct ipmi_intf *intf) rsp = intf->sendrecv(intf, &req); - if (rsp == NULL) { + if (!rsp) { lprintf(LOG_ERR, "No valid response received"); } else if (rsp->ccode == 0xC1) { lprintf(LOG_INFO, "Invalid completion code received: %s", @@ -198,7 +198,7 @@ vita_discover(struct ipmi_intf *intf) } else if (rsp->ccode == 0xCC) { lprintf(LOG_INFO, "Invalid data field received: %s", val2str(rsp->ccode, completion_code_vals)); - } else if (rsp->ccode != 0) { + } else if (rsp->ccode) { lprintf(LOG_INFO, "Invalid completion code received: %s", val2str(rsp->ccode, completion_code_vals)); } else if (rsp->data_len < 5) { @@ -240,9 +240,9 @@ ipmi_vita_ipmb_address(struct ipmi_intf *intf) rsp = intf->sendrecv(intf, &req); - if (rsp == NULL) { + if (!rsp) { lprintf(LOG_ERR, "No valid response received"); - } else if (rsp->ccode != 0) { + } else if (rsp->ccode) { lprintf(LOG_ERR, "Invalid completion code received: %s", val2str(rsp->ccode, completion_code_vals)); } else if (rsp->data_len < 7) { @@ -284,10 +284,10 @@ ipmi_vita_getaddr(struct ipmi_intf *intf, int argc, char **argv) rsp = intf->sendrecv(intf, &req); - if (rsp == NULL) { + if (!rsp) { lprintf(LOG_ERR, "No valid response received"); return -1; - } else if (rsp->ccode != 0) { + } else if (rsp->ccode) { lprintf(LOG_ERR, "Invalid completion code received: %s", val2str(rsp->ccode, completion_code_vals)); return -1; @@ -332,10 +332,10 @@ ipmi_vita_get_vso_capabilities(struct ipmi_intf *intf) rsp = intf->sendrecv(intf, &req); - if (rsp == NULL) { + if (!rsp) { lprintf(LOG_ERR, "No valid response received."); return -1; - } else if (rsp->ccode != 0) { + } else if (rsp->ccode) { lprintf(LOG_ERR, "Invalid completion code received: %s", val2str(rsp->ccode, completion_code_vals)); return -1; @@ -402,10 +402,10 @@ ipmi_vita_set_fru_activation(struct ipmi_intf *intf, rsp = intf->sendrecv(intf, &req); - if (rsp == NULL) { + if (!rsp) { lprintf(LOG_ERR, "No valid response received."); return -1; - } else if (rsp->ccode != 0) { + } else if (rsp->ccode) { lprintf(LOG_ERR, "Invalid completion code received: %s", val2str(rsp->ccode, completion_code_vals)); return -1; @@ -444,10 +444,10 @@ ipmi_vita_get_fru_state_policy_bits(struct ipmi_intf *intf, char **argv) rsp = intf->sendrecv(intf, &req); - if (rsp == NULL) { + if (!rsp) { lprintf(LOG_ERR, "No valid response received."); return -1; - } else if (rsp->ccode != 0) { + } else if (rsp->ccode) { lprintf(LOG_ERR, "Invalid completion code received: %s", val2str(rsp->ccode, completion_code_vals)); return -1; @@ -499,10 +499,10 @@ ipmi_vita_set_fru_state_policy_bits(struct ipmi_intf *intf, char **argv) rsp = intf->sendrecv(intf, &req); - if (rsp == NULL) { + if (!rsp) { lprintf(LOG_ERR, "No valid response received."); return -1; - } else if (rsp->ccode != 0) { + } else if (rsp->ccode) { lprintf(LOG_ERR, "Invalid completion code received: %s", val2str(rsp->ccode, completion_code_vals)); return -1; @@ -540,10 +540,10 @@ ipmi_vita_get_led_properties(struct ipmi_intf *intf, char **argv) rsp = intf->sendrecv(intf, &req); - if (rsp == NULL) { + if (!rsp) { lprintf(LOG_ERR, "No valid response received."); return -1; - } else if (rsp->ccode != 0) { + } else if (rsp->ccode) { lprintf(LOG_ERR, "Invalid completion code received: %s", val2str(rsp->ccode, completion_code_vals)); return -1; @@ -585,10 +585,10 @@ ipmi_vita_get_led_color_capabilities(struct ipmi_intf *intf, char **argv) rsp = intf->sendrecv(intf, &req); - if (rsp == NULL) { + if (!rsp) { lprintf(LOG_ERR, "No valid response received."); return -1; - } else if (rsp->ccode != 0) { + } else if (rsp->ccode) { lprintf(LOG_ERR, "Invalid completion code received: %s", val2str(rsp->ccode, completion_code_vals)); return -1; @@ -603,14 +603,14 @@ ipmi_vita_get_led_color_capabilities(struct ipmi_intf *intf, char **argv) printf("LED Color Capabilities: "); for (i = 0; i < 8; i++) { if (rsp->data[1] & (0x01 << i)) { - printf("%s, ", led_color_str[i]); + printf("%s, ", picmg_led_color_str(i)); } } putchar('\n'); printf("Default LED Color in\n"); - printf(" LOCAL control: %s\n", led_color_str[rsp->data[2]]); - printf(" OVERRIDE state: %s\n", led_color_str[rsp->data[3]]); + printf(" LOCAL control: %s\n", picmg_led_color_str(rsp->data[2])); + printf(" OVERRIDE state: %s\n", picmg_led_color_str(rsp->data[3])); if (rsp->data_len == 5) { printf("LED flags:\n"); @@ -649,10 +649,10 @@ ipmi_vita_get_led_state(struct ipmi_intf *intf, char **argv) rsp = intf->sendrecv(intf, &req); - if (rsp == NULL) { + if (!rsp) { lprintf(LOG_ERR, "No valid response received."); return -1; - } else if (rsp->ccode != 0) { + } else if (rsp->ccode) { lprintf(LOG_ERR, "Invalid completion code received: %s", val2str(rsp->ccode, completion_code_vals)); return -1; @@ -692,7 +692,7 @@ ipmi_vita_get_led_state(struct ipmi_intf *intf, char **argv) } printf(" Local Control On-Duration: %x\n", rsp->data[3]); printf(" Local Control Color: %x\t[%s]\n", - rsp->data[4], led_color_str[rsp->data[4] & 7]); + rsp->data[4], picmg_led_color_str(rsp->data[4] & 7)); } /* override state or lamp test */ @@ -707,7 +707,7 @@ ipmi_vita_get_led_state(struct ipmi_intf *intf, char **argv) } printf(" Override On-Duration: %x\n", rsp->data[6]); printf(" Override Color: %x\t[%s]\n", - rsp->data[7], led_color_str[rsp->data[7] & 7]); + rsp->data[7], picmg_led_color_str(rsp->data[7] & 7)); if (rsp->data[1] == 0x04) { printf(" Lamp test duration: %x\n", rsp->data[8]); } @@ -749,10 +749,10 @@ ipmi_vita_set_led_state(struct ipmi_intf *intf, char **argv) rsp = intf->sendrecv(intf, &req); - if (rsp == NULL) { + if (!rsp) { lprintf(LOG_ERR, "No valid response received."); return -1; - } else if (rsp->ccode != 0) { + } else if (rsp->ccode) { lprintf(LOG_ERR, "Invalid completion code received: %s", val2str(rsp->ccode, completion_code_vals)); return -1; @@ -796,10 +796,10 @@ ipmi_vita_fru_control(struct ipmi_intf *intf, char **argv) rsp = intf->sendrecv(intf, &req); - if (rsp == NULL) { + if (!rsp) { lprintf(LOG_ERR, "No valid response received."); return -1; - } else if (rsp->ccode != 0) { + } else if (rsp->ccode) { lprintf(LOG_ERR, "Invalid completion code received: %s", val2str(rsp->ccode, completion_code_vals)); return -1; @@ -819,48 +819,48 @@ ipmi_vita_fru_control(struct ipmi_intf *intf, char **argv) static int ipmi_vita_get_cmd(int argc, char **argv) { - if (argc < 1 || !strncmp(argv[0], "help", 4)) { + if (argc < 1 || !strcmp(argv[0], "help")) { return VITA_CMD_HELP; } /* Get VSO Properties */ - if (!strncmp(argv[0], "properties", 10)) { + if (!strcmp(argv[0], "properties")) { return VITA_CMD_PROPERTIES; } /* FRU Control command */ - if (!strncmp(argv[0], "frucontrol", 10)) { + if (!strcmp(argv[0], "frucontrol")) { return VITA_CMD_FRUCONTROL; } /* Get FRU Address Info command */ - if (!strncmp(argv[0], "addrinfo", 8)) { + if (!strcmp(argv[0], "addrinfo")) { return VITA_CMD_ADDRINFO; } /* Set FRU Activation (activate) command */ - if (!strncmp(argv[0], "activate", 8)) { + if (!strcmp(argv[0], "activate")) { return VITA_CMD_ACTIVATE; } /* Set FRU Activation (deactivate) command */ - if (!strncmp(argv[0], "deactivate", 10)) { + if (!strcmp(argv[0], "deactivate")) { return VITA_CMD_DEACTIVATE; } /* FRU State Policy Bits commands */ - if (!strncmp(argv[0], "policy", 6)) { + if (!strcmp(argv[0], "policy")) { if (argc < 2) { return VITA_CMD_UNKNOWN; } /* Get FRU State Policy Bits command */ - if (!strncmp(argv[1], "get", 3)) { + if (!strcmp(argv[1], "get")) { return VITA_CMD_POLICY_GET; } /* Set FRU State Policy Bits command */ - if (!strncmp(argv[1], "set", 3)) { + if (!strcmp(argv[1], "set")) { return VITA_CMD_POLICY_SET; } @@ -869,28 +869,28 @@ ipmi_vita_get_cmd(int argc, char **argv) } /* FRU LED commands */ - if (!strncmp(argv[0], "led", 3)) { + if (!strcmp(argv[0], "led")) { if (argc < 2) { return VITA_CMD_UNKNOWN; } /* FRU LED Get Properties */ - if (!strncmp(argv[1], "prop", 4)) { + if (!strcmp(argv[1], "prop")) { return VITA_CMD_LED_PROP; } /* FRU LED Get Capabilities */ - if (!strncmp(argv[1], "cap", 3)) { + if (!strcmp(argv[1], "cap")) { return VITA_CMD_LED_CAP; } /* FRU LED Get State */ - if (!strncmp(argv[1], "get", 3)) { + if (!strcmp(argv[1], "get")) { return VITA_CMD_LED_GET; } /* FRU LED Set State */ - if (!strncmp(argv[1], "set", 3)) { + if (!strcmp(argv[1], "set")) { return VITA_CMD_LED_SET; } |