ID: 46 - ipmi_fwum needs some re-work

KfwumMain() - change code formatting

Commit changes code formatting of KfwumMain() into readable form and to make
sense out of it.
This commit is contained in:
Zdenek Styblik 2013-10-26 18:37:00 +00:00
parent fb3c6f292e
commit 2b08fd405e

View File

@ -319,129 +319,76 @@ static void KfwumMain(struct ipmi_intf * intf, tKFWUM_Task task)
unsigned long fileSize = 0; unsigned long fileSize = 0;
static unsigned short padding; static unsigned short padding;
if((status == KFWUM_STATUS_OK) && (task == KFWUM_TASK_INFO)) if ((status == KFWUM_STATUS_OK) && (task == KFWUM_TASK_INFO)) {
{
unsigned char notUsed; unsigned char notUsed;
if(verbose) if (verbose) {
{
printf("Getting Kontron FWUM Info\n"); printf("Getting Kontron FWUM Info\n");
} }
KfwumGetDeviceInfo(intf, 1, &boardInfo); KfwumGetDeviceInfo(intf, 1, &boardInfo);
KfwumGetInfo(intf, 1, &notUsed); KfwumGetInfo(intf, 1, &notUsed);
} }
if ((status == KFWUM_STATUS_OK) && (task == KFWUM_TASK_STATUS)) {
if (verbose) {
if((status == KFWUM_STATUS_OK) && (task == KFWUM_TASK_STATUS))
{
if(verbose)
{
printf("Getting Kontron FWUM Status\n"); printf("Getting Kontron FWUM Status\n");
} }
KfwumGetStatus(intf); KfwumGetStatus(intf);
} }
if ((status == KFWUM_STATUS_OK) && (task == KFWUM_TASK_ROLLBACK)) {
if( (status == KFWUM_STATUS_OK) && (task == KFWUM_TASK_ROLLBACK) )
{
status = KfwumManualRollback(intf); status = KfwumManualRollback(intf);
} }
if ((status == KFWUM_STATUS_OK)
if( && ((task == KFWUM_TASK_UPGRADE)
(status == KFWUM_STATUS_OK) && || (task == KFWUM_TASK_DOWNLOAD))) {
(
(task == KFWUM_TASK_UPGRADE) || (task == KFWUM_TASK_DOWNLOAD)
)
)
{
status = KfwumGetFileSize(fileName, &fileSize); status = KfwumGetFileSize(fileName, &fileSize);
if(status == KFWUM_STATUS_OK) if (status == KFWUM_STATUS_OK) {
{
status = KfwumSetupBuffersFromFile(fileName, fileSize); status = KfwumSetupBuffersFromFile(fileName, fileSize);
if(status == KFWUM_STATUS_OK) if (status == KFWUM_STATUS_OK) {
{
padding = KfwumCalculateChecksumPadding(firmBuf, fileSize); padding = KfwumCalculateChecksumPadding(firmBuf, fileSize);
} }
} }
if(status == KFWUM_STATUS_OK) if (status == KFWUM_STATUS_OK) {
{
status = KfwumGetInfoFromFirmware(firmBuf, fileSize, &firmInfo); status = KfwumGetInfoFromFirmware(firmBuf, fileSize, &firmInfo);
} }
if(status == KFWUM_STATUS_OK) if (status == KFWUM_STATUS_OK) {
{
status = KfwumGetDeviceInfo(intf, 0, &boardInfo); status = KfwumGetDeviceInfo(intf, 0, &boardInfo);
} }
if (status == KFWUM_STATUS_OK) {
if(status == KFWUM_STATUS_OK)
{
status = KfwumValidFirmwareForBoard(boardInfo,firmInfo); status = KfwumValidFirmwareForBoard(boardInfo,firmInfo);
} }
if (status == KFWUM_STATUS_OK) {
if (status == KFWUM_STATUS_OK)
{
unsigned char notUsed; unsigned char notUsed;
KfwumGetInfo(intf, 0, &notUsed); KfwumGetInfo(intf, 0, &notUsed);
} }
KfwumOutputInfo(boardInfo,firmInfo); KfwumOutputInfo(boardInfo,firmInfo);
} }
if ((status == KFWUM_STATUS_OK)
if( && ((task == KFWUM_TASK_UPGRADE)
(status == KFWUM_STATUS_OK) && || (task == KFWUM_TASK_DOWNLOAD))) {
(
(task == KFWUM_TASK_UPGRADE) || (task == KFWUM_TASK_DOWNLOAD)
)
)
{
status = KfwumStartFirmwareImage(intf, fileSize, padding); status = KfwumStartFirmwareImage(intf, fileSize, padding);
} }
if ((status == KFWUM_STATUS_OK)
&& ((task == KFWUM_TASK_UPGRADE)
if( || (task == KFWUM_TASK_DOWNLOAD))) {
(status == KFWUM_STATUS_OK) &&
(
(task == KFWUM_TASK_UPGRADE) || (task == KFWUM_TASK_DOWNLOAD)
)
)
{
status = KfwumUploadFirmware(intf, firmBuf, fileSize); status = KfwumUploadFirmware(intf, firmBuf, fileSize);
} }
if ((status == KFWUM_STATUS_OK)
if( && ((task == KFWUM_TASK_UPGRADE)
(status == KFWUM_STATUS_OK) && || (task == KFWUM_TASK_DOWNLOAD))) {
(
(task == KFWUM_TASK_UPGRADE) || (task == KFWUM_TASK_DOWNLOAD)
)
)
{
status = KfwumFinishFirmwareImage(intf, firmInfo); status = KfwumFinishFirmwareImage(intf, firmInfo);
} }
if ((status == KFWUM_STATUS_OK)
if( && ((task == KFWUM_TASK_UPGRADE)
(status == KFWUM_STATUS_OK) && || (task == KFWUM_TASK_DOWNLOAD))) {
(
(task == KFWUM_TASK_UPGRADE) || (task == KFWUM_TASK_DOWNLOAD)
)
)
{
status = KfwumGetStatus(intf); status = KfwumGetStatus(intf);
} }
if ((status == KFWUM_STATUS_OK)
if( && ((task == KFWUM_TASK_UPGRADE)
(status == KFWUM_STATUS_OK) && || (task == KFWUM_TASK_START_UPGRADE))) {
(
(task == KFWUM_TASK_UPGRADE) || (task == KFWUM_TASK_START_UPGRADE)
)
)
{
status = KfwumStartFirmwareUpgrade(intf); status = KfwumStartFirmwareUpgrade(intf);
} }
if ((status == KFWUM_STATUS_OK) && (task == KFWUM_TASK_TRACELOG)) {
if((status == KFWUM_STATUS_OK) && (task == KFWUM_TASK_TRACELOG))
{
status = KfwumGetTraceLog(intf); status = KfwumGetTraceLog(intf);
} }
} }
/* KfwumGetFileSize - gets the file size /* KfwumGetFileSize - gets the file size