cleanup: RevoEX (gotos, comma conditions, placeholders) #1360
@@ -50,7 +50,7 @@ int* CDBIntArrayEnd(CDBIntArray* array) {
|
||||
return array->values + array->size;
|
||||
}
|
||||
|
||||
#pragma dont_inline on
|
||||
#pragma dont_inline on // MWCC must keep dictionary search and insertion calls out of line.
|
||||
int CDBIntArrayDicInsertR(CDBIntArray* array, int* value, int first, int last) {
|
||||
int index;
|
||||
int result;
|
||||
|
||||
@@ -139,37 +139,37 @@ CDBErr CDBRecordOpen_(CDBRecord* record) {
|
||||
CDBReportError("can't open the record; the database is READONLY\n");
|
||||
return CDB_ERROR_26;
|
||||
}
|
||||
|
||||
CDBConvKeyToFullPath(&record->key, fullPath);
|
||||
err = CDBRecordFileOpen(record, fullPath, CDB_RECORD_ALLOC_RW);
|
||||
if (err != CDB_ERROR_OK) {
|
||||
return err;
|
||||
}
|
||||
|
||||
err = CDBRecordFileReadAttrBuf(record);
|
||||
if (err != CDB_ERROR_OK) {
|
||||
return err;
|
||||
}
|
||||
|
||||
if (record->key.location == CDB_FS_LOCATION_SD) {
|
||||
err = CDBCryptBufAllocate((CDBCryptBuf**)&record->cryptBuf);
|
||||
if (err != CDB_ERROR_OK) {
|
||||
return err;
|
||||
}
|
||||
|
||||
cryptBuf = (CDBCryptBuf*)record->cryptBuf;
|
||||
if (record == NULL || !CDBRecordKeyIsValid(&record->key)) {
|
||||
err = CDB_ERROR_1;
|
||||
} else {
|
||||
if (record->key.location == CDB_FS_LOCATION_SD) {
|
||||
goto open_location_ok;
|
||||
}
|
||||
} else if (record->key.location != CDB_FS_LOCATION_SD) {
|
||||
err = CDB_ERROR_2;
|
||||
goto open_result_ready;
|
||||
open_location_ok:
|
||||
} else {
|
||||
if (CDBFSSDIsMounted()) {
|
||||
err = CDBRecordDecrypt(record, cryptBuf, 0x3EC00, &cryptBuf->size, NULL);
|
||||
} else {
|
||||
err = CDB_ERROR_SD_IS_NOT_MOUNTED;
|
||||
}
|
||||
}
|
||||
open_result_ready:
|
||||
|
||||
if (err != CDB_ERROR_OK) {
|
||||
CDBCryptBufFree((CDBCryptBuf**)&record->cryptBuf);
|
||||
return err;
|
||||
@@ -198,37 +198,37 @@ CDBErr CDBRecordOpenReadOnly_(CDBRecord* record) {
|
||||
CDBReportError("invalid key\n");
|
||||
return CDB_ERROR_5;
|
||||
}
|
||||
|
||||
CDBConvKeyToFullPath(&record->key, fullPath);
|
||||
err = CDBRecordFileOpen(record, fullPath, CDB_RECORD_ALLOC_READ);
|
||||
if (err != CDB_ERROR_OK) {
|
||||
return err;
|
||||
}
|
||||
|
||||
err = CDBRecordFileReadAttrBuf(record);
|
||||
if (err != CDB_ERROR_OK) {
|
||||
return err;
|
||||
}
|
||||
|
||||
if (record->key.location == CDB_FS_LOCATION_SD) {
|
||||
err = CDBCryptBufAllocate((CDBCryptBuf**)&record->cryptBuf);
|
||||
if (err != CDB_ERROR_OK) {
|
||||
return err;
|
||||
}
|
||||
|
||||
cryptBuf = (CDBCryptBuf*)record->cryptBuf;
|
||||
if (record == NULL || !CDBRecordKeyIsValid(&record->key)) {
|
||||
result = CDB_ERROR_1;
|
||||
} else {
|
||||
if (record->key.location == CDB_FS_LOCATION_SD) {
|
||||
goto location_ok;
|
||||
}
|
||||
} else if (record->key.location != CDB_FS_LOCATION_SD) {
|
||||
result = CDB_ERROR_2;
|
||||
goto result_ready;
|
||||
location_ok:
|
||||
} else {
|
||||
if (CDBFSSDIsMounted()) {
|
||||
result = CDBRecordDecrypt(record, cryptBuf, 0x3EC00, &cryptBuf->size, NULL);
|
||||
} else {
|
||||
result = CDB_ERROR_SD_IS_NOT_MOUNTED;
|
||||
}
|
||||
}
|
||||
result_ready:
|
||||
|
||||
if (result != CDB_ERROR_OK) {
|
||||
CDBCryptBufFree((CDBCryptBuf**)&record->cryptBuf);
|
||||
return result;
|
||||
@@ -717,7 +717,7 @@ CDBErr CDBRecordGetId(CDBRecord* record, CDBId* id) {
|
||||
err = CDB_ERROR_OK;
|
||||
break;
|
||||
default:
|
||||
goto get_id_done;
|
||||
break;
|
||||
}
|
||||
get_id_done:
|
||||
CDBUnlock();
|
||||
|
||||
@@ -135,7 +135,7 @@ CDBRecordKey* CDBRecordKeyArrayEnd(CDBRecordKeyArray* recordArray) {
|
||||
return recordArray->records + recordArray->size;
|
||||
}
|
||||
|
||||
#pragma dont_inline on
|
||||
#pragma dont_inline on // MWCC must keep dictionary search and insertion calls out of line.
|
||||
|
||||
int CDBRecordKeyArrayDicInsertR(CDBRecordKeyArray* recordArray, CDBRecordKey* recordKey, int first, int last) {
|
||||
int index;
|
||||
|
||||
@@ -14,9 +14,7 @@ static int FirstConfig(u32 configs) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
#pragma dont_inline on
|
||||
int NETiGetConnectionTypeFromConfigList(u32 wireless, u32 wired, u32 other);
|
||||
#pragma dont_inline reset
|
||||
int NETiGetConnectionTypeFromConfigList(u32 wireless, u32 wired, u32 other) {
|
||||
int connection = 99;
|
||||
if (wireless != 0) {
|
||||
@@ -29,7 +27,7 @@ int NETiGetConnectionTypeFromConfigList(u32 wireless, u32 wired, u32 other) {
|
||||
return connection;
|
||||
}
|
||||
|
||||
#pragma dont_inline on
|
||||
#pragma dont_inline on // MWCC must preserve the startup-error helper call boundaries.
|
||||
int NETGetStartupErrorCode(int error) {
|
||||
u32 other, wired, wireless;
|
||||
int connection = 99;
|
||||
|
||||
@@ -80,39 +80,15 @@ s32 NHTTPi_compareTokenN_HdrRecvBuf(const NHTTPResponseInfo* response, s32 posit
|
||||
if (position < limit) {
|
||||
FindHeaderBlock(response, position, &block, &offset);
|
||||
|
||||
if (block == NULL) {
|
||||
if (offset < NHTTP_HDRRECVBUF_INILEN) {
|
||||
character = (s8)response->hdrBufFirst[offset++];
|
||||
goto compare_characters;
|
||||
}
|
||||
block = response->hdrBufBlock_p;
|
||||
offset = 0;
|
||||
} else if (offset == NHTTP_HDRRECVBUF_BLOCKLEN) {
|
||||
offset = 0;
|
||||
block = block->next_p;
|
||||
}
|
||||
character = block->block[offset++];
|
||||
character = ReadHeaderChar(response, &block, &offset);
|
||||
|
||||
compare_characters:
|
||||
i = position;
|
||||
while (NHTTPi_TOLOWER((s8)character) == NHTTPi_TOLOWER((s8)*token)) {
|
||||
tokenChar = (s8)*token;
|
||||
if (tokenChar == '\0' || tokenChar == ' ' || tokenChar == delimiter || i == limit - 1) return 0;
|
||||
|
||||
if (block == NULL) {
|
||||
if (offset < NHTTP_HDRRECVBUF_INILEN) {
|
||||
character = (s8)response->hdrBufFirst[offset++];
|
||||
goto advance_token;
|
||||
}
|
||||
block = response->hdrBufBlock_p;
|
||||
offset = 0;
|
||||
} else if (offset == NHTTP_HDRRECVBUF_BLOCKLEN) {
|
||||
offset = 0;
|
||||
block = block->next_p;
|
||||
}
|
||||
character = block->block[offset++];
|
||||
character = ReadHeaderChar(response, &block, &offset);
|
||||
|
||||
advance_token:
|
||||
i++;
|
||||
token++;
|
||||
}
|
||||
|
||||
@@ -170,7 +170,7 @@ s32 ConvertDateToDays(u16 year, u8 month, u8 day) {
|
||||
if (day < 1 || day > 29) {
|
||||
return -1;
|
||||
}
|
||||
goto validDate;
|
||||
goto validDate; // MWCC needs the leap-day branch to skip the common day check.
|
||||
}
|
||||
}
|
||||
if (day < 1 || DAYS_OF_MONTH[month - 1] < day) {
|
||||
|
||||
@@ -1147,7 +1147,7 @@ NWC24Err NWC24iCreateDlTaskList() {
|
||||
}
|
||||
}
|
||||
|
||||
#pragma dont_inline on
|
||||
#pragma dont_inline on // MWCC must keep task-list initialization out of line.
|
||||
NWC24Err NWC24iInitDlTaskList(BOOL force) {
|
||||
NWC24Err result;
|
||||
DlTaskListHeader* header;
|
||||
|
||||
@@ -38,14 +38,16 @@ NWC24Err NWC24iPrepareShutdown(void) {
|
||||
if (nwc24ShtFd < 0)
|
||||
result = NWC24OpenResourceManager("/dev/net/kd/request", &nwc24ShtFd, 1);
|
||||
nwc24ShtRetryRest = 5;
|
||||
do {
|
||||
while (TRUE) {
|
||||
status = SCCheckStatus();
|
||||
if (status == SC_STATUS_FATAL)
|
||||
goto ready;
|
||||
} while (status == SC_STATUS_BUSY);
|
||||
SCGetIdleMode(&idleMode);
|
||||
__OSSetIdleLEDMode(idleMode.led);
|
||||
ready:
|
||||
break;
|
||||
if (status == SC_STATUS_BUSY)
|
||||
continue;
|
||||
SCGetIdleMode(&idleMode);
|
||||
__OSSetIdleLEDMode(idleMode.led);
|
||||
break;
|
||||
}
|
||||
if (OSGetAppType() == OS_APP_TYPE_IPL)
|
||||
NWC24iSetScriptMode(1);
|
||||
return result;
|
||||
|
||||
@@ -13,7 +13,7 @@ typedef struct SOSysWork {
|
||||
SOFree freeFunc;
|
||||
s32 rmState;
|
||||
s32 rmFd;
|
||||
u32 unk10;
|
||||
u32 hostReplyAddr;
|
||||
s32 allocCount;
|
||||
} SOSysWork;
|
||||
|
||||
@@ -111,7 +111,7 @@ int SOInit(SOLibraryConfig* config) {
|
||||
work->rmState = SO_INTERNAL_RM_STATE_CLOSED;
|
||||
work->rmFd = -1;
|
||||
ptr = SOiAlloc(0xB, 0x460);
|
||||
soWork.unk10 = (u32)ptr;
|
||||
soWork.hostReplyAddr = (u32)ptr;
|
||||
if (ptr == NULL) {
|
||||
result = SO_ENOMEM;
|
||||
} else {
|
||||
@@ -146,9 +146,9 @@ int SOFinish(void) {
|
||||
break;
|
||||
}
|
||||
soState = SO_INTERNAL_STATE_TERMINATED;
|
||||
if (soWork.unk10 != 0 && soWork.freeFunc) {
|
||||
if (soWork.hostReplyAddr != 0 && soWork.freeFunc) {
|
||||
soWork.allocCount--;
|
||||
soWork.freeFunc(0x0b, (void*)soWork.unk10, 0x460);
|
||||
soWork.freeFunc(0x0b, (void*)soWork.hostReplyAddr, 0x460);
|
||||
}
|
||||
break;
|
||||
case SO_INTERNAL_STATE_ACTIVE:
|
||||
@@ -203,155 +203,157 @@ int SOStartupEx(int timeout) {
|
||||
|
||||
linkupRetryCount = 4;
|
||||
|
||||
begin_startup:
|
||||
result = SO_SUCCESS;
|
||||
for (;;) {
|
||||
result = SO_SUCCESS;
|
||||
|
||||
enabled = OSDisableInterrupts();
|
||||
enabled = OSDisableInterrupts();
|
||||
|
||||
switch (soState) {
|
||||
case SO_INTERNAL_STATE_TERMINATED:
|
||||
default:
|
||||
result = SO_ENETRESET;
|
||||
break;
|
||||
case SO_INTERNAL_STATE_ACTIVE:
|
||||
result = SO_EALREADY;
|
||||
break;
|
||||
case SO_INTERNAL_STATE_READY:
|
||||
if (soWork.rmState > SO_INTERNAL_RM_STATE_CLOSED) {
|
||||
result = SO_EBUSY;
|
||||
switch (soState) {
|
||||
case SO_INTERNAL_STATE_TERMINATED:
|
||||
default:
|
||||
result = SO_ENETRESET;
|
||||
break;
|
||||
} else if (!OSGetCurrentThread()) {
|
||||
result = SO_EFATAL;
|
||||
case SO_INTERNAL_STATE_ACTIVE:
|
||||
result = SO_EALREADY;
|
||||
break;
|
||||
} else {
|
||||
int resultNCD;
|
||||
|
||||
soWork.rmState = SO_INTERNAL_RM_STATE_WORKING;
|
||||
(void)OSRestoreInterrupts(enabled);
|
||||
|
||||
while (1) {
|
||||
resultNCD = NCDGetLinkStatus();
|
||||
if (resultNCD != NCD_RESULT_INPROGRESS &&
|
||||
resultNCD != NCD_LINKSTATUS_WORKING)
|
||||
break;
|
||||
OSSleepTicks((((s64)100) * ((__OSBusClock / 4) / 1000)));
|
||||
if (limitTime != 0 && limitTime < __OSGetSystemTime()) {
|
||||
if (resultNCD == NCD_LINKSTATUS_WORKING)
|
||||
result = SO_ERR_LINK_UP_TIMEOUT;
|
||||
else
|
||||
result = SO_EFATAL;
|
||||
goto change_state;
|
||||
}
|
||||
}
|
||||
if (resultNCD < NCD_RESULT_SUCCESS) {
|
||||
case SO_INTERNAL_STATE_READY:
|
||||
if (soWork.rmState > SO_INTERNAL_RM_STATE_CLOSED) {
|
||||
result = SO_EBUSY;
|
||||
break;
|
||||
} else if (!OSGetCurrentThread()) {
|
||||
result = SO_EFATAL;
|
||||
goto change_state;
|
||||
} else if (resultNCD == NCD_LINKSTATUS_NONE) {
|
||||
result = SO_ENOENT;
|
||||
goto change_state;
|
||||
}
|
||||
|
||||
while (1) {
|
||||
soWork.rmFd = IOS_Open(NET_RM_SOCK, 0);
|
||||
if (soWork.rmFd != -6)
|
||||
break;
|
||||
OSSleepTicks((((s64)100) * ((__OSBusClock / 4) / 1000)));
|
||||
if (limitTime != 0 && limitTime < __OSGetSystemTime()) {
|
||||
result = SO_EFATAL;
|
||||
goto change_state;
|
||||
}
|
||||
};
|
||||
|
||||
if (soWork.rmFd < 0) {
|
||||
result = SO_EFATAL;
|
||||
goto change_state;
|
||||
break;
|
||||
} else {
|
||||
s32 errNwc24;
|
||||
int resultNCD;
|
||||
|
||||
result = SO_SUCCESS;
|
||||
exErr = SO_SUCCESS;
|
||||
soWork.rmState = SO_INTERNAL_RM_STATE_WORKING;
|
||||
(void)OSRestoreInterrupts(enabled);
|
||||
|
||||
while (1) {
|
||||
errNwc24 = NWC24iStartupSocket(&exErr);
|
||||
if (errNwc24 != NWC24_ERR_INPROGRESS)
|
||||
resultNCD = NCDGetLinkStatus();
|
||||
if (resultNCD != NCD_RESULT_INPROGRESS &&
|
||||
resultNCD != NCD_LINKSTATUS_WORKING)
|
||||
break;
|
||||
OSSleepTicks((((s64)100) * ((__OSBusClock / 4) / 1000)));
|
||||
if (limitTime != 0 && limitTime < __OSGetSystemTime()) {
|
||||
if (resultNCD == NCD_LINKSTATUS_WORKING)
|
||||
result = SO_ERR_LINK_UP_TIMEOUT;
|
||||
else
|
||||
result = SO_EFATAL;
|
||||
goto change_state;
|
||||
}
|
||||
}
|
||||
if (resultNCD < NCD_RESULT_SUCCESS) {
|
||||
result = SO_EFATAL;
|
||||
goto change_state;
|
||||
} else if (resultNCD == NCD_LINKSTATUS_NONE) {
|
||||
result = SO_ENOENT;
|
||||
goto change_state;
|
||||
}
|
||||
|
||||
while (1) {
|
||||
soWork.rmFd = IOS_Open(NET_RM_SOCK, 0);
|
||||
if (soWork.rmFd != -6)
|
||||
break;
|
||||
OSSleepTicks((((s64)100) * ((__OSBusClock / 4) / 1000)));
|
||||
if (limitTime != 0 && limitTime < __OSGetSystemTime()) {
|
||||
result = SO_EFATAL;
|
||||
break;
|
||||
goto change_state;
|
||||
}
|
||||
};
|
||||
|
||||
if (soWork.rmFd < 0) {
|
||||
result = SO_EFATAL;
|
||||
goto change_state;
|
||||
} else {
|
||||
s32 errNwc24;
|
||||
|
||||
result = SO_SUCCESS;
|
||||
exErr = SO_SUCCESS;
|
||||
|
||||
while (1) {
|
||||
errNwc24 = NWC24iStartupSocket(&exErr);
|
||||
if (errNwc24 != NWC24_ERR_INPROGRESS)
|
||||
break;
|
||||
OSSleepTicks((((s64)100) * ((__OSBusClock / 4) / 1000)));
|
||||
if (limitTime != 0 && limitTime < __OSGetSystemTime()) {
|
||||
result = SO_EFATAL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (result == SO_SUCCESS)
|
||||
result = SOStartupErr(errNwc24, exErr);
|
||||
if (result != SO_SUCCESS) {
|
||||
if (IOS_Close(soWork.rmFd) < 0) {
|
||||
result = SO_EFATAL;
|
||||
goto change_state;
|
||||
} else {
|
||||
soWork.rmFd = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (result == SO_SUCCESS)
|
||||
result = SOStartupErr(errNwc24, exErr);
|
||||
if (result != SO_SUCCESS) {
|
||||
if (IOS_Close(soWork.rmFd) < 0) {
|
||||
result = SO_EFATAL;
|
||||
goto change_state;
|
||||
} else {
|
||||
soWork.rmFd = -1;
|
||||
}
|
||||
|
||||
change_state:
|
||||
enabled = OSDisableInterrupts();
|
||||
if (result == SO_SUCCESS) {
|
||||
soState = SO_INTERNAL_STATE_ACTIVE;
|
||||
soWork.rmState = SO_INTERNAL_RM_STATE_OPENED;
|
||||
} else {
|
||||
soState = SO_INTERNAL_STATE_READY;
|
||||
if (result != SO_EFATAL)
|
||||
soWork.rmState = SO_INTERNAL_RM_STATE_CLOSED;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
change_state:
|
||||
enabled = OSDisableInterrupts();
|
||||
if (result == SO_SUCCESS) {
|
||||
soState = SO_INTERNAL_STATE_ACTIVE;
|
||||
soWork.rmState = SO_INTERNAL_RM_STATE_OPENED;
|
||||
{
|
||||
OSThread* cur = OSGetCurrentThread();
|
||||
if (cur)
|
||||
cur->error = result;
|
||||
else
|
||||
soError = result;
|
||||
}
|
||||
|
||||
(void)OSRestoreInterrupts(enabled);
|
||||
|
||||
if (result == 0) {
|
||||
s64 dhcpTimeOutTicks;
|
||||
|
||||
if (limitTime != 0) {
|
||||
dhcpTimeOutTicks = limitTime - __OSGetSystemTime();
|
||||
} else {
|
||||
soState = SO_INTERNAL_STATE_READY;
|
||||
if (result != SO_EFATAL)
|
||||
soWork.rmState = SO_INTERNAL_RM_STATE_CLOSED;
|
||||
dhcpTimeOutTicks = 0;
|
||||
}
|
||||
if (limitTime != 0 && dhcpTimeOutTicks <= 0) {
|
||||
result = SO_ETIMEDOUT;
|
||||
} else {
|
||||
result = SOiWaitForDHCPEx(
|
||||
(int)((dhcpTimeOutTicks) / ((__OSBusClock / 4) / 1000)));
|
||||
}
|
||||
|
||||
if (result != 0) {
|
||||
(void)SOCleanup();
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
OSThread* cur = OSGetCurrentThread();
|
||||
if (cur)
|
||||
cur->error = result;
|
||||
else
|
||||
soError = result;
|
||||
}
|
||||
|
||||
if (result == -112) {
|
||||
linkupRetryCount--;
|
||||
if (linkupRetryCount >= 0) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
{
|
||||
OSThread* cur = OSGetCurrentThread();
|
||||
if (cur)
|
||||
cur->error = result;
|
||||
else
|
||||
soError = result;
|
||||
}
|
||||
|
||||
(void)OSRestoreInterrupts(enabled);
|
||||
|
||||
if (result == 0) {
|
||||
s64 dhcpTimeOutTicks;
|
||||
|
||||
if (limitTime != 0) {
|
||||
dhcpTimeOutTicks = limitTime - __OSGetSystemTime();
|
||||
} else {
|
||||
dhcpTimeOutTicks = 0;
|
||||
}
|
||||
if (limitTime != 0 && dhcpTimeOutTicks <= 0) {
|
||||
result = SO_ETIMEDOUT;
|
||||
} else {
|
||||
result = SOiWaitForDHCPEx(
|
||||
(int)((dhcpTimeOutTicks) / ((__OSBusClock / 4) / 1000)));
|
||||
}
|
||||
|
||||
if (result != 0) {
|
||||
(void)SOCleanup();
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
OSThread* cur = OSGetCurrentThread();
|
||||
if (cur)
|
||||
cur->error = result;
|
||||
else
|
||||
soError = result;
|
||||
}
|
||||
|
||||
if (result == -112) {
|
||||
linkupRetryCount--;
|
||||
if (linkupRetryCount >= 0) {
|
||||
goto begin_startup;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -684,7 +686,7 @@ int SOiWaitForDHCPEx(int timeout) {
|
||||
return result;
|
||||
}
|
||||
|
||||
#pragma dont_inline on
|
||||
#pragma dont_inline on // MWCC must preserve the socket-creation call boundary.
|
||||
int __SOCreateSocket(int pf, int type, int protocol) {
|
||||
int result;
|
||||
s32 rmId;
|
||||
|
||||
@@ -635,7 +635,7 @@ VFErr VFSysSetDeviceNANDFlash(s32* o_idx_p, void* i_cache_heap_p, u32 i_cache_si
|
||||
|
||||
static void VFiSysClearDeviceSDDirect(VFSys_deviceSD* o_sd_p);
|
||||
|
||||
#pragma dont_inline on
|
||||
#pragma dont_inline on // MWCC must preserve the SD-direct setup call boundary.
|
||||
VFErr VFSysSetDeviceSDDirect(s32* o_idx_p, u32 i_slot_no, void* i_cache_heap_p, u32 i_cache_size, VFSDEventCallback i_eventCallback) {
|
||||
s32 idx = VFiSysGetFreeHandleIdx();
|
||||
VFSys_handle* handle_p = VFSysGetHandleP(idx);
|
||||
|
||||
@@ -383,19 +383,16 @@ pf_s32 VFiPFDRV_lerase(PF_VOLUME* p_vol, pf_u32 sector, pf_u32 num_sectors) {
|
||||
|
||||
err = VFipdm_part_logical_erase(p_vol->p_part, sector, num_sectors, p_vol->bpb.bytes_per_sector);
|
||||
|
||||
if (err == 0) {
|
||||
goto success;
|
||||
if (err != 0) {
|
||||
if (err == 21) {
|
||||
err = VFipdm_part_get_driver_error_code((struct PDM_PARTITION*)p_vol->p_part);
|
||||
VFipf_vol_set.last_driver_error = err;
|
||||
p_vol->last_driver_error = err;
|
||||
return 0x1000;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (err == 21) {
|
||||
err = VFipdm_part_get_driver_error_code((struct PDM_PARTITION*)p_vol->p_part);
|
||||
VFipf_vol_set.last_driver_error = err;
|
||||
p_vol->last_driver_error = err;
|
||||
return 0x1000;
|
||||
}
|
||||
|
||||
return -1;
|
||||
|
||||
success:
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -65,12 +65,10 @@ pf_s32 VFipdm_mbr_get_mbr_part_table(PDM_DISK* p_disk, PDM_MBR* p_mbr_tbl) {
|
||||
VFipdm_mbr_check_master_boot_record(p_disk, (pf_u8*)&buf, &is_master_boot);
|
||||
if (is_master_boot != 0) {
|
||||
VFipdm_mbr_get_table((pf_u8*)&buf, 0, p_mbr_tbl);
|
||||
goto success;
|
||||
} else {
|
||||
return 5;
|
||||
}
|
||||
|
||||
return 5;
|
||||
|
||||
success:
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -116,12 +114,10 @@ pf_s32 VFipdm_mbr_get_epbr_part_table(PDM_DISK* p_disk, PDM_MBR* p_mbr_tbl) {
|
||||
VFipdm_mbr_check_master_boot_record(p_disk, (pf_u8*)&buf, &is_master_boot);
|
||||
if (is_master_boot) {
|
||||
VFipdm_mbr_get_table((pf_u8*)&buf, extend_start_sector, p_mbr_tbl);
|
||||
goto success;
|
||||
} else {
|
||||
return 6;
|
||||
}
|
||||
|
||||
success:
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -53,39 +53,39 @@ static pf_s32 VFipdm_part_get_start_sector(PDM_PARTITION* p_part) {
|
||||
p_part->total_sector = mbr_tbl.partition_table[part_id].lba_num_sectors;
|
||||
p_part->partition_type = mbr_tbl.partition_table[part_id].partition_type;
|
||||
p_part->mbr_sector = mbr_tbl.current_sector;
|
||||
goto success;
|
||||
}
|
||||
for (part_index = 4;; part_index++) {
|
||||
err = VFipdm_mbr_get_epbr_part_table(p_part->p_disk, &mbr_tbl);
|
||||
if (err != 0 && err != 6) {
|
||||
return err;
|
||||
}
|
||||
if (err != 6) {
|
||||
if (part_id == part_index) {
|
||||
p_part->start_sector = mbr_tbl.partition_table[0].lba_start_sector;
|
||||
p_part->total_sector = mbr_tbl.partition_table[0].lba_num_sectors;
|
||||
p_part->partition_type = mbr_tbl.partition_table[0].partition_type;
|
||||
p_part->mbr_sector = mbr_tbl.current_sector;
|
||||
goto success;
|
||||
} else {
|
||||
for (part_index = 4;; part_index++) {
|
||||
err = VFipdm_mbr_get_epbr_part_table(p_part->p_disk, &mbr_tbl);
|
||||
if (err != 0 && err != 6) {
|
||||
return err;
|
||||
}
|
||||
continue;
|
||||
if (err != 6) {
|
||||
if (part_id == part_index) {
|
||||
p_part->start_sector = mbr_tbl.partition_table[0].lba_start_sector;
|
||||
p_part->total_sector = mbr_tbl.partition_table[0].lba_num_sectors;
|
||||
p_part->partition_type = mbr_tbl.partition_table[0].partition_type;
|
||||
p_part->mbr_sector = mbr_tbl.current_sector;
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
return 7;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (part_id >= 1) {
|
||||
return 7;
|
||||
}
|
||||
err = VFipdm_disk_get_media_information(p_part->p_disk, &disk_info);
|
||||
if (err != 0) {
|
||||
return err;
|
||||
}
|
||||
p_part->start_sector = 0;
|
||||
p_part->total_sector = disk_info.total_sectors;
|
||||
p_part->partition_type = 0;
|
||||
p_part->mbr_sector = 0;
|
||||
}
|
||||
if (part_id >= 1) {
|
||||
return 7;
|
||||
}
|
||||
err = VFipdm_disk_get_media_information(p_part->p_disk, &disk_info);
|
||||
if (err != 0) {
|
||||
return err;
|
||||
}
|
||||
p_part->start_sector = 0;
|
||||
p_part->total_sector = disk_info.total_sectors;
|
||||
p_part->partition_type = 0;
|
||||
p_part->mbr_sector = 0;
|
||||
|
||||
success:
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -301,43 +301,38 @@ pf_s32 VFipdm_part_get_permission(PDM_PARTITION* p_part) {
|
||||
}
|
||||
|
||||
lp_part = &VFipdm_disk_set.partition[PDM_PART_GET_NO(p_part)];
|
||||
if ((lp_part->status & 0x02) != 0) {
|
||||
goto fail;
|
||||
}
|
||||
err = VFipdm_disk_set_disk(lp_part->p_disk, p_part);
|
||||
if (err != 0) {
|
||||
return err;
|
||||
}
|
||||
if ((lp_part->status & 0x02) == 0) {
|
||||
err = VFipdm_disk_set_disk(lp_part->p_disk, p_part);
|
||||
if (err != 0) {
|
||||
return err;
|
||||
}
|
||||
|
||||
err = VFipdm_disk_get_part_permission(lp_part->p_disk);
|
||||
if (err != 0) {
|
||||
return err;
|
||||
}
|
||||
err = VFipdm_disk_get_part_permission(lp_part->p_disk);
|
||||
if (err != 0) {
|
||||
return err;
|
||||
}
|
||||
|
||||
err = VFipdm_disk_get_media_information(lp_part->p_disk, &disk_info);
|
||||
if (err != 0) {
|
||||
VFipdm_disk_release_part_permission(lp_part->p_disk, 1);
|
||||
return err;
|
||||
}
|
||||
err = VFipdm_disk_get_media_information(lp_part->p_disk, &disk_info);
|
||||
if (err != 0) {
|
||||
VFipdm_disk_release_part_permission(lp_part->p_disk, 1);
|
||||
return err;
|
||||
}
|
||||
|
||||
if ((disk_info.media_attr & 0x01) != 0) {
|
||||
lp_part->status |= 0x10;
|
||||
if ((disk_info.media_attr & 0x01) != 0) {
|
||||
lp_part->status |= 0x10;
|
||||
} else {
|
||||
lp_part->status &= ~0x10;
|
||||
}
|
||||
|
||||
err = VFipdm_part_get_start_sector(lp_part);
|
||||
if (err != 0) {
|
||||
VFipdm_disk_release_part_permission(lp_part->p_disk, 1);
|
||||
return err;
|
||||
}
|
||||
} else {
|
||||
lp_part->status &= ~0x10;
|
||||
return 13;
|
||||
}
|
||||
|
||||
err = VFipdm_part_get_start_sector(lp_part);
|
||||
if (err != 0) {
|
||||
VFipdm_disk_release_part_permission(lp_part->p_disk, 1);
|
||||
return err;
|
||||
}
|
||||
|
||||
goto success;
|
||||
|
||||
fail:
|
||||
return 13;
|
||||
|
||||
success:
|
||||
lp_part->status |= 0x02;
|
||||
lp_part->status &= ~0x08;
|
||||
|
||||
|
||||
@@ -716,14 +716,12 @@ pf_s32 VFiPFENT_RemoveEntry(PF_DIR_ENT* p_ent, PF_ENT_ITER* p_iter) {
|
||||
if (success_size != 1) {
|
||||
return 17;
|
||||
}
|
||||
if (!(p_vol->cache.mode & 4)) {
|
||||
goto success;
|
||||
if (p_vol->cache.mode & 4) {
|
||||
err = VFiPFCACHE_FlushDataCacheSpecific(p_vol, PF_NULL);
|
||||
if (err != 0) {
|
||||
return err;
|
||||
}
|
||||
}
|
||||
err = VFiPFCACHE_FlushDataCacheSpecific(p_vol, PF_NULL);
|
||||
if (err != 0) {
|
||||
return err;
|
||||
}
|
||||
success:
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -233,7 +233,6 @@ static pf_s32 VFiPFENT_ITER_DoFindEntry(PF_ENT_ITER* p_iter, PF_DIR_ENT* p_ent,
|
||||
return 0;
|
||||
}
|
||||
|
||||
// I'm tired
|
||||
static pf_s32 VFiPFENT_ITER_DoAllocateEntry(PF_DIR_ENT* p_ent, pf_u8 num_entries, PF_FFD* p_ffd, pf_u32* p_prev_chain, PF_STR* p_filename,
|
||||
pf_u8 attr_required, pf_u32* p_pos) {
|
||||
pf_s32 err;
|
||||
@@ -261,67 +260,64 @@ static pf_s32 VFiPFENT_ITER_DoAllocateEntry(PF_DIR_ENT* p_ent, pf_u8 num_entries
|
||||
p_prev_chain[0] = p_prev_chain[1] = -1U;
|
||||
iter.ffd = *p_ffd;
|
||||
err = VFiPFENT_ITER_IteratorInitialize(&iter, 0U);
|
||||
loop_3:
|
||||
if (err != 0) {
|
||||
if (err != 0x10) {
|
||||
return err;
|
||||
while (PF_TRUE) {
|
||||
if (err != 0) {
|
||||
if (err != 0x10) {
|
||||
return err;
|
||||
}
|
||||
break;
|
||||
}
|
||||
goto block_33;
|
||||
}
|
||||
if (is_found == 0) {
|
||||
if (num_free_entries == 0) {
|
||||
current_sector = iter.sector;
|
||||
}
|
||||
if ((iter.buf[0] == 0) || (iter.buf[0] == 0xE5)) {
|
||||
if (current_sector != iter.sector) {
|
||||
prev_sector1 = prev_sector0;
|
||||
prev_sector0 = current_sector;
|
||||
if (is_found == 0) {
|
||||
if (num_free_entries == 0) {
|
||||
current_sector = iter.sector;
|
||||
}
|
||||
num_free_entries += 1;
|
||||
if (num_free_entries >= num_entries) {
|
||||
if (p_pos != PF_NULL) {
|
||||
*p_pos = iter.index;
|
||||
if ((iter.buf[0] == 0) || (iter.buf[0] == 0xE5)) {
|
||||
if (current_sector != iter.sector) {
|
||||
prev_sector1 = prev_sector0;
|
||||
prev_sector0 = current_sector;
|
||||
current_sector = iter.sector;
|
||||
}
|
||||
wk_sector = iter.sector;
|
||||
wk_offset = iter.offset;
|
||||
is_found = 1;
|
||||
num_free_entries += 1;
|
||||
if (num_free_entries >= num_entries) {
|
||||
if (p_pos != PF_NULL) {
|
||||
*p_pos = iter.index;
|
||||
}
|
||||
wk_sector = iter.sector;
|
||||
wk_offset = iter.offset;
|
||||
is_found = 1;
|
||||
}
|
||||
} else {
|
||||
num_free_entries = 0;
|
||||
prev_sector0 = -1U;
|
||||
prev_sector1 = -1U;
|
||||
}
|
||||
} else {
|
||||
num_free_entries = 0;
|
||||
prev_sector0 = -1U;
|
||||
prev_sector1 = -1U;
|
||||
}
|
||||
}
|
||||
if (p_filename != PF_NULL) {
|
||||
if ((is_found == 0) || (iter.buf[0] != 0)) {
|
||||
if ((iter.buf[0] != 0) && (iter.buf[0] != 0xE5) &&
|
||||
(VFiPFENT_ITER_GetEntry(&wk_ent, &iter, p_filename, attr_required, PF_NULL, 0U) == 0)) {
|
||||
*p_ent = wk_ent;
|
||||
p_ent->p_vol = p_ffd->p_vol;
|
||||
if (p_filename != PF_NULL) {
|
||||
if ((is_found == 0) || (iter.buf[0] != 0)) {
|
||||
if ((iter.buf[0] != 0) && (iter.buf[0] != 0xE5) &&
|
||||
(VFiPFENT_ITER_GetEntry(&wk_ent, &iter, p_filename, attr_required, PF_NULL, 0U) == 0)) {
|
||||
*p_ent = wk_ent;
|
||||
p_ent->p_vol = p_ffd->p_vol;
|
||||
|
||||
return 8;
|
||||
}
|
||||
if ((is_found != 0) && ((iter.offset + 0x20) == p_ffd->p_vol->bpb.bytes_per_sector)) {
|
||||
err = VFiPFFAT_GetSectorSpecified(p_ffd, iter.file_sector_index + 1, 0U, §or);
|
||||
if (err != 0) {
|
||||
return err;
|
||||
return 8;
|
||||
}
|
||||
if (sector == -1U) {
|
||||
goto block_33;
|
||||
if ((is_found != 0) && ((iter.offset + 0x20) == p_ffd->p_vol->bpb.bytes_per_sector)) {
|
||||
err = VFiPFFAT_GetSectorSpecified(p_ffd, iter.file_sector_index + 1, 0U, §or);
|
||||
if (err != 0) {
|
||||
return err;
|
||||
}
|
||||
if (sector == -1U) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
goto block_32;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
goto block_32;
|
||||
} else if (is_found != 0) {
|
||||
break;
|
||||
}
|
||||
goto block_33;
|
||||
}
|
||||
if (is_found == 0) {
|
||||
block_32:
|
||||
err = VFiPFENT_ITER_Advance(&iter, 1U);
|
||||
goto loop_3;
|
||||
}
|
||||
block_33:
|
||||
if (is_found == 0) {
|
||||
return 5;
|
||||
}
|
||||
@@ -358,13 +354,12 @@ static pf_s32 VFiPFENT_ITER_DoGetEntryOfPath(PF_ENT_ITER* p_iter, PF_DIR_ENT* p_
|
||||
if ((VFiPFSTR_StrNumChar(p_path, 1U) == 1) && (VFiPFSTR_StrNCmp(p_path, (pf_s8*)"\0", 2U, 0, 1U) == 0)) {
|
||||
return 0;
|
||||
}
|
||||
goto block_11;
|
||||
} else {
|
||||
err = VFiPFVOL_GetCurrentDir(p_vol, p_ent);
|
||||
if (err != 0) {
|
||||
return err;
|
||||
}
|
||||
}
|
||||
err = VFiPFVOL_GetCurrentDir(p_vol, p_ent);
|
||||
if (err != 0) {
|
||||
return err;
|
||||
}
|
||||
block_11:
|
||||
p = VFiPFSTR_GetStrPos(p_path, 1U);
|
||||
VFiPFFAT_InitFFD(&p_iter->ffd, &hint, p_vol, &p_iter->ffd.start_cluster);
|
||||
p_iter->ffd.start_cluster = p_ent->start_cluster;
|
||||
|
||||
@@ -152,7 +152,7 @@ static pf_s32 VFiPFFAT_ReadFATSector(PF_VOLUME* p_vol, PF_CACHE_PAGE** p_page, p
|
||||
} else {
|
||||
current_fat = 1;
|
||||
}
|
||||
while (PF_TRUE) {
|
||||
do {
|
||||
err = VFiPFCACHE_ReadFATPage(p_vol, sector, p_page);
|
||||
if (err == 0x1000 && p_vol->p_callback != PF_NULL) {
|
||||
result = ((PF_VOLUME_CB)p_vol->p_callback)(p_vol->last_driver_error);
|
||||
@@ -160,20 +160,17 @@ static pf_s32 VFiPFFAT_ReadFATSector(PF_VOLUME* p_vol, PF_CACHE_PAGE** p_page, p
|
||||
if (result == 1 && p_vol->bpb.num_active_FATs >= 2 && current_fat < p_vol->bpb.num_active_FATs) {
|
||||
current_fat++;
|
||||
sector += p_vol->bpb.sectors_per_FAT;
|
||||
goto block_22;
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
goto block_22;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (err != 0) {
|
||||
return err;
|
||||
}
|
||||
block_22:
|
||||
if (err == 0) {
|
||||
return err;
|
||||
}
|
||||
}
|
||||
} while (err != 0);
|
||||
return err;
|
||||
}
|
||||
|
||||
static pf_s32 VFiPFFAT_SearchForNumFreeClusters(PF_VOLUME* p_vol, pf_u32 start_cluster, pf_u32 end_cluster, pf_u32 num_cluster,
|
||||
@@ -185,7 +182,7 @@ static pf_s32 VFiPFFAT_SearchForNumFreeClusters(PF_VOLUME* p_vol, pf_u32 start_c
|
||||
pf_u32 save_success_num;
|
||||
pf_s32 err;
|
||||
pf_u32 search_flg = 0;
|
||||
pf_u32 temp_start_cluster = 0;
|
||||
pf_u32 initial_search_cluster = 0;
|
||||
PF_CACHE_PAGE* p_page;
|
||||
|
||||
*p_start_free_cluster = -1;
|
||||
@@ -202,7 +199,7 @@ static pf_s32 VFiPFFAT_SearchForNumFreeClusters(PF_VOLUME* p_vol, pf_u32 start_c
|
||||
if (end_cluster < 2 || end_cluster >= (p_vol->bpb.num_clusters + 2)) {
|
||||
end_cluster = upper_bound_cluster - 1;
|
||||
}
|
||||
temp_start_cluster = start_cluster;
|
||||
initial_search_cluster = start_cluster;
|
||||
err = VFiPFFAT_ReadFATSector(p_vol, &p_page, start_cluster);
|
||||
if (err != 0) {
|
||||
return err;
|
||||
@@ -235,7 +232,7 @@ static pf_s32 VFiPFFAT_SearchForNumFreeClusters(PF_VOLUME* p_vol, pf_u32 start_c
|
||||
}
|
||||
start_cluster++;
|
||||
if (search_flg == 0 && success_num == 0 && start_cluster > 2 && start_cluster == upper_bound_cluster) {
|
||||
end_cluster = temp_start_cluster;
|
||||
end_cluster = initial_search_cluster;
|
||||
start_cluster = 2;
|
||||
search_flg = 1;
|
||||
}
|
||||
@@ -348,46 +345,37 @@ static pf_s32 VFiPFFAT_FindClusterLinkPage(PF_FFD* p_ffd, pf_u32 chain_index, pf
|
||||
if (p_ffd->cluster_link.position == 0) {
|
||||
return 0;
|
||||
}
|
||||
if (p_ffd->cluster_link.save_index < chain_index) {
|
||||
goto out1;
|
||||
}
|
||||
position = chain_index / (p_ffd->cluster_link.interval + 1);
|
||||
offset = chain_index % (p_ffd->cluster_link.interval + 1);
|
||||
if (offset == 0) {
|
||||
*p_cluster = p_ffd->cluster_link.buffer[position];
|
||||
*is_found = PF_TRUE;
|
||||
goto out2;
|
||||
} else {
|
||||
current_cluster = p_ffd->cluster_link.buffer[position];
|
||||
for (i = offset; i != 0; i--) {
|
||||
err = VFiPFFAT_ReadFATEntryPage(p_ffd->p_vol, current_cluster, &next_cluster, &p_page);
|
||||
if (err != 0) {
|
||||
return err;
|
||||
if (p_ffd->cluster_link.save_index >= chain_index) {
|
||||
position = chain_index / (p_ffd->cluster_link.interval + 1);
|
||||
offset = chain_index % (p_ffd->cluster_link.interval + 1);
|
||||
if (offset == 0) {
|
||||
*p_cluster = p_ffd->cluster_link.buffer[position];
|
||||
*is_found = PF_TRUE;
|
||||
} else {
|
||||
current_cluster = p_ffd->cluster_link.buffer[position];
|
||||
for (i = offset; i != 0; i--) {
|
||||
err = VFiPFFAT_ReadFATEntryPage(p_ffd->p_vol, current_cluster, &next_cluster, &p_page);
|
||||
if (err != 0) {
|
||||
return err;
|
||||
}
|
||||
if (next_cluster == 0) {
|
||||
return 13;
|
||||
}
|
||||
current_cluster = next_cluster;
|
||||
}
|
||||
|
||||
if (next_cluster == 0) {
|
||||
return 13;
|
||||
}
|
||||
current_cluster = next_cluster;
|
||||
if (next_cluster == fat_special_values[p_ffd->p_vol->bpb.fat_type].eoc2) {
|
||||
return 0;
|
||||
}
|
||||
*p_cluster = next_cluster;
|
||||
*is_found = PF_TRUE;
|
||||
}
|
||||
|
||||
if (next_cluster == 0) {
|
||||
return 13;
|
||||
}
|
||||
if (next_cluster == fat_special_values[p_ffd->p_vol->bpb.fat_type].eoc2) {
|
||||
return 0;
|
||||
}
|
||||
*p_cluster = next_cluster;
|
||||
*is_found = PF_TRUE;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// what
|
||||
|
||||
goto out2;
|
||||
|
||||
out1:
|
||||
return 0;
|
||||
|
||||
out2:
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -791,13 +779,12 @@ static pf_s32 VFiPFFAT_GetClusterAllocatedInChain(PF_FFD* p_ffd, pf_u32 initial_
|
||||
if (next_cluster == fat_special_values[p_vol->bpb.fat_type].eoc2) {
|
||||
p_ffd->last_cluster.num_last_cluster = cluster;
|
||||
p_ffd->last_cluster.max_chain_index = chain_index - 1;
|
||||
goto block_9;
|
||||
break;
|
||||
} else {
|
||||
cluster = next_cluster;
|
||||
chain_index++;
|
||||
}
|
||||
}
|
||||
block_9:
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -212,49 +212,45 @@ pf_s32 VFiPFFAT12_WriteFATEntryPage(PF_VOLUME* p_vol, pf_u16 cluster, pf_u16 val
|
||||
pf_u32 current_fat;
|
||||
pf_s32 result;
|
||||
|
||||
#define __PF_CONCAT(prefix, y) prefix##y
|
||||
#define PF_CONCAT(prefix, y) __PF_CONCAT(prefix, y)
|
||||
|
||||
#define FAT_MACRO(sectorOffset) \
|
||||
if ((*pp_page)->sector > (fat_sector + sectorOffset) || ((*pp_page)->sector + p_vol->cache.fat_buff_size) <= (fat_sector + sectorOffset)) { \
|
||||
err = VFiPFFAT_UpdateFATEntry(p_vol, *pp_page); \
|
||||
if (err != 0) { \
|
||||
return err; \
|
||||
} \
|
||||
if ((p_vol->bpb.ext_flags & 0x80) != 0) { \
|
||||
current_fat = p_vol->bpb.ext_flags & (0x01 | 0x02 | 0x04); \
|
||||
} else { \
|
||||
current_fat = 1; \
|
||||
} \
|
||||
do { \
|
||||
err = VFiPFCACHE_ReadFATPage(p_vol, fat_sector + sectorOffset, pp_page); \
|
||||
if (err != 0x1000 || p_vol->p_callback == PF_NULL) { \
|
||||
goto PF_CONCAT(chk_, __LINE__); \
|
||||
} \
|
||||
result = ((PF_VOLUME_CB)p_vol->p_callback)(p_vol->last_driver_error); \
|
||||
if (result != 0) { \
|
||||
if (result == 1 && p_vol->bpb.num_active_FATs >= 2 && current_fat < p_vol->bpb.num_active_FATs) { \
|
||||
current_fat++; \
|
||||
fat_sector += p_vol->bpb.sectors_per_FAT; \
|
||||
} else { \
|
||||
goto PF_CONCAT(chk_, __LINE__); \
|
||||
} \
|
||||
} \
|
||||
continue; \
|
||||
PF_CONCAT(chk_, __LINE__) : if (err != 0) { \
|
||||
return err; \
|
||||
} \
|
||||
} while (err != 0); \
|
||||
if (sectorOffset) { \
|
||||
VFiPFCACHE_UpdateModifiedSector(p_vol, *pp_page, 1); \
|
||||
} \
|
||||
} else { \
|
||||
if ((fat_sector + sectorOffset) != (*pp_page)->sector + (((*pp_page)->p_buf - (*pp_page)->buffer) >> p_vol->bpb.log2_bytes_per_sector)) { \
|
||||
(*pp_page)->p_buf = &(*pp_page)->buffer[((fat_sector + sectorOffset) - (*pp_page)->sector) << p_vol->bpb.log2_bytes_per_sector]; \
|
||||
if (sectorOffset) { \
|
||||
VFiPFCACHE_UpdateModifiedSector(p_vol, *pp_page, 1); \
|
||||
} \
|
||||
} \
|
||||
#define FAT_MACRO(sectorOffset) \
|
||||
if ((*pp_page)->sector > (fat_sector + sectorOffset) || ((*pp_page)->sector + p_vol->cache.fat_buff_size) <= (fat_sector + sectorOffset)) { \
|
||||
err = VFiPFFAT_UpdateFATEntry(p_vol, *pp_page); \
|
||||
if (err != 0) { \
|
||||
return err; \
|
||||
} \
|
||||
if ((p_vol->bpb.ext_flags & 0x80) != 0) { \
|
||||
current_fat = p_vol->bpb.ext_flags & (0x01 | 0x02 | 0x04); \
|
||||
} else { \
|
||||
current_fat = 1; \
|
||||
} \
|
||||
do { \
|
||||
err = VFiPFCACHE_ReadFATPage(p_vol, fat_sector + sectorOffset, pp_page); \
|
||||
if (err == 0x1000 && p_vol->p_callback != PF_NULL) { \
|
||||
result = ((PF_VOLUME_CB)p_vol->p_callback)(p_vol->last_driver_error); \
|
||||
if (result != 0) { \
|
||||
if (result == 1 && p_vol->bpb.num_active_FATs >= 2 && current_fat < p_vol->bpb.num_active_FATs) { \
|
||||
current_fat++; \
|
||||
fat_sector += p_vol->bpb.sectors_per_FAT; \
|
||||
continue; \
|
||||
} \
|
||||
} else { \
|
||||
continue; \
|
||||
} \
|
||||
} \
|
||||
if (err != 0) { \
|
||||
return err; \
|
||||
} \
|
||||
} while (err != 0); \
|
||||
if (sectorOffset) { \
|
||||
VFiPFCACHE_UpdateModifiedSector(p_vol, *pp_page, 1); \
|
||||
} \
|
||||
} else { \
|
||||
if ((fat_sector + sectorOffset) != (*pp_page)->sector + (((*pp_page)->p_buf - (*pp_page)->buffer) >> p_vol->bpb.log2_bytes_per_sector)) { \
|
||||
(*pp_page)->p_buf = &(*pp_page)->buffer[((fat_sector + sectorOffset) - (*pp_page)->sector) << p_vol->bpb.log2_bytes_per_sector]; \
|
||||
if (sectorOffset) { \
|
||||
VFiPFCACHE_UpdateModifiedSector(p_vol, *pp_page, 1); \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
|
||||
err = 0;
|
||||
@@ -292,7 +288,4 @@ pf_s32 VFiPFFAT12_WriteFATEntryPage(PF_VOLUME* p_vol, pf_u16 cluster, pf_u16 val
|
||||
return err;
|
||||
|
||||
#undef FAT_MACRO
|
||||
|
||||
#undef PF_CONCAT
|
||||
#undef __CONCAT
|
||||
}
|
||||
|
||||
@@ -81,20 +81,18 @@ pf_s32 VFiPFFAT16_ReadFATEntryPage(PF_VOLUME* p_vol, pf_u32 cluster, pf_u32* p_v
|
||||
}
|
||||
do {
|
||||
err = VFiPFCACHE_ReadFATPage(p_vol, sector, pp_page);
|
||||
if (err != 0x1000 || p_vol->p_callback == PF_NULL) {
|
||||
goto block_22;
|
||||
}
|
||||
result = ((PF_VOLUME_CB)p_vol->p_callback)(p_vol->last_driver_error);
|
||||
if (result != 0) {
|
||||
if (result == 1 && p_vol->bpb.num_active_FATs >= 2 && current_fat < p_vol->bpb.num_active_FATs) {
|
||||
current_fat++;
|
||||
sector += p_vol->bpb.sectors_per_FAT;
|
||||
if (err == 0x1000 && p_vol->p_callback != PF_NULL) {
|
||||
result = ((PF_VOLUME_CB)p_vol->p_callback)(p_vol->last_driver_error);
|
||||
if (result != 0) {
|
||||
if (result == 1 && p_vol->bpb.num_active_FATs >= 2 && current_fat < p_vol->bpb.num_active_FATs) {
|
||||
current_fat++;
|
||||
sector += p_vol->bpb.sectors_per_FAT;
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
goto block_22;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
continue;
|
||||
block_22:
|
||||
if (err != 0) {
|
||||
return err;
|
||||
}
|
||||
@@ -161,20 +159,18 @@ pf_s32 VFiPFFAT16_WriteFATEntryPage(PF_VOLUME* p_vol, pf_u32 cluster, pf_u32 val
|
||||
}
|
||||
do {
|
||||
err = VFiPFCACHE_ReadFATPage(p_vol, fat_sector, pp_page);
|
||||
if (err != 0x1000 || p_vol->p_callback == PF_NULL) {
|
||||
goto block_21;
|
||||
}
|
||||
result = ((PF_VOLUME_CB)p_vol->p_callback)(p_vol->last_driver_error);
|
||||
if (result != 0) {
|
||||
if (result == 1 && p_vol->bpb.num_active_FATs >= 2 && current_fat < p_vol->bpb.num_active_FATs) {
|
||||
current_fat++;
|
||||
fat_sector += p_vol->bpb.sectors_per_FAT;
|
||||
if (err == 0x1000 && p_vol->p_callback != PF_NULL) {
|
||||
result = ((PF_VOLUME_CB)p_vol->p_callback)(p_vol->last_driver_error);
|
||||
if (result != 0) {
|
||||
if (result == 1 && p_vol->bpb.num_active_FATs >= 2 && current_fat < p_vol->bpb.num_active_FATs) {
|
||||
current_fat++;
|
||||
fat_sector += p_vol->bpb.sectors_per_FAT;
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
goto block_21;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
continue;
|
||||
block_21:
|
||||
if (err != 0) {
|
||||
return err;
|
||||
}
|
||||
|
||||
@@ -82,20 +82,18 @@ pf_s32 VFiPFFAT32_ReadFATEntryPage(PF_VOLUME* p_vol, pf_u32 cluster, pf_u32* p_v
|
||||
}
|
||||
do {
|
||||
err = VFiPFCACHE_ReadFATPage(p_vol, sector, pp_page);
|
||||
if (err != 0x1000 || p_vol->p_callback == PF_NULL) {
|
||||
goto block_22;
|
||||
}
|
||||
result = ((PF_VOLUME_CB)p_vol->p_callback)(p_vol->last_driver_error);
|
||||
if (result != 0) {
|
||||
if (result == 1 && p_vol->bpb.num_active_FATs >= 2 && current_fat < p_vol->bpb.num_active_FATs) {
|
||||
current_fat++;
|
||||
sector += p_vol->bpb.sectors_per_FAT;
|
||||
if (err == 0x1000 && p_vol->p_callback != PF_NULL) {
|
||||
result = ((PF_VOLUME_CB)p_vol->p_callback)(p_vol->last_driver_error);
|
||||
if (result != 0) {
|
||||
if (result == 1 && p_vol->bpb.num_active_FATs >= 2 && current_fat < p_vol->bpb.num_active_FATs) {
|
||||
current_fat++;
|
||||
sector += p_vol->bpb.sectors_per_FAT;
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
goto block_22;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
continue;
|
||||
block_22:
|
||||
if (err != 0) {
|
||||
return err;
|
||||
}
|
||||
@@ -169,20 +167,18 @@ pf_s32 VFiPFFAT32_WriteFATEntryPage(PF_VOLUME* p_vol, pf_u32 cluster, pf_u32 val
|
||||
}
|
||||
do {
|
||||
err = VFiPFCACHE_ReadFATPage(p_vol, fat_sector, pp_page);
|
||||
if (err != 0x1000 || p_vol->p_callback == PF_NULL) {
|
||||
goto block_21;
|
||||
}
|
||||
result = ((PF_VOLUME_CB)p_vol->p_callback)(p_vol->last_driver_error);
|
||||
if (result != 0) {
|
||||
if (result == 1 && p_vol->bpb.num_active_FATs >= 2 && current_fat < p_vol->bpb.num_active_FATs) {
|
||||
current_fat++;
|
||||
fat_sector += p_vol->bpb.sectors_per_FAT;
|
||||
if (err == 0x1000 && p_vol->p_callback != PF_NULL) {
|
||||
result = ((PF_VOLUME_CB)p_vol->p_callback)(p_vol->last_driver_error);
|
||||
if (result != 0) {
|
||||
if (result == 1 && p_vol->bpb.num_active_FATs >= 2 && current_fat < p_vol->bpb.num_active_FATs) {
|
||||
current_fat++;
|
||||
fat_sector += p_vol->bpb.sectors_per_FAT;
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
goto block_21;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
continue;
|
||||
block_21:
|
||||
if (err != 0) {
|
||||
return err;
|
||||
}
|
||||
|
||||
@@ -684,37 +684,34 @@ static pf_s32 VFiPFFILE_p_fopen(PF_VOLUME* p_vol, PF_STR* p_path_str, pf_s32 mod
|
||||
return 0xA;
|
||||
}
|
||||
VFiPFENT_getcurrentDateTimeForEnt(&ent.access_date, &access_time);
|
||||
goto block_35;
|
||||
} else {
|
||||
if ((namelength + parent_ent.path_len) > 0x103U) {
|
||||
return 1;
|
||||
}
|
||||
err = VFiPFFILE_createEmptyFile(p_vol, &ent, &file_str, &parent_ent, namelength);
|
||||
if (err == 8) {
|
||||
if ((mode & 0x10) != 0) {
|
||||
return 8;
|
||||
}
|
||||
if (((mode & 1) != 0) && (VFiPFFILE_IsOpened(&ent) != 0)) {
|
||||
return 8;
|
||||
}
|
||||
if (((ent.attr & 1) != 0) && (((mode & 1) != 0) || ((mode & 4) != 0) || ((mode & 8) != 0))) {
|
||||
return 0xA;
|
||||
}
|
||||
if ((ent.attr & 0x10) != 0) {
|
||||
return 0x17;
|
||||
}
|
||||
if ((mode & 1) != 0) {
|
||||
VFiPFFAT_InitFFD(&ffd, &hint, ent.p_vol, &ent.start_cluster);
|
||||
VFiPFFILE_EmptyFile(&ffd, &ent);
|
||||
} else {
|
||||
VFiPFENT_getcurrentDateTimeForEnt(&ent.access_date, &access_time);
|
||||
}
|
||||
} else if (err != 0) {
|
||||
return err;
|
||||
}
|
||||
}
|
||||
if ((namelength + parent_ent.path_len) > 0x103U) {
|
||||
return 1;
|
||||
}
|
||||
err = VFiPFFILE_createEmptyFile(p_vol, &ent, &file_str, &parent_ent, namelength);
|
||||
if (err == 8) {
|
||||
if ((mode & 0x10) != 0) {
|
||||
return 8;
|
||||
}
|
||||
if (((mode & 1) != 0) && (VFiPFFILE_IsOpened(&ent) != 0)) {
|
||||
return 8;
|
||||
}
|
||||
if (((ent.attr & 1) != 0) && (((mode & 1) != 0) || ((mode & 4) != 0) || ((mode & 8) != 0))) {
|
||||
return 0xA;
|
||||
}
|
||||
if ((ent.attr & 0x10) != 0) {
|
||||
return 0x17;
|
||||
}
|
||||
if ((mode & 1) != 0) {
|
||||
VFiPFFAT_InitFFD(&ffd, &hint, ent.p_vol, &ent.start_cluster);
|
||||
VFiPFFILE_EmptyFile(&ffd, &ent);
|
||||
} else {
|
||||
VFiPFENT_getcurrentDateTimeForEnt(&ent.access_date, &access_time);
|
||||
}
|
||||
goto block_35;
|
||||
}
|
||||
if (err != 0) {
|
||||
return err;
|
||||
}
|
||||
block_35:
|
||||
p_vol = ent.p_vol;
|
||||
p_sfd = VFiPFFILE_GetSFD(p_vol, &ent);
|
||||
if (p_sfd == PF_NULL) {
|
||||
|
||||
@@ -630,7 +630,6 @@ pf_s32 VFiPFVOL_attach(PF_DRV_TBL* p_drv) {
|
||||
} else {
|
||||
if ((vol_idx < 0) || (vol_idx >= 0x1A)) {
|
||||
return VFipf_vol_set.last_error = 0x12;
|
||||
return 0x12;
|
||||
}
|
||||
p_vol = &VFipf_vol_set.volumes[vol_idx];
|
||||
if ((p_vol->flags & 1) != 0) {
|
||||
@@ -663,9 +662,7 @@ pf_s32 VFiPFVOL_attach(PF_DRV_TBL* p_drv) {
|
||||
return 0;
|
||||
}
|
||||
p_drv->stat |= 2;
|
||||
goto block_55;
|
||||
}
|
||||
block_55:
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
108
tools/decomp-assist/cleanup2-x5.attempts.md
Normal file
108
tools/decomp-assist/cleanup2-x5.attempts.md
Normal file
@@ -0,0 +1,108 @@
|
||||
# cleanup2-x5 attempts
|
||||
|
||||
Baseline d83fa089e2d7d256ad9295e803a9484f042a5bfa. Assigned libs/RevoEX except NWC24MsgSubject.c and WDScan.c. Initial full 43U build passed, all 1028 units exact and linked, DECOMPLETE_OK, DOL SHA1 26116613f624061ba99c8d1a299aaa6efa85670d. Existing unrelated untracked files preserved.
|
||||
|
||||
Each function trial builds its object and compares every byte with the initial exact object. Failed trials restore the prior source and rebuild it. No function-scoped optimization pragmas or comma conditions appeared in the initial owned-source scan.
|
||||
|
||||
## Trials
|
||||
- REVERTED libs/RevoEX/src/vf/fatfs/pf_fat.c: VFiPFFAT_ReadFATSector: replace retry gotos with continue; changed sections .text,.rela.text,.symtab; instructions 75/76, differences 13.
|
||||
- REVERTED libs/RevoEX/src/vf/fatfs/pf_fat.c: VFiPFFAT_FindClusterLinkPage: replace exit labels with structured return and fallthrough; changed sections .text,.rela.text,.symtab; instructions 106/107, differences 86.
|
||||
- KEPT libs/RevoEX/src/vf/fatfs/pf_fat.c: VFiPFFAT_GetClusterAllocatedInChain: replace loop exit goto with break; whole built object byte-identical to initial exact object.
|
||||
- KEPT libs/RevoEX/src/vf/fatfs/pf_fat.c: file: rename saved free-cluster search start; whole built object byte-identical to initial exact object.
|
||||
- KEPT libs/RevoEX/src/vf/fatfs/pf_fat.c: VFiPFFAT_ReadFATSector: express retry loop as do/while; whole built object byte-identical to initial exact object.
|
||||
- KEPT libs/RevoEX/src/vf/fatfs/pf_fat.c: VFiPFFAT_FindClusterLinkPage: use sibling-style guarded cluster lookup with separate empty result; whole built object byte-identical to initial exact object.
|
||||
- KEPT libs/RevoEX/src/vf/fatfs/pf_file.c: VFiPFFILE_p_fopen: replace file-open join gotos with if/else; whole built object byte-identical to initial exact object.
|
||||
- REVERTED libs/RevoEX/src/cdb/CDBRecord.c: CDBRecordOpen_: replace SD-decrypt entry and result gotos with if/else; changed sections .text,.strtab; instructions 109/109, differences 0.
|
||||
- REVERTED libs/RevoEX/src/cdb/CDBRecord.c: CDBRecordOpenReadOnly_: replace SD-decrypt entry and result gotos with if/else; changed sections .text,.strtab; instructions 93/93, differences 0.
|
||||
- REVERTED libs/RevoEX/src/cdb/CDBRecord.c: CDBRecordGetId: replace result switch and exit gotos with guarded ID extraction; changed sections .text,.rela.text,.symtab,.strtab; instructions 65/66, differences 16.
|
||||
- KEPT libs/RevoEX/src/vf/fatfs/pf_fat.c: file: remove extra blank line at guarded lookup join; whole built object byte-identical to initial exact object.
|
||||
- REVERTED libs/RevoEX/src/vf/fatfs/pf_entry_iterator.c: VFiPFENT_ITER_DoAllocateEntry: replace emulated entry scan loop and middle-block jumps with while/break; changed sections .strtab; instructions 259/259, differences 0.
|
||||
- KEPT libs/RevoEX/src/vf/fatfs/pf_entry_iterator.c: VFiPFENT_ITER_DoGetEntryOfPath: replace directory-resolution join goto with if/else; whole built object byte-identical to initial exact object.
|
||||
- KEPT libs/RevoEX/src/vf/fatfs/pf_entry_iterator.c: file: remove obsolete decompiler note; whole built object byte-identical to initial exact object.
|
||||
- REVERTED libs/RevoEX/src/vf/fatfs/pf_entry_iterator.c: VFiPFENT_ITER_DoAllocateEntry: replace emulated entry scan loop with while/break; check removed local labels separately; changed sections .strtab; instructions 259/259, differences 0.
|
||||
- KEPT libs/RevoEX/src/vf/fatfs/pf_entry_iterator.c: VFiPFENT_ITER_DoAllocateEntry: replace emulated entry scan loop with while/break; check removed local labels separately; code, data, relocations and symbol-table bytes identical; only compiler-generated local literal names changed in .strtab.
|
||||
- REVERTED libs/RevoEX/src/cdb/CDBRecord.c: CDBRecordOpen_: structure SD-decrypt branches; separate phases while preserving later OSPanic line; changed sections .text,.strtab; instructions 109/109, differences 0.
|
||||
- REVERTED libs/RevoEX/src/cdb/CDBRecord.c: CDBRecordOpenReadOnly_: structure SD-decrypt branches; separate phases while preserving later OSPanic line; changed sections .text,.strtab; instructions 93/93, differences 0.
|
||||
- KEPT libs/RevoEX/src/cdb/CDBRecord.c: CDBRecordOpen_: structure SD-decrypt branches with phase spacing; later native panic remains at line 772; code, data, relocations and symbol-table bytes identical; only compiler-generated local literal names changed in .strtab.
|
||||
- KEPT libs/RevoEX/src/cdb/CDBRecord.c: CDBRecordOpenReadOnly_: structure SD-decrypt branches with phase spacing; later native panic remains at line 772; code, data, relocations and symbol-table bytes identical; only compiler-generated local literal names changed in .strtab.
|
||||
- KEPT libs/RevoEX/src/vf/fatfs/pf_fat16.c: VFiPFFAT16_ReadFATEntryPage: replace FAT page retry labels with guarded callback and continue; whole built object byte-identical to initial exact object.
|
||||
- KEPT libs/RevoEX/src/vf/fatfs/pf_fat16.c: VFiPFFAT16_WriteFATEntryPage: replace FAT page retry labels with guarded callback and continue; whole built object byte-identical to initial exact object.
|
||||
- KEPT libs/RevoEX/src/vf/fatfs/pf_fat32.c: VFiPFFAT32_ReadFATEntryPage: replace FAT page retry labels with guarded callback and continue; whole built object byte-identical to initial exact object.
|
||||
- KEPT libs/RevoEX/src/vf/fatfs/pf_fat32.c: VFiPFFAT32_WriteFATEntryPage: replace FAT page retry labels with guarded callback and continue; whole built object byte-identical to initial exact object.
|
||||
- KEPT libs/RevoEX/src/vf/fatfs/pf_fat12.c: VFiPFFAT12_WriteFATEntryPage: structure repeated FAT page retry macro and remove generated-label concatenation macros; whole built object byte-identical to initial exact object.
|
||||
- KEPT libs/RevoEX/src/vf/fatfs/pf_entry.c: VFiPFENT_RemoveEntry: replace optional cache-flush goto with guarded flush; code, data, relocations and symbol-table bytes identical; only compiler-generated local literal names changed in .strtab.
|
||||
- KEPT libs/RevoEX/src/vf/fatfs/pf_volume.c: VFiPFVOL_attach: remove redundant final goto and unreachable return; whole built object byte-identical to initial exact object.
|
||||
- REVERTED libs/RevoEX/src/vf/dskmng/pdm_partition.c: VFipdm_part_get_permission: replace status-check and success gotos with direct control flow; changed sections .text,.rela.text; instructions 118/118, differences 43.
|
||||
- REVERTED libs/RevoEX/src/vf/driver/pf_driver.c: VFiPFDRV_lerase: replace successful erase goto with direct return; changed sections .text,.rela.text; instructions 32/32, differences 13.
|
||||
- KEPT libs/RevoEX/src/so/SOCommon.c: SOStartupEx: replace emulated startup retry loop with for/continue; code, data, relocations and symbol-table bytes identical; only compiler-generated local literal names changed in .strtab.
|
||||
- KEPT libs/RevoEX/src/so/SOCommon.c: file: name retained allocated socket work buffer address; code, data, relocations and symbol-table bytes identical; only compiler-generated local literal names changed in .strtab.
|
||||
- KEPT libs/RevoEX/src/cdb/CDBRecord.c: CDBRecordGetId: remove redundant default-case cleanup jump; keep shared unlock exit; code, data, relocations and symbol-table bytes identical; only compiler-generated local literal names changed in .strtab.
|
||||
- KEPT libs/RevoEX/src/vf/driver/pf_driver.c: VFiPFDRV_lerase: guard erase error path and retain shared success return; whole built object byte-identical to initial exact object.
|
||||
- KEPT libs/RevoEX/src/vf/dskmng/pdm_partition.c: VFipdm_part_get_permission: structure partition permission guard with terminal error else; whole built object byte-identical to initial exact object.
|
||||
- KEPT libs/RevoEX/src/vf/dskmng/pdm_partition.c: VFipdm_part_get_start_sector: replace primary and extended partition success jumps with structured branches and break; whole built object byte-identical to initial exact object.
|
||||
- KEPT libs/RevoEX/src/vf/dskmng/pdm_mbr.c: VFipdm_mbr_get_mbr_part_table: replace MBR success goto with validation else; whole built object byte-identical to initial exact object.
|
||||
- KEPT libs/RevoEX/src/vf/dskmng/pdm_mbr.c: VFipdm_mbr_get_epbr_part_table: remove extended partition success join label; whole built object byte-identical to initial exact object.
|
||||
- KEPT libs/RevoEX/src/nhttp/NHTTP_recvbuf.c: NHTTPi_compareTokenN_HdrRecvBuf: replace goto-based character reads with existing ReadHeaderChar helper; whole built object byte-identical to initial exact object.
|
||||
- REVERTED libs/RevoEX/src/nwc24/NWC24System.c: NWC24iPrepareShutdown: replace fatal-status goto with break and guarded LED setup; changed sections .text,.rela.text,.symtab,.strtab; instructions 50/48, differences 18.
|
||||
- REVERTED libs/RevoEX/src/nwc24/NWC24System.c: NWC24iPrepareShutdown: structure status polling loop with fatal exit, busy retry and LED setup; changed sections .strtab; instructions 48/48, differences 0.
|
||||
- REVERTED libs/RevoEX/src/nwc24/NWC24DateParser.c: ConvertDateToDays: replace leap-February validation goto with explicit date cases; changed sections .text,.rela.text,.symtab; instructions 123/113, differences 72.
|
||||
- REVERTED libs/RevoEX/src/nwc24/NWC24System.c: NWC24iPrepareShutdown: check symbol-only changes in structured status polling loop; changed sections .strtab; instructions 48/48, differences 0.
|
||||
- KEPT libs/RevoEX/src/nwc24/NWC24System.c: NWC24iPrepareShutdown: structure shutdown status loop; verify generated static suffix names only; code, data, relocations and symbol-table bytes identical; only compiler-generated local symbol suffixes changed in .strtab.
|
||||
- KEPT libs/RevoEX/src/so/SOCommon.c: file: refine buffer name from same-offset HostReply field in SOInformation.c; code, data, relocations and symbol-table bytes identical; only compiler-generated local symbol suffixes changed in .strtab.
|
||||
- REVERTED libs/RevoEX/src/nwc24/NWC24Download.c: file: try removing scoped dont_inline directives; changed sections .text,.rela.text,.symtab,.strtab.
|
||||
- REVERTED libs/RevoEX/src/vf/develop/d_vf_sys.c: file: try removing scoped dont_inline directives; changed sections .text,.rela.text,.rela.sdata,.symtab,.strtab,.comment.
|
||||
- REVERTED libs/RevoEX/src/cdb/CDBRecordKey.c: file: try removing scoped dont_inline directives; changed sections .text,.rela.text,.symtab,.strtab,.comment.
|
||||
- REVERTED libs/RevoEX/src/cdb/CDBIntArray.c: file: try removing scoped dont_inline directives; changed sections .text,.rela.text,.symtab.
|
||||
- REVERTED libs/RevoEX/src/so/SOCommon.c: file: try removing scoped dont_inline directives; changed sections .text,.rela.text,.symtab,.strtab.
|
||||
- KEPT libs/RevoEX/src/net/neterrorcode.c: file: try removing connection-type prototype inline control; whole built object byte-identical to initial exact object.
|
||||
- REVERTED libs/RevoEX/src/net/neterrorcode.c: file: try removing startup-error scoped inline control; changed sections .text,.rela.text,.symtab,.strtab.
|
||||
- KEPT libs/RevoEX/src/nwc24/NWC24Download.c: file: document retained inline control after byte-changing removal trial; whole built object byte-identical to initial exact object.
|
||||
- KEPT libs/RevoEX/src/vf/develop/d_vf_sys.c: file: document retained inline control after byte-changing removal trial; whole built object byte-identical to initial exact object.
|
||||
- KEPT libs/RevoEX/src/cdb/CDBRecordKey.c: file: document retained inline control after byte-changing removal trial; whole built object byte-identical to initial exact object.
|
||||
- KEPT libs/RevoEX/src/cdb/CDBIntArray.c: file: document retained inline control after byte-changing removal trial; whole built object byte-identical to initial exact object.
|
||||
- KEPT libs/RevoEX/src/so/SOCommon.c: file: document retained inline control after byte-changing removal trial; code, data, relocations and symbol-table bytes identical; only compiler-generated local symbol suffixes changed in .strtab.
|
||||
- KEPT libs/RevoEX/src/net/neterrorcode.c: file: document retained inline control after byte-changing removal trial; whole built object byte-identical to initial exact object.
|
||||
- KEPT libs/RevoEX/src/nwc24/NWC24DateParser.c: ConvertDateToDays: document retained leap-day join after structured validation changed instructions; whole built object byte-identical to initial exact object.
|
||||
- KEPT libs/RevoEX/src/vf/fatfs/pf_fat12.c: VFiPFFAT12_WriteFATEntryPage: align macro continuation spacing after label removal; whole built object byte-identical to initial exact object.
|
||||
- KEPT libs/RevoEX/src/vf/dskmng/pdm_partition.c: VFipdm_part_get_permission: remove excess blank line at permission branch join; whole built object byte-identical to initial exact object.
|
||||
|
||||
## Audit decisions
|
||||
|
||||
- Largest files CDBDatabase.c and NHTTP_thread.c contain function-call argument commas, not comma operators in conditions. The balanced condition scan found no comma-expression conditions in the owned files.
|
||||
- Retained common cleanup exits in NHTTP_request.c, NWC24MsgCommit.c, NWC24MsgRead.c, NWC24FriendList.c, NWC24MBoxCtrl.c, NWC24Download.c, d_vf.c, sd_drv.c, SOInit/SOStartupEx and CDBRecordGetId. They share close, unlock, error-reporting or state-restoration paths, as permitted by wave-2 guidance.
|
||||
- Retained ConvertDateToDays leap-day join, documented inline. Its structured validation trial grew 113 instructions to 123 and changed 72 instruction positions.
|
||||
- Retained scoped dont_inline controls in NWC24Download.c, d_vf_sys.c, CDBRecordKey.c, CDBIntArray.c, SOCommon.c and NETGetStartupErrorCode, documented at the directives. Removal changed object code or call relocations. The redundant NETiGetConnectionTypeFromConfigList prototype controls were removed exactly.
|
||||
- Kept arg1 in the user-ID generation interface because the fourth ioctl result word has no demonstrated meaning in this checkout. SOCommon.unk10 was identified as the HostReply allocation by SOInformation.c and renamed hostReplyAddr.
|
||||
- Native CDBRecordDuplicate OSPanic stays at source line 772. Spacing between open phases preserves its existing __LINE__ value without changing the assertion or adding a directive.
|
||||
- Object comparisons allow only generated local symbol-name suffix changes when every other ELF section, including code, data, relocations and raw symbol-table entries, is byte-identical. No compiled byte or relocation change was retained.
|
||||
|
||||
|
||||
## Final validation
|
||||
|
||||
GATE PASS over all 21 modified units using gate.py --quick with fixed baseline d83fa089e2d7d256ad9295e803a9484f042a5bfa. Full build passed, all 357 owned functions remain instruction-exact, 0 regressions, 0 added forbidden patterns, 0 readability warnings. Regenerated live report passed DECOMPLETE_OK. Code and data remain 100% matched and linked across all 1028 units. Global fuzzy measure remains at the unchanged baseline value 99.999886. DOL SHA1 26116613f624061ba99c8d1a299aaa6efa85670d.
|
||||
|
||||
Removed 43 goto statements in the modified files, two generated-label concatenation macros, two redundant dont_inline directives and one unreachable return. Renamed initial_search_cluster and hostReplyAddr. NWC24MsgSubject.c and WDScan.c are unchanged.
|
||||
|
||||
| File | Exact functions before/after | Commit |
|
||||
|---|---:|---|
|
||||
| libs/RevoEX/src/cdb/CDBIntArray.c | 13/13 -> 13/13 | ed8b5a31 |
|
||||
| libs/RevoEX/src/cdb/CDBRecord.c | 29/29 -> 29/29 | aff3c409 |
|
||||
| libs/RevoEX/src/cdb/CDBRecordKey.c | 20/20 -> 20/20 | daedc017 |
|
||||
| libs/RevoEX/src/net/neterrorcode.c | 4/4 -> 4/4 | 32abb56c |
|
||||
| libs/RevoEX/src/nhttp/NHTTP_recvbuf.c | 7/7 -> 7/7 | 36e3ec8b |
|
||||
| libs/RevoEX/src/nwc24/NWC24DateParser.c | 8/8 -> 8/8 | 8334af1d |
|
||||
| libs/RevoEX/src/nwc24/NWC24Download.c | 30/30 -> 30/30 | b6b3cb09 |
|
||||
| libs/RevoEX/src/nwc24/NWC24System.c | 4/4 -> 4/4 | 64bdf6d5 |
|
||||
| libs/RevoEX/src/so/SOCommon.c | 16/16 -> 16/16 | ed490fc1 |
|
||||
| libs/RevoEX/src/vf/develop/d_vf_sys.c | 59/59 -> 59/59 | 4f0d05ca |
|
||||
| libs/RevoEX/src/vf/driver/pf_driver.c | 14/14 -> 14/14 | 23f7f02a |
|
||||
| libs/RevoEX/src/vf/dskmng/pdm_mbr.c | 4/4 -> 4/4 | 78cdd465 |
|
||||
| libs/RevoEX/src/vf/dskmng/pdm_partition.c | 19/19 -> 19/19 | 43a893b3 |
|
||||
| libs/RevoEX/src/vf/fatfs/pf_entry.c | 22/22 -> 22/22 | 09c3e5aa |
|
||||
| libs/RevoEX/src/vf/fatfs/pf_entry_iterator.c | 15/15 -> 15/15 | 3a78906a |
|
||||
| libs/RevoEX/src/vf/fatfs/pf_fat.c | 37/37 -> 37/37 | cf96cfa7 |
|
||||
| libs/RevoEX/src/vf/fatfs/pf_fat12.c | 4/4 -> 4/4 | fbf6e428 |
|
||||
| libs/RevoEX/src/vf/fatfs/pf_fat16.c | 4/4 -> 4/4 | cb8d66ab |
|
||||
| libs/RevoEX/src/vf/fatfs/pf_fat32.c | 4/4 -> 4/4 | 2cc38bb7 |
|
||||
| libs/RevoEX/src/vf/fatfs/pf_file.c | 24/24 -> 24/24 | a5bfb7c5 |
|
||||
| libs/RevoEX/src/vf/fatfs/pf_volume.c | 20/20 -> 20/20 | e5e37ae0 |
|
||||
Reference in New Issue
Block a user