Windows: Record callback issued time
[openafs.git] / src / WINNT / afsd / cm_memmap.h
1 /*
2  * Copyright 2004-2011, 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_VERSION  20
14 #define CM_CONFIG_DATA_MAGIC            ('A' | 'F'<<8 | 'S'<<16 | CM_CONFIG_DATA_VERSION<<24)
15
16 typedef struct cm_config_data {
17     afs_uint32          size;
18     afs_uint32          magic;
19     CHAR *              baseAddress;
20
21     afs_uint32          stats;
22     afs_uint32          chunkSize;
23     afs_uint32          blockSize;
24     afs_uint64          bufferSize;
25     afs_uint32          cacheType;
26     afs_uint32          dirty;
27
28     cm_volume_t *       volumeBaseAddress;
29     cm_cell_t   *       cellBaseAddress;
30     cm_aclent_t *       aclBaseAddress;
31     cm_scache_t *       scacheBaseAddress;
32     cm_nc_t     *       dnlcBaseAddress;
33     cm_buf_t    *       bufHeaderBaseAddress;
34     char *              bufDataBaseAddress;
35     char *              bufEndOfData;
36
37     cm_volume_t *       allVolumesp;
38     afs_uint32          currentVolumes;
39     afs_uint32          maxVolumes;
40
41     cm_cell_t   *       allCellsp;
42     cm_cell_t   *       freeCellsp;
43     afs_uint32          currentCells;
44     afs_uint32          maxCells;
45
46     cm_volume_t *       rootVolumep;
47     cm_cell_t   *       rootCellp;
48     cm_fid_t            rootFid;
49     cm_scache_t *       rootSCachep;
50     cm_scache_t         fakeSCache;
51     afs_uint64          fakeDirVersion;
52     afs_uint32          fakeUnique;
53
54     cm_aclent_t *       aclLRUp;
55     cm_aclent_t *       aclLRUEndp;
56
57     cm_scache_t **      scacheHashTablep;
58     afs_uint32          scacheHashTableSize;
59
60     cm_scache_t *       allSCachesp;
61     afs_uint32          currentSCaches;
62     afs_uint32          maxSCaches;
63     cm_scache_t *       scacheLRUFirstp;
64     cm_scache_t *       scacheLRULastp;
65
66     cm_cell_t   **      cellNameHashTablep;
67     cm_cell_t   **      cellIDHashTablep;
68     afs_uint32          cellHashTableSize;
69
70     cm_volume_t **      volumeNameHashTablep;
71     cm_volume_t **      volumeRWIDHashTablep;
72     cm_volume_t **      volumeROIDHashTablep;
73     cm_volume_t **      volumeBKIDHashTablep;
74     afs_uint32          volumeHashTableSize;
75     cm_volume_t *       volumeLRUFirstp;
76     cm_volume_t *       volumeLRULastp;
77
78     cm_nc_t     *       ncfreelist;
79     cm_nc_t     *       nameCache;
80     cm_nc_t     **      nameHash;
81
82     cm_buf_t    *       buf_freeListp;
83     cm_buf_t    *       buf_freeListEndp;
84     cm_buf_t    *       buf_dirtyListp;
85     cm_buf_t    *       buf_dirtyListEndp;
86     cm_buf_t    *       buf_redirListp;
87     cm_buf_t    *       buf_redirListEndp;
88     cm_buf_t    **      buf_scacheHashTablepp;
89     cm_buf_t    **      buf_fileHashTablepp;
90     cm_buf_t    *       buf_allp;
91     afs_uint32          buf_blockSize;
92     afs_uint32          buf_hashSize;
93 #ifdef _M_IX86
94     afs_uint32          buf_nbuffers;
95     afs_uint32          buf_nOrigBuffers;
96     afs_uint32          buf_reservedBufs;
97     afs_uint32          buf_maxReservedBufs;
98     afs_uint32          buf_reserveWaiting;
99     afs_uint32          buf_freeCount;
100     afs_uint32          buf_redirCount;
101 #else
102     afs_uint64          buf_nbuffers;
103     afs_uint64          buf_nOrigBuffers;
104     afs_uint64          buf_reservedBufs;
105     afs_uint64          buf_maxReservedBufs;
106     afs_uint64          buf_reserveWaiting;
107     afs_uint64          buf_freeCount;
108     afs_uint64          buf_redirCount;
109 #endif
110     time_t              mountRootGen;
111     afsUUID             Uuid;
112     DWORD               volSerialNumber;
113     CHAR                Sid[6 * sizeof(DWORD)];
114 } cm_config_data_t;
115
116 extern cm_config_data_t cm_data;
117
118 afs_uint64 GranularityAdjustment(afs_uint64 size);
119 afs_uint64 ComputeSizeOfConfigData(void);
120 afs_uint64 ComputeSizeOfVolumes(DWORD maxvols);
121 afs_uint64 ComputeSizeOfCells(DWORD maxcells);
122 afs_uint64 ComputeSizeOfACLCache(DWORD stats);
123 afs_uint64 ComputeSizeOfSCache(DWORD stats);
124 afs_uint64 ComputeSizeOfSCacheHT(DWORD stats);
125 afs_uint64 ComputeSizeOfDNLCache(void);
126 afs_uint64 ComputeSizeOfDataBuffers(afs_uint64 cacheBlocks, DWORD blockSize);
127 afs_uint64 ComputeSizeOfDataHT(afs_uint64 cacheBlocks);
128 afs_uint64 ComputeSizeOfDataHeaders(afs_uint64 cacheBlocks);
129 afs_uint64 ComputeSizeOfMappingFile(DWORD stats, DWORD maxVols, DWORD maxCells, DWORD chunkSize, afs_uint64 cacheBlocks, DWORD blockSize);
130 PSECURITY_ATTRIBUTES CreateCacheFileSA();
131 VOID  FreeCacheFileSA(PSECURITY_ATTRIBUTES psa);
132 int   cm_ShutdownMappedMemory(void);
133 int   cm_ValidateMappedMemory(char * cachePath);
134 int   cm_InitMappedMemory(DWORD virtualCache, char * cachePath, DWORD stats, DWORD maxVols, DWORD maxCells, DWORD chunkSize, afs_uint64 cacheBlocks, afs_uint32 blockSize);
135 #endif /* CM_MEMMAP_H */