📄 davrcvr.c
字号:
}
break;
} /* switch */
break;
case RATTBL_RatEntryOperation_ModifyWithNoBackup:
switch(RATTBL_GetRecoveredRatEntryBtmProgressState(&ratEntry, ratEntryHandle))
{
case RATTBL_RatEntryBtmProgressState_NoOperationInProgress:
case RATTBL_RatEntryBtmProgressState_BkupOfOrigGroupInProgress:
case RATTBL_RatEntryBtmProgressState_RestartBtmBlkBkupGroupInReclaim:
case RATTBL_RatEntryBtmProgressState_RestartBtmBlkBkupGroupReclaimComplete:
case RATTBL_RatEntryBtmProgressState_RestartTopBlkBkupGroupInReclaim:
case RATTBL_RatEntryBtmProgressState_RestartTopBlkBkupGroupReclaimComplete:
case RATTBL_RatEntryBtmProgressState_BkupOfOrigGroupComplete:
break;
case RATTBL_RatEntryBtmProgressState_BtmBlkOrigGroupInReclaim:
case RATTBL_RatEntryBtmProgressState_BtmBlkOrigGroupReclaimComplete:
case RATTBL_RatEntryBtmProgressState_TopBlkOrigGroupInReclaim:
case RATTBL_RatEntryBtmProgressState_TopBlkOrigGroupReclaimComplete:
/* since there was no backup, we've lost the object (group should have only 1 in this case) */
ottBtmIndex = RATTBL_GetRatEntryBtmIndex(&ratEntry);
status = OTTTBL_GetFirstOttEntry(&ottHandle, &ottEntry, &ottLeader);
if (status != ERR_NONE)
{
return status;
}
if (ottBtmIndex > 0)
{
for (ottIndex = 0; ottIndex <= ottBtmIndex; ottIndex++)
{
status = OTTTBL_GetNextOttEntry(&ottHandle, &ottEntry, &ottHandle);
if (status != ERR_NONE)
{
return status;
}
}
}
bottomObjectOffset = OTTTBL_GetOttEntryDestination(&ottEntry);
bottomObjectHandle = (bottomObjectOffset * FDI_PageSize) + FDI_PageSpaceAddressBottom;
/* mark the fixed header for this object as invalid */
status = RECLAIM_PAGE_RestartInvalidateOrigObject(bottomObjectHandle, aRefPtr->plrRestart);
if (status != ERR_NONE)
{
return status;
}
/* set bottom status to ModifyInProgress */
RATTBL_SetRatEntryBtmProgressState(&ratEntry, RATTBL_RatEntryBtmProgressState_ModifyInProgress);
status = RATTBL_WriteRatEntryBtmProgressState(&ratEntryHandle, &ratEntry);
if (status != ERR_NONE)
{
return status;
}
/* set top status to ModifyUserObjectsComplete */
RATTBL_SetRatEntryTopProgressState(&ratEntry, RATTBL_RatEntryTopProgressState_ModifyUserObjectsComplete);
status = RATTBL_WriteRatEntryTopProgressState(&ratEntryHandle, &ratEntry);
if (status != ERR_NONE)
{
return status;
}
break;
case RATTBL_RatEntryBtmProgressState_ModifyInProgress:
if (RATTBL_GetRecoveredRatEntryTopProgressState(&ratEntry, ratEntryHandle) == RATTBL_RatEntryTopProgressState_NoOperationInProgress)
{
/* since there was no backup, we've lost the object (group should have only 1 in this case) */
ottBtmIndex = RATTBL_GetRatEntryBtmIndex(&ratEntry);
status = OTTTBL_GetFirstOttEntry(&ottHandle, &ottEntry, &ottLeader);
if (status != ERR_NONE)
{
return status;
}
if (ottBtmIndex > 0)
{
for (ottIndex = 0; ottIndex <= ottBtmIndex; ottIndex++)
{
status = OTTTBL_GetNextOttEntry(&ottHandle, &ottEntry, &ottHandle);
if (status != ERR_NONE)
{
return status;
}
}
}
bottomObjectOffset = OTTTBL_GetOttEntryDestination(&ottEntry);
bottomObjectHandle = (bottomObjectOffset * FDI_PageSize) + FDI_PageSpaceAddressBottom;
/* mark the fixed header for this object as invalid */
status = RECLAIM_PAGE_RestartInvalidateOrigObject(bottomObjectHandle, aRefPtr->plrRestart);
if (status != ERR_NONE)
{
return status;
}
/* set bottom status to ModifyInProgress */
RATTBL_SetRatEntryBtmProgressState(&ratEntry, RATTBL_RatEntryBtmProgressState_ModifyInProgress);
status = RATTBL_WriteRatEntryBtmProgressState(&ratEntryHandle, &ratEntry);
if (status != ERR_NONE)
{
return status;
}
/* set top status to ModifyUserObjectsComplete */
RATTBL_SetRatEntryTopProgressState(&ratEntry, RATTBL_RatEntryTopProgressState_ModifyUserObjectsComplete);
status = RATTBL_WriteRatEntryTopProgressState(&ratEntryHandle, &ratEntry);
if (status != ERR_NONE)
{
return status;
}
break;
}
switch(RATTBL_GetRecoveredRatEntryTopProgressState(&ratEntry, ratEntryHandle))
{
case RATTBL_RatEntryTopProgressState_NoOperationInProgress:
/* since there was no backup, we've lost the object (group should have only 1 in this case) */
ottBtmIndex = RATTBL_GetRatEntryBtmIndex(&ratEntry);
status = OTTTBL_GetFirstOttEntry(&ottHandle, &ottEntry, &ottLeader);
if (status != ERR_NONE)
{
return status;
}
if (ottBtmIndex > 0)
{
for (ottIndex = 0; ottIndex <= ottBtmIndex; ottIndex++)
{
status = OTTTBL_GetNextOttEntry(&ottHandle, &ottEntry, &ottHandle);
if (status != ERR_NONE)
{
return status;
}
}
}
bottomObjectOffset = OTTTBL_GetOttEntryDestination(&ottEntry);
bottomObjectHandle = (bottomObjectOffset * FDI_PageSize) + FDI_PageSpaceAddressBottom;
/* mark the fixed header for this object as invalid */
status = RECLAIM_PAGE_RestartInvalidateOrigObject(bottomObjectHandle, aRefPtr->plrRestart);
if (status != ERR_NONE)
{
return status;
}
/* set bottom status to ModifyInProgress */
RATTBL_SetRatEntryBtmProgressState(&ratEntry, RATTBL_RatEntryBtmProgressState_ModifyInProgress);
status = RATTBL_WriteRatEntryBtmProgressState(&ratEntryHandle, &ratEntry);
if (status != ERR_NONE)
{
return status;
}
/* set top status to ModifyUserObjectsComplete */
RATTBL_SetRatEntryTopProgressState(&ratEntry, RATTBL_RatEntryTopProgressState_ModifyUserObjectsComplete);
status = RATTBL_WriteRatEntryTopProgressState(&ratEntryHandle, &ratEntry);
if (status != ERR_NONE)
{
return status;
}
break;
case RATTBL_RatEntryTopProgressState_ModifyComplete:
case RATTBL_RatEntryTopProgressState_BtmBlkBkupGroupInReclaim:
case RATTBL_RatEntryTopProgressState_BtmBlkBkupGroupReclaimComplete:
case RATTBL_RatEntryTopProgressState_TopBlkBkupGroupInReclaim:
case RATTBL_RatEntryTopProgressState_TopBlkBkupGroupReclaimComplete:
case RATTBL_RatEntryTopProgressState_ModifyUserObjectsComplete:
break;
default:
status = ERR_STATE;
if (status != ERR_NONE)
{
return status;
}
break;
}
break;
default:
status = ERR_STATE;
if (status != ERR_NONE)
{
return status;
}
break;
} /* switch */
break;
case RATTBL_RatEntryOperation_BackupOnly:
switch(RATTBL_GetRecoveredRatEntryBtmProgressState(&ratEntry, ratEntryHandle))
{
case RATTBL_RatEntryBtmProgressState_NoOperationInProgress:
/* we want to abort this operation entirely */
RATTBL_SetRatEntryBtmProgressState(&ratEntry, RATTBL_RatEntryBtmProgressState_ModifyInProgress);
status = RATTBL_WriteRatEntryBtmProgressState(&ratEntryHandle, &ratEntry);
if (status != ERR_NONE)
{
return status;
}
RATTBL_SetRatEntryTopProgressState(&ratEntry, RATTBL_RatEntryTopProgressState_ModifyUserObjectsComplete);
status = RATTBL_WriteRatEntryTopProgressState(&ratEntryHandle, &ratEntry);
if (status != ERR_NONE)
{
return status;
}
break;
case RATTBL_RatEntryBtmProgressState_BkupOfOrigGroupInProgress:
case RATTBL_RatEntryBtmProgressState_RestartBtmBlkBkupGroupInReclaim:
case RATTBL_RatEntryBtmProgressState_RestartBtmBlkBkupGroupReclaimComplete:
case RATTBL_RatEntryBtmProgressState_RestartTopBlkBkupGroupInReclaim:
status = RECLAIM_PAGE_CalcBackupGroupParms(&topBlock,
&topObjectHandle,
&topObjectSizeInPages,
&groupSizeInPages,
&bottomBlock,
&bottomObjectHandle,
aRefPtr->plrRestart);
if (status != ERR_NONE)
{
return status;
}
/* mark all backup objects in the group as absorbing */
status = RECLAIM_PAGE_SetBackupGroupAbsorbStatus(HDR_ABSORBING,
aRefPtr->plrRestart);
if (status != ERR_NONE)
{
return status;
}
status = RECLAIM_PAGE_RestartEraseBackupGroup(
ratEntryHandle,
&ratEntry,
topBlock,
topObjectHandle,
topObjectSizeInPages,
groupSizeInPages,
bottomBlock,
bottomObjectHandle,
aRefPtr->plrRestart);
if (status != ERR_NONE)
{
return status;
}
/* need to recompute the bottom object handle for the backup */
/* group, since this is PLR */
RECLAIM_PAGE_CalcBackupAllocation(&ratLeader,
&bottomObjectHandle,
&bkupSizeInPages,
aRefPtr->plrRestart);
/* create a free chunk header to replace the backup group, and */
/* the free chunk beyond it, if necessary. */
/* Be sure to use the group size, not the backup size, to do */
/* this because the backup size is the total allocation not */
/* just what we used for the group. */
/* Open issue in 5.3.3: groupSize will not be valid for double PLR */
status = RECLAIM_PAGE_CleanUpBackupAllocation(bottomObjectHandle,
groupSizeInPages,
aRefPtr->plrRestart);
if (status != ERR_NONE)
{
return status;
}
/* erase the reclaim block */
status = FLASH_EraseBlock(FDI_ReclaimBlockAddressBottom, FALSE);
if (status != ERR_NONE)
{
return status;
}
/* set any backup headers to absorbed */
status = RECLAIM_PAGE_SetBackupGroupAbsorbStatus(HDR_ABSORBED,
aRefPtr->plrRestart);
if (status != ERR_NONE)
{
return status;
}
/* we want to abort this operation entirely */
RATTBL_SetRatEntryBtmProgressState(&ratEntry, RATTBL_RatEntryBtmProgressState_ModifyInProgress);
status = RATTBL_WriteRatEntryBtmProgressState(&ratEntryHandle, &ratEntry);
if (status != ERR_NONE)
{
return status;
}
RATTBL_SetRatEntryTopProgressState(&ratEntry, RATTBL_RatEntryTopProgressState_ModifyUserObjectsComplete);
status = RATTBL_WriteRatEntryTopProgressState(&ratEntryHandle, &ratEntry);
if (status != ERR_NONE)
{
return status;
}
break;
case RATTBL_RatEntryBtmProgressState_RestartTopBlkBkupGroupReclaimComplete:
case RATTBL_RatEntryBtmProgressState_BkupOfOrigGroupComplete:
case RATTBL_RatEntryBtmProgressState_BtmBlkOrigGroupInReclaim:
case RATTBL_RatEntryBtmProgressState_BtmBlkOrigGroupReclaimComplete:
case RATTBL_RatEntryBtmProgressState_TopBlkOrigGroupInReclaim:
case RATTBL_RatEntryBtmProgressState_TopBlkOrigGroupReclaimComplete:
/* Open issue in 5.3.3: need to restore original object, remove backup, and abort operation here */
break;
case RATTBL_RatEntryBtmProgressState_ModifyInProgress:
if (RATTBL_GetRecoveredRatEntryTopProgressState(&ratEntry, ratEntryHandle) == RATTBL_RatEntryTopProgressState_NoOperationInProgress)
{
/* Open issue in 5.3.3: need to restore original object, remove backup, and abort operation here */
break;
}
switch(RATTBL_GetRecoveredRatEntryTopProgressState(&ratEntry, ratEntryHandle))
{
case RATTBL_RatEntryTopProgressState_NoOperationInProgress:
case RATTBL_RatEntryTopProgressState_ModifyComplete:
case RATTBL_RatEntryTopProgressState_BtmBlkBkupGroupInReclaim:
case RATTBL_RatEntryTopProgressState_BtmBlkBkupGroupReclaimComplete:
case RATTBL_RatEntryTopProgressState_TopBlkBkupGroupInReclaim:
case RATTBL_RatEntryTopProgressState_TopBlkBkupGroupReclaimComplete:
case RATTBL_RatEntryTopProgressState_ModifyUserObjectsComplete:
/* Open issue in 5.3.3: need to restore original object, remove backup, and abort operation here */
break;
default:
status = ERR_STATE;
if (status != ERR_NONE)
{
return status;
}
break;
}
break;
default:
status = ERR_STATE;
if (status != ERR_NONE)
{
return status;
}
break;
} /* switch */
break;
default:
status = ERR_STATE;
if (status != ERR_NONE)
{
return status;
}
break;
}
} /* switch */
#ifdef ENABLE_RECOVER_TESTS
/*TBD EVT_TestEvent(EVT_RECOVER_RestartModifyObjects_End);*/
#endif
return status;
}
/*#################################################################
### RECOVER_PAGE_ResetInitializeRat
###
### DESCRIPTION:
### This will reset the rat table initialization step.
###
### PARAMETERS
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -