int cm_chunkSize;
int cm_virtualCache = 0;
afs_int32 cm_verifyData = 0;
+int cm_shortNames = 1;
+int cm_directIO = 1;
+int cm_volumeInfoReadOnlyFlag = 0;
+
+afs_uint32 rdr_ReparsePointPolicy = 0;
int smb_UseV3 = 1;
afs_uint32 smb_Enabled = 1;
if ( tsp ) /* an existing server - ref count increased */
{
lock_ObtainMutex(&tsp->mx);
- tsp->ipRank = (USHORT)dwRank;
+ tsp->adminRank = (USHORT)dwRank;
_InterlockedOr(&tsp->flags, CM_SERVERFLAG_PREF_SET);
- tsp->adminRank = tsp->ipRank;
+ cm_RankServer(tsp);
lock_ReleaseMutex(&tsp->mx);
/* set preferences for an existing vlserver */
{
tsp = cm_NewServer(&saddr, CM_SERVER_VLDB, NULL, NULL, CM_FLAG_NOPROBE); /* refcount = 1 */
lock_ObtainMutex(&tsp->mx);
- tsp->ipRank = (USHORT)dwRank;
+ tsp->adminRank = (USHORT)dwRank;
_InterlockedOr(&tsp->flags, CM_SERVERFLAG_PREF_SET);
- tsp->adminRank = tsp->ipRank;
+ cm_RankServer(tsp);
lock_ReleaseMutex(&tsp->mx);
}
}
if ( tsp ) /* an existing server - ref count increased */
{
lock_ObtainMutex(&tsp->mx);
- tsp->ipRank = (USHORT)dwRank;
+ tsp->adminRank = (USHORT)dwRank;
_InterlockedOr(&tsp->flags, CM_SERVERFLAG_PREF_SET);
- tsp->adminRank = tsp->ipRank;
+ cm_RankServer(tsp);
lock_ReleaseMutex(&tsp->mx);
/* find volumes which might have RO copy
{
tsp = cm_NewServer(&saddr, CM_SERVER_FILE, NULL, NULL, CM_FLAG_NOPROBE); /* refcount = 1 */
lock_ObtainMutex(&tsp->mx);
- tsp->ipRank = (USHORT)dwRank;
+ tsp->adminRank = (USHORT)dwRank;
_InterlockedOr(&tsp->flags, CM_SERVERFLAG_PREF_SET);
- tsp->adminRank = tsp->ipRank;
+ cm_RankServer(tsp);
lock_ReleaseMutex(&tsp->mx);
}
}
/*int freelanceEnabled;*/
WSADATA WSAjunk;
int i;
- int cm_noIPAddr; /* number of client network interfaces */
- int cm_IPAddr[CM_MAXINTERFACE_ADDR]; /* client's IP address in host order */
- int cm_SubnetMask[CM_MAXINTERFACE_ADDR];/* client's subnet mask in host order*/
- int cm_NetMtu[CM_MAXINTERFACE_ADDR]; /* client's MTU sizes */
- int cm_NetFlags[CM_MAXINTERFACE_ADDR]; /* network flags */
DWORD dwPriority;
+ OSVERSIONINFO osVersion;
+
+ /* Get the version of Windows */
+ memset(&osVersion, 0x00, sizeof(osVersion));
+ osVersion.dwOSVersionInfoSize = sizeof(osVersion);
+ GetVersionEx(&osVersion);
WSAStartup(0x0101, &WSAjunk);
if (code != ERROR_SUCCESS)
cacheSize = CM_CONFIGDEFAULT_CACHESIZE;
+#if defined(_X86)
+ /*
+ * For 32-bit systems the max process space is 2GB and the
+ * max cache size is the max contiguous free address space.
+ * Since it is too hard to calculate what that is simply
+ * cap the value at 716800.
+ */
+ if (cacheSize > 716800) {
+ afsi_log("Requested Cache size %u", cacheSize);
+ cacheSize = 716800;
+ }
+#endif
+
if (cm_virtualCache) {
MEMORYSTATUSEX memStatus;
DWORD maxCacheSize;
(BYTE *) &cm_freelanceImportCellServDB, &dummyLen);
afsi_log("Freelance client %s import CellServDB",
cm_freelanceImportCellServDB ? "does" : "does not");
+
+ dummyLen = sizeof(cm_freelanceDiscovery);
+ code = RegQueryValueEx(parmKey, "FreelanceDiscovery", NULL, NULL,
+ (BYTE *) &cm_freelanceDiscovery, &dummyLen);
+ afsi_log("Freelance client discovery is %s",
+ cm_freelanceDiscovery ? "on" : "off");
+
#endif /* AFS_FREELANCE_CLIENT */
dummyLen = sizeof(smb_UseUnicode);
}
afsi_log("CM ReadOnlyVolumeVersioning is %u", cm_readonlyVolumeVersioning);
+ dummyLen = sizeof(DWORD);
+ code = RegQueryValueEx(parmKey, "ShortNames", NULL, NULL,
+ (BYTE *) &dwValue, &dummyLen);
+ if (code == ERROR_SUCCESS) {
+ cm_shortNames = (unsigned short) dwValue;
+ } else {
+ /* disable by default on Win7, Win 8, Server 2008 R2 and Server 2012 */
+ if (osVersion.dwMajorVersion > 6 ||
+ osVersion.dwMajorVersion == 6 &&
+ osVersion.dwMinorVersion >= 1)
+ cm_shortNames = 0;
+ else
+ cm_shortNames = 1;
+ }
+ afsi_log("CM ShortNames is %u", cm_shortNames);
+
+ dummyLen = sizeof(DWORD);
+ code = RegQueryValueEx(parmKey, "VolumeInfoReadOnlyFlag", NULL, NULL,
+ (BYTE *) &dwValue, &dummyLen);
+ if (code == ERROR_SUCCESS) {
+ cm_volumeInfoReadOnlyFlag = (unsigned short) dwValue;
+ } else {
+ /* enable by default on Win 8 and Server 2012 */
+ if (osVersion.dwMajorVersion > 6 ||
+ osVersion.dwMajorVersion == 6 &&
+ osVersion.dwMinorVersion >= 2)
+ cm_volumeInfoReadOnlyFlag = 1;
+ else
+ cm_volumeInfoReadOnlyFlag = 0;
+ }
+ afsi_log("CM VolumeInfoReadOnlyFlag is %u", cm_volumeInfoReadOnlyFlag);
+
+ dummyLen = sizeof(DWORD);
+ code = RegQueryValueEx(parmKey, "DirectIO", NULL, NULL,
+ (BYTE *) &dwValue, &dummyLen);
+ if (code == ERROR_SUCCESS) {
+ cm_directIO = (unsigned short) dwValue;
+ } else {
+ cm_directIO = 1;
+ }
+ afsi_log("CM DirectIO is %u", cm_directIO);
+
+ dummyLen = sizeof(DWORD);
+ code = RegQueryValueEx(parmKey, "ReparsePointPolicy", NULL, NULL,
+ (BYTE *) &dwValue, &dummyLen);
+ if (code == ERROR_SUCCESS) {
+ rdr_ReparsePointPolicy = (unsigned short) dwValue;
+ } else {
+ rdr_ReparsePointPolicy = 0;
+ }
+ afsi_log("RDR ReparsePointPolicy is 0x%x", rdr_ReparsePointPolicy);
+
RegCloseKey (parmKey);
cacheBlocks = ((afs_uint64)cacheSize * 1024) / blockSize;
/* get network related info */
- cm_noIPAddr = CM_MAXINTERFACE_ADDR;
- code = syscfg_GetIFInfo(&cm_noIPAddr,
- cm_IPAddr, cm_SubnetMask,
- cm_NetMtu, cm_NetFlags);
-
+ code = cm_UpdateIFInfo();
if ( (cm_noIPAddr <= 0) || (code <= 0 ) )
afsi_log("syscfg_GetIFInfo error code %d", code);
else
cm_IPAddr[0], cm_SubnetMask[0]);
/*
- * Save client configuration for GetCacheConfig requests
+ * Save client configuration for GetCacheConf\eig requests
*/
cm_initParams.nChunkFiles = 0;
cm_initParams.nStatCaches = stats;
return -1;
}
+ /* Must be called after cm_InitMappedMemory. */
+ cm_EAccesInitCache();
+
#if !defined(_WIN32_WINNT) || (_WIN32_WINNT < 0x0500)
if (cm_InitDNS(cm_dnsEnabled) == -1)
cm_dnsEnabled = 0; /* init failed, so deactivate */
afsi_log("rx_SetUdpBufSize %d", rx_udpbufsize);
}
- rx_SetBusyChannelError(1); /* Activate busy call channel reporting */
-
/* initialize RX, and tell it to listen to the callbackport,
* which is used for callback RPC messages.
*/