]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
find-netbios-optimize-20040320
authorJeffrey Altman <jaltman@mit.edu>
Sun, 21 Mar 2004 03:05:45 +0000 (03:05 +0000)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Sun, 21 Mar 2004 03:05:45 +0000 (03:05 +0000)
In Mount_ReadSubmount() cache the first response to GetNetbiosName()
since the result won't change and the work necessary to get the result
is considerable.  We don't want to be calling it loops over and over
again.

src/WINNT/client_config/drivemap.cpp

index 86fc0ae25243a6e524a1e2e756f296c08924a757..dffbd36d840a59b02d76806b31364f520a9d522d 100644 (file)
@@ -698,22 +698,27 @@ void AdjustAfsPath (LPTSTR pszTarget, LPCTSTR pszSource, BOOL fWantAFS, BOOL fWa
 
 BOOL GetDriveSubmount (TCHAR chDrive, LPTSTR pszSubmountNow)
 {
-    TCHAR szDrive[] = TEXT("*:");
+       BOOL isWinNT = IsWindowsNT();
+
+       TCHAR szDrive[] = TEXT("*:");
     szDrive[0] = chDrive;
 
     TCHAR szMapping[ _MAX_PATH ] = TEXT("");
-    LPTSTR pszSubmount = szMapping;
-    TCHAR szNetBiosName[32];
-
-    memset(szNetBiosName, '\0', sizeof(szNetBiosName));
-    lana_GetNetbiosName(szNetBiosName, LANA_NETBIOS_NAME_FULL);
-    _tcscat(szNetBiosName, TEXT("\\"));
 
-   if (IsWindowsNT())
-   {
-       if (!QueryDosDevice (szDrive, szMapping, MAX_PATH))
+    if (isWinNT && !QueryDosDevice (szDrive, szMapping, MAX_PATH))
            return FALSE;
 
+    LPTSTR pszSubmount = szMapping;
+    
+       static TCHAR szNetBiosName[32] = "";
+       if (szNetBiosName[0] == 0) {
+               memset(szNetBiosName, '\0', sizeof(szNetBiosName));
+               lana_GetNetbiosName(szNetBiosName, LANA_NETBIOS_NAME_FULL);
+               _tcscat(szNetBiosName, TEXT("\\"));
+       }
+
+   if (isWinNT)
+   {
       // Now if this is an AFS network drive mapping, {szMapping} will be:
       //
       //   \Device\LanmanRedirector\<Drive>:\<netbiosname>\submount