VirtualBox

Changeset 3359 in kBuild for trunk/src


Ignore:
Timestamp:
Jun 5, 2020 4:17:17 PM (4 years ago)
Author:
bird
Message:

kmk,kFsCache: Added variant of kFsCacheInvalidateAll that also closes directory handles, we need to do this befor ere-executing kmk after having remake some include file we needed. It messes up fetching otherwise.

Location:
trunk/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kmk/dir-nt-bird.c

    r3203 r3359  
    660660
    661661/**
     662 * Invalidate the whole directory cache and closes all open handles.
     663 *
     664 * Used by $(dircache-ctl invalidate-and-close-dirs)
     665 * @param   including_root      Also close the root directory.
     666 * @note    Multi-thread safe.
     667 */
     668void dir_cache_invalid_all_and_close_dirs(int including_root)
     669{
     670    g_cInvalidates++;
     671    kFsCacheInvalidateAllAndCloseDirs(g_pFsCache, !!including_root);
     672}
     673
     674/**
    662675 * Invalidate missing bits of the directory cache.
    663676 *
  • trunk/src/kmk/function.c

    r3351 r3359  
    57625762        O (error, reading_file, "$(dircache-ctl invalidate) takes no parameters");
    57635763      dir_cache_invalid_all ();
     5764    }
     5765  else if (strcmp (cmd, "invalidate-and-close-dirs") == 0)
     5766    {
     5767      if (argv[1] != NULL)
     5768        O (error, reading_file, "$(dircache-ctl invalidate) takes no parameters");
     5769      dir_cache_invalid_all_and_close_dirs (0 /*including_root*/);
    57645770    }
    57655771  else if (strcmp (cmd, "invalidate-missing") == 0)
  • trunk/src/kmk/makeint.h

    r3322 r3359  
    11761176extern void dir_cache_invalid_after_job (void);
    11771177extern void dir_cache_invalid_all (void);
     1178extern void dir_cache_invalid_all_and_close_dirs (int including_root);
    11781179extern void dir_cache_invalid_missing (void);
    11791180extern int dir_cache_volatile_dir (const char *dir);
  • trunk/src/kmk/w32/winchildren.c

    r3358 r3359  
    36483648     * going on in the "exec'ed" make by keeping directories open.
    36493649     */
    3650     dir_cache_invalid_all();
     3650    dir_cache_invalid_all_and_close_dirs(1);
    36513651#endif
    36523652
  • trunk/src/lib/nt/kFsCache.c

    r3184 r3359  
    44554455
    44564456
    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 */
     4460static 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 */
     4481static void kFsCacheInvalidateAllWorker(PKFSCACHE pCache, KBOOL fCloseDirs, KBOOL fIncludingRoot)
    44634482{
    44644483    kHlpAssert(pCache->u32Magic == KFSOBJ_MAGIC);
     
    44754494    kHlpAssert(pCache->auGenerations[1] < KU32_MAX);
    44764495
     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
    44774506    KFSCACHE_LOG(("Invalidate all - default: %#x/%#x,  custom: %#x/%#x\n",
    44784507                  pCache->auGenerationsMissing[0], pCache->auGenerations[0],
    44794508                  pCache->auGenerationsMissing[1], pCache->auGenerations[1]));
    44804509    KFSCACHE_UNLOCK(pCache);
     4510}
     4511
     4512
     4513/**
     4514 * Invalidate all cache entries (regular, custom & missing).
     4515 *
     4516 * @param   pCache      The cache.
     4517 */
     4518void 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 */
     4532void kFsCacheInvalidateAllAndCloseDirs(PKFSCACHE pCache, KBOOL fIncludingRoot)
     4533{
     4534    kHlpAssert(pCache->u32Magic == KFSOBJ_MAGIC);
     4535    kFsCacheInvalidateAllWorker(pCache, K_TRUE, fIncludingRoot);
    44814536}
    44824537
  • trunk/src/lib/nt/kFsCache.h

    r3199 r3359  
    555555void        kFsCacheInvalidateMissing(PKFSCACHE pCache);
    556556void        kFsCacheInvalidateAll(PKFSCACHE pCache);
     557void        kFsCacheInvalidateAllAndCloseDirs(PKFSCACHE pCache, KBOOL fIncludingRoot);
    557558void        kFsCacheInvalidateCustomMissing(PKFSCACHE pCache);
    558559void        kFsCacheInvalidateCustomBoth(PKFSCACHE pCache);
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette