/* * RefreshInfo - refresh all but costly info */ BOOL RefreshInfo( void ) { BOOL error; DWORD rc; WaitForSingleObject( writeMutex, INFINITE ); freeInfo(); error = FALSE; rc = getTitles(); if( rc != ERROR_SUCCESS ) error = TRUE; rc = getData( "Global", ®Data ); if( !error && rc != ERROR_SUCCESS ) error = TRUE; ReleaseMutex( writeMutex ); if( error ) freeInfo(); return( !error ); }
void FileSystem::startFileSystemChecking() { PartitionEntry *entry = getPartitionTable(0, 0); progressBar->setValue(10); PartitionEntry *temp = entry; while (temp != NULL) { if (temp->type == EXT2_PARTITION) { readSuperblock(temp); setInfo(); readRootInode(temp); freeInfo(); } temp = temp->next; progressBar->setValue(progressBar->value() + 30); } }
static void pragmaFini( // FINISH PRAGMAS INITFINI* defn ) // - definition { AUX_ENTRY *next; AUX_ENTRY *curr; AUX_INFO *info; defn = defn; for( curr = AuxList; curr != NULL; curr = next ) { next = curr->next; info = curr->info; if( info != NULL ) { if( info->use > 1 ) { info->use--; } else { freeInfo( info ); #ifndef NDEBUG if( IsAuxInfoBuiltIn( info ) ) { CFatal( "freeing a static calling convention info" ); } #endif if( !IsAuxInfoBuiltIn( info ) ) { CMemFree( info ); } } } CMemFree( curr ); } freeInfo( &DefaultInfo ); freeInfo( &CdeclInfo ); freeInfo( &PascalInfo ); freeInfo( &SyscallInfo ); freeInfo( &OptlinkInfo ); freeInfo( &StdcallInfo ); freeInfo( &FastcallInfo ); #if _CPU == 386 freeInfo( &Far16CdeclInfo ); freeInfo( &Far16PascalInfo ); #endif freeInfo( &WatcallInfo ); freeInfo( &FortranInfo ); //CMemFreePtr( &FortranInfo.objname ); AuxList = NULL; CgInfoFreeLibs(); CgInfoFreeImports(); CgInfoFreeImportsS(); }
/*============================================================================ Description: (API call) Removes a given storage or stream from the structured storage file. Arguments: io_pParent - storage containing the item to destroy in_pName - name of item to destroy Return: Status code ==========================================================================*/ int destroy( Storage* io_pParent, const wchar_t* in_pName) { SINT4 iRet = SSTG_OK; TOC* pTOC = NULL; DirectoryEntry* pParentEntry = NULL; DirectoryEntry* pChildEntry = NULL; StgInfo* pStgChildren = NULL; SINT4 childCount = 0; SINT4 i = 0; Storage* pStorage = 0; Header* pHeader = NULL; Fat* pRegFat = NULL; Fat* pSmallFat = NULL; ASSERT(io_pParent != NULL); ASSERT(in_pName != NULL); ASSERT(STG_CANWRITE(io_pParent->mode)); if ((io_pParent == NULL) || (in_pName == NULL)) { return SSTG_ERROR_ILLEGAL_CALL; } if (!STG_CANWRITE(io_pParent->mode)) { return SSTG_ERROR_ILLEGAL_ACCESS; } pRegFat = rootStorageGetFat(io_pParent->pRoot); pSmallFat = rootStorageGetSmallFat(io_pParent->pRoot); /* Get parent storage's directory entry */ pTOC = rootStorageGetTOC(io_pParent->pRoot); pParentEntry = tocGetEntryAtIndex(pTOC, io_pParent->ulDirIndex); if (pParentEntry == NULL) { return (int)SSTG_ERROR_CHILD_NOT_FOUND; } /* Find specified stream's directory entry */ iRet = tocFindChildEntry (pTOC, pParentEntry, in_pName, &pChildEntry); if (iRet != SSTG_OK) { return (int)iRet; } /* Ensure that the deletion operation is legal */ if ((directoryGetType(pChildEntry) != DIR_STREAM) && (directoryGetType(pChildEntry) != DIR_STORAGE)) { return SSTG_ERROR_ILLEGAL_ACCESS; } /* From this point on, any failures will cause an incomplete state in * the structured storage file. */ /* Mark all metadata as being dirty so it will be rewritten later */ iRet = rootStorageSetDirty(io_pParent->pRoot); if (iRet != SSTG_OK) { return (int)iRet; } if (directoryGetType(pChildEntry) == DIR_STREAM) { pHeader = rootStorageGetHeader(io_pParent->pRoot); if (directoryGetStreamLength(pChildEntry) < headerGetSmallStreamCutoff(pHeader)) { /* Merge the sectors of the stream into the free chain */ iRet = fatFreeChain(pSmallFat, directoryGetStartSector(pChildEntry)); if (iRet != SSTG_OK) { return iRet; } /* Recover as many sectors as possible from the small FAT's free * chain */ iRet = fatRecoverMiniFatFreeSectors(pSmallFat, pRegFat); if (iRet != SSTG_OK) { return iRet; } } else { /* Merge the sectors of the stream into the free chain */ iRet = fatFreeChain(pRegFat, directoryGetStartSector(pChildEntry)); if (iRet != SSTG_OK) { return iRet; } } } else if (directoryGetType(pChildEntry) == DIR_STORAGE) { /* Non-empty storages should be removed recursively */ iRet = openStorage(io_pParent, in_pName, &pStorage); if (iRet != SSTG_OK) { return iRet; } iRet = getChildrenInfo(pStorage, &pStgChildren, (int*)(void*)&childCount); if (iRet != SSTG_OK) { return iRet; } for (i = 0; i < childCount; i++) { iRet = destroy(pStorage, pStgChildren[i].sName); if (iRet != SSTG_OK) { return iRet; } } if (childCount > 0) { iRet = freeInfo(&pStgChildren, childCount); if (iRet != SSTG_OK) { return iRet; } } iRet = closeStorage(&pStorage); if (iRet != SSTG_OK) { return iRet; } } /* Remove the corresponding entry from the TOC */ iRet = tocRemoveEntry(pTOC, pParentEntry, pChildEntry); if (iRet != SSTG_OK) { return (int)iRet; } #ifdef DEBUG assertMiniStreamIntegrity(io_pParent->pRoot); #endif /* DEBUG */ return (int) iRet; }
/*============================================================================ Description: (API call) Returns an array of StgInfo structures with info about each child of a given Storage. Arguments: in_pStorage - pointer to storage for which to return child info out_paInfo - pointer to variable that, on success, will point to an array of StgInfo structures out_pCount - pointer to variable that, on success, will contain the number of entries in the out_paInfo array Return: Status code ==========================================================================*/ int getChildrenInfo(Storage* in_pStorage, StgInfo** out_paInfo, int* out_pCount) { TOC* pTOC = NULL; DirectoryEntry* pParentEntry = NULL; UINT4 cChildren = 0; UINT4 i = 0; StgInfo* pInfo = NULL; TCHECK2; ASSERT (in_pStorage != NULL); ASSERT (out_paInfo != NULL); ASSERT (out_pCount != NULL); if ((in_pStorage == NULL) || (out_paInfo == NULL) || (out_pCount == NULL)) { return SSTG_ERROR_ILLEGAL_CALL; } pTOC = rootStorageGetTOC(in_pStorage->pRoot); pParentEntry = tocGetEntryAtIndex(pTOC, in_pStorage->ulDirIndex); if (pParentEntry == NULL) { return SSTG_ERROR_ILLEGAL_CALL; } cChildren = tocCountEntryChildren(pTOC, pParentEntry); /* Early exit if no children */ if (cChildren == 0) { *out_pCount = 0; return SSTG_OK; } /* Allocate an array of new StgInfos */ pInfo = (StgInfo*)malloc(sizeof(StgInfo) * cChildren); if (pInfo == NULL) { return SSTG_ERROR_MEMORY; } memset(pInfo, 0, sizeof(StgInfo) * cChildren); /* Fill in information for each entry */ i = tocFillChildrenStgArray(pTOC, pParentEntry, pInfo); if(i != cChildren) { freeInfo(&pInfo, cChildren); return SSTG_ERROR_MEMORY; } KABOOM2; *out_paInfo = pInfo; *out_pCount = cChildren; return SSTG_OK; }
static void pragmaFini( // FINISH PRAGMAS INITFINI* defn ) // - definition { register struct aux_entry *next; register void *junk; defn = defn; next = AuxList; while( next != NULL ) { junk = next; if( next->info != NULL ) { if( next->info->use != 1 ) { next->info->use--; } else { freeInfo( next->info ); #ifndef NDEBUG if( IsAuxInfoBuiltIn( next->info ) ) { CFatal( "freeing a static calling convention info" ); } #endif if( !IsAuxInfoBuiltIn( next->info ) ) { CMemFree( next->info ); } } } next = next->next; CMemFree( junk ); } freeInfo( &DefaultInfo ); freeInfo( &CdeclInfo ); freeInfo( &PascalInfo ); freeInfo( &SyscallInfo ); freeInfo( &OptlinkInfo ); freeInfo( &StdcallInfo ); freeInfo( &FastcallInfo ); #if _CPU == 386 freeInfo( &Far16CdeclInfo ); freeInfo( &Far16PascalInfo ); #endif freeInfo( &WatcallInfo ); freeInfo( &FortranInfo ); //CMemFreePtr( &FortranInfo.objname ); AuxList = NULL; CgInfoFreeLibs(); CgInfoFreeImports(); CgInfoFreeImportsS(); }