Changeset 2861 in kBuild for trunk/src/kmk/incdep.c
- Timestamp:
- Sep 1, 2016 10:42:55 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kmk/incdep.c
r2850 r2861 32 32 # define INCL_ERRORS 33 33 #endif 34 #ifdef KBUILD_OS_WINDOWS 35 # ifdef KMK 36 # define INCDEP_USE_KFSCACHE 37 # endif 38 #endif 34 39 35 40 #include "make.h" … … 63 68 # include <Windows.h> 64 69 # define PARSE_IN_WORKER 70 #endif 71 72 #ifdef INCDEP_USE_KFSCACHE 73 # include "nt/kFsCache.h" 74 extern PKFSCACHE g_pFsCache; /* dir-nt-bird.c for now */ 65 75 #endif 66 76 … … 146 156 struct incdep_recorded_file *recorded_file_tail; 147 157 #endif 148 158 #ifdef INCDEP_USE_KFSCACHE 159 /** Pointer to the fs cache object for this file (it exists and is a file). */ 160 PKFSOBJ pFileObj; 161 #else 149 162 char name[1]; 163 #endif 150 164 }; 151 165 … … 484 498 incdep_read_file (struct incdep *cur, struct floc *f) 485 499 { 500 #ifdef INCDEP_USE_KFSCACHE 501 size_t const cbFile = (size_t)cur->pFileObj->Stats.st_size; 502 503 assert(cur->pFileObj->fFlags); 504 cur->file_base = incdep_xmalloc (cur, cbFile + 1); 505 if (cur->file_base) 506 { 507 if (kFsCacheFileSimpleOpenReadClose (g_pFsCache, cur->pFileObj, 0, cur->file_base, cbFile)) 508 { 509 cur->file_end = cur->file_base + cbFile; 510 cur->file_base[cbFile] = '\0'; 511 return 0; 512 } 513 incdep_xfree (cur, cur->file_base); 514 } 515 error (f, "%s/%s: error reading file", cur->pFileObj->pParent->Obj.pszName, cur->pFileObj->pszName); 516 517 #else /* !INCDEP_USE_KFSCACHE */ 486 518 int fd; 487 519 struct stat st; … … 526 558 527 559 close (fd); 560 #endif /* !INCDEP_USE_KFSCACHE */ 528 561 cur->file_base = cur->file_end = NULL; 529 562 return -1; … … 541 574 542 575 incdep_xfree (cur, cur->file_base); 576 #ifdef INCDEP_USE_KFSCACHE 577 /** @todo release object ref some day... */ 578 #endif 543 579 cur->next = NULL; 544 580 free (cur); … … 890 926 891 927 if (cur->err_msg) 928 #ifdef INCDEP_USE_KFSCACHE 929 error(NILF, "%s/%s(%d): %s", cur->pFileObj->pParent->Obj.pszName, cur->pFileObj->pszName, cur->err_line_no, cur->err_msg); 930 #else 892 931 error(NILF, "%s(%d): %s", cur->name, cur->err_line_no, cur->err_msg); 932 #endif 893 933 894 934 … … 967 1007 { 968 1008 if (cur->worker_tid == -1) 1009 #ifdef INCDEP_USE_KFSCACHE 1010 error (NILF, "%s/%s(%d): %s", cur->pFileObj->pParent->Obj.pszName, cur->pFileObj->pszName, line_no, msg); 1011 #else 969 1012 error (NILF, "%s(%d): %s", cur->name, line_no, msg); 1013 #endif 970 1014 #ifdef PARSE_IN_WORKER 971 1015 else … … 1754 1798 while ((name = find_next_token (&names_iterator, &name_len)) != 0) 1755 1799 { 1800 #ifdef INCDEP_USE_KFSCACHE 1801 KFSLOOKUPERROR enmError; 1802 PKFSOBJ pFileObj = kFsCacheLookupWithLengthA (g_pFsCache, name, name_len, &enmError); 1803 if (!pFileObj) 1804 continue; 1805 if (pFileObj->bObjType != KFSOBJ_TYPE_FILE) 1806 { 1807 kFsCacheObjRelease (g_pFsCache, pFileObj); 1808 continue; 1809 } 1810 1811 cur = xmalloc (sizeof (*cur)); /* not incdep_xmalloc here */ 1812 cur->pFileObj = pFileObj; 1813 #else 1756 1814 cur = xmalloc (sizeof (*cur) + name_len); /* not incdep_xmalloc here */ 1757 cur->file_base = cur->file_end = NULL;1758 1815 memcpy (cur->name, name, name_len); 1759 1816 cur->name[name_len] = '\0'; 1817 #endif 1818 1819 cur->file_base = cur->file_end = NULL; 1760 1820 cur->worker_tid = -1; 1761 1821 #ifdef PARSE_IN_WORKER
Note:
See TracChangeset
for help on using the changeset viewer.