Changeset 3359 for trunk/src/lib/nt/kFsCache.c
- Timestamp:
- Jun 5, 2020, 6:17:17 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/nt/kFsCache.c
r3184 r3359 4455 4455 4456 4456 4457 /** 4458 * Invalidate all cache entries (regular, custom & missing). 4459 * 4460 * @param pCache The cache. 4461 */ 4462 void kFsCacheInvalidateAll(PKFSCACHE pCache) 4457 /** 4458 * Recursively close directories. 4459 */ 4460 static void kFsCacheCloseDirs(PKFSOBJ *papChildren, KU32 cChildren) 4461 { 4462 while (cChildren-- > 0) 4463 { 4464 PKFSDIR pDir = (PKFSDIR)papChildren[cChildren]; 4465 if (pDir && pDir->Obj.bObjType == KFSOBJ_TYPE_DIR) 4466 { 4467 if (pDir->hDir != INVALID_HANDLE_VALUE) 4468 { 4469 g_pfnNtClose(pDir->hDir); 4470 pDir->hDir = INVALID_HANDLE_VALUE; 4471 } 4472 kFsCacheCloseDirs(pDir->papChildren, pDir->cChildren); 4473 } 4474 } 4475 } 4476 4477 4478 /** 4479 * Worker for kFsCacheInvalidateAll and kFsCacheInvalidateAllAndCloseDirs 4480 */ 4481 static void kFsCacheInvalidateAllWorker(PKFSCACHE pCache, KBOOL fCloseDirs, KBOOL fIncludingRoot) 4463 4482 { 4464 4483 kHlpAssert(pCache->u32Magic == KFSOBJ_MAGIC); … … 4475 4494 kHlpAssert(pCache->auGenerations[1] < KU32_MAX); 4476 4495 4496 if (fCloseDirs) 4497 { 4498 kFsCacheCloseDirs(pCache->RootDir.papChildren, pCache->RootDir.cChildren); 4499 if (fCloseDirs && pCache->RootDir.hDir != INVALID_HANDLE_VALUE) 4500 { 4501 g_pfnNtClose(pCache->RootDir.hDir); 4502 pCache->RootDir.hDir = INVALID_HANDLE_VALUE; 4503 } 4504 } 4505 4477 4506 KFSCACHE_LOG(("Invalidate all - default: %#x/%#x, custom: %#x/%#x\n", 4478 4507 pCache->auGenerationsMissing[0], pCache->auGenerations[0], 4479 4508 pCache->auGenerationsMissing[1], pCache->auGenerations[1])); 4480 4509 KFSCACHE_UNLOCK(pCache); 4510 } 4511 4512 4513 /** 4514 * Invalidate all cache entries (regular, custom & missing). 4515 * 4516 * @param pCache The cache. 4517 */ 4518 void kFsCacheInvalidateAll(PKFSCACHE pCache) 4519 { 4520 kHlpAssert(pCache->u32Magic == KFSOBJ_MAGIC); 4521 kFsCacheInvalidateAllWorker(pCache, K_FALSE, K_FALSE); 4522 } 4523 4524 4525 /** 4526 * Invalidate all cache entries (regular, custom & missing) and close all the 4527 * directory handles. 4528 * 4529 * @param pCache The cache. 4530 * @param fIncludingRoot Close the root directory handle too. 4531 */ 4532 void kFsCacheInvalidateAllAndCloseDirs(PKFSCACHE pCache, KBOOL fIncludingRoot) 4533 { 4534 kHlpAssert(pCache->u32Magic == KFSOBJ_MAGIC); 4535 kFsCacheInvalidateAllWorker(pCache, K_TRUE, fIncludingRoot); 4481 4536 } 4482 4537
Note:
See TracChangeset
for help on using the changeset viewer.