OpenAFS
OpenAFS distributed network file system
|
00001 /* 00002 * Copyright 2004-2011, Secure Endpoints Inc. 00003 * All Rights Reserved. 00004 * 00005 * This software has been released under the terms of the IBM Public 00006 * License. For details, see the LICENSE file in the top-level source 00007 * directory or online at http://www.openafs.org/dl/license10.html 00008 */ 00009 00010 #ifndef CM_MEMMAP_H 00011 #define CM_MEMMAP_H 1 00012 00013 #define CM_CONFIG_DATA_VERSION 21 00014 #define CM_CONFIG_DATA_MAGIC ('A' | 'F'<<8 | 'S'<<16 | CM_CONFIG_DATA_VERSION<<24) 00015 00016 typedef struct cm_config_data { 00017 afs_uint32 size; 00018 afs_uint32 magic; 00019 CHAR * baseAddress; 00020 00021 afs_uint32 stats; 00022 afs_uint32 chunkSize; 00023 afs_uint32 blockSize; 00024 afs_uint64 bufferSize; 00025 afs_uint32 cacheType; 00026 afs_uint32 dirty; 00027 00028 cm_volume_t * volumeBaseAddress; 00029 cm_cell_t * cellBaseAddress; 00030 cm_aclent_t * aclBaseAddress; 00031 cm_scache_t * scacheBaseAddress; 00032 cm_nc_t * dnlcBaseAddress; 00033 cm_buf_t * bufHeaderBaseAddress; 00034 char * bufDataBaseAddress; 00035 char * bufEndOfData; 00036 00037 cm_volume_t * allVolumesp; 00038 afs_uint32 currentVolumes; 00039 afs_uint32 maxVolumes; 00040 00041 cm_cell_t * allCellsp; 00042 cm_cell_t * freeCellsp; 00043 afs_uint32 currentCells; 00044 afs_uint32 maxCells; 00045 00046 cm_volume_t * rootVolumep; 00047 cm_cell_t * rootCellp; 00048 cm_fid_t rootFid; 00049 cm_scache_t * rootSCachep; 00050 cm_scache_t fakeSCache; 00051 afs_uint64 fakeDirVersion; 00052 afs_uint32 fakeUnique; 00053 00054 cm_aclent_t * aclLRUp; 00055 cm_aclent_t * aclLRUEndp; 00056 00057 cm_scache_t ** scacheHashTablep; 00058 afs_uint32 scacheHashTableSize; 00059 00060 cm_scache_t * allSCachesp; 00061 afs_uint32 currentSCaches; 00062 afs_uint32 maxSCaches; 00063 cm_scache_t * scacheLRUFirstp; 00064 cm_scache_t * scacheLRULastp; 00065 00066 cm_cell_t ** cellNameHashTablep; 00067 cm_cell_t ** cellIDHashTablep; 00068 afs_uint32 cellHashTableSize; 00069 00070 cm_volume_t ** volumeNameHashTablep; 00071 cm_volume_t ** volumeRWIDHashTablep; 00072 cm_volume_t ** volumeROIDHashTablep; 00073 cm_volume_t ** volumeBKIDHashTablep; 00074 afs_uint32 volumeHashTableSize; 00075 cm_volume_t * volumeLRUFirstp; 00076 cm_volume_t * volumeLRULastp; 00077 00078 cm_nc_t * ncfreelist; 00079 cm_nc_t * nameCache; 00080 cm_nc_t ** nameHash; 00081 00082 cm_buf_t * buf_freeListp; 00083 cm_buf_t * buf_freeListEndp; 00084 cm_buf_t * buf_dirtyListp; 00085 cm_buf_t * buf_dirtyListEndp; 00086 cm_buf_t * buf_redirListp; 00087 cm_buf_t * buf_redirListEndp; 00088 cm_buf_t ** buf_scacheHashTablepp; 00089 cm_buf_t ** buf_fileHashTablepp; 00090 cm_buf_t * buf_allp; 00091 afs_uint32 buf_blockSize; 00092 afs_uint32 buf_hashSize; 00093 #ifdef _M_IX86 00094 afs_uint32 buf_nbuffers; 00095 afs_uint32 buf_nOrigBuffers; 00096 afs_uint32 buf_reservedBufs; 00097 afs_uint32 buf_maxReservedBufs; 00098 afs_uint32 buf_reserveWaiting; 00099 afs_uint32 buf_freeCount; 00100 afs_uint32 buf_redirCount; 00101 #else 00102 afs_uint64 buf_nbuffers; 00103 afs_uint64 buf_nOrigBuffers; 00104 afs_uint64 buf_reservedBufs; 00105 afs_uint64 buf_maxReservedBufs; 00106 afs_uint64 buf_reserveWaiting; 00107 afs_uint64 buf_freeCount; 00108 afs_uint64 buf_redirCount; 00109 #endif 00110 time_t mountRootGen; 00111 afsUUID Uuid; 00112 DWORD volSerialNumber; 00113 CHAR Sid[6 * sizeof(DWORD)]; 00114 } cm_config_data_t; 00115 00116 extern cm_config_data_t cm_data; 00117 00118 afs_uint64 GranularityAdjustment(afs_uint64 size); 00119 afs_uint64 ComputeSizeOfConfigData(void); 00120 afs_uint64 ComputeSizeOfVolumes(DWORD maxvols); 00121 afs_uint64 ComputeSizeOfCells(DWORD maxcells); 00122 afs_uint64 ComputeSizeOfACLCache(DWORD stats); 00123 afs_uint64 ComputeSizeOfSCache(DWORD stats); 00124 afs_uint64 ComputeSizeOfSCacheHT(DWORD stats); 00125 afs_uint64 ComputeSizeOfDNLCache(void); 00126 afs_uint64 ComputeSizeOfDataBuffers(afs_uint64 cacheBlocks, DWORD blockSize); 00127 afs_uint64 ComputeSizeOfDataHT(afs_uint64 cacheBlocks); 00128 afs_uint64 ComputeSizeOfDataHeaders(afs_uint64 cacheBlocks); 00129 afs_uint64 ComputeSizeOfMappingFile(DWORD stats, DWORD maxVols, DWORD maxCells, DWORD chunkSize, afs_uint64 cacheBlocks, DWORD blockSize); 00130 PSECURITY_ATTRIBUTES CreateCacheFileSA(); 00131 VOID FreeCacheFileSA(PSECURITY_ATTRIBUTES psa); 00132 int cm_ShutdownMappedMemory(void); 00133 int cm_ValidateMappedMemory(char * cachePath); 00134 int cm_InitMappedMemory(DWORD virtualCache, char * cachePath, DWORD stats, DWORD maxVols, DWORD maxCells, DWORD chunkSize, afs_uint64 cacheBlocks, afs_uint32 blockSize); 00135 #endif /* CM_MEMMAP_H */