45686c898cb2b40522e43a8fad5477c24d3382f7
[openafs.git] / src / WINNT / afsd / cm_memmap.h
1 /*
2  * Copyright 2004, Secure Endpoints Inc.
3  * All Rights Reserved.
4  * 
5  * This software has been released under the terms of the IBM Public
6  * License.  For details, see the LICENSE file in the top-level source
7  * directory or online at http://www.openafs.org/dl/license10.html
8  */
9
10 #ifndef CM_MEMMAP_H
11 #define CM_MEMMAP_H 1
12
13 #define CM_CONFIG_DATA_MAGIC            ('A' | 'F'<<8 | 'S'<<16 | 'D'<<24)
14
15 typedef struct cm_config_data {
16     long                size;
17     long                magic;
18     CHAR *              baseAddress;
19
20     long                stats;
21     long                chunkSize;
22     long                blockSize;
23     long                bufferSize;
24     long                cacheType;
25     long                dirty;
26
27     cm_volume_t *       volumeBaseAddress;
28     cm_cell_t   *       cellBaseAddress; 
29     cm_aclent_t *       aclBaseAddress;
30     cm_scache_t *       scacheBaseAddress;
31     cm_nc_t     *       dnlcBaseAddress;
32     cm_buf_t    *       bufHeaderBaseAddress;
33     char *              bufDataBaseAddress;
34     char *              bufEndOfData;
35
36     cm_volume_t *       allVolumesp;
37     long                currentVolumes;
38     long                maxVolumes;
39
40     cm_cell_t   *       allCellsp;
41     long                currentCells;
42     long                maxCells;
43
44     cm_volume_t *       rootVolumep;
45     cm_cell_t   *       rootCellp;
46     cm_fid_t            rootFid;
47     cm_scache_t *       rootSCachep;
48     cm_scache_t         fakeSCache;
49     afs_uint32          fakeDirVersion;
50
51     cm_aclent_t *       aclLRUp;
52     cm_aclent_t *       aclLRUEndp;
53
54     cm_scache_t **      hashTablep;
55     long                hashTableSize;
56
57     long                currentSCaches;
58     long                maxSCaches;
59     cm_scache_t *       scacheLRUFirstp;
60     cm_scache_t *       scacheLRULastp;
61
62     cm_nc_t     *       ncfreelist;
63     cm_nc_t     *       nameCache;
64     cm_nc_t     **      nameHash; 
65
66     cm_buf_t    *       buf_freeListp;
67     cm_buf_t    *       buf_freeListEndp;
68     cm_buf_t    **      buf_hashTablepp;
69     cm_buf_t    **      buf_fileHashTablepp;
70     cm_buf_t    *       buf_allp;
71     long                buf_nbuffers;
72     long                buf_blockSize;
73     long                buf_hashSize;
74     long                buf_nOrigBuffers;
75     long                buf_reservedBufs;
76     long                buf_maxReservedBufs;
77     long                buf_reserveWaiting;
78
79     time_t              mountRootGen;
80     afsUUID             Uuid;
81 } cm_config_data_t;
82
83 extern cm_config_data_t cm_data;
84
85 DWORD GranularityAdjustment(DWORD size);
86 DWORD ComputeSizeOfConfigData(void);
87 DWORD ComputeSizeOfVolumes(DWORD maxvols);
88 DWORD ComputeSizeOfCells(DWORD maxcells);
89 DWORD ComputeSizeOfACLCache(DWORD stats);
90 DWORD ComputeSizeOfSCache(DWORD stats);
91 DWORD ComputeSizeOfSCacheHT(DWORD stats);
92 DWORD ComputeSizeOfDNLCache(void);
93 DWORD ComputeSizeOfDataBuffers(DWORD cacheBlocks, DWORD blockSize);
94 DWORD ComputeSizeOfDataHT(void);
95 DWORD ComputeSizeOfDataHeaders(DWORD cacheBlocks);
96 DWORD ComputeSizeOfMappingFile(DWORD stats, DWORD chunkSize, DWORD cacheBlocks, DWORD blockSize);
97 PSECURITY_ATTRIBUTES CreateCacheFileSA();
98 VOID  FreeCacheFileSA(PSECURITY_ATTRIBUTES psa);
99 int   cm_ShutdownMappedMemory(void);
100 int   cm_ValidateMappedMemory(char * cachePath);
101 int   cm_InitMappedMemory(DWORD virtualCache, char * cachePath, DWORD stats, DWORD chunkSize, DWORD cacheBlocks );
102 #endif /* CM_MEMMAP_H */