1 #ifndef MTOOLS_DIRCACHE_H
2 #define MTOOLS_DIRCACHE_H
4 /* Copyright 1997,1999,2001-2003,2008,2009 Alain Knaff.
5 * This file is part of mtools.
7 * Mtools is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
12 * Mtools is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Mtools. If not, see <http://www.gnu.org/licenses/>.
24 } dirCacheEntryType_t;
26 #define DC_BITMAP_SIZE 128
28 typedef struct dirCacheEntry_t {
29 dirCacheEntryType_t type;
30 unsigned int beginSlot;
37 typedef struct dirCache_t {
38 struct dirCacheEntry_t **entries;
40 unsigned int nrHashed;
41 unsigned int bm0[DC_BITMAP_SIZE];
42 unsigned int bm1[DC_BITMAP_SIZE];
43 unsigned int bm2[DC_BITMAP_SIZE];
46 int isHashed(dirCache_t *cache, wchar_t *name);
47 int growDirCache(dirCache_t *cache, int slot);
48 dirCache_t *allocDirCache(Stream_t *Stream, int slot);
49 dirCacheEntry_t *addUsedEntry(dirCache_t *Stream, int begin, int end,
50 wchar_t *longName, wchar_t *shortName,
51 struct directory *dir);
52 void freeDirCache(Stream_t *Stream);
53 dirCacheEntry_t *addFreeEntry(dirCache_t *Stream,
54 unsigned int begin, unsigned int end);
55 dirCacheEntry_t *addEndEntry(dirCache_t *Stream, int pos);
56 dirCacheEntry_t *lookupInDircache(dirCache_t *Stream, int pos);