VirtualBox

source: kBuild/trunk/src/lib/nt/kFsCache.h@ 3362

Last change on this file since 3362 was 3362, checked in by bird, 5 years ago

kFsCache: Don't need to lock the whole cache when using kFsCacheObjAddUserData and kFsCacheObjGetUserData. Fixed incorrect debug hack checking that we don't release objects while they are in the path hash structures.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 22.7 KB
Line 
1/* $Id: kFsCache.h 3362 2020-06-08 19:28:44Z bird $ */
2/** @file
3 * kFsCache.c - NT directory content cache.
4 */
5
6/*
7 * Copyright (c) 2016 knut st. osmundsen <bird-kBuild-spamx@anduin.net>
8 *
9 * Permission is hereby granted, free of charge, to any person obtaining a
10 * copy of this software and associated documentation files (the "Software"),
11 * to deal in the Software without restriction, including without limitation
12 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
13 * and/or sell copies of the Software, and to permit persons to whom the
14 * Software is furnished to do so, subject to the following conditions:
15 *
16 * The above copyright notice and this permission notice shall be included
17 * in all copies or substantial portions of the Software.
18 *
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
25 * IN THE SOFTWARE.
26 *
27 * Alternatively, the content of this file may be used under the terms of the
28 * GPL version 2 or later, or LGPL version 2.1 or later.
29 */
30
31#ifndef ___lib_nt_kFsCache_h___
32#define ___lib_nt_kFsCache_h___
33
34
35#include <k/kHlp.h>
36#include "ntstat.h"
37#ifndef NDEBUG
38# include <stdarg.h>
39#endif
40
41
42/** @def KFSCACHE_CFG_UTF16
43 * Whether to compile in the UTF-16 names support. */
44#define KFSCACHE_CFG_UTF16 1
45/** @def KFSCACHE_CFG_SHORT_NAMES
46 * Whether to compile in the short name support. */
47#define KFSCACHE_CFG_SHORT_NAMES 1
48/** @def KFSCACHE_CFG_PATH_HASH_TAB_SIZE
49 * Size of the path hash table. */
50#define KFSCACHE_CFG_PATH_HASH_TAB_SIZE 99991
51/** The max length paths we consider. */
52#define KFSCACHE_CFG_MAX_PATH 1024
53/** The max ANSI name length. */
54#define KFSCACHE_CFG_MAX_ANSI_NAME (256*3 + 16)
55/** The max UTF-16 name length. */
56#define KFSCACHE_CFG_MAX_UTF16_NAME (256*2 + 16)
57/** Enables locking of the cache and thereby making it thread safe. */
58#define KFSCACHE_CFG_LOCKING 1
59
60
61
62/** Special KFSOBJ::uCacheGen number indicating that it does not apply. */
63#define KFSOBJ_CACHE_GEN_IGNORE KU32_MAX
64
65
66/** @name KFSOBJ_TYPE_XXX - KFSOBJ::bObjType
67 * @{ */
68/** Directory, type KFSDIR. */
69#define KFSOBJ_TYPE_DIR KU8_C(0x01)
70/** Regular file - type KFSOBJ. */
71#define KFSOBJ_TYPE_FILE KU8_C(0x02)
72/** Other file - type KFSOBJ. */
73#define KFSOBJ_TYPE_OTHER KU8_C(0x03)
74/** Caching of a negative result - type KFSOBJ.
75 * @remarks We will allocate enough space for the largest cache node, so this
76 * can metamorph into any other object should it actually turn up. */
77#define KFSOBJ_TYPE_MISSING KU8_C(0x04)
78///** Invalidated entry flag. */
79//#define KFSOBJ_TYPE_F_INVALID KU8_C(0x20)
80/** @} */
81
82/** @name KFSOBJ_F_XXX - KFSOBJ::fFlags
83 * @{ */
84 /** Use custom generation.
85 * @remarks This is given the value 1, as we use it as an index into
86 * KFSCACHE::auGenerations, 0 being the default. */
87#define KFSOBJ_F_USE_CUSTOM_GEN KU32_C(0x00000001)
88
89/** Whether the file system update the modified timestamp of directories
90 * when something is removed from it or added to it.
91 * @remarks They say NTFS is the only windows filesystem doing this. */
92#define KFSOBJ_F_WORKING_DIR_MTIME KU32_C(0x00000002)
93/** NTFS file system volume. */
94#define KFSOBJ_F_NTFS KU32_C(0x80000000)
95/** Flags that are automatically inherited. */
96#define KFSOBJ_F_INHERITED_MASK KU32_C(0xffffffff)
97/** @} */
98
99
100#define IS_ALPHA(ch) ( ((ch) >= 'A' && (ch) <= 'Z') || ((ch) >= 'a' && (ch) <= 'z') )
101#define IS_SLASH(ch) ((ch) == '\\' || (ch) == '/')
102
103
104
105
106/** Pointer to a cache. */
107typedef struct KFSCACHE *PKFSCACHE;
108/** Pointer to a core object. */
109typedef struct KFSOBJ *PKFSOBJ;
110/** Pointer to a directory object. */
111typedef struct KFSDIR *PKFSDIR;
112/** Pointer to a directory hash table entry. */
113typedef struct KFSOBJHASH *PKFSOBJHASH;
114
115
116
117/** Pointer to a user data item. */
118typedef struct KFSUSERDATA *PKFSUSERDATA;
119/**
120 * User data item associated with a cache node.
121 */
122typedef struct KFSUSERDATA
123{
124 /** Pointer to the next piece of user data. */
125 PKFSUSERDATA pNext;
126 /** The key identifying this user. */
127 KUPTR uKey;
128 /** The destructor. */
129 void (*pfnDestructor)(PKFSCACHE pCache, PKFSOBJ pObj, PKFSUSERDATA pData);
130} KFSUSERDATA;
131
132
133/**
134 * Storage for name strings for the unlikely event that they should grow in
135 * length after the KFSOBJ was created.
136 */
137typedef struct KFSOBJNAMEALLOC
138{
139 /** Size of the allocation. */
140 KU32 cb;
141 /** The space for names. */
142 char abSpace[1];
143} KFSOBJNAMEALLOC;
144/** Name growth allocation. */
145typedef KFSOBJNAMEALLOC *PKFSOBJNAMEALLOC;
146
147
148/**
149 * Base cache node.
150 */
151typedef struct KFSOBJ
152{
153 /** Magic value (KFSOBJ_MAGIC). */
154 KU32 u32Magic;
155 /** Number of references. */
156 KU32 volatile cRefs;
157 /** The cache generation, see KFSOBJ_CACHE_GEN_IGNORE. */
158 KU32 uCacheGen;
159 /** The object type, KFSOBJ_TYPE_XXX. */
160 KU8 bObjType;
161 /** Set if the Stats member is valid, clear if not. */
162 KBOOL fHaveStats;
163 /** Internal debug field for counting path hash references.
164 * @internal */
165 KU8 cPathHashRefs;
166 /** Index into KFSCACHE::auUserData. */
167 KU8 idxUserDataLock;
168 /** Flags, KFSOBJ_F_XXX. */
169 KU32 fFlags;
170
171 /** Hash value of the name inserted into the parent hash table.
172 * This is 0 if not inserted. Names are only hashed and inserted as they are
173 * first found thru linear searching of its siblings, and which name it is
174 * dependens on the lookup function (W or A) and whether the normal name or
175 * short name seems to have matched.
176 *
177 * @note It was ruled out as too much work to hash and track all four names,
178 * so instead this minimalist approach was choosen in stead. */
179 KU32 uNameHash;
180 /** Pointer to the next child with the same name hash value. */
181 PKFSOBJ pNextNameHash;
182 /** Pointer to the parent (directory).
183 * This is only NULL for a root. */
184 PKFSDIR pParent;
185
186 /** The directory name. (Allocated after the structure.) */
187 const char *pszName;
188 /** The length of pszName. */
189 KU16 cchName;
190 /** The length of the parent path (up to where pszName starts).
191 * @note This is valuable when constructing an absolute path to this node by
192 * means of the parent pointer (no need for recursion). */
193 KU16 cchParent;
194#ifdef KFSCACHE_CFG_UTF16
195 /** The length of pwszName (in wchar_t's). */
196 KU16 cwcName;
197 /** The length of the parent UTF-16 path (in wchar_t's).
198 * @note This is valuable when constructing an absolute path to this node by
199 * means of the parent pointer (no need for recursion). */
200 KU16 cwcParent;
201 /** The UTF-16 object name. (Allocated after the structure.) */
202 const wchar_t *pwszName;
203#endif
204
205#ifdef KFSCACHE_CFG_SHORT_NAMES
206 /** The short object name. (Allocated after the structure, could be same
207 * as pszName.) */
208 const char *pszShortName;
209 /** The length of pszShortName. */
210 KU16 cchShortName;
211 /** The length of the short parent path (up to where pszShortName starts). */
212 KU16 cchShortParent;
213# ifdef KFSCACHE_CFG_UTF16
214 /** The length of pwszShortName (in wchar_t's). */
215 KU16 cwcShortName;
216 /** The length of the short parent UTF-16 path (in wchar_t's). */
217 KU16 cwcShortParent;
218 /** The UTF-16 short object name. (Allocated after the structure, possibly
219 * same as pwszName.) */
220 const wchar_t *pwszShortName;
221# endif
222#endif
223
224 /** Allocation for handling name length increases. */
225 PKFSOBJNAMEALLOC pNameAlloc;
226
227 /** Pointer to the first user data item */
228 PKFSUSERDATA pUserDataHead;
229
230 /** Stats - only valid when fHaveStats is set. */
231 BirdStat_T Stats;
232} KFSOBJ;
233
234/** The magic for a KFSOBJ structure (Thelonious Sphere Monk). */
235#define KFSOBJ_MAGIC KU32_C(0x19171010)
236
237
238/**
239 * Directory node in the cache.
240 */
241typedef struct KFSDIR
242{
243 /** The core object information. */
244 KFSOBJ Obj;
245
246 /** Child objects. */
247 PKFSOBJ *papChildren;
248 /** The number of child objects. */
249 KU32 cChildren;
250 /** The allocated size of papChildren. */
251 KU32 cChildrenAllocated;
252
253 /** Pointer to the child hash table. */
254 PKFSOBJ *papHashTab;
255 /** The mask shift of the hash table.
256 * Hash table size is a power of two, this is the size minus one.
257 *
258 * @remarks The hash table is optional and populated by lookup hits. The
259 * assumption being that a lookup is repeated and will choose a good
260 * name to hash on. We've got up to 4 different hashes, so this
261 * was the easy way out. */
262 KU32 fHashTabMask;
263
264 /** Handle to the directory (we generally keep it open). */
265#ifndef DECLARE_HANDLE
266 KUPTR hDir;
267#else
268 HANDLE hDir;
269#endif
270 /** The device number we queried/inherited when opening it. */
271 KU64 uDevNo;
272
273 /** The last write time sampled the last time the directory was refreshed.
274 * @remarks May differ from st_mtim because it will be updated when the
275 * parent directory is refreshed. */
276 KI64 iLastWrite;
277
278 /** Set if populated. */
279 KBOOL fPopulated;
280 /** Set if it needs re-populated. */
281 KBOOL fNeedRePopulating;
282} KFSDIR;
283
284
285/**
286 * Lookup errors.
287 */
288typedef enum KFSLOOKUPERROR
289{
290 /** Lookup was a success. */
291 KFSLOOKUPERROR_SUCCESS = 0,
292 /** A path component was not found. */
293 KFSLOOKUPERROR_PATH_COMP_NOT_FOUND,
294 /** A path component is not a directory. */
295 KFSLOOKUPERROR_PATH_COMP_NOT_DIR,
296 /** The final path entry is not a directory (trailing slash). */
297 KFSLOOKUPERROR_NOT_DIR,
298 /** Not found. */
299 KFSLOOKUPERROR_NOT_FOUND,
300 /** The path is too long. */
301 KFSLOOKUPERROR_PATH_TOO_LONG,
302 /** Unsupported path type. */
303 KFSLOOKUPERROR_UNSUPPORTED,
304 /** We're out of memory. */
305 KFSLOOKUPERROR_OUT_OF_MEMORY,
306
307 /** Error opening directory. */
308 KFSLOOKUPERROR_DIR_OPEN_ERROR,
309 /** Error reading directory. */
310 KFSLOOKUPERROR_DIR_READ_ERROR,
311 /** UTF-16 to ANSI conversion error. */
312 KFSLOOKUPERROR_ANSI_CONVERSION_ERROR,
313 /** ANSI to UTF-16 conversion error. */
314 KFSLOOKUPERROR_UTF16_CONVERSION_ERROR,
315 /** Internal error. */
316 KFSLOOKUPERROR_INTERNAL_ERROR
317} KFSLOOKUPERROR;
318
319
320/** Pointer to an ANSI path hash table entry. */
321typedef struct KFSHASHA *PKFSHASHA;
322/**
323 * ANSI file system path hash table entry.
324 * The path hash table allows us to skip parsing and walking a path.
325 */
326typedef struct KFSHASHA
327{
328 /** Next entry with the same hash table slot. */
329 PKFSHASHA pNext;
330 /** Path hash value. */
331 KU32 uHashPath;
332 /** The path length. */
333 KU16 cchPath;
334 /** Set if aboslute path. */
335 KBOOL fAbsolute;
336 /** Index into KFSCACHE:auGenerationsMissing when pFsObj is NULL. */
337 KU8 idxMissingGen;
338 /** The cache generation ID. */
339 KU32 uCacheGen;
340 /** The lookup error (when pFsObj is NULL). */
341 KFSLOOKUPERROR enmError;
342 /** The path. (Allocated after the structure.) */
343 const char *pszPath;
344 /** Pointer to the matching FS object.
345 * This is NULL for negative path entries? */
346 PKFSOBJ pFsObj;
347} KFSHASHA;
348
349
350#ifdef KFSCACHE_CFG_UTF16
351/** Pointer to an UTF-16 path hash table entry. */
352typedef struct KFSHASHW *PKFSHASHW;
353/**
354 * UTF-16 file system path hash table entry. The path hash table allows us
355 * to skip parsing and walking a path.
356 */
357typedef struct KFSHASHW
358{
359 /** Next entry with the same hash table slot. */
360 PKFSHASHW pNext;
361 /** Path hash value. */
362 KU32 uHashPath;
363 /** The path length (in wchar_t units). */
364 KU16 cwcPath;
365 /** Set if aboslute path. */
366 KBOOL fAbsolute;
367 /** Index into KFSCACHE:auGenerationsMissing when pFsObj is NULL. */
368 KU8 idxMissingGen;
369 /** The cache generation ID. */
370 KU32 uCacheGen;
371 /** The lookup error (when pFsObj is NULL). */
372 KFSLOOKUPERROR enmError;
373 /** The path. (Allocated after the structure.) */
374 const wchar_t *pwszPath;
375 /** Pointer to the matching FS object.
376 * This is NULL for negative path entries? */
377 PKFSOBJ pFsObj;
378} KFSHASHW;
379#endif
380
381
382/** @def KFSCACHE_LOCK
383 * Locks the cache exclusively. */
384/** @def KFSCACHE_UNLOCK
385 * Counterpart to KFSCACHE_LOCK. */
386/** @def KFSCACHE_OBJUSERDATA_LOCK
387 * Locks the user data list of an object exclusively. */
388/** @def KFSCACHE_OBJUSERDATA_UNLOCK
389 * Counterpart to KFSCACHE_OBJUSERDATA_LOCK. */
390#ifdef KFSCACHE_CFG_LOCKING
391# define KFSCACHE_LOCK(a_pCache) EnterCriticalSection(&(a_pCache)->u.CritSect)
392# define KFSCACHE_UNLOCK(a_pCache) LeaveCriticalSection(&(a_pCache)->u.CritSect)
393# define KFSCACHE_OBJUSERDATA_LOCK(a_pCache, a_pObj) do { \
394 KU8 idxUserDataLock = (a_pObj)->idxUserDataLock; \
395 if (idxUserDataLock != KU8_MAX) \
396 { /* likely */ } \
397 else \
398 idxUserDataLock = kFsCacheObjGetUserDataLockIndex(a_pCache, a_pObj); \
399 idxUserDataLock &= (KU8)(K_ELEMENTS((a_pCache)->auUserDataLocks) - 1); \
400 EnterCriticalSection(&(a_pCache)->auUserDataLocks[idxUserDataLock].CritSect); \
401 } while (0)
402# define KFSCACHE_OBJUSERDATA_UNLOCK(a_pCache, a_pObj) \
403 LeaveCriticalSection(&(a_pCache)->auUserDataLocks[(a_pObj)->idxUserDataLock & (K_ELEMENTS((a_pCache)->auUserDataLocks) - 1)].CritSect)
404#else
405# define KFSCACHE_LOCK(a_pCache) do { } while (0)
406# define KFSCACHE_UNLOCK(a_pCache) do { } while (0)
407# define KFSCACHE_OBJUSERDATA_LOCK(a_pCache, a_pObj) do { } while (0)
408# define KFSCACHE_OBJUSERDATA_UNLOCK(a_pCache, a_pObj) do { } while (0)
409#endif
410
411
412/** @name KFSCACHE_F_XXX
413 * @{ */
414/** Whether to cache missing directory entries (KFSOBJ_TYPE_MISSING). */
415#define KFSCACHE_F_MISSING_OBJECTS KU32_C(0x00000001)
416/** Whether to cache missing paths. */
417#define KFSCACHE_F_MISSING_PATHS KU32_C(0x00000002)
418/** @} */
419
420
421/**
422 * Directory cache instance.
423 */
424typedef struct KFSCACHE
425{
426 /** Magic value (KFSCACHE_MAGIC). */
427 KU32 u32Magic;
428 /** Cache flags. */
429 KU32 fFlags;
430
431 /** The default and custom cache generations for stuff that exists, indexed by
432 * KFSOBJ_F_USE_CUSTOM_GEN.
433 *
434 * The custom generation can be used to invalidate parts of the file system that
435 * are known to be volatile without triggering refreshing of the more static
436 * parts. Like the 'out' directory in a kBuild setup or a 'TEMP' directory are
437 * expected to change and you need to invalidate the caching of these frequently
438 * to stay on top of things. Whereas the sources, headers, compilers, sdk,
439 * ddks, windows directory and such generally doesn't change all that often.
440 */
441 KU32 auGenerations[2];
442 /** The current cache generation for missing objects, negative results, ++.
443 * This comes with a custom variant too. Indexed by KFSOBJ_F_USE_CUSTOM_GEN. */
444 KU32 auGenerationsMissing[2];
445
446 /** Number of cache objects. */
447 KSIZE cObjects;
448 /** Memory occupied by the cache object structures. */
449 KSIZE cbObjects;
450 /** Number of lookups. */
451 KSIZE cLookups;
452 /** Number of hits in the path hash tables. */
453 KSIZE cPathHashHits;
454 /** Number of hits walking the file system hierarchy. */
455 KSIZE cWalkHits;
456 /** Number of child searches. */
457 KSIZE cChildSearches;
458 /** Number of cChildLookups resolved thru hash table hits. */
459 KSIZE cChildHashHits;
460 /** The number of child hash tables. */
461 KSIZE cChildHashTabs;
462 /** The sum of all child hash table sizes. */
463 KSIZE cChildHashEntriesTotal;
464 /** Number of children inserted into the hash tables. */
465 KSIZE cChildHashed;
466 /** Number of collisions in the child hash tables. */
467 KSIZE cChildHashCollisions;
468 /** Number times a object name changed. */
469 KSIZE cNameChanges;
470 /** Number times a object name grew and needed KFSOBJNAMEALLOC.
471 * (Subset of cNameChanges) */
472 KSIZE cNameGrowths;
473
474 /** The root directory. */
475 KFSDIR RootDir;
476
477#ifdef KFSCACHE_CFG_LOCKING
478 union
479 {
480# ifdef _WINBASE_
481 CRITICAL_SECTION CritSect;
482# endif
483 KU64 abPadding[2 * 4 + 4 * sizeof(void *)];
484 }
485 /** Critical section protecting the cache. */
486 u,
487 /** Critical section protecting the pUserDataHead of objects.
488 * @note Array size must be a power of two. */
489 auUserDataLocks[8];
490 /** The next auUserData index. */
491 KU8 idxUserDataNext;
492#endif
493
494 /** File system hash table for ANSI filename strings. */
495 PKFSHASHA apAnsiPaths[KFSCACHE_CFG_PATH_HASH_TAB_SIZE];
496 /** Number of paths in the apAnsiPaths hash table. */
497 KSIZE cAnsiPaths;
498 /** Number of collisions in the apAnsiPaths hash table. */
499 KSIZE cAnsiPathCollisions;
500 /** Amount of memory used by the path entries. */
501 KSIZE cbAnsiPaths;
502
503#ifdef KFSCACHE_CFG_UTF16
504 /** Number of paths in the apUtf16Paths hash table. */
505 KSIZE cUtf16Paths;
506 /** Number of collisions in the apUtf16Paths hash table. */
507 KSIZE cUtf16PathCollisions;
508 /** Amount of memory used by the UTF-16 path entries. */
509 KSIZE cbUtf16Paths;
510 /** File system hash table for UTF-16 filename strings. */
511 PKFSHASHW apUtf16Paths[KFSCACHE_CFG_PATH_HASH_TAB_SIZE];
512#endif
513} KFSCACHE;
514
515/** Magic value for KFSCACHE::u32Magic (Jon Batiste). */
516#define KFSCACHE_MAGIC KU32_C(0x19861111)
517
518
519/** @def KW_LOG
520 * Generic logging.
521 * @param a Argument list for kFsCacheDbgPrintf */
522#if 1 /*def NDEBUG - enable when needed! */
523# define KFSCACHE_LOG(a) do { } while (0)
524#else
525# define KFSCACHE_LOG(a) kFsCacheDbgPrintf a
526void kFsCacheDbgPrintfV(const char *pszFormat, va_list va);
527void kFsCacheDbgPrintf(const char *pszFormat, ...);
528#endif
529
530
531KBOOL kFsCacheDirEnsurePopuplated(PKFSCACHE pCache, PKFSDIR pDir, KFSLOOKUPERROR *penmError);
532KBOOL kFsCacheDirAddChild(PKFSCACHE pCache, PKFSDIR pParent, PKFSOBJ pChild, KFSLOOKUPERROR *penmError);
533PKFSOBJ kFsCacheCreateObject(PKFSCACHE pCache, PKFSDIR pParent,
534 char const *pszName, KU16 cchName, wchar_t const *pwszName, KU16 cwcName,
535#ifdef KFSCACHE_CFG_SHORT_NAMES
536 char const *pszShortName, KU16 cchShortName, wchar_t const *pwszShortName, KU16 cwcShortName,
537#endif
538 KU8 bObjType, KFSLOOKUPERROR *penmError);
539PKFSOBJ kFsCacheCreateObjectW(PKFSCACHE pCache, PKFSDIR pParent, wchar_t const *pwszName, KU32 cwcName,
540#ifdef KFSCACHE_CFG_SHORT_NAMES
541 wchar_t const *pwszShortName, KU32 cwcShortName,
542#endif
543 KU8 bObjType, KFSLOOKUPERROR *penmError);
544PKFSOBJ kFsCacheLookupA(PKFSCACHE pCache, const char *pszPath, KFSLOOKUPERROR *penmError);
545PKFSOBJ kFsCacheLookupW(PKFSCACHE pCache, const wchar_t *pwszPath, KFSLOOKUPERROR *penmError);
546PKFSOBJ kFsCacheLookupRelativeToDirA(PKFSCACHE pCache, PKFSDIR pParent, const char *pszPath, KU32 cchPath, KU32 fFlags,
547 KFSLOOKUPERROR *penmError, PKFSOBJ *ppLastAncestor);
548PKFSOBJ kFsCacheLookupRelativeToDirW(PKFSCACHE pCache, PKFSDIR pParent, const wchar_t *pwszPath, KU32 cwcPath, KU32 fFlags,
549 KFSLOOKUPERROR *penmError, PKFSOBJ *ppLastAncestor);
550PKFSOBJ kFsCacheLookupWithLengthA(PKFSCACHE pCache, const char *pchPath, KSIZE cchPath, KFSLOOKUPERROR *penmError);
551PKFSOBJ kFsCacheLookupWithLengthW(PKFSCACHE pCache, const wchar_t *pwcPath, KSIZE cwcPath, KFSLOOKUPERROR *penmError);
552PKFSOBJ kFsCacheLookupNoMissingA(PKFSCACHE pCache, const char *pszPath, KFSLOOKUPERROR *penmError);
553PKFSOBJ kFsCacheLookupNoMissingW(PKFSCACHE pCache, const wchar_t *pwszPath, KFSLOOKUPERROR *penmError);
554
555/** @name KFSCACHE_LOOKUP_F_XXX - lookup flags
556 * @{ */
557/** No inserting new cache entries.
558 * This effectively prevent directories from being repopulated too. */
559#define KFSCACHE_LOOKUP_F_NO_INSERT KU32_C(1)
560/** No refreshing cache entries. */
561#define KFSCACHE_LOOKUP_F_NO_REFRESH KU32_C(2)
562/** @} */
563
564KU32 kFsCacheObjRelease(PKFSCACHE pCache, PKFSOBJ pObj);
565KU32 kFsCacheObjReleaseTagged(PKFSCACHE pCache, PKFSOBJ pObj, const char *pszWhere);
566#ifndef NDEBUG /* enable to debug object release. */
567# define kFsCacheObjRelease(a_pCache, a_pObj) kFsCacheObjReleaseTagged(a_pCache, a_pObj, __FUNCTION__)
568#endif
569KU32 kFsCacheObjRetain(PKFSOBJ pObj);
570PKFSUSERDATA kFsCacheObjAddUserData(PKFSCACHE pCache, PKFSOBJ pObj, KUPTR uKey, KSIZE cbUserData);
571PKFSUSERDATA kFsCacheObjGetUserData(PKFSCACHE pCache, PKFSOBJ pObj, KUPTR uKey);
572KU8 kFsCacheObjGetUserDataLockIndex(PKFSCACHE pCache, PKFSOBJ pObj);
573KBOOL kFsCacheObjGetFullPathA(PKFSOBJ pObj, char *pszPath, KSIZE cbPath, char chSlash);
574KBOOL kFsCacheObjGetFullPathW(PKFSOBJ pObj, wchar_t *pwszPath, KSIZE cwcPath, wchar_t wcSlash);
575KBOOL kFsCacheObjGetFullShortPathA(PKFSOBJ pObj, char *pszPath, KSIZE cbPath, char chSlash);
576KBOOL kFsCacheObjGetFullShortPathW(PKFSOBJ pObj, wchar_t *pwszPath, KSIZE cwcPath, wchar_t wcSlash);
577
578KBOOL kFsCacheFileSimpleOpenReadClose(PKFSCACHE pCache, PKFSOBJ pFileObj, KU64 offStart, void *pvBuf, KSIZE cbToRead);
579
580PKFSCACHE kFsCacheCreate(KU32 fFlags);
581void kFsCacheDestroy(PKFSCACHE);
582void kFsCacheInvalidateMissing(PKFSCACHE pCache);
583void kFsCacheInvalidateAll(PKFSCACHE pCache);
584void kFsCacheInvalidateAllAndCloseDirs(PKFSCACHE pCache, KBOOL fIncludingRoot);
585void kFsCacheInvalidateCustomMissing(PKFSCACHE pCache);
586void kFsCacheInvalidateCustomBoth(PKFSCACHE pCache);
587KBOOL kFsCacheSetupCustomRevisionForTree(PKFSCACHE pCache, PKFSOBJ pRoot);
588KBOOL kFsCacheInvalidateDeletedDirectoryA(PKFSCACHE pCache, const char *pszDir);
589
590#endif
Note: See TracBrowser for help on using the repository browser.

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