mirror of
https://github.com/ipmitool/ipmitool.git
synced 2025-05-10 18:47:22 +00:00
fru: cleanup ipmi_fru_oemkontron_get
Cleanup style in method ipmi_fru_oemkontron_get as well as add inverted logic checks to reduce indentation. Signed-off-by: Patrick Venture <venture@google.com>
This commit is contained in:
parent
6d515dd06b
commit
92ee477cde
@ -40,6 +40,7 @@
|
||||
#include <ipmitool/ipmi_strings.h> /* IANA id strings */
|
||||
#include <ipmitool/ipmi_time.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
@ -1616,7 +1617,7 @@ static void ipmi_fru_oemkontron_get(int argc,
|
||||
int off,
|
||||
struct fru_multirec_oem_header *oh)
|
||||
{
|
||||
static int badParams=FALSE;
|
||||
static bool badParams = false;
|
||||
int start = off;
|
||||
int offset = start;
|
||||
offset += sizeof(struct fru_multirec_oem_header);
|
||||
@ -1626,21 +1627,25 @@ static void ipmi_fru_oemkontron_get(int argc,
|
||||
if( argc > OEM_KONTRON_SUBCOMMAND_ARG_POS ){
|
||||
if(strncmp("oem", argv[OEM_KONTRON_SUBCOMMAND_ARG_POS],3)){
|
||||
printf("usage: fru get <id> <oem>\n");
|
||||
badParams = TRUE;
|
||||
badParams = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
if( argc<GET_OEM_KONTRON_COMPLETE_ARG_COUNT ){
|
||||
printf("usage: oem <iana> <recordid>\n");
|
||||
printf("usage: oem 15000 3\n");
|
||||
badParams = TRUE;
|
||||
badParams = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if(!badParams){
|
||||
if (badParams) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(oh->record_id == OEM_KONTRON_INFORMATION_RECORD ) {
|
||||
if (oh->record_id != OEM_KONTRON_INFORMATION_RECORD) {
|
||||
return;
|
||||
}
|
||||
|
||||
uint8_t version;
|
||||
|
||||
@ -1657,7 +1662,7 @@ static void ipmi_fru_oemkontron_get(int argc,
|
||||
lprintf(LOG_ERR,
|
||||
"Instance argument '%s' is either invalid or out of range.",
|
||||
argv[OEM_KONTRON_INSTANCE_ARG_POS]);
|
||||
badParams = TRUE;
|
||||
badParams = true;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1668,15 +1673,15 @@ static void ipmi_fru_oemkontron_get(int argc,
|
||||
uint8_t nameLen;
|
||||
|
||||
nameLen = (fru_data[offset++] &= 0x3F);
|
||||
printf(" Name: %*.*s\n",nameLen, nameLen, (const char *)(fru_data+offset));
|
||||
printf(" Name: %*.*s\n", nameLen, nameLen,
|
||||
(const char *)(fru_data + offset));
|
||||
|
||||
offset += nameLen;
|
||||
|
||||
pRecordData = &fru_data[offset];
|
||||
|
||||
printf(" Record Version: %d\n", version);
|
||||
if( version == 0 )
|
||||
{
|
||||
if (version == 0) {
|
||||
printf(" Version: %*.*s\n",
|
||||
OEM_KONTRON_FIELD_SIZE,
|
||||
OEM_KONTRON_FIELD_SIZE,
|
||||
@ -1696,9 +1701,7 @@ static void ipmi_fru_oemkontron_get(int argc,
|
||||
matchInstance++;
|
||||
offset += sizeof(tOemKontronInformationRecordV0);
|
||||
offset++;
|
||||
}
|
||||
else if ( version == 1 )
|
||||
{
|
||||
} else if (version == 1) {
|
||||
printf(" Version: %*.*s\n",
|
||||
OEM_KONTRON_VERSION_FIELD_SIZE,
|
||||
OEM_KONTRON_VERSION_FIELD_SIZE,
|
||||
@ -1718,15 +1721,11 @@ static void ipmi_fru_oemkontron_get(int argc,
|
||||
matchInstance++;
|
||||
offset += sizeof(tOemKontronInformationRecordV1);
|
||||
offset++;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
printf(" Unsupported version %d\n", version);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int ipmi_fru_oemkontron_edit( int argc, char ** argv,uint8_t * fru_data,
|
||||
int off,int len,
|
||||
|
Loading…
x
Reference in New Issue
Block a user