Ignore:
Timestamp:
Sep 14, 2016, 3:36:15 PM (9 years ago)
Author:
bird
Message:

rewrote kmk_redirect to skip the separate process. Added chache invalidation after directory deletion for addressing kmk rebuild and fetching.

File:
1 edited

Legend:

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

    r2886 r2912  
    121121                else
    122122                {
    123                     PKFSOBJ pNameObj = kFsCacheLookupRelativeToDirA(g_pFsCache, (PKFSDIR)pDirObj,
    124                                                                     pszName, strlen(pszName), &enmError, NULL);
     123                    PKFSOBJ pNameObj = kFsCacheLookupRelativeToDirA(g_pFsCache, (PKFSDIR)pDirObj, pszName, strlen(pszName),
     124                                                                    0/*fFlags*/, &enmError, NULL);
    125125                    if (pNameObj)
    126126                    {
     
    586586}
    587587
     588/**
     589 * Invalidates a deleted directory so the cache can close handles to it.
     590 *
     591 * Used by kmk_builtin_rm and kmk_builtin_rmdir.
     592 *
     593 * @returns 0 on success, -1 on failure.
     594 * @param   pszDir      The directory to invalidate as deleted.
     595 */
     596int dir_cache_deleted_directory(const char *pszDir)
     597{
     598    if (kFsCacheInvalidateDeletedDirectoryA(g_pFsCache, pszDir))
     599        return 0;
     600    return -1;
     601}
     602
     603
     604int kmk_builtin_dircache(int argc, char **argv, char **envp)
     605{
     606    if (argc >= 2)
     607    {
     608        const char *pszCmd = argv[1];
     609        if (strcmp(pszCmd, "invalidate") == 0)
     610        {
     611            if (argc == 2)
     612            {
     613                dir_cache_invalid_all();
     614                return 0;
     615            }
     616            fprintf(stderr, "kmk_builtin_dircache: the 'invalidate' command takes no arguments!\n");
     617        }
     618        else if (strcmp(pszCmd, "invalidate-missing") == 0)
     619        {
     620            if (argc == 2)
     621            {
     622                dir_cache_invalid_missing ();
     623                return 0;
     624            }
     625            fprintf(stderr, "kmk_builtin_dircache: the 'invalidate-missing' command takes no arguments!\n");
     626        }
     627        else if (strcmp(pszCmd, "volatile") == 0)
     628        {
     629            int i;
     630            for (i = 2; i < argc; i++)
     631                dir_cache_volatile_dir(argv[i]);
     632            return 0;
     633        }
     634        else if (strcmp(pszCmd, "deleted") == 0)
     635        {
     636            int i;
     637            for (i = 2; i < argc; i++)
     638                dir_cache_deleted_directory(argv[i]);
     639            return 0;
     640        }
     641        else
     642            fprintf(stderr, "kmk_builtin_dircache: Invalid command '%s'!\n", pszCmd);
     643    }
     644    else
     645        fprintf(stderr, "kmk_builtin_dircache: No command given!\n");
     646
     647    K_NOREF(envp);
     648    return 2;
     649}
     650
Note: See TracChangeset for help on using the changeset viewer.