Index: openafs/src/NTMakefile diff -c openafs/src/NTMakefile:1.27.2.8 openafs/src/NTMakefile:1.27.2.9 *** openafs/src/NTMakefile:1.27.2.8 Tue Mar 11 13:02:04 2008 --- openafs/src/NTMakefile Sat Jun 28 19:42:54 2008 *************** *** 18,23 **** --- 18,24 ---- # These three macros define the source, object, and destination folders SRC=$(AFSROOT)\src + DOC=$(AFSROOT)\doc #If AFS_OBJDIR is not defined then use obj as relative obj folder !IFNDEF AFS_OBJDIR *************** *** 46,52 **** $(NTMAKE) $(CD) ..\.. ! procmgmt_headers:config echo ***** $@ $(DOCD) $(SRC)\procmgmt $(CD) $(SRC)\procmgmt --- 47,60 ---- $(NTMAKE) $(CD) ..\.. ! man-pages: config ! echo ***** $@ ! $(DOCD) $(DOC)\man-pages ! $(CD) $(DOC)\man-pages ! $(NTMAKE) ! $(CD) ..\.. ! ! procmgmt_headers: man-pages echo ***** $@ $(DOCD) $(SRC)\procmgmt $(CD) $(SRC)\procmgmt *************** *** 65,71 **** $(DOCD) $(SRC)\lwp $(CD) $(SRC)\lwp $(NTMAKE_HEADERS) ! $(CD) ..\..\.. util: procmgmt_headers afsreg_headers lwp_headers echo ***** $@ --- 73,79 ---- $(DOCD) $(SRC)\lwp $(CD) $(SRC)\lwp $(NTMAKE_HEADERS) ! $(CD) ..\.. util: procmgmt_headers afsreg_headers lwp_headers echo ***** $@ Index: openafs/src/ntbuild.bat diff -c openafs/src/ntbuild.bat:1.18.4.1 openafs/src/ntbuild.bat:1.18.4.2 *** openafs/src/ntbuild.bat:1.18.4.1 Mon Apr 21 12:03:56 2008 --- openafs/src/ntbuild.bat Fri May 9 11:10:10 2008 *************** *** 50,55 **** --- 50,58 ---- REM Location of WDK/DDK (8.3 short name) set NTDDKDIR=c:\progra~1\micros~5 + REM Location of Microsoft IDN Normalization SDK + set MSIDNNLS=C:\progra~1\MI5913~1 + REM ######################################################################## REM NTMakefile optional definitions: REM *************** *** 110,116 **** set AFSDEV_BUILDTYPE=%AFSBLD_TYPE% ! set AFSDEV_INCLUDE=%MSSDKDIR%\include;%MSVCDIR%\include IF "%AFSVER_CL%" == "1400" set AFSDEV_INCLUDE=%AFSDEV_INCLUDE%;%MSVCDIR%\atlmfc\include IF "%AFSVER_CL%" == "1310" set AFSDEV_INCLUDE=%AFSDEV_INCLUDE%;%MSVCDIR%\atlmfc\include IF "%AFSVER_CL%" == "1300" set AFSDEV_INCLUDE=%AFSDEV_INCLUDE%;%MSVCDIR%\atlmfc\include --- 113,119 ---- set AFSDEV_BUILDTYPE=%AFSBLD_TYPE% ! set AFSDEV_INCLUDE=%MSSDKDIR%\include;%MSVCDIR%\include;%MSIDNNLS%\include IF "%AFSVER_CL%" == "1400" set AFSDEV_INCLUDE=%AFSDEV_INCLUDE%;%MSVCDIR%\atlmfc\include IF "%AFSVER_CL%" == "1310" set AFSDEV_INCLUDE=%AFSDEV_INCLUDE%;%MSVCDIR%\atlmfc\include IF "%AFSVER_CL%" == "1300" set AFSDEV_INCLUDE=%AFSDEV_INCLUDE%;%MSVCDIR%\atlmfc\include Index: openafs/src/WINNT/afs_setup_utils/NTMakefile diff -c openafs/src/WINNT/afs_setup_utils/NTMakefile:1.10 openafs/src/WINNT/afs_setup_utils/NTMakefile:1.10.4.1 *** openafs/src/WINNT/afs_setup_utils/NTMakefile:1.10 Sun Nov 20 20:55:59 2005 --- openafs/src/WINNT/afs_setup_utils/NTMakefile Wed Jul 2 08:48:01 2008 *************** *** 81,88 **** $(DESTDIR)\lib\afs\afsutil.lib $(AFSRM_EXEFILE): $(AFSRM_EXEOBJS) $(AFSRM_EXELIBS) ! $(EXECONLINK) $(_VC_MANIFEST_EMBED_EXE) ############################################################################ --- 81,89 ---- $(DESTDIR)\lib\afs\afsutil.lib $(AFSRM_EXEFILE): $(AFSRM_EXEOBJS) $(AFSRM_EXELIBS) ! $(EXECONLINK) $(_VC_MANIFEST_EMBED_EXE) + $(CODESIGN_USERLAND) ############################################################################ *************** *** 132,137 **** --- 133,139 ---- $(DLLGUILINK) -entry:DllEntryPoint /DEF:install_utils.def $(VCLIBS) $(_VC_MANIFEST_EMBED_DLL) $(DLLPREP) + $(CODESIGN_USERLAND) $(COPY) $*.lib $(ILIBDIR) $(DEL) $*.lib $*.exp *************** *** 139,144 **** --- 141,147 ---- $(DLLGUILINK) -entry:DllEntryPoint /DEF:server_uninst.def $(VCLIBS) $(_VC_MANIFEST_EMBED_DLL) $(DLLPREP) + $(CODESIGN_USERLAND) $(COPY) $*.lib $(ILIBDIR) $(DEL) $*.lib $*.exp *************** *** 146,151 **** --- 149,155 ---- $(DLLGUILINK) -entry:DllEntryPoint /DEF:client_uninst.def $(VCLIBS) $(_VC_MANIFEST_EMBED_DLL) $(DLLPREP) + $(CODESIGN_USERLAND) $(COPY) $*.lib $(ILIBDIR) $(DEL) $*.lib $*.exp *************** *** 153,158 **** --- 157,163 ---- $(DLLGUILINK) -entry:DllEntryPoint /DEF:cc_uninst.def $(VCLIBS) $(_VC_MANIFEST_EMBED_DLL) $(DLLPREP) + $(CODESIGN_USERLAND) $(COPY) $*.lib $(ILIBDIR) $(DEL) $*.lib $*.exp *************** *** 160,165 **** --- 165,171 ---- $(DLLGUILINK) -entry:DllEntryPoint /DEF:light_client_uninst.def $(VCLIBS) $(_VC_MANIFEST_EMBED_DLL) $(DLLPREP) + $(CODESIGN_USERLAND) $(COPY) $*.lib $(ILIBDIR) $(DEL) $*.lib $*.exp *************** *** 167,172 **** --- 173,179 ---- $(DLLGUILINK) -entry:DllEntryPoint /DEF:docs_uninst.def $(VCLIBS) $(_VC_MANIFEST_EMBED_DLL) $(DLLPREP) + $(CODESIGN_USERLAND) $(COPY) $*.lib $(ILIBDIR) $(DEL) $*.lib $*.exp Index: openafs/src/WINNT/afs_setup_utils/lang/NTMakefile diff -c openafs/src/WINNT/afs_setup_utils/lang/NTMakefile:1.4 openafs/src/WINNT/afs_setup_utils/lang/NTMakefile:1.4.14.1 *** openafs/src/WINNT/afs_setup_utils/lang/NTMakefile:1.4 Fri Nov 21 02:59:38 2003 --- openafs/src/WINNT/afs_setup_utils/lang/NTMakefile Wed Jul 2 08:48:03 2008 *************** *** 44,49 **** --- 44,50 ---- $(DLLFILE) : $(DLLOBJS) $(DLLRESLINK) $(DLLPREP) + $(CODESIGN_USERLAND) install : $(DLLFILE) Index: openafs/src/WINNT/afsadmsvr/NTMakefile diff -c openafs/src/WINNT/afsadmsvr/NTMakefile:1.8.4.2 openafs/src/WINNT/afsadmsvr/NTMakefile:1.8.4.3 *** openafs/src/WINNT/afsadmsvr/NTMakefile:1.8.4.2 Tue Feb 12 08:32:48 2008 --- openafs/src/WINNT/afsadmsvr/NTMakefile Wed Jul 2 08:48:05 2008 *************** *** 146,151 **** --- 146,152 ---- $(EXECONLINK) $(VCLIBS) $(_VC_MANIFEST_EMBED_EXE) $(EXEPREP) + $(CODESIGN_USERLAND) install : \ $(IDLFILES) \ Index: openafs/src/WINNT/afsapplib/NTMakefile diff -c openafs/src/WINNT/afsapplib/NTMakefile:1.12.4.1 openafs/src/WINNT/afsapplib/NTMakefile:1.12.4.2 *** openafs/src/WINNT/afsapplib/NTMakefile:1.12.4.1 Tue Feb 12 08:32:50 2008 --- openafs/src/WINNT/afsapplib/NTMakefile Wed Jul 2 08:48:07 2008 *************** *** 129,134 **** --- 129,135 ---- $(DLLGUILINK) $(LOCALLINKFLAGS) $(VCLIBS) $(_VC_MANIFEST_EMBED_DLL) $(DLLPREP) + $(CODESIGN_USERLAND) $(COPY) $*.lib $(ILIBDIR) $(DEL) $*.lib $*.exp Index: openafs/src/WINNT/afsapplib/lang/NTMakefile diff -c openafs/src/WINNT/afsapplib/lang/NTMakefile:1.6 openafs/src/WINNT/afsapplib/lang/NTMakefile:1.6.4.1 *** openafs/src/WINNT/afsapplib/lang/NTMakefile:1.6 Sun Nov 20 20:56:04 2005 --- openafs/src/WINNT/afsapplib/lang/NTMakefile Wed Jul 2 08:48:11 2008 *************** *** 46,51 **** --- 46,52 ---- $(DLLRESLINK) $(_VC_MANIFEST_EMBED_DLL) $(DLLPREP) + $(CODESIGN_USERLAND) install : $(DLLFILE) Index: openafs/src/WINNT/afsapplib/test/NTMakefile diff -c openafs/src/WINNT/afsapplib/test/NTMakefile:1.5 openafs/src/WINNT/afsapplib/test/NTMakefile:1.5.4.1 *** openafs/src/WINNT/afsapplib/test/NTMakefile:1.5 Sun Nov 20 20:56:05 2005 --- openafs/src/WINNT/afsapplib/test/NTMakefile Wed Jul 2 08:48:12 2008 *************** *** 40,45 **** --- 40,46 ---- $(EXEGUILINK) comctl32.lib shell32.lib $(_VC_MANIFEST_EMBED_EXE) $(EXEPREP) + $(CODESIGN_USERLAND) test : $(EXEFILE) Index: openafs/src/WINNT/afsd/NTMakefile diff -c openafs/src/WINNT/afsd/NTMakefile:1.46.2.11 openafs/src/WINNT/afsd/NTMakefile:1.46.2.14 *** openafs/src/WINNT/afsd/NTMakefile:1.46.2.11 Wed Mar 19 09:59:29 2008 --- openafs/src/WINNT/afsd/NTMakefile Wed Jul 2 08:48:12 2008 *************** *** 5,11 **** # License. For details, see the LICENSE file in the top-level source # directory or online at http://www.openafs.org/dl/license10.html ! AFSDEV_AUXCDEFINES = $(AFSDEV_AUXCDEFINES) /D"_AFXDLL" -I..\kfw\inc\loadfuncs -I..\kfw\inc\krb5 -I..\kfw\inc\leash AFSDEV_NETGUI = 1 RELDIR=WINNT\afsd !INCLUDE ..\..\config\NTMakefile.$(SYS_NAME) --- 5,11 ---- # License. For details, see the LICENSE file in the top-level source # directory or online at http://www.openafs.org/dl/license10.html ! AFSDEV_AUXCDEFINES = $(AFSDEV_AUXCDEFINES) /D"_AFXDLL" -I..\kfw\inc\loadfuncs -I..\kfw\inc\krb5 -I..\kfw\inc\leash -DSMB_UNICODE AFSDEV_NETGUI = 1 RELDIR=WINNT\afsd !INCLUDE ..\..\config\NTMakefile.$(SYS_NAME) *************** *** 65,70 **** --- 65,71 ---- $(INCFILEDIR)\cm_freelance.h \ $(INCFILEDIR)\cm_memmap.h \ $(INCFILEDIR)\cm_performance.h \ + $(INCFILEDIR)\cm_nls.h \ $(INCFILEDIR)\afsd_eventlog.h \ $(INCFILEDIR)\afsd_eventmessages.h \ $(INCFILEDIR)\afskfw.h \ *************** *** 74,80 **** afsrpc.h $(OUT)\afsrpc_c.obj CONFOBJS=$(OUT)\cm_config.obj \ ! $(OUT)\cm_dns.obj $(CONFOBJS): --- 75,82 ---- afsrpc.h $(OUT)\afsrpc_c.obj CONFOBJS=$(OUT)\cm_config.obj \ ! $(OUT)\cm_dns.obj \ ! $(OUT)\cm_nls.obj $(CONFOBJS): *************** *** 120,125 **** --- 122,128 ---- $(OUT)\cm_rpc.obj \ $(OUT)\cm_memmap.obj \ $(OUT)\cm_performance.obj \ + $(OUT)\cm_nls.obj \ $(OUT)\afsrpc_s.obj \ !IFDEF OSICRASH $(OUT)\afsdcrash.obj \ *************** *** 134,140 **** $(OUT)\cm_conn.obj: cm_conn.c $(C2OBJ) -DAFS_PTHREAD_ENV /Fo$@ $** ! FSOBJS=$(OUT)\fs.obj $(OUT)\fs_utils.obj CMDBGOBJS=$(OUT)\cmdebug.obj --- 137,144 ---- $(OUT)\cm_conn.obj: cm_conn.c $(C2OBJ) -DAFS_PTHREAD_ENV /Fo$@ $** ! FSOBJS=$(OUT)\fs.obj \ ! $(OUT)\fs_utils.obj CMDBGOBJS=$(OUT)\cmdebug.obj *************** *** 188,193 **** --- 192,198 ---- $(DLLGUILINK) -def:libafsconf.def dnsapi.lib mpr.lib shell32.lib $(_VC_MANIFEST_EMBED_DLL) $(DLLPREP) + $(CODESIGN_USERLAND) $(COPY) $*.lib $(ILIBDIR) $(DEL) $*.lib $*.exp *************** *** 225,231 **** LOGON_DLLOBJS =\ $(OUT)\afslogon.obj \ $(OUT)\logon_ad.obj \ ! $(OUT)\afslogon.res LOGON_DLLLIBS =\ $(DESTDIR)\lib\afsauthent.lib \ --- 230,237 ---- LOGON_DLLOBJS =\ $(OUT)\afslogon.obj \ $(OUT)\logon_ad.obj \ ! $(OUT)\afslogon.res \ ! $(OUT)\cm_nls.obj LOGON_DLLLIBS =\ $(DESTDIR)\lib\afsauthent.lib \ *************** *** 252,257 **** --- 258,264 ---- $(DLLGUILINK) $(LOGONLINKFLAGS) -def:afslogon.def $(LOGON_DLLSDKLIBS) $(_VC_MANIFEST_EMBED_DLL) $(DLLPREP) + $(CODESIGN_USERLAND) $(COPY) $*.lib $(DESTDIR)\lib $(DEL) $*.lib $*.exp *************** *** 277,284 **** ############################################################################ # Install target; primary makefile target ! install_objs: $(OUT)\cm_dns.obj $(OUT)\cm_config.obj $(LANAHELPERLIB) $(OUT)\afsicf.obj $(COPY) $(OUT)\cm_dns.obj $(DESTDIR)\lib $(COPY) $(OUT)\cm_config.obj $(DESTDIR)\lib $(COPY) $(OUT)\afsicf.obj $(DESTDIR)\lib --- 284,292 ---- ############################################################################ # Install target; primary makefile target ! install_objs: $(OUT)\cm_dns.obj $(OUT)\cm_config.obj $(OUT)\cm_nls.obj $(LANAHELPERLIB) $(OUT)\afsicf.obj $(COPY) $(OUT)\cm_dns.obj $(DESTDIR)\lib + $(COPY) $(OUT)\cm_nls.obj $(DESTDIR)\lib $(COPY) $(OUT)\cm_config.obj $(DESTDIR)\lib $(COPY) $(OUT)\afsicf.obj $(DESTDIR)\lib *************** *** 336,342 **** $(DESTDIR)\lib\afsrx.lib \ $(DESTDIR)\lib\afslwp.lib \ $(DESTDIR)\lib\libosi.lib \ ! $(DESTDIR)\lib\libafsconf.lib EXELIBS2 = \ $(DESTDIR)\lib\afsrpc.lib \ --- 344,351 ---- $(DESTDIR)\lib\afsrx.lib \ $(DESTDIR)\lib\afslwp.lib \ $(DESTDIR)\lib\libosi.lib \ ! $(DESTDIR)\lib\libafsconf.lib \ ! $(DESTDIR)\lib\cm_nls.obj EXELIBS2 = \ $(DESTDIR)\lib\afsrpc.lib \ *************** *** 357,380 **** --- 366,393 ---- $(EXECONLINK) dnsapi.lib mpr.lib iphlpapi.lib shell32.lib $(_VC_MANIFEST_EMBED_EXE) $(EXEPREP) + $(CODESIGN_USERLAND) # tokens.exe $(EXEDIR)\tokens.exe: $(OUT)\ctokens.obj $(OUT)\tokens.res $(EXELIBS) $(EXECONLINK) dnsapi.lib mpr.lib iphlpapi.lib shell32.lib $(_VC_MANIFEST_EMBED_EXE) $(EXEPREP) + $(CODESIGN_USERLAND) # unlog.exe $(EXEDIR)\unlog.exe: $(OUT)\cunlog.obj $(OUT)\unlog.res $(EXELIBS) $(EXECONLINK) dnsapi.lib mpr.lib iphlpapi.lib shell32.lib $(_VC_MANIFEST_EMBED_EXE) $(EXEPREP) + $(CODESIGN_USERLAND) # afscpcc.exe $(EXEDIR)\afscpcc.exe: $(OUT)\afscpcc.obj $(OUT)\afscpcc.res $(LOGON_DLLLIBS) $(EXECONLINK) dnsapi.lib mpr.lib iphlpapi.lib shell32.lib userenv.lib $(_VC_MANIFEST_EMBED_EXE) $(EXEPREP) + $(CODESIGN_USERLAND) # afsd.exe *************** *** 410,451 **** --- 423,471 ---- $(EXEGUILINK) $(AFSD_SDKLIBS) $(_VC_MANIFEST_EMBED_EXE) $(EXEPREP) + $(CODESIGN_USERLAND) # afsd_service.exe $(EXEDIR)\afsd_service.exe: $(OUT)\afsd_service.obj $(AFSDOBJS) $(OUT)\afsd_service.res $(RXOBJS) $(AFSD_EXELIBS) $(EXECONLINK) $(AFSD_SDKLIBS) /MAP /LARGEADDRESSAWARE $(_VC_MANIFEST_EMBED_EXE) $(EXEPREP) + $(CODESIGN_USERLAND) # fs.exe $(EXEDIR)\fs.exe: $(FSOBJS) $(OUT)\fs.res $(EXELIBS) $(EXECONLINK) dnsapi.lib mpr.lib iphlpapi.lib shell32.lib $(_VC_MANIFEST_EMBED_EXE) $(EXEPREP) + $(CODESIGN_USERLAND) # cmdebug.exe $(EXEDIR)\cmdebug.exe: $(CMDBGOBJS) $(OUT)\cmdebug.res $(EXELIBS2) $(EXECONLINK) $(EXELIBS2) dnsapi.lib mpr.lib iphlpapi.lib shell32.lib rpcrt4.lib $(_VC_MANIFEST_EMBED_EXE) $(EXEPREP) + $(CODESIGN_USERLAND) # symlink.exe $(EXEDIR)\symlink.exe: $(SLOBJS) $(OUT)\symlink.res $(EXELIBS) $(EXECONLINK) dnsapi.lib mpr.lib iphlpapi.lib shell32.lib $(_VC_MANIFEST_EMBED_EXE) $(EXEPREP) + $(CODESIGN_USERLAND) # afsshare.exe $(EXEDIR)\afsshare.exe: $(OUT)\afsshare.obj $(OUT)\afsshare.res $(EXELIBS) $(EXECONLINK) $(_VC_MANIFEST_EMBED_EXE) $(EXEPREP) + $(CODESIGN_USERLAND) # afsdacl.exe $(EXEDIR)\afsdacl.exe: $(OUT)\afsdacl.obj $(OUT)\afsdacl.res $(EXECONLINK) $(_VC_MANIFEST_EMBED_EXE) $(EXEPREP) + $(CODESIGN_USERLAND) # kpasswd.exe - built in kauth, but rebuild here to make pthread-based, # which is required for Windows 95. At some point it would be nice *************** *** 487,492 **** --- 507,513 ---- $(EXECONLINK) $(_VC_MANIFEST_EMBED_EXE) $(EXEPREP) + $(CODESIGN_USERLAND) ############################################################################ Index: openafs/src/WINNT/afsd/afsd.h diff -c openafs/src/WINNT/afsd/afsd.h:1.18.2.8 openafs/src/WINNT/afsd/afsd.h:1.18.2.13 *** openafs/src/WINNT/afsd/afsd.h:1.18.2.8 Fri Mar 7 17:24:04 2008 --- openafs/src/WINNT/afsd/afsd.h Thu Jun 26 12:38:29 2008 *************** *** 14,37 **** #include - #ifndef DJGPP BOOL InitClass(HANDLE); BOOL InitInstance(HANDLE, int); LONG APIENTRY MainWndProc(HWND, unsigned int, unsigned int, long); BOOL APIENTRY About(HWND, unsigned int, unsigned int, long); - #endif /* !DJGPP */ - #ifndef DJGPP #include - #else /* DJGPP */ - #include - #include - #include "dosdefs95.h" - #include "largeint95.h" - #endif /* !DJGPP */ #include "cm.h" #include #include --- 14,29 ---- #include BOOL InitClass(HANDLE); BOOL InitInstance(HANDLE, int); LONG APIENTRY MainWndProc(HWND, unsigned int, unsigned int, long); BOOL APIENTRY About(HWND, unsigned int, unsigned int, long); #include #include "cm.h" + #include "cm_nls.h" #include #include *************** *** 53,61 **** #include "cm_volume.h" #include "cm_dcache.h" #include "cm_access.h" #include "cm_utils.h" #include "cm_vnodeops.h" ! #include "cm_dir.h" #include "cm_daemon.h" #include "cm_ioctl.h" #include "cm_dnlc.h" --- 45,54 ---- #include "cm_volume.h" #include "cm_dcache.h" #include "cm_access.h" + #include "cm_dir.h" #include "cm_utils.h" #include "cm_vnodeops.h" ! #include "cm_btree.h" #include "cm_daemon.h" #include "cm_ioctl.h" #include "cm_dnlc.h" *************** *** 64,75 **** #include "cm_freelance.h" #include "cm_performance.h" #include "smb_ioctl.h" #include "afsd_init.h" - #ifdef DJGPP - #include "afs/afsmsg95.h" - #else #include "afsd_eventlog.h" - #endif #define AFS_DAEMON_SERVICE_NAME AFSREG_CLT_SVC_NAME --- 57,65 ---- #include "cm_freelance.h" #include "cm_performance.h" #include "smb_ioctl.h" + #include "smb_iocons.h" #include "afsd_init.h" #include "afsd_eventlog.h" #define AFS_DAEMON_SERVICE_NAME AFSREG_CLT_SVC_NAME *************** *** 94,102 **** extern osi_log_t *afsd_logp; ! extern char cm_mountRoot[]; extern DWORD cm_mountRootLen; extern char cm_CachePath[]; extern BOOL isGateway; --- 84,95 ---- extern osi_log_t *afsd_logp; ! extern fschar_t cm_mountRoot[]; extern DWORD cm_mountRootLen; + extern clientchar_t cm_mountRootC[]; + extern DWORD cm_mountRootCLen; + extern char cm_CachePath[]; extern BOOL isGateway; Index: openafs/src/WINNT/afsd/afsd95.c diff -c openafs/src/WINNT/afsd/afsd95.c:1.3 openafs/src/WINNT/afsd/afsd95.c:1.3.8.1 *** openafs/src/WINNT/afsd/afsd95.c:1.3 Tue Nov 2 01:10:29 2004 --- openafs/src/WINNT/afsd/afsd95.c Thu Jun 26 10:38:23 2008 *************** *** 113,125 **** long code; char *reason; - #ifdef DJGPP - osi_Init(); - #endif - - #ifndef DJGPP osi_InitPanic(afsd_notifier); - #endif /*sleep(10);*/ --- 113,119 ---- *************** *** 149,168 **** afs_current_status = AFS_STATUS_RUNNING; afsMsg_StatusChange(afs_current_status, 0, NULL); - #ifdef DJGPP - /* Keep the process from just terminating */ - while(afs_shutdown == 0) - { - /*IOMGR_Sleep(180);*/ - IOMGR_Sleep(8); - /* workaround: WaitForKeystroke(nonzero num) calls - IOMGR_Select, though Win95 select works only on sockets */ - /* so, we poll instead */ - /*if (LWP_WaitForKeystroke(0)) - break;*/ - } - afsd_shutdown(0); - #endif afs_exit(0); return (TRUE); --- 143,148 ---- Index: openafs/src/WINNT/afsd/afsd_flushvol.c diff -c openafs/src/WINNT/afsd/afsd_flushvol.c:1.8 openafs/src/WINNT/afsd/afsd_flushvol.c:1.8.4.2 *** openafs/src/WINNT/afsd/afsd_flushvol.c:1.8 Sat Nov 5 01:47:45 2005 --- openafs/src/WINNT/afsd/afsd_flushvol.c Thu Jun 26 12:38:29 2008 *************** *** 64,81 **** CONST CHAR COLON = ':'; CONST CHAR SLASH = '\\'; CONST DWORD NETRESBUFSIZE = 16384; ! CHAR bufMessage[1024]; ! UINT i; ! DWORD dwServerSize; ! DWORD dwRet; ! DWORD dwCount; ! DWORD dwNetResBufSize; ! DWORD dwTotalVols = 0; ! DWORD dwVolBegin, dwVolEnd; ! DWORD dwFlushBegin, dwFlushEnd; ! HANDLE hEnum; LPNETRESOURCE lpNetResBuf, lpnr; ! PCHAR pszShareName, pc; afs_int32 afsRet = 0; if ( lana_OnlyLoopback() ) { --- 64,81 ---- CONST CHAR COLON = ':'; CONST CHAR SLASH = '\\'; CONST DWORD NETRESBUFSIZE = 16384; ! CHAR bufMessage[1024]; ! UINT i; ! DWORD dwServerSize; ! DWORD dwRet; ! DWORD dwCount; ! DWORD dwNetResBufSize; ! DWORD dwTotalVols = 0; ! DWORD dwVolBegin, dwVolEnd; ! DWORD dwFlushBegin, dwFlushEnd; ! HANDLE hEnum; LPNETRESOURCE lpNetResBuf, lpnr; ! char *pszShareName, *pc; afs_int32 afsRet = 0; if ( lana_OnlyLoopback() ) { *************** *** 152,158 **** { // got one! // but we don't want to flush '\\[...]afs\all' ! if (_stricmp(lpnr->lpRemoteName, pszShareName) == 0) continue; ++dwTotalVols; --- 152,158 ---- { // got one! // but we don't want to flush '\\[...]afs\all' ! if (cm_stricmp_utf8(lpnr->lpRemoteName, pszShareName) == 0) continue; ++dwTotalVols; Index: openafs/src/WINNT/afsd/afsd_init.c diff -c openafs/src/WINNT/afsd/afsd_init.c:1.79.2.38.2.1 openafs/src/WINNT/afsd/afsd_init.c:1.79.2.43 *** openafs/src/WINNT/afsd/afsd_init.c:1.79.2.38.2.1 Sun Jun 22 22:50:08 2008 --- openafs/src/WINNT/afsd/afsd_init.c Thu Jun 26 12:38:29 2008 *************** *** 36,41 **** --- 36,44 ---- #include "lanahelper.h" #include #include "cm_memmap.h" + #ifdef DEBUG + #include + #endif extern int RXAFSCB_ExecuteRequest(struct rx_call *z_call); extern int RXSTATS_ExecuteRequest(struct rx_call *z_call); *************** *** 50,65 **** #endif extern afs_int32 cm_OfflineROIsValid; extern afs_int32 cm_giveUpAllCBs; ! extern const char **smb_ExecutableExtensions; osi_log_t *afsd_logp; cm_config_data_t cm_data; ! char cm_rootVolumeName[VL_MAXNAMELEN]; DWORD cm_rootVolumeNameLen; ! char cm_mountRoot[1024]; DWORD cm_mountRootLen; int cm_logChunkSize; int cm_chunkSize; --- 53,73 ---- #endif extern afs_int32 cm_OfflineROIsValid; extern afs_int32 cm_giveUpAllCBs; ! extern const clientchar_t **smb_ExecutableExtensions; osi_log_t *afsd_logp; cm_config_data_t cm_data; ! fschar_t cm_rootVolumeName[VL_MAXNAMELEN]; DWORD cm_rootVolumeNameLen; ! ! fschar_t cm_mountRoot[1024]; DWORD cm_mountRootLen; + + clientchar_t cm_mountRootC[1024]; + DWORD cm_mountRootCLen; + int cm_logChunkSize; int cm_chunkSize; *************** *** 79,84 **** --- 87,93 ---- unsigned short cm_callbackport = CM_DEFAULT_CALLBACKPORT; char cm_NetbiosName[MAX_NB_NAME_LENGTH] = ""; + clientchar_t cm_NetbiosNameC[MAX_NB_NAME_LENGTH] = _C(""); char cm_CachePath[MAX_PATH]; DWORD cm_ValidateCache = 1; *************** *** 87,95 **** cm_initparams_v1 cm_initParams; ! char *cm_sysName = 0; ! unsigned int cm_sysNameCount = 0; ! char *cm_sysNameList[MAXNUMSYSNAMES]; DWORD TraceOption = 0; --- 96,104 ---- cm_initparams_v1 cm_initParams; ! clientchar_t *cm_sysName = 0; ! unsigned int cm_sysNameCount = 0; ! clientchar_t *cm_sysNameList[MAXNUMSYSNAMES]; DWORD TraceOption = 0; *************** *** 134,145 **** } } - extern initUpperCaseTable(); - void afsd_initUpperCaseTable() - { - initUpperCaseTable(); - } - void afsi_start() { --- 143,148 ---- *************** *** 296,302 **** pHostNames, &dwSize) == ERROR_SUCCESS) { for (pName = pHostNames; ! (pName - pHostNames < dwSize) && *pName ; pName += strlen(pName) + 1) { if ( !stricmp(pName, cm_NetbiosName) ) { --- 299,305 ---- pHostNames, &dwSize) == ERROR_SUCCESS) { for (pName = pHostNames; ! (pName - pHostNames < (int) dwSize) && *pName ; pName += strlen(pName) + 1) { if ( !stricmp(pName, cm_NetbiosName) ) { *************** *** 390,396 **** } - #if !defined(DJGPP) static void afsd_InitServerPreferences(void) { HKEY hkPrefs = 0; --- 393,398 ---- *************** *** 540,546 **** RegCloseKey(hkPrefs); } } - #endif /* DJGPP */ /* * AFSD Initialization --- 542,547 ---- *************** *** 564,570 **** long ltt, ltto; long rx_nojumbo; long virtualCache = 0; ! char rootCellName[256]; struct rx_service *serverp; static struct rx_securityClass *nullServerSecurityClassp; struct hostent *thp; --- 565,571 ---- long ltt, ltto; long rx_nojumbo; long virtualCache = 0; ! fschar_t rootCellName[256]; struct rx_service *serverp; static struct rx_securityClass *nullServerSecurityClassp; struct hostent *thp; *************** *** 577,583 **** /*int freelanceEnabled;*/ WSADATA WSAjunk; int i; - char *p, *q; 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*/ --- 578,583 ---- *************** *** 586,592 **** WSAStartup(0x0101, &WSAjunk); - afsd_initUpperCaseTable(); init_et_to_sys_error(); /* setup osidebug server at RPC slot 1000 */ --- 586,591 ---- *************** *** 614,620 **** /* Look up configuration parameters in Registry */ code = RegOpenKeyEx(HKEY_LOCAL_MACHINE, AFSREG_CLT_SVC_PARAM_SUBKEY, ! 0, KEY_QUERY_VALUE, &parmKey); if (code != ERROR_SUCCESS) { FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER, --- 613,619 ---- /* Look up configuration parameters in Registry */ code = RegOpenKeyEx(HKEY_LOCAL_MACHINE, AFSREG_CLT_SVC_PARAM_SUBKEY, ! 0, KEY_QUERY_VALUE, &parmKey); if (code != ERROR_SUCCESS) { FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER, *************** *** 822,850 **** dummyLen = sizeof(cm_rootVolumeName); code = RegQueryValueEx(parmKey, "RootVolume", NULL, NULL, ! cm_rootVolumeName, &dummyLen); if (code == ERROR_SUCCESS) afsi_log("Root volume %s", cm_rootVolumeName); else { ! StringCbCopyA(cm_rootVolumeName, sizeof(cm_rootVolumeName), "root.afs"); afsi_log("Default root volume name root.afs"); } ! cm_mountRootLen = sizeof(cm_mountRoot); ! code = RegQueryValueEx(parmKey, "MountRoot", NULL, NULL, ! cm_mountRoot, &cm_mountRootLen); if (code == ERROR_SUCCESS) { ! afsi_log("Mount root %s", cm_mountRoot); ! cm_mountRootLen = (DWORD)strlen(cm_mountRoot); } else { ! StringCbCopyA(cm_mountRoot, sizeof(cm_mountRoot), "/afs"); ! cm_mountRootLen = 4; /* Don't log */ } dummyLen = sizeof(buf); code = RegQueryValueEx(parmKey, "CachePath", NULL, ®Type, ! buf, &dummyLen); if (code == ERROR_SUCCESS && buf[0]) { if (regType == REG_EXPAND_SZ) { dummyLen = ExpandEnvironmentStrings(buf, cm_CachePath, sizeof(cm_CachePath)); --- 821,852 ---- dummyLen = sizeof(cm_rootVolumeName); code = RegQueryValueEx(parmKey, "RootVolume", NULL, NULL, ! (LPBYTE) cm_rootVolumeName, &dummyLen); if (code == ERROR_SUCCESS) afsi_log("Root volume %s", cm_rootVolumeName); else { ! cm_FsStrCpy(cm_rootVolumeName, lengthof(cm_rootVolumeName), "root.afs"); afsi_log("Default root volume name root.afs"); } ! cm_mountRootCLen = sizeof(cm_mountRootC); ! code = RegQueryValueExW(parmKey, L"MountRoot", NULL, NULL, ! (LPBYTE) cm_mountRootC, &cm_mountRootCLen); if (code == ERROR_SUCCESS) { ! afsi_log("Mount root %S", cm_mountRootC); ! cm_mountRootCLen = cm_ClientStrLen(cm_mountRootC); } else { ! cm_ClientStrCpy(cm_mountRootC, lengthof(cm_mountRootC), _C("/afs")); ! cm_mountRootCLen = cm_ClientStrLen(cm_mountRootC); /* Don't log */ } + cm_ClientStringToFsString(cm_mountRootC, -1, cm_mountRoot, lengthof(cm_mountRoot)); + cm_mountRootLen = cm_FsStrLen(cm_mountRoot); + dummyLen = sizeof(buf); code = RegQueryValueEx(parmKey, "CachePath", NULL, ®Type, ! buf, &dummyLen); if (code == ERROR_SUCCESS && buf[0]) { if (regType == REG_EXPAND_SZ) { dummyLen = ExpandEnvironmentStrings(buf, cm_CachePath, sizeof(cm_CachePath)); *************** *** 909,955 **** } for ( i=0; i < MAXNUMSYSNAMES; i++ ) { ! cm_sysNameList[i] = osi_Alloc(MAXSYSNAME); cm_sysNameList[i][0] = '\0'; } cm_sysName = cm_sysNameList[0]; ! dummyLen = sizeof(buf); ! code = RegQueryValueEx(parmKey, "SysName", NULL, NULL, buf, &dummyLen); ! if (code != ERROR_SUCCESS || !buf[0]) { #if defined(_IA64_) ! StringCbCopyA(buf, sizeof(buf), "ia64_win64"); #elif defined(_AMD64_) ! StringCbCopyA(buf, sizeof(buf), "amd64_win64 x86_win32 i386_w2k"); #else /* assume x86 32-bit */ ! StringCbCopyA(buf, sizeof(buf), "x86_win32 i386_w2k i386_nt40"); #endif ! } ! afsi_log("Sys name %s", buf); ! /* breakup buf into individual search string entries */ ! for (p = q = buf; p < buf + dummyLen; p++) ! { ! if (*p == '\0' || isspace(*p)) { ! memcpy(cm_sysNameList[cm_sysNameCount],q,p-q); ! cm_sysNameList[cm_sysNameCount][p-q] = '\0'; ! cm_sysNameCount++; ! ! do { ! if (*p == '\0') ! goto done_sysname; ! p++; ! } while (*p == '\0' || isspace(*p)); ! q = p; ! p--; } } done_sysname: ! StringCbCopyA(cm_sysName, MAXSYSNAME, cm_sysNameList[0]); dummyLen = sizeof(cryptall); code = RegQueryValueEx(parmKey, "SecurityLevel", NULL, NULL, ! (BYTE *) &cryptall, &dummyLen); if (code == ERROR_SUCCESS) { afsi_log("SecurityLevel is %s", cryptall?"crypt":"clear"); } else { --- 911,959 ---- } for ( i=0; i < MAXNUMSYSNAMES; i++ ) { ! cm_sysNameList[i] = osi_Alloc(MAXSYSNAME * sizeof(clientchar_t)); cm_sysNameList[i][0] = '\0'; } cm_sysName = cm_sysNameList[0]; ! { ! clientchar_t *p, *q; ! clientchar_t * cbuf = (clientchar_t *) buf; ! dummyLen = sizeof(buf); ! code = RegQueryValueExW(parmKey, L"SysName", NULL, NULL, (LPBYTE) cbuf, &dummyLen); ! if (code != ERROR_SUCCESS || !cbuf[0]) { #if defined(_IA64_) ! cm_ClientStrCpy(cbuf, lengthof(buf), _C("ia64_win64")); #elif defined(_AMD64_) ! cm_ClientStrCpy(cbuf, lengthof(buf), _C("amd64_win64 x86_win32 i386_w2k")); #else /* assume x86 32-bit */ ! cm_ClientStrCpy(cbuf, lengthof(buf), _C("x86_win32 i386_w2k i386_nt40")); #endif ! } ! afsi_log("Sys name %S", cbuf); ! /* breakup buf into individual search string entries */ ! for (p = q = cbuf; p < cbuf + dummyLen; p++) { ! if (*p == '\0' || iswspace(*p)) { ! memcpy(cm_sysNameList[cm_sysNameCount],q,(p-q) * sizeof(clientchar_t)); ! cm_sysNameList[cm_sysNameCount][p-q] = '\0'; ! cm_sysNameCount++; ! do { ! if (*p == '\0') ! goto done_sysname; ! p++; ! } while (*p == '\0' || isspace(*p)); ! q = p; ! p--; ! } } } done_sysname: ! cm_ClientStrCpy(cm_sysName, MAXSYSNAME, cm_sysNameList[0]); dummyLen = sizeof(cryptall); code = RegQueryValueEx(parmKey, "SecurityLevel", NULL, NULL, ! (BYTE *) &cryptall, &dummyLen); if (code == ERROR_SUCCESS) { afsi_log("SecurityLevel is %s", cryptall?"crypt":"clear"); } else { *************** *** 996,1001 **** --- 1000,1014 ---- } #endif /* AFS_FREELANCE_CLIENT */ + dummyLen = sizeof(smb_UseUnicode); + code = RegQueryValueEx(parmKey, "NegotiateUnicode", NULL, NULL, + (BYTE *) &smb_UseUnicode, &dummyLen); + if (code != ERROR_SUCCESS) { + smb_UseUnicode = 1; /* default on */ + } + afsi_log("SMB Server Unicode Support is %s", + smb_UseUnicode ? "enabled" : "disabled"); + dummyLen = sizeof(smb_hideDotFiles); code = RegQueryValueEx(parmKey, "HideDotFiles", NULL, NULL, (BYTE *) &smb_hideDotFiles, &dummyLen); *************** *** 1143,1170 **** afsi_log("CM BPlusTrees is not supported"); #endif ! if ((RegQueryValueEx( parmKey, "PrefetchExecutableExtensions", 0, ! ®Type, NULL, &dummyLen) == ERROR_SUCCESS) && (regType == REG_MULTI_SZ)) { ! char * pSz; dummyLen += 3; /* in case the source string is not nul terminated */ pSz = malloc(dummyLen); ! if ((RegQueryValueEx( parmKey, "PrefetchExecutableExtensions", 0, ®Type, ! pSz, &dummyLen) == ERROR_SUCCESS) && (regType == REG_MULTI_SZ)) { int cnt; ! char * p; ! for (cnt = 0, p = pSz; (p - pSz < dummyLen) && *p; cnt++, p += strlen(p) + 1); ! smb_ExecutableExtensions = malloc(sizeof(char *) * (cnt+1)); ! for (cnt = 0, p = pSz; (p - pSz < dummyLen) && *p; cnt++, p += strlen(p) + 1) ! { smb_ExecutableExtensions[cnt] = p; ! afsi_log("PrefetchExecutableExtension: \"%s\"", p); } smb_ExecutableExtensions[cnt] = NULL; } --- 1156,1182 ---- afsi_log("CM BPlusTrees is not supported"); #endif ! if ((RegQueryValueExW( parmKey, L"PrefetchExecutableExtensions", 0, ! ®Type, NULL, &dummyLen) == ERROR_SUCCESS) && (regType == REG_MULTI_SZ)) { ! clientchar_t * pSz; dummyLen += 3; /* in case the source string is not nul terminated */ pSz = malloc(dummyLen); ! if ((RegQueryValueExW( parmKey, L"PrefetchExecutableExtensions", 0, ®Type, ! (LPBYTE) pSz, &dummyLen) == ERROR_SUCCESS) && (regType == REG_MULTI_SZ)) { int cnt; ! clientchar_t * p; ! for (cnt = 0, p = pSz; (p - pSz < dummyLen) && *p; cnt++, p += cm_ClientStrLen(p) + 1); ! smb_ExecutableExtensions = malloc(sizeof(clientchar_t *) * (cnt+1)); ! for (cnt = 0, p = pSz; (p - pSz < dummyLen) && *p; cnt++, p += cm_ClientStrLen(p) + 1) { smb_ExecutableExtensions[cnt] = p; ! afsi_log("PrefetchExecutableExtension: \"%S\"", p); } smb_ExecutableExtensions[cnt] = NULL; } *************** *** 1244,1249 **** --- 1256,1263 ---- cm_InitCallback(); + cm_InitNormalization(); + code = cm_InitMappedMemory(virtualCache, cm_CachePath, stats, volumes, cells, cm_chunkSize, cacheBlocks, blockSize); afsi_log("cm_InitMappedMemory code %x", code); if (code != 0) { *************** *** 1266,1271 **** --- 1280,1287 ---- } if ( rx_mtu != -1 ) { + extern void rx_SetMaxMTU(int); + rx_SetMaxMTU(rx_mtu); afsi_log("rx_SetMaxMTU %d successful", rx_mtu); } *************** *** 1315,1321 **** code = cm_GetRootCellName(rootCellName); afsi_log("cm_GetRootCellName code %d, cm_freelanceEnabled= %d, rcn= %s", ! code, cm_freelanceEnabled, (code ? "" : rootCellName)); if (code != 0 && !cm_freelanceEnabled) { *reasonP = "can't find root cell name in " AFS_CELLSERVDB; --- 1331,1337 ---- code = cm_GetRootCellName(rootCellName); afsi_log("cm_GetRootCellName code %d, cm_freelanceEnabled= %d, rcn= %s", ! code, cm_freelanceEnabled, (code ? "" : rootCellName)); if (code != 0 && !cm_freelanceEnabled) { *reasonP = "can't find root cell name in " AFS_CELLSERVDB; *************** *** 1343,1351 **** /* Initialize the RPC server for session keys */ RpcInit(); - #if !defined(DJGPP) afsd_InitServerPreferences(); - #endif return 0; } --- 1359,1365 ---- *************** *** 1779,1787 **** void afsd_SetUnhandledExceptionFilter() { SetUnhandledExceptionFilter(afsd_ExceptionFilter); } ! #ifdef _DEBUG void afsd_DbgBreakAllocInit() { --- 1793,1803 ---- void afsd_SetUnhandledExceptionFilter() { + #ifndef NOTRACE SetUnhandledExceptionFilter(afsd_ExceptionFilter); + #endif } ! #ifdef _DEBUG void afsd_DbgBreakAllocInit() { Index: openafs/src/WINNT/afsd/afsd_init.h diff -c openafs/src/WINNT/afsd/afsd_init.h:1.6.6.1 openafs/src/WINNT/afsd/afsd_init.h:1.6.6.3 *** openafs/src/WINNT/afsd/afsd_init.h:1.6.6.1 Sun Oct 8 16:31:36 2006 --- openafs/src/WINNT/afsd/afsd_init.h Thu Jun 26 12:38:29 2008 *************** *** 9,23 **** void afsi_start(); - #ifndef DJGPP int afsd_InitCM(char **reasonP); int afsd_InitSMB(char **reasonP, void *aMBfunc); void GenerateMiniDump(PEXCEPTION_POINTERS ep); - #else /* DJGPP */ - int afsd_InitCM(char **reasonP, struct cmd_syndesc *as, char *arock); - int afsd_InitSMB(char **reasonP); - #endif /* !DJGPP */ int afsd_InitDaemons(char **reasonP); int afsd_ShutdownCM(void); void afsd_ForceTrace(BOOL flush); --- 9,18 ---- *************** *** 25,29 **** extern char cm_HostName[]; extern char cm_NetbiosName[]; ! --- 20,24 ---- extern char cm_HostName[]; extern char cm_NetbiosName[]; ! extern clientchar_t cm_NetbiosNameC[]; Index: openafs/src/WINNT/afsd/afsd_init95.c diff -c openafs/src/WINNT/afsd/afsd_init95.c:1.4 openafs/src/WINNT/afsd/afsd_init95.c:1.4.6.1 *** openafs/src/WINNT/afsd/afsd_init95.c:1.4 Fri Mar 11 00:33:21 2005 --- openafs/src/WINNT/afsd/afsd_init95.c Thu Jun 26 10:38:23 2008 *************** *** 324,330 **** WSAStartup(0x0101, &WSAjunk);*/ - #ifndef DJGPP /* setup osidebug server at RPC slot 1000 */ osi_LongToUID(1000, &debugID); code = osi_InitDebug(&debugID); --- 324,329 ---- *************** *** 334,351 **** *reasonP = "unknown error"; return -1; } - #endif /* who are we ? */ gethostname(cm_HostName, sizeof(cm_HostName)); - #ifdef DJGPP - /* For some reason, we may be getting space-padded hostnames. - If so, we take out the padding so that we can append -AFS later. */ - { - char *space = strchr(cm_HostName,' '); - if (space) *space = '\0'; - } - #endif afsi_log("gethostname %s", cm_HostName); thp = gethostbyname(cm_HostName); memcpy(&cm_HostAddr, thp->h_addr_list[0], 4); --- 333,341 ---- Index: openafs/src/WINNT/afsd/afsd_service.c diff -c openafs/src/WINNT/afsd/afsd_service.c:1.52.4.25 openafs/src/WINNT/afsd/afsd_service.c:1.52.4.26 *** openafs/src/WINNT/afsd/afsd_service.c:1.52.4.25 Wed Mar 19 11:36:25 2008 --- openafs/src/WINNT/afsd/afsd_service.c Thu Jun 26 12:38:29 2008 *************** *** 14,19 **** --- 14,22 ---- #include #include #include + #include "cm_btree.h" + #include "cm_rpc.h" + #include "smb.h" #include *************** *** 1094,1099 **** --- 1097,1104 ---- HMODULE hAdvApi32; #ifdef _DEBUG + void afsd_DbgBreakAllocInit(); + afsd_DbgBreakAllocInit(); _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF /*| _CRTDBG_CHECK_ALWAYS_DF*/ | _CRTDBG_CHECK_CRT_DF /* | _CRTDBG_DELAY_FREE_MEM_DF */ ); Index: openafs/src/WINNT/afsd/afskfw.c diff -c openafs/src/WINNT/afsd/afskfw.c:1.28.4.18 openafs/src/WINNT/afsd/afskfw.c:1.28.4.19 *** openafs/src/WINNT/afsd/afskfw.c:1.28.4.18 Sun Mar 30 10:13:17 2008 --- openafs/src/WINNT/afsd/afskfw.c Sat Jul 5 02:27:46 2008 *************** *** 3122,3128 **** retry++; goto retry_gettoken5; } ! goto try_krb524d; } if (atoken.kvno == btoken.kvno && --- 3122,3128 ---- retry++; goto retry_gettoken5; } ! goto cleanup; } if (atoken.kvno == btoken.kvno && Index: openafs/src/WINNT/afsd/afslogon.c diff -c openafs/src/WINNT/afsd/afslogon.c:1.45.2.13 openafs/src/WINNT/afsd/afslogon.c:1.45.2.14 *** openafs/src/WINNT/afsd/afslogon.c:1.45.2.13 Mon Jan 28 14:51:20 2008 --- openafs/src/WINNT/afsd/afslogon.c Thu Jun 26 08:45:10 2008 *************** *** 370,376 **** if(domain) { dwSize = MAX_COMPUTERNAME_LENGTH; if(GetComputerName(computerName, &dwSize)) { ! if(!stricmp(computerName, domain)) { effDomain = "LOCALHOST"; opt->flags = LOGON_FLAG_LOCAL; } --- 370,376 ---- if(domain) { dwSize = MAX_COMPUTERNAME_LENGTH; if(GetComputerName(computerName, &dwSize)) { ! if(!cm_stricmp_utf8(computerName, domain)) { effDomain = "LOCALHOST"; opt->flags = LOGON_FLAG_LOCAL; } *************** *** 977,983 **** } p = opt.theseCells; while ( *p ) { ! if ( stricmp(p, cell) ) { SetEnvironmentVariable(DO_NOT_REGISTER_VARNAME, ""); code2 = KFW_AFS_get_cred(principal, p, 0, 0, opt.smbName, &reason); SetEnvironmentVariable(DO_NOT_REGISTER_VARNAME, NULL); --- 977,983 ---- } p = opt.theseCells; while ( *p ) { ! if ( cm_stricmp_utf8(p, cell) ) { SetEnvironmentVariable(DO_NOT_REGISTER_VARNAME, ""); code2 = KFW_AFS_get_cred(principal, p, 0, 0, opt.smbName, &reason); SetEnvironmentVariable(DO_NOT_REGISTER_VARNAME, NULL); Index: openafs/src/WINNT/afsd/cm_access.c diff -c openafs/src/WINNT/afsd/cm_access.c:1.7.2.18 openafs/src/WINNT/afsd/cm_access.c:1.7.2.19 *** openafs/src/WINNT/afsd/cm_access.c:1.7.2.18 Sun Mar 2 23:25:40 2008 --- openafs/src/WINNT/afsd/cm_access.c Thu Jun 26 10:38:23 2008 *************** *** 10,25 **** #include #include - #ifndef DJGPP #include #include - #endif #include #include #include - #ifndef DJGPP #include - #endif #include #include "afsd.h" --- 10,21 ---- Index: openafs/src/WINNT/afsd/cm_aclent.c diff -c openafs/src/WINNT/afsd/cm_aclent.c:1.14.2.4 openafs/src/WINNT/afsd/cm_aclent.c:1.14.2.5 *** openafs/src/WINNT/afsd/cm_aclent.c:1.14.2.4 Sun Mar 2 23:25:40 2008 --- openafs/src/WINNT/afsd/cm_aclent.c Thu Jun 26 10:38:23 2008 *************** *** 10,18 **** #include #include - #ifndef DJGPP #include - #endif #include #include #include --- 10,16 ---- Index: openafs/src/WINNT/afsd/cm_btree.c diff -c openafs/src/WINNT/afsd/cm_btree.c:1.1.2.14.2.1 openafs/src/WINNT/afsd/cm_btree.c:1.1.2.20 *** openafs/src/WINNT/afsd/cm_btree.c:1.1.2.14.2.1 Sun Jun 22 22:52:04 2008 --- openafs/src/WINNT/afsd/cm_btree.c Mon Jul 14 09:01:31 2008 *************** *** 1,5 **** /* ! * Copyright 2007 Secure Endpoints Inc. * * All Rights Reserved. * --- 1,5 ---- /* ! * Copyright 2007-2008 Secure Endpoints Inc. * * All Rights Reserved. * *************** *** 15,20 **** --- 15,21 ---- #include #include #include "afsd.h" + #include #ifdef USE_BPLUS #include "cm_btree.h" *************** *** 43,49 **** static void cleanupNodePool(Tree *B); static Nptr descendToLeaf(Tree *B, Nptr curr); ! static int getSlot(Tree *B, Nptr curr); static int findKey(Tree *B, Nptr curr, int lo, int hi); static int bestMatch(Tree *B, Nptr curr, int slot); --- 44,50 ---- static void cleanupNodePool(Tree *B); static Nptr descendToLeaf(Tree *B, Nptr curr); ! int getSlot(Tree *B, Nptr curr); static int findKey(Tree *B, Nptr curr, int lo, int hi); static int bestMatch(Tree *B, Nptr curr, int slot); *************** *** 141,147 **** { Tree *B; keyT empty = {NULL}; ! dataT data = {0,0,0,0}; if (fanout > MAX_FANOUT) fanout = MAX_FANOUT; --- 142,148 ---- { Tree *B; keyT empty = {NULL}; ! dataT data = {0,0,0,0,0,0,0}; if (fanout > MAX_FANOUT) fanout = MAX_FANOUT; *************** *** 164,170 **** setcomparekeys(B, keyCmp); #ifdef DEBUG_BTREE ! sprintf(B->message, "INIT: B+tree of fanout %d at %10p.\n", fanout, (void *)B); OutputDebugString(B->message); #endif --- 165,171 ---- setcomparekeys(B, keyCmp); #ifdef DEBUG_BTREE ! StringCbPrintfA(B->message, sizeof(B->message), "INIT: B+tree of fanout %d at %10p.\n", fanout, (void *)B); OutputDebugString(B->message); #endif *************** *** 178,184 **** void freeBtree(Tree *B) { #ifdef DEBUG_BTREE ! sprintf(B->message, "FREE: B+tree at %10p.\n", (void *) B); OutputDebugString(B->message); #endif --- 179,185 ---- void freeBtree(Tree *B) { #ifdef DEBUG_BTREE ! StringCbPrintfA(B->message, sizeof(B->message), "FREE: B+tree at %10p.\n", (void *) B); OutputDebugString(B->message); #endif *************** *** 266,272 **** Nptr leafNode; #ifdef DEBUG_BTREE ! sprintf(B->message, "LOOKUP: key %s.\n", key.name); OutputDebugString(B->message); #endif --- 267,273 ---- Nptr leafNode; #ifdef DEBUG_BTREE ! StringCbPrintfA(B->message, sizeof(B->message), "LOOKUP: key %s.\n", key.name); OutputDebugString(B->message); #endif *************** *** 286,299 **** dataNode = getnode(leafNode, slot); data = getdatavalue(dataNode); ! sprintf(B->message, "LOOKUP: %s found on page %d value (%d.%d.%d).\n", key.name, getnodenumber(B, leafNode), data.fid.volume, data.fid.vnode, data.fid.unique); } else ! sprintf(B->message, "LOOKUP: not found!\n"); OutputDebugString(B->message); #endif --- 287,300 ---- dataNode = getnode(leafNode, slot); data = getdatavalue(dataNode); ! StringCbPrintfA(B->message, sizeof(B->message), "LOOKUP: %s found on page %d value (%d.%d.%d).\n", key.name, getnodenumber(B, leafNode), data.fid.volume, data.fid.vnode, data.fid.unique); } else ! StringCbPrintfA(B->message, sizeof(B->message), "LOOKUP: not found!\n"); OutputDebugString(B->message); #endif *************** *** 334,340 **** } /******************** find slot for search key *********************/ ! static int getSlot(Tree *B, Nptr curr) { int slot, entries; --- 335,341 ---- } /******************** find slot for search key *********************/ ! int getSlot(Tree *B, Nptr curr) { int slot, entries; *************** *** 355,361 **** #ifdef DEBUG_BTREE if (findslot == BTERROR) { ! sprintf(B->message, "FINDKEY: (lo %d hi %d) Bad key ordering on node %d (0x%p)\n", lo, hi, getnodenumber(B, curr), curr); osi_Log1(afsd_logp, "BPlus: %s", osi_LogSaveString(afsd_logp, B->message)); } --- 356,362 ---- #ifdef DEBUG_BTREE if (findslot == BTERROR) { ! StringCbPrintfA(B->message, sizeof(B->message), "FINDKEY: (lo %d hi %d) Bad key ordering on node %d (0x%p)\n", lo, hi, getnodenumber(B, curr), curr); osi_Log1(afsd_logp, "BPlus: %s", osi_LogSaveString(afsd_logp, B->message)); } *************** *** 372,378 **** findslot = findKey(B, curr, mid + 1, hi); break; case BTERROR: ! sprintf(B->message, "FINDKEY: (lo %d hi %d) Bad key ordering on node %d (0x%p)\n", lo, hi, getnodenumber(B, curr), curr); osi_Log1(afsd_logp, "BPlus: %s", osi_LogSaveString(afsd_logp, B->message)); } --- 373,379 ---- findslot = findKey(B, curr, mid + 1, hi); break; case BTERROR: ! StringCbPrintfA(B->message, sizeof(B->message), "FINDKEY: (lo %d hi %d) Bad key ordering on node %d (0x%p)\n", lo, hi, getnodenumber(B, curr), curr); osi_Log1(afsd_logp, "BPlus: %s", osi_LogSaveString(afsd_logp, B->message)); } *************** *** 380,386 **** if (isleaf(curr) && findslot == 0) { ! sprintf(B->message, "FINDKEY: (lo %d hi %d) findslot %d is invalid for leaf nodes, bad key ordering on node %d (0x%p)\n", lo, hi, findslot, getnodenumber(B, curr), curr); osi_Log1(afsd_logp, "BPlus: %s", osi_LogSaveString(afsd_logp, B->message)); } --- 381,387 ---- if (isleaf(curr) && findslot == 0) { ! StringCbPrintfA(B->message, sizeof(B->message), "FINDKEY: (lo %d hi %d) findslot %d is invalid for leaf nodes, bad key ordering on node %d (0x%p)\n", lo, hi, findslot, getnodenumber(B, curr), curr); osi_Log1(afsd_logp, "BPlus: %s", osi_LogSaveString(afsd_logp, B->message)); } *************** *** 435,441 **** if (findslot == BTERROR || isleaf(curr) && findslot == 0) { ! sprintf(B->message, "BESTMATCH: node %d (0x%p) slot %d diff %d comp %d findslot %d\n", getnodenumber(B, curr), curr, slot, diff, comp, findslot); osi_Log1(afsd_logp, "BPlus: %s", osi_LogSaveString(afsd_logp, B->message)); } --- 436,442 ---- if (findslot == BTERROR || isleaf(curr) && findslot == 0) { ! StringCbPrintfA(B->message, sizeof(B->message), "BESTMATCH: node %d (0x%p) slot %d diff %d comp %d findslot %d\n", getnodenumber(B, curr), curr, slot, diff, comp, findslot); osi_Log1(afsd_logp, "BPlus: %s", osi_LogSaveString(afsd_logp, B->message)); } *************** *** 454,460 **** Nptr newNode; #ifdef DEBUG_BTREE ! sprintf(B->message, "INSERT: key %s.\n", key.name); osi_Log1(afsd_logp, "BPlus: %s", osi_LogSaveString(afsd_logp, B->message)); #endif --- 455,461 ---- Nptr newNode; #ifdef DEBUG_BTREE ! StringCbPrintfA(B->message, sizeof(B->message), "INSERT: key %s.\n", key.name); osi_Log1(afsd_logp, "BPlus: %s", osi_LogSaveString(afsd_logp, B->message)); #endif *************** *** 528,534 **** keyT key; #ifdef DEBUG_BTREE ! sprintf(B->message, "INSERT: slot %d, down node %d.\n", slot, getnodenumber(B, downPtr)); osi_Log1(afsd_logp, "BPlus: %s", osi_LogSaveString(afsd_logp, B->message)); #endif --- 529,535 ---- keyT key; #ifdef DEBUG_BTREE ! StringCbPrintfA(B->message, sizeof(B->message), "INSERT: slot %d, down node %d.\n", slot, getnodenumber(B, downPtr)); osi_Log1(afsd_logp, "BPlus: %s", osi_LogSaveString(afsd_logp, B->message)); #endif *************** *** 732,738 **** Nptr newNode; #ifdef DEBUG_BTREE ! sprintf(B->message, "DELETE: key %s.\n", key.name); osi_Log1(afsd_logp, "BPlus: %s", osi_LogSaveString(afsd_logp, B->message)); #endif --- 733,739 ---- Nptr newNode; #ifdef DEBUG_BTREE ! StringCbPrintfA(B->message, sizeof(B->message), "DELETE: key %s.\n", key.name); osi_Log1(afsd_logp, "BPlus: %s", osi_LogSaveString(afsd_logp, B->message)); #endif *************** *** 741,747 **** newNode = descendBalance(B, getroot(B), NONODE, NONODE, NONODE, NONODE, NONODE); if (isnode(newNode)) { #ifdef DEBUG_BTREE ! sprintf(B->message, "DELETE: collapsing node %d", getnodenumber(B, newNode)); osi_Log1(afsd_logp, "BPlus: %s", osi_LogSaveString(afsd_logp, B->message)); #endif collapseRoot(B, getroot(B), newNode); /* remove root when superfluous */ --- 742,748 ---- newNode = descendBalance(B, getroot(B), NONODE, NONODE, NONODE, NONODE, NONODE); if (isnode(newNode)) { #ifdef DEBUG_BTREE ! StringCbPrintfA(B->message, sizeof(B->message), "DELETE: collapsing node %d", getnodenumber(B, newNode)); osi_Log1(afsd_logp, "BPlus: %s", osi_LogSaveString(afsd_logp, B->message)); #endif collapseRoot(B, getroot(B), newNode); /* remove root when superfluous */ *************** *** 755,761 **** { #ifdef DEBUG_BTREE ! sprintf(B->message, "COLLAPSE: old %d, new %d.\n", getnodenumber(B, oldRoot), getnodenumber(B, newRoot)); osi_Log1(afsd_logp, "BPlus: %s", osi_LogSaveString(afsd_logp, B->message)); showNode(B, "collapseRoot oldRoot", oldRoot); showNode(B, "collapseRoot newRoot", newRoot); --- 756,762 ---- { #ifdef DEBUG_BTREE ! StringCbPrintfA(B->message, sizeof(B->message), "COLLAPSE: old %d, new %d.\n", getnodenumber(B, oldRoot), getnodenumber(B, newRoot)); osi_Log1(afsd_logp, "BPlus: %s", osi_LogSaveString(afsd_logp, B->message)); showNode(B, "collapseRoot oldRoot", oldRoot); showNode(B, "collapseRoot newRoot", newRoot); *************** *** 777,783 **** int slot = 0, notleft = 0, notright = 0, fewleft = 0, fewright = 0, test = 0; #ifdef DEBUG_BTREE ! sprintf(B->message, "descendBalance curr %d, left %d, right %d, lAnc %d, rAnc %d, parent %d\n", curr ? getnodenumber(B, curr) : -1, left ? getnodenumber(B, left) : -1, right ? getnodenumber(B, right) : -1, --- 778,784 ---- int slot = 0, notleft = 0, notright = 0, fewleft = 0, fewright = 0, test = 0; #ifdef DEBUG_BTREE ! StringCbPrintfA(B->message, sizeof(B->message), "descendBalance curr %d, left %d, right %d, lAnc %d, rAnc %d, parent %d\n", curr ? getnodenumber(B, curr) : -1, left ? getnodenumber(B, left) : -1, right ? getnodenumber(B, right) : -1, *************** *** 918,924 **** if (newMe != NONODE) { /* this node removal doesn't consider duplicates */ #ifdef DEBUG_BTREE ! sprintf(B->message, "descendBalance DELETE: slot %d, node %d.\n", slot, getnodenumber(B, curr)); osi_Log1(afsd_logp, "BPlus: %s", osi_LogSaveString(afsd_logp, B->message)); #endif --- 919,925 ---- if (newMe != NONODE) { /* this node removal doesn't consider duplicates */ #ifdef DEBUG_BTREE ! StringCbPrintfA(B->message, sizeof(B->message), "descendBalance DELETE: slot %d, node %d.\n", slot, getnodenumber(B, curr)); osi_Log1(afsd_logp, "BPlus: %s", osi_LogSaveString(afsd_logp, B->message)); #endif *************** *** 972,978 **** } #ifdef DEBUG_BTREE ! sprintf(B->message, "descendBalance returns %d\n", getnodenumber(B, newNode)); osi_Log1(afsd_logp, "BPlus: %s", osi_LogSaveString(afsd_logp, B->message)); #endif return newNode; --- 973,979 ---- } #ifdef DEBUG_BTREE ! StringCbPrintfA(B->message, sizeof(B->message), "descendBalance returns %d\n", getnodenumber(B, newNode)); osi_Log1(afsd_logp, "BPlus: %s", osi_LogSaveString(afsd_logp, B->message)); #endif return newNode; *************** *** 1004,1010 **** int x, y, z; #ifdef DEBUG_BTREE ! sprintf(B->message, "MERGE: left %d, right %d.\n", getnodenumber(B, left), getnodenumber(B, right)); osi_Log1(afsd_logp, "BPlus: %s", osi_LogSaveString(afsd_logp, B->message)); showNode(B, "pre-merge anchor", anchor); showNode(B, "pre-merge left", left); --- 1005,1011 ---- int x, y, z; #ifdef DEBUG_BTREE ! StringCbPrintfA(B->message, sizeof(B->message), "MERGE: left %d, right %d.\n", getnodenumber(B, left), getnodenumber(B, right)); osi_Log1(afsd_logp, "BPlus: %s", osi_LogSaveString(afsd_logp, B->message)); showNode(B, "pre-merge anchor", anchor); showNode(B, "pre-merge left", left); *************** *** 1061,1067 **** int i, x, y, z; #ifdef DEBUG_BTREE ! sprintf(B->message, "SHIFT: left %d, right %d, anchor %d.\n", getnodenumber(B, left), getnodenumber(B, right), getnodenumber(B, anchor)); --- 1062,1068 ---- int i, x, y, z; #ifdef DEBUG_BTREE ! StringCbPrintfA(B->message, sizeof(B->message), "SHIFT: left %d, right %d, anchor %d.\n", getnodenumber(B, left), getnodenumber(B, right), getnodenumber(B, anchor)); *************** *** 1162,1168 **** setmergepath(B, NONODE); #ifdef DEBUG_BTREE ! sprintf(B->message, "SHIFT: left %d, right %d.\n", getnodenumber(B, left), getnodenumber(B, right)); osi_Log1(afsd_logp, "BPlus: %s", osi_LogSaveString(afsd_logp, B->message)); showNode(B, "post-shift anchor", anchor); showNode(B, "post-shift left", left); --- 1163,1169 ---- setmergepath(B, NONODE); #ifdef DEBUG_BTREE ! StringCbPrintfA(B->message, sizeof(B->message), "SHIFT: left %d, right %d.\n", getnodenumber(B, left), getnodenumber(B, right)); osi_Log1(afsd_logp, "BPlus: %s", osi_LogSaveString(afsd_logp, B->message)); showNode(B, "post-shift anchor", anchor); showNode(B, "post-shift left", left); *************** *** 1192,1198 **** if (entry == 0) DebugBreak(); #endif ! getkey(node,entry + offset).name = strdup(getkey(node,entry).name); #ifdef DEBUG_BTREE if ( getnode(node, entry) == NONODE ) DebugBreak(); --- 1193,1199 ---- if (entry == 0) DebugBreak(); #endif ! getkey(node,entry + offset).name = cm_NormStrDup(getkey(node,entry).name); #ifdef DEBUG_BTREE if ( getnode(node, entry) == NONODE ) DebugBreak(); *************** *** 1205,1211 **** { if (getkey(node,entry).name != NULL) free(getkey(node,entry).name); ! getkey(node,entry).name = strdup(getkey(node,entry + offset).name); #ifdef DEBUG_BTREE if ( getnode(node, entry + offset) == NONODE ) DebugBreak(); --- 1206,1212 ---- { if (getkey(node,entry).name != NULL) free(getkey(node,entry).name); ! getkey(node,entry).name = cm_NormStrDup(getkey(node,entry + offset).name); #ifdef DEBUG_BTREE if ( getnode(node, entry + offset) == NONODE ) DebugBreak(); *************** *** 1218,1224 **** { if (getkey(destNode,destEntry).name != NULL) free(getkey(destNode,destEntry).name); ! getkey(destNode,destEntry).name = strdup(getkey(srcNode,srcEntry).name); #ifdef DEBUG_BTREE if ( getnode(srcNode, srcEntry) == NONODE ) DebugBreak(); --- 1219,1225 ---- { if (getkey(destNode,destEntry).name != NULL) free(getkey(destNode,destEntry).name); ! getkey(destNode,destEntry).name = cm_NormStrDup(getkey(srcNode,srcEntry).name); #ifdef DEBUG_BTREE if ( getnode(srcNode, srcEntry) == NONODE ) DebugBreak(); *************** *** 1231,1237 **** { if (getkey(node,entry).name != NULL) free(getkey(node,entry).name); ! getkey(node,entry).name = strdup(key.name); #ifdef DEBUG_BTREE if ( downNode == NONODE ) DebugBreak(); --- 1232,1238 ---- { if (getkey(node,entry).name != NULL) free(getkey(node,entry).name); ! getkey(node,entry).name = cm_NormStrDup(key.name); #ifdef DEBUG_BTREE if ( downNode == NONODE ) DebugBreak(); *************** *** 1289,1297 **** free(getdatakey(node).name); getdatakey(node).name = NULL; } ! if ( getdatavalue(node).longname ) { ! free(getdatavalue(node).longname); ! getdatavalue(node).longname = NULL; } } else { /* data node */ for ( j=1; j<=getfanout(B); j++ ) { --- 1290,1302 ---- free(getdatakey(node).name); getdatakey(node).name = NULL; } ! if ( getdatavalue(node).cname ) { ! free(getdatavalue(node).cname); ! getdatavalue(node).cname = NULL; ! } ! if ( getdatavalue(node).fsname ) { ! free(getdatavalue(node).fsname); ! getdatavalue(node).fsname = NULL; } } else { /* data node */ for ( j=1; j<=getfanout(B); j++ ) { *************** *** 1341,1348 **** if (isdata(node)) { if ( getdatakey(node).name ) free(getdatakey(node).name); ! if ( getdatavalue(node).longname ) ! free(getdatavalue(node).longname); } else { /* data node */ for ( i=1; i<=getfanout(B); i++ ) { if (getkey(node, i).name) --- 1346,1355 ---- if (isdata(node)) { if ( getdatakey(node).name ) free(getdatakey(node).name); ! if ( getdatavalue(node).cname ) ! free(getdatavalue(node).cname); ! if ( getdatavalue(node).fsname ) ! free(getdatavalue(node).fsname); } else { /* data node */ for ( i=1; i<=getfanout(B); i++ ) { if (getkey(node, i).name) *************** *** 1364,1370 **** Nptr newNode = getFreeNode(B); setflag(newNode, isDATA); ! getdatakey(newNode).name = strdup(key.name); getdatavalue(newNode) = data; getdatanext(newNode) = NONODE; --- 1371,1377 ---- Nptr newNode = getFreeNode(B); setflag(newNode, isDATA); ! getdatakey(newNode).name = cm_NormStrDup(key.name); getdatavalue(newNode) = data; getdatanext(newNode) = NONODE; *************** *** 1382,1442 **** { int x; ! sprintf(B->message, "- -- -- -- -- -- -- -- -- -- -- -- -\n"); osi_Log1(afsd_logp, "BPlus: %s", osi_LogSaveString(afsd_logp, B->message)); ! sprintf(B->message, "| %-20s |\n", where); osi_Log1(afsd_logp, "BPlus: %s", osi_LogSaveString(afsd_logp, B->message)); ! sprintf(B->message, "| node %6d ", getnodenumber(B, n)); osi_Log1(afsd_logp, "BPlus: %s", osi_LogSaveString(afsd_logp, B->message)); ! sprintf(B->message, " magic %4x |\n", getmagic(n)); osi_Log1(afsd_logp, "BPlus: %s", osi_LogSaveString(afsd_logp, B->message)); ! sprintf(B->message, "- -- -- -- -- -- -- -- -- -- -- -- -\n"); osi_Log1(afsd_logp, "BPlus: %s", osi_LogSaveString(afsd_logp, B->message)); ! sprintf(B->message, "| flags %1d%1d%1d%1d ", isfew(n), isfull(n), isroot(n), isleaf(n)); osi_Log1(afsd_logp, "BPlus: %s", osi_LogSaveString(afsd_logp, B->message)); ! sprintf(B->message, "| keys = %5d ", numentries(n)); osi_Log1(afsd_logp, "BPlus: %s", osi_LogSaveString(afsd_logp, B->message)); ! sprintf(B->message, "| node = %6d |\n", getnodenumber(B, getfirstnode(n))); osi_Log1(afsd_logp, "BPlus: %s", osi_LogSaveString(afsd_logp, B->message)); for (x = 1; x <= numentries(n); x++) { ! sprintf(B->message, "| entry %6d ", x); osi_Log1(afsd_logp, "BPlus: %s", osi_LogSaveString(afsd_logp, B->message)); ! sprintf(B->message, "| key = %6s ", getkey(n, x).name); osi_Log1(afsd_logp, "BPlus: %s", osi_LogSaveString(afsd_logp, B->message)); ! sprintf(B->message, "| node = %6d |\n", getnodenumber(B, getnode(n, x))); osi_Log1(afsd_logp, "BPlus: %s", osi_LogSaveString(afsd_logp, B->message)); } ! sprintf(B->message, "- -- -- -- -- -- -- -- -- -- -- -- -\n"); osi_Log1(afsd_logp, "BPlus: %s", osi_LogSaveString(afsd_logp, B->message)); } /****************** B+tree class variable printer ******************/ void showBtree(Tree *B) { ! sprintf(B->message, "- -- -- -- -- -- -\n"); osi_Log1(afsd_logp, "BPlus: %s", osi_LogSaveString(afsd_logp, B->message)); ! sprintf(B->message, "| B+tree %10p |\n", (void *) B); osi_Log1(afsd_logp, "BPlus: %s", osi_LogSaveString(afsd_logp, B->message)); ! sprintf(B->message, "- -- -- -- -- -- -\n"); osi_Log1(afsd_logp, "BPlus: %s", osi_LogSaveString(afsd_logp, B->message)); ! sprintf(B->message, "| root %6d |\n", getnodenumber(B, getroot(B))); osi_Log1(afsd_logp, "BPlus: %s", osi_LogSaveString(afsd_logp, B->message)); ! sprintf(B->message, "| leaf %6d |\n", getnodenumber(B, getleaf(B))); osi_Log1(afsd_logp, "BPlus: %s", osi_LogSaveString(afsd_logp, B->message)); ! sprintf(B->message, "| fanout %3d |\n", getfanout(B) + 1); osi_Log1(afsd_logp, "BPlus: %s", osi_LogSaveString(afsd_logp, B->message)); ! sprintf(B->message, "| minfanout %3d |\n", getminfanout(B, getroot(B)) + 1); osi_Log1(afsd_logp, "BPlus: %s", osi_LogSaveString(afsd_logp, B->message)); ! sprintf(B->message, "| height %3d |\n", gettreeheight(B)); osi_Log1(afsd_logp, "BPlus: %s", osi_LogSaveString(afsd_logp, B->message)); ! sprintf(B->message, "| freenode %6d |\n", getnodenumber(B, getfirstfreenode(B))); osi_Log1(afsd_logp, "BPlus: %s", osi_LogSaveString(afsd_logp, B->message)); ! sprintf(B->message, "| theKey %6s |\n", getfunkey(B).name); osi_Log1(afsd_logp, "BPlus: %s", osi_LogSaveString(afsd_logp, B->message)); ! sprintf(B->message, "| theData %d.%d.%d |\n", getfundata(B).volume, getfundata(B).vnode, getfundata(B).unique); osi_Log1(afsd_logp, "BPlus: %s", osi_LogSaveString(afsd_logp, B->message)); ! sprintf(B->message, "- -- -- -- -- -- -\n"); osi_Log1(afsd_logp, "BPlus: %s", osi_LogSaveString(afsd_logp, B->message)); } --- 1389,1449 ---- { int x; ! StringCbPrintfA(B->message, sizeof(B->message), "- -- -- -- -- -- -- -- -- -- -- -- -\n"); osi_Log1(afsd_logp, "BPlus: %s", osi_LogSaveString(afsd_logp, B->message)); ! StringCbPrintfA(B->message, sizeof(B->message), "| %-20s |\n", where); osi_Log1(afsd_logp, "BPlus: %s", osi_LogSaveString(afsd_logp, B->message)); ! StringCbPrintfA(B->message, sizeof(B->message), "| node %6d ", getnodenumber(B, n)); osi_Log1(afsd_logp, "BPlus: %s", osi_LogSaveString(afsd_logp, B->message)); ! StringCbPrintfA(B->message, sizeof(B->message), " magic %4x |\n", getmagic(n)); osi_Log1(afsd_logp, "BPlus: %s", osi_LogSaveString(afsd_logp, B->message)); ! StringCbPrintfA(B->message, sizeof(B->message), "- -- -- -- -- -- -- -- -- -- -- -- -\n"); osi_Log1(afsd_logp, "BPlus: %s", osi_LogSaveString(afsd_logp, B->message)); ! StringCbPrintfA(B->message, sizeof(B->message), "| flags %1d%1d%1d%1d ", isfew(n), isfull(n), isroot(n), isleaf(n)); osi_Log1(afsd_logp, "BPlus: %s", osi_LogSaveString(afsd_logp, B->message)); ! StringCbPrintfA(B->message, sizeof(B->message), "| keys = %5d ", numentries(n)); osi_Log1(afsd_logp, "BPlus: %s", osi_LogSaveString(afsd_logp, B->message)); ! StringCbPrintfA(B->message, sizeof(B->message), "| node = %6d |\n", getnodenumber(B, getfirstnode(n))); osi_Log1(afsd_logp, "BPlus: %s", osi_LogSaveString(afsd_logp, B->message)); for (x = 1; x <= numentries(n); x++) { ! StringCbPrintfA(B->message, sizeof(B->message), "| entry %6d ", x); osi_Log1(afsd_logp, "BPlus: %s", osi_LogSaveString(afsd_logp, B->message)); ! StringCbPrintfA(B->message, sizeof(B->message), "| key = %6s ", getkey(n, x).name); osi_Log1(afsd_logp, "BPlus: %s", osi_LogSaveString(afsd_logp, B->message)); ! StringCbPrintfA(B->message, sizeof(B->message), "| node = %6d |\n", getnodenumber(B, getnode(n, x))); osi_Log1(afsd_logp, "BPlus: %s", osi_LogSaveString(afsd_logp, B->message)); } ! StringCbPrintfA(B->message, sizeof(B->message), "- -- -- -- -- -- -- -- -- -- -- -- -\n"); osi_Log1(afsd_logp, "BPlus: %s", osi_LogSaveString(afsd_logp, B->message)); } /****************** B+tree class variable printer ******************/ void showBtree(Tree *B) { ! StringCbPrintfA(B->message, sizeof(B->message), "- -- -- -- -- -- -\n"); osi_Log1(afsd_logp, "BPlus: %s", osi_LogSaveString(afsd_logp, B->message)); ! StringCbPrintfA(B->message, sizeof(B->message), "| B+tree %10p |\n", (void *) B); osi_Log1(afsd_logp, "BPlus: %s", osi_LogSaveString(afsd_logp, B->message)); ! StringCbPrintfA(B->message, sizeof(B->message), "- -- -- -- -- -- -\n"); osi_Log1(afsd_logp, "BPlus: %s", osi_LogSaveString(afsd_logp, B->message)); ! StringCbPrintfA(B->message, sizeof(B->message), "| root %6d |\n", getnodenumber(B, getroot(B))); osi_Log1(afsd_logp, "BPlus: %s", osi_LogSaveString(afsd_logp, B->message)); ! StringCbPrintfA(B->message, sizeof(B->message), "| leaf %6d |\n", getnodenumber(B, getleaf(B))); osi_Log1(afsd_logp, "BPlus: %s", osi_LogSaveString(afsd_logp, B->message)); ! StringCbPrintfA(B->message, sizeof(B->message), "| fanout %3d |\n", getfanout(B) + 1); osi_Log1(afsd_logp, "BPlus: %s", osi_LogSaveString(afsd_logp, B->message)); ! StringCbPrintfA(B->message, sizeof(B->message), "| minfanout %3d |\n", getminfanout(B, getroot(B)) + 1); osi_Log1(afsd_logp, "BPlus: %s", osi_LogSaveString(afsd_logp, B->message)); ! StringCbPrintfA(B->message, sizeof(B->message), "| height %3d |\n", gettreeheight(B)); osi_Log1(afsd_logp, "BPlus: %s", osi_LogSaveString(afsd_logp, B->message)); ! StringCbPrintfA(B->message, sizeof(B->message), "| freenode %6d |\n", getnodenumber(B, getfirstfreenode(B))); osi_Log1(afsd_logp, "BPlus: %s", osi_LogSaveString(afsd_logp, B->message)); ! StringCbPrintfA(B->message, sizeof(B->message), "| theKey %6s |\n", getfunkey(B).name); osi_Log1(afsd_logp, "BPlus: %s", osi_LogSaveString(afsd_logp, B->message)); ! StringCbPrintfA(B->message, sizeof(B->message), "| theData %d.%d.%d |\n", getfundata(B).volume, getfundata(B).vnode, getfundata(B).unique); osi_Log1(afsd_logp, "BPlus: %s", osi_LogSaveString(afsd_logp, B->message)); ! StringCbPrintfA(B->message, sizeof(B->message), "- -- -- -- -- -- -\n"); osi_Log1(afsd_logp, "BPlus: %s", osi_LogSaveString(afsd_logp, B->message)); } *************** *** 1448,1454 **** dataT data; if (isntnode(node)) { ! sprintf(B->message, "%s - NoNode!!!\n"); osi_Log1(afsd_logp, "BPlus: %s", osi_LogSaveString(afsd_logp, B->message)); return; } --- 1455,1461 ---- dataT data; if (isntnode(node)) { ! StringCbPrintfA(B->message, sizeof(B->message), "%s - NoNode!!!\n"); osi_Log1(afsd_logp, "BPlus: %s", osi_LogSaveString(afsd_logp, B->message)); return; } *************** *** 1456,1462 **** if (!isnode(node)) { data = getdatavalue(node); ! sprintf(B->message, "%s - data node %d (%d.%d.%d)\n", parent_desc, getnodenumber(B, node), data.fid.volume, data.fid.vnode, data.fid.unique); osi_Log1(afsd_logp, "BPlus: %s", osi_LogSaveString(afsd_logp, B->message)); --- 1463,1469 ---- if (!isnode(node)) { data = getdatavalue(node); ! StringCbPrintfA(B->message, sizeof(B->message), "%s - data node %d (%d.%d.%d)\n", parent_desc, getnodenumber(B, node), data.fid.volume, data.fid.vnode, data.fid.unique); osi_Log1(afsd_logp, "BPlus: %s", osi_LogSaveString(afsd_logp, B->message)); *************** *** 1465,1471 **** showNode(B, parent_desc, node); if ( isinternal(node) || isroot(node) ) { ! sprintf(thisnode, "parent %6d", getnodenumber(B , node)); osi_Log1(afsd_logp, "BPlus: %s", osi_LogSaveString(afsd_logp, B->message)); for ( i= isinternal(node) ? 0 : 1; i <= numentries(node); i++ ) { --- 1472,1478 ---- showNode(B, parent_desc, node); if ( isinternal(node) || isroot(node) ) { ! StringCbPrintfA(thisnode, sizeof(thisnode), "parent %6d", getnodenumber(B , node)); osi_Log1(afsd_logp, "BPlus: %s", osi_LogSaveString(afsd_logp, B->message)); for ( i= isinternal(node) ? 0 : 1; i <= numentries(node); i++ ) { *************** *** 1479,1502 **** listBtreeValues(Tree *B, Nptr n, int num) { int slot; ! keyT prev = {""}; dataT data; for (slot = 1; (n != NONODE) && num && numentries(n); num--) { if (comparekeys(B)(getkey(n, slot),prev, 0) < 0) { ! sprintf(B->message, "BOMB %8s\n", getkey(n, slot).name); osi_Log1(afsd_logp, "BPlus: %s", osi_LogSaveString(afsd_logp, B->message)); DebugBreak(); } prev = getkey(n, slot); data = getdatavalue(getnode(n, slot)); ! sprintf(B->message, "%8s (%d.%d.%d)\n", prev.name, data.fid.volume, data.fid.vnode, data.fid.unique); osi_Log1(afsd_logp, "BPlus: %s", osi_LogSaveString(afsd_logp, B->message)); if (++slot > numentries(n)) n = getnextnode(n), slot = 1; ! } ! sprintf(B->message, "\n\n"); osi_Log1(afsd_logp, "BPlus: %s", osi_LogSaveString(afsd_logp, B->message)); } --- 1486,1509 ---- listBtreeValues(Tree *B, Nptr n, int num) { int slot; ! keyT prev = {L""}; dataT data; for (slot = 1; (n != NONODE) && num && numentries(n); num--) { if (comparekeys(B)(getkey(n, slot),prev, 0) < 0) { ! StringCbPrintfA(B->message, sizeof(B->message), "BOMB %8s\n", getkey(n, slot).name); osi_Log1(afsd_logp, "BPlus: %s", osi_LogSaveString(afsd_logp, B->message)); DebugBreak(); } prev = getkey(n, slot); data = getdatavalue(getnode(n, slot)); ! StringCbPrintfA(B->message, sizeof(B->message), "%8S (%d.%d.%d)\n", prev.name, data.fid.volume, data.fid.vnode, data.fid.unique); osi_Log1(afsd_logp, "BPlus: %s", osi_LogSaveString(afsd_logp, B->message)); if (++slot > numentries(n)) n = getnextnode(n), slot = 1; ! } ! StringCbPrintfA(B->message, sizeof(B->message), "\n\n"); osi_Log1(afsd_logp, "BPlus: %s", osi_LogSaveString(afsd_logp, B->message)); } *************** *** 1514,1524 **** int num = -1; Nptr n = getleaf(B), l; int slot; ! keyT prev = {""}; for (slot = 1; (n != NONODE) && num && numentries(n); num--) { if (comparekeys(B)(getkey(n, slot),prev, 0) < 0) { ! sprintf(B->message,"BOMB %8s\n", getkey(n, slot).name); osi_Log1(afsd_logp, "BPlus: %s", osi_LogSaveString(afsd_logp, B->message)); #ifdef DEBUG_BTREE DebugBreak(); --- 1521,1531 ---- int num = -1; Nptr n = getleaf(B), l; int slot; ! keyT prev = {L""}; for (slot = 1; (n != NONODE) && num && numentries(n); num--) { if (comparekeys(B)(getkey(n, slot),prev, 0) < 0) { ! StringCbPrintfA(B->message, sizeof(B->message),"BOMB %8s\n", getkey(n, slot).name); osi_Log1(afsd_logp, "BPlus: %s", osi_LogSaveString(afsd_logp, B->message)); #ifdef DEBUG_BTREE DebugBreak(); *************** *** 1528,1536 **** l = bplus_Lookup(B, prev); if ( l != n ){ if (l == NONODE) ! sprintf(B->message,"BOMB %8s cannot be found\n", prev.name); else ! sprintf(B->message,"BOMB lookup(%8s) finds wrong node\n", prev.name); osi_Log1(afsd_logp, "BPlus: %s", osi_LogSaveString(afsd_logp, B->message)); #ifdef DEBUG_BTREE DebugBreak(); --- 1535,1543 ---- l = bplus_Lookup(B, prev); if ( l != n ){ if (l == NONODE) ! StringCbPrintfA(B->message, sizeof(B->message),"BOMB %8S cannot be found\n", prev.name); else ! StringCbPrintfA(B->message, sizeof(B->message),"BOMB lookup(%8S) finds wrong node\n", prev.name); osi_Log1(afsd_logp, "BPlus: %s", osi_LogSaveString(afsd_logp, B->message)); #ifdef DEBUG_BTREE DebugBreak(); *************** *** 1552,1568 **** * match. Otherwise, the search order might be considered * to be inconsistent when the EXACT_MATCH flag is set. */ ! static int ! compareKeys(keyT key1, keyT key2, int flags) { int comp; ! comp = stricmp(key1.name, key2.name); if (comp == 0 && (flags & EXACT_MATCH)) ! comp = strcmp(key1.name, key2.name); return (comp < 0 ? -1 : (comp > 0 ? 1 : 0)); } /* Look up a file name in directory. On entry: --- 1559,1661 ---- * match. Otherwise, the search order might be considered * to be inconsistent when the EXACT_MATCH flag is set. */ ! int ! cm_BPlusCompareNormalizedKeys(keyT key1, keyT key2, int flags) { int comp; ! comp = cm_NormStrCmpI(key1.name, key2.name); if (comp == 0 && (flags & EXACT_MATCH)) ! comp = cm_NormStrCmp(key1.name, key2.name); return (comp < 0 ? -1 : (comp > 0 ? 1 : 0)); } + int + cm_BPlusDirLookupOriginalName(cm_dirOp_t * op, clientchar_t *centry, + fschar_t **fsnameRetp) + { + int rc = EINVAL; + keyT key = {NULL}; + Nptr leafNode = NONODE; + LARGE_INTEGER start, end; + fschar_t * fsname = NULL; + normchar_t * entry = NULL; + + if (op->scp->dirBplus == NULL || + op->dataVersion != op->scp->dirDataVersion) { + rc = EINVAL; + goto done; + } + + entry = cm_ClientStringToNormStringAlloc(centry, -1, NULL); + key.name = entry; + + lock_AssertAny(&op->scp->dirlock); + + QueryPerformanceCounter(&start); + + leafNode = bplus_Lookup(op->scp->dirBplus, key); + if (leafNode != NONODE) { + int slot; + Nptr firstDataNode, dataNode, nextDataNode; + int exact = 0; + int count = 0; + + /* Found a leaf that matches the key via a case-insensitive + * match. There may be one or more data nodes that match. + * If we have an exact match, return that. + * If we have an ambiguous match, return an error. + * If we have only one inexact match, return that. + */ + slot = getSlot(op->scp->dirBplus, leafNode); + if (slot <= BTERROR) { + op->scp->dirDataVersion = 0; + rc = (slot == BTERROR ? EINVAL : ENOENT); + goto done; + } + firstDataNode = getnode(leafNode, slot); + + for ( dataNode = firstDataNode; dataNode; dataNode = nextDataNode) { + count++; + if (!comparekeys(op->scp->dirBplus)(key, getdatakey(dataNode), EXACT_MATCH) ) { + exact = 1; + break; + } + nextDataNode = getdatanext(dataNode); + } + + if (exact) { + fsname = getdatavalue(dataNode).fsname; + rc = 0; + bplus_lookup_hits++; + } else if (count == 1) { + fsname = getdatavalue(firstDataNode).fsname; + rc = CM_ERROR_INEXACT_MATCH; + bplus_lookup_hits_inexact++; + } else { + rc = CM_ERROR_AMBIGUOUS_FILENAME; + bplus_lookup_ambiguous++; + } + } else { + rc = ENOENT; + bplus_lookup_misses++; + } + + if (fsname) + *fsnameRetp = cm_FsStrDup(fsname); + + QueryPerformanceCounter(&end); + + bplus_lookup_time += (end.QuadPart - start.QuadPart); + + done: + if (entry) + free(entry); + + return rc; + + } + /* Look up a file name in directory. On entry: *************** *** 1572,1581 **** op->scp->dirlock is read locked */ int ! cm_BPlusDirLookup(cm_dirOp_t * op, char *entry, cm_fid_t * cfid) { int rc = EINVAL; ! keyT key = {entry}; Nptr leafNode = NONODE; LARGE_INTEGER start, end; --- 1665,1675 ---- op->scp->dirlock is read locked */ int ! cm_BPlusDirLookup(cm_dirOp_t * op, clientchar_t * centry, cm_fid_t * cfid) { int rc = EINVAL; ! normchar_t * entry = NULL; ! keyT key = {NULL}; Nptr leafNode = NONODE; LARGE_INTEGER start, end; *************** *** 1585,1590 **** --- 1679,1687 ---- goto done; } + entry = cm_ClientStringToNormStringAlloc(centry, -1, NULL); + key.name = entry; + lock_AssertAny(&op->scp->dirlock); QueryPerformanceCounter(&start); *************** *** 1641,1646 **** --- 1738,1746 ---- bplus_lookup_time += (end.QuadPart - start.QuadPart); done: + if (entry) + free(entry); + return rc; } *************** *** 1652,1664 **** On exit: op->scp->dirlock is write locked */ ! long cm_BPlusDirCreateEntry(cm_dirOp_t * op, char *entry, cm_fid_t * cfid) { long rc = 0; ! keyT key = {entry}; dataT data; LARGE_INTEGER start, end; ! char shortName[13]; if (op->scp->dirBplus == NULL || op->dataVersion != op->scp->dirDataVersion) { --- 1752,1764 ---- On exit: op->scp->dirlock is write locked */ ! long cm_BPlusDirCreateEntry(cm_dirOp_t * op, clientchar_t * entry, cm_fid_t * cfid) { long rc = 0; ! keyT key = {NULL}; dataT data; LARGE_INTEGER start, end; ! normchar_t * normalizedName = NULL; if (op->scp->dirBplus == NULL || op->dataVersion != op->scp->dirDataVersion) { *************** *** 1666,1690 **** goto done; } lock_AssertWrite(&op->scp->dirlock); cm_SetFid(&data.fid, cfid->cell, cfid->volume, cfid->vnode, cfid->unique); ! data.longname = NULL; QueryPerformanceCounter(&start); bplus_create_entry++; insert(op->scp->dirBplus, key, data); if (!cm_Is8Dot3(entry)) { cm_dirFid_t dfid; dfid.vnode = htonl(data.fid.vnode); dfid.unique = htonl(data.fid.unique); ! cm_Gen8Dot3NameInt(entry, &dfid, shortName, NULL); - key.name = shortName; - data.longname = strdup(entry); insert(op->scp->dirBplus, key, data); } --- 1766,1801 ---- goto done; } + normalizedName = cm_ClientStringToNormStringAlloc(entry, -1, NULL); + key.name = normalizedName; lock_AssertWrite(&op->scp->dirlock); cm_SetFid(&data.fid, cfid->cell, cfid->volume, cfid->vnode, cfid->unique); ! data.cname = cm_ClientStrDup(entry); ! data.fsname = cm_ClientStringToFsStringAlloc(entry, -1, NULL); ! data.shortform = FALSE; QueryPerformanceCounter(&start); bplus_create_entry++; insert(op->scp->dirBplus, key, data); + if (!cm_Is8Dot3(entry)) { cm_dirFid_t dfid; + clientchar_t wshortName[13]; + dfid.vnode = htonl(data.fid.vnode); dfid.unique = htonl(data.fid.unique); ! cm_Gen8Dot3NameIntW(entry, &dfid, wshortName, NULL); ! ! key.name = wshortName; ! ! data.cname = cm_ClientStrDup(entry); ! data.fsname = cm_ClientStringToFsStringAlloc(entry, -1, NULL); ! data.shortform = TRUE; insert(op->scp->dirBplus, key, data); } *************** *** 1694,1699 **** --- 1805,1813 ---- done: + if (normalizedName != NULL) + free(normalizedName); + return rc; } *************** *** 1704,1715 **** On exit: op->scp->dirlock is write locked */ ! int cm_BPlusDirDeleteEntry(cm_dirOp_t * op, char *entry) { long rc = 0; ! keyT key = {entry}; Nptr leafNode = NONODE; LARGE_INTEGER start, end; if (op->scp->dirBplus == NULL || op->dataVersion != op->scp->dirDataVersion) { --- 1818,1830 ---- On exit: op->scp->dirlock is write locked */ ! int cm_BPlusDirDeleteEntry(cm_dirOp_t * op, clientchar_t *centry) { long rc = 0; ! keyT key = {NULL}; Nptr leafNode = NONODE; LARGE_INTEGER start, end; + normchar_t * normalizedEntry = NULL; if (op->scp->dirBplus == NULL || op->dataVersion != op->scp->dirDataVersion) { *************** *** 1717,1722 **** --- 1832,1840 ---- goto done; } + normalizedEntry = cm_ClientStringToNormStringAlloc(centry, -1, NULL); + key.name = normalizedEntry; + lock_AssertWrite(&op->scp->dirlock); QueryPerformanceCounter(&start); *************** *** 1724,1733 **** bplus_remove_entry++; if (op->scp->dirBplus) { ! if (!cm_Is8Dot3(entry)) { cm_dirFid_t dfid; cm_fid_t fid; ! char shortName[13]; leafNode = bplus_Lookup(op->scp->dirBplus, key); if (leafNode != NONODE) { --- 1842,1851 ---- bplus_remove_entry++; if (op->scp->dirBplus) { ! if (!cm_Is8Dot3(centry)) { cm_dirFid_t dfid; cm_fid_t fid; ! clientchar_t shortName[13]; leafNode = bplus_Lookup(op->scp->dirBplus, key); if (leafNode != NONODE) { *************** *** 1774,1780 **** if (rc != CM_ERROR_AMBIGUOUS_FILENAME) { dfid.vnode = htonl(fid.vnode); dfid.unique = htonl(fid.unique); ! cm_Gen8Dot3NameInt(entry, &dfid, shortName, NULL); /* delete first the long name and then the short name */ delete(op->scp->dirBplus, key); --- 1892,1898 ---- if (rc != CM_ERROR_AMBIGUOUS_FILENAME) { dfid.vnode = htonl(fid.vnode); dfid.unique = htonl(fid.unique); ! cm_Gen8Dot3NameIntW(centry, &dfid, shortName, NULL); /* delete first the long name and then the short name */ delete(op->scp->dirBplus, key); *************** *** 1782,1788 **** delete(op->scp->dirBplus, key); } } else { ! char * longname = NULL; /* We need to lookup the 8dot3 name to determine what the * matching long name is */ --- 1900,1907 ---- delete(op->scp->dirBplus, key); } } else { ! clientchar_t * cname = NULL; ! /* We need to lookup the 8dot3 name to determine what the * matching long name is */ *************** *** 1818,1827 **** } if (exact) { ! longname = getdatavalue(dataNode).longname; rc = 0; } else if (count == 1) { ! longname = getdatavalue(firstDataNode).longname; rc = CM_ERROR_INEXACT_MATCH; } else { rc = CM_ERROR_AMBIGUOUS_FILENAME; --- 1937,1946 ---- } if (exact) { ! cname = getdatavalue(dataNode).cname; rc = 0; } else if (count == 1) { ! cname = getdatavalue(firstDataNode).cname; rc = CM_ERROR_INEXACT_MATCH; } else { rc = CM_ERROR_AMBIGUOUS_FILENAME; *************** *** 1829,1839 **** } if (rc != CM_ERROR_AMBIGUOUS_FILENAME) { ! if (longname) { ! key.name = longname; delete(op->scp->dirBplus, key); ! key.name = entry; } delete(op->scp->dirBplus, key); } } --- 1948,1963 ---- } if (rc != CM_ERROR_AMBIGUOUS_FILENAME) { ! if (cname) { ! normchar_t * longNName = cm_NormalizeStringAlloc(cname, -1, NULL); ! ! key.name = longNName; delete(op->scp->dirBplus, key); ! key.name = normalizedEntry; ! ! free(longNName); } + delete(op->scp->dirBplus, key); } } *************** *** 1844,1849 **** --- 1968,1976 ---- bplus_remove_time += (end.QuadPart - start.QuadPart); done: + if (normalizedEntry) + free(normalizedEntry); + return rc; } *************** *** 1852,1878 **** int cm_BPlusDirFoo(struct cm_scache *scp, struct cm_dirEntry *dep, void *dummy, osi_hyper_t *entryOffsetp) { ! keyT key = {dep->name}; dataT data; ! char shortName[13]; ! cm_SetFid(&data.fid, scp->fid.cell, scp->fid.volume, ntohl(dep->fid.vnode), ntohl(dep->fid.unique)); ! data.longname = NULL; /* the Write lock is held in cm_BPlusDirBuildTree() */ insert(scp->dirBplus, key, data); ! if (!cm_Is8Dot3(dep->name)) { cm_dirFid_t dfid; dfid.vnode = dep->fid.vnode; dfid.unique = dep->fid.unique; ! cm_Gen8Dot3NameInt(dep->name, &dfid, shortName, NULL); ! key.name = shortName; ! data.longname = strdup(dep->name); insert(scp->dirBplus, key, data); } #ifdef BTREE_DEBUG findAllBtreeValues(scp->dirBplus); #endif --- 1979,2031 ---- int cm_BPlusDirFoo(struct cm_scache *scp, struct cm_dirEntry *dep, void *dummy, osi_hyper_t *entryOffsetp) { ! keyT key = {NULL}; dataT data; ! normchar_t *normalized_name=NULL; ! cm_SetFid(&data.fid, scp->fid.cell, scp->fid.volume, ! ntohl(dep->fid.vnode), ntohl(dep->fid.unique)); ! data.cname = NULL; ! data.fsname = NULL; + normalized_name = cm_FsStringToNormStringAlloc(dep->name, -1, NULL); + + if (normalized_name) { + key.name = normalized_name; + } else { + #ifdef DEBUG + DebugBreak(); + #endif + return 0; + } + + data.cname = cm_FsStringToClientStringAlloc(dep->name, -1, NULL); + data.fsname = cm_FsStrDup(dep->name); + data.shortform = FALSE; + /* the Write lock is held in cm_BPlusDirBuildTree() */ insert(scp->dirBplus, key, data); ! ! if (!cm_Is8Dot3(data.cname)) { cm_dirFid_t dfid; + wchar_t wshortName[13]; + dfid.vnode = dep->fid.vnode; dfid.unique = dep->fid.unique; ! cm_Gen8Dot3NameIntW(data.cname, &dfid, wshortName, NULL); ! key.name = wshortName; ! data.cname = cm_FsStringToClientStringAlloc(dep->name, -1, NULL); ! data.fsname = cm_FsStrDup(dep->name); ! data.shortform = TRUE; ! insert(scp->dirBplus, key, data); } + if (normalized_name) + free(normalized_name); + #ifdef BTREE_DEBUG findAllBtreeValues(scp->dirBplus); #endif *************** *** 1899,1905 **** bplus_build_tree++; if (scp->dirBplus == NULL) { ! scp->dirBplus = initBtree(64, MAX_FANOUT, compareKeys); } if (scp->dirBplus == NULL) { rc = ENOMEM; --- 2052,2058 ---- bplus_build_tree++; if (scp->dirBplus == NULL) { ! scp->dirBplus = initBtree(64, MAX_FANOUT, cm_BPlusCompareNormalizedKeys); } if (scp->dirBplus == NULL) { rc = ENOMEM; *************** *** 1924,1957 **** int zilch; char output[128]; ! sprintf(output, "%s - B+ Lookup Hits: %-8d\r\n", cookie, bplus_lookup_hits); WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL); ! sprintf(output, "%s - Inexact Hits: %-8d\r\n", cookie, bplus_lookup_hits_inexact); WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL); ! sprintf(output, "%s - Ambiguous Hits: %-8d\r\n", cookie, bplus_lookup_ambiguous); WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL); ! sprintf(output, "%s - Misses: %-8d\r\n", cookie, bplus_lookup_misses); WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL); ! sprintf(output, "%s - Create: %-8d\r\n", cookie, bplus_create_entry); WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL); ! sprintf(output, "%s - Remove: %-8d\r\n", cookie, bplus_remove_entry); WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL); ! sprintf(output, "%s - Build Tree: %-8d\r\n", cookie, bplus_build_tree); WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL); ! sprintf(output, "%s - Free Tree: %-8d\r\n", cookie, bplus_free_tree); WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL); ! sprintf(output, "%s - DV Error: %-8d\r\n", cookie, bplus_dv_error); WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL); ! sprintf(output, "%s - B+ Time Lookup: %-16I64d\r\n", cookie, bplus_lookup_time); WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL); ! sprintf(output, "%s - Create: %-16I64d\r\n", cookie, bplus_create_time); WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL); ! sprintf(output, "%s - Remove: %-16I64d\r\n", cookie, bplus_remove_time); WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL); ! sprintf(output, "%s - Build: %-16I64d\r\n", cookie, bplus_build_time); WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL); ! sprintf(output, "%s - Free: %-16I64d\r\n", cookie, bplus_free_time); WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL); return(0); --- 2077,2110 ---- int zilch; char output[128]; ! StringCbPrintfA(output, sizeof(output), "%s - B+ Lookup Hits: %-8d\r\n", cookie, bplus_lookup_hits); WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL); ! StringCbPrintfA(output, sizeof(output), "%s - Inexact Hits: %-8d\r\n", cookie, bplus_lookup_hits_inexact); WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL); ! StringCbPrintfA(output, sizeof(output), "%s - Ambiguous Hits: %-8d\r\n", cookie, bplus_lookup_ambiguous); WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL); ! StringCbPrintfA(output, sizeof(output), "%s - Misses: %-8d\r\n", cookie, bplus_lookup_misses); WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL); ! StringCbPrintfA(output, sizeof(output), "%s - Create: %-8d\r\n", cookie, bplus_create_entry); WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL); ! StringCbPrintfA(output, sizeof(output), "%s - Remove: %-8d\r\n", cookie, bplus_remove_entry); WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL); ! StringCbPrintfA(output, sizeof(output), "%s - Build Tree: %-8d\r\n", cookie, bplus_build_tree); WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL); ! StringCbPrintfA(output, sizeof(output), "%s - Free Tree: %-8d\r\n", cookie, bplus_free_tree); WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL); ! StringCbPrintfA(output, sizeof(output), "%s - DV Error: %-8d\r\n", cookie, bplus_dv_error); WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL); ! StringCbPrintfA(output, sizeof(output), "%s - B+ Time Lookup: %-16I64d\r\n", cookie, bplus_lookup_time); WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL); ! StringCbPrintfA(output, sizeof(output), "%s - Create: %-16I64d\r\n", cookie, bplus_create_time); WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL); ! StringCbPrintfA(output, sizeof(output), "%s - Remove: %-16I64d\r\n", cookie, bplus_remove_time); WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL); ! StringCbPrintfA(output, sizeof(output), "%s - Build: %-16I64d\r\n", cookie, bplus_build_time); WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL); ! StringCbPrintfA(output, sizeof(output), "%s - Free: %-16I64d\r\n", cookie, bplus_free_time); WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL); return(0); *************** *** 1994,2000 **** long cm_BPlusDirEnumerate(cm_scache_t *scp, afs_uint32 locked, ! char * maskp, cm_direnum_t **enumpp) { afs_uint32 count = 0, slot, numentries; Nptr leafNode = NONODE, nextLeafNode; --- 2147,2153 ---- long cm_BPlusDirEnumerate(cm_scache_t *scp, afs_uint32 locked, ! clientchar_t * maskp, cm_direnum_t **enumpp) { afs_uint32 count = 0, slot, numentries; Nptr leafNode = NONODE, nextLeafNode; *************** *** 2021,2036 **** firstDataNode = getnode(leafNode, slot); for ( dataNode = firstDataNode; dataNode; dataNode = nextDataNode) { if (maskp == NULL) { ! /* name is in getdatakey(dataNode) */ ! if (getdatavalue(dataNode).longname != NULL || ! cm_Is8Dot3(getdatakey(dataNode).name)) count++; } else { ! if (cm_Is8Dot3(getdatakey(dataNode).name) && ! smb_V3MatchMask(getdatakey(dataNode).name, maskp, CM_FLAG_CASEFOLD) || ! getdatavalue(dataNode).longname == NULL && ! smb_V3MatchMask(getdatavalue(dataNode).longname, maskp, CM_FLAG_CASEFOLD)) count++; } nextDataNode = getdatanext(dataNode); --- 2174,2190 ---- firstDataNode = getnode(leafNode, slot); for ( dataNode = firstDataNode; dataNode; dataNode = nextDataNode) { + + /* There can be two data nodes for one file. One for + the long name and one for the short name. We only + include one of these for the enumeration */ + if (maskp == NULL) { ! if (!getdatavalue(dataNode).shortform) count++; } else { ! if (!getdatavalue(dataNode).shortform && ! cm_MatchMask(getdatavalue(dataNode).cname, maskp, CM_FLAG_CASEFOLD)) count++; } nextDataNode = getdatanext(dataNode); *************** *** 2038,2046 **** } nextLeafNode = getnextnode(leafNode); ! } ! sprintf(buffer, "BPlusTreeEnumerate count = %d", count); osi_Log1(afsd_logp, "BPlus: %s", osi_LogSaveString(afsd_logp, buffer)); /* Allocate the enumeration object */ --- 2192,2200 ---- } nextLeafNode = getnextnode(leafNode); ! } ! StringCbPrintfA(buffer, sizeof(buffer), "BPlusTreeEnumerate count = %d", count); osi_Log1(afsd_logp, "BPlus: %s", osi_LogSaveString(afsd_logp, buffer)); /* Allocate the enumeration object */ *************** *** 2050,2104 **** rc = ENOMEM; goto done; } ! ! /* Copy the name and fid for each longname entry into the enumeration */ for (count = 0, leafNode = getleaf(scp->dirBplus); leafNode; leafNode = nextLeafNode) { for ( slot = 1, numentries = numentries(leafNode); slot <= numentries; slot++) { firstDataNode = getnode(leafNode, slot); for ( dataNode = firstDataNode; dataNode; dataNode = nextDataNode) { ! char * name; ! int hasShortName; int includeIt = 0; if (maskp == NULL) { ! if (getdatavalue(dataNode).longname != NULL || ! cm_Is8Dot3(getdatakey(dataNode).name)) ! { includeIt = 1; } } else { ! if (cm_Is8Dot3(getdatakey(dataNode).name) && ! smb_V3MatchMask(getdatakey(dataNode).name, maskp, CM_FLAG_CASEFOLD) || ! getdatavalue(dataNode).longname == NULL && ! smb_V3MatchMask(getdatavalue(dataNode).longname, maskp, CM_FLAG_CASEFOLD)) ! { includeIt = 1; } } if (includeIt) { ! if (getdatavalue(dataNode).longname) { ! name = strdup(getdatavalue(dataNode).longname); ! hasShortName = 1; ! } else { ! name = strdup(getdatakey(dataNode).name); ! hasShortName = 0; ! } if (name == NULL) { osi_Log0(afsd_logp, "cm_BPlusDirEnumerate strdup failed"); rc = ENOMEM; goto done; } enump->entry[count].name = name; enump->entry[count].fid = getdatavalue(dataNode).fid; ! if (hasShortName) ! strncpy(enump->entry[count].shortName, getdatakey(dataNode).name, ! sizeof(enump->entry[count].shortName)); ! else ! enump->entry[count].shortName[0] = '\0'; count++; } nextDataNode = getdatanext(dataNode); --- 2204,2256 ---- rc = ENOMEM; goto done; } ! ! /* Copy the name and fid for each cname entry into the enumeration */ for (count = 0, leafNode = getleaf(scp->dirBplus); leafNode; leafNode = nextLeafNode) { for ( slot = 1, numentries = numentries(leafNode); slot <= numentries; slot++) { firstDataNode = getnode(leafNode, slot); for ( dataNode = firstDataNode; dataNode; dataNode = nextDataNode) { ! clientchar_t * name; int includeIt = 0; if (maskp == NULL) { ! if (!getdatavalue(dataNode).shortform) { includeIt = 1; } } else { ! if (!getdatavalue(dataNode).shortform && ! cm_MatchMask(getdatavalue(dataNode).cname, maskp, CM_FLAG_CASEFOLD)) { includeIt = 1; } } if (includeIt) { ! name = cm_ClientStrDup(getdatavalue(dataNode).cname); if (name == NULL) { osi_Log0(afsd_logp, "cm_BPlusDirEnumerate strdup failed"); rc = ENOMEM; goto done; } + enump->entry[count].name = name; enump->entry[count].fid = getdatavalue(dataNode).fid; ! ! if (!cm_Is8Dot3(name)) { ! cm_dirFid_t dfid; ! ! dfid.vnode = htonl(getdatavalue(dataNode).fid.vnode); ! dfid.unique = htonl(getdatavalue(dataNode).fid.unique); ! ! cm_Gen8Dot3NameIntW(name, &dfid, enump->entry[count].shortName, NULL); ! } else { ! StringCbCopyW(enump->entry[count].shortName, ! sizeof(enump->entry[count].shortName), ! name); ! } ! count++; } nextDataNode = getdatanext(dataNode); *************** *** 2130,2135 **** --- 2282,2339 ---- } long + cm_BPlusDirEnumBulkStat(cm_scache_t *dscp, cm_direnum_t *enump, cm_user_t *userp, cm_req_t *reqp) + { + cm_bulkStat_t *bsp; + afs_uint32 count; + afs_uint32 code; + + if ( dscp->fid.cell == AFS_FAKE_ROOT_CELL_ID ) + return 0; + + bsp = malloc(sizeof(cm_bulkStat_t)); + memset(bsp, 0, sizeof(cm_bulkStat_t)); + + for ( count = 0; count < enump->count; count++ ) { + cm_scache_t *tscp = cm_FindSCache(&enump->entry[count].fid); + int i; + + if (tscp) { + if (lock_TryWrite(&tscp->rw)) { + /* we have an entry that we can look at */ + if (!(tscp->flags & CM_SCACHEFLAG_EACCESS) && cm_HaveCallback(tscp)) { + /* we have a callback on it. Don't bother + * fetching this stat entry, since we're happy + * with the info we have. + */ + lock_ReleaseWrite(&tscp->rw); + cm_ReleaseSCache(tscp); + continue; + } + lock_ReleaseWrite(&tscp->rw); + } /* got lock */ + cm_ReleaseSCache(tscp); + } /* found entry */ + + i = bsp->counter++; + bsp->fids[i].Volume = enump->entry[count].fid.volume; + bsp->fids[i].Vnode = enump->entry[count].fid.vnode; + bsp->fids[i].Unique = enump->entry[count].fid.unique; + + if (bsp->counter == AFSCBMAX) { + code = cm_TryBulkStatRPC(dscp, bsp, userp, reqp); + memset(bsp, 0, sizeof(cm_bulkStat_t)); + } + } + + if (bsp->counter > 0) + code = cm_TryBulkStatRPC(dscp, bsp, userp, reqp); + + free(bsp); + return 0; + } + + long cm_BPlusDirNextEnumEntry(cm_direnum_t *enump, cm_direnum_entry_t **entrypp) { if (enump == NULL || entrypp == NULL || enump->next > enump->count) { *************** *** 2213,2219 **** cm_ReleaseSCache(scp); } ! sprintf(buffer, "'%s' Fid = (%d,%d,%d,%d) Short = '%s' Type %s DV %I64d", entryp->name, entryp->fid.cell, entryp->fid.volume, entryp->fid.vnode, entryp->fid.unique, entryp->shortName, --- 2417,2423 ---- cm_ReleaseSCache(scp); } ! StringCbPrintfA(buffer, sizeof(buffer), "'%S' Fid = (%d,%d,%d,%d) Short = '%S' Type %s DV %I64d", entryp->name, entryp->fid.cell, entryp->fid.volume, entryp->fid.vnode, entryp->fid.unique, entryp->shortName, Index: openafs/src/WINNT/afsd/cm_btree.h diff -c openafs/src/WINNT/afsd/cm_btree.h:1.1.2.7 openafs/src/WINNT/afsd/cm_btree.h:1.1.2.10 *** openafs/src/WINNT/afsd/cm_btree.h:1.1.2.7 Mon Nov 5 13:26:49 2007 --- openafs/src/WINNT/afsd/cm_btree.h Mon Jul 14 09:01:31 2008 *************** *** 48,60 **** typedef struct node *Nptr; typedef struct key { ! char *name; } keyT; - typedef struct dirdata { cm_fid_t fid; ! char * longname; } dataT; typedef struct entry { --- 48,65 ---- typedef struct node *Nptr; typedef struct key { ! normchar_t *name; /* Normalized name */ } keyT; typedef struct dirdata { cm_fid_t fid; ! int shortform; /* This is the short form entry. If ! this value is non-zero, then there ! is another entry in the B-Plus tree ! corresponding to the long name of ! this fid. */ ! clientchar_t *cname; /* Client name (long) */ ! fschar_t * fsname; /* FileServer name */ } dataT; typedef struct entry { *************** *** 136,154 **** Nptr lookup(Tree *B, keyT key); /******************* cache manager directory operations ***************/ ! int cm_BPlusDirLookup(cm_dirOp_t * op, char *entry, cm_fid_t * cfid); ! long cm_BPlusDirCreateEntry(cm_dirOp_t * op, char *entry, cm_fid_t * cfid); ! int cm_BPlusDirDeleteEntry(cm_dirOp_t * op, char *entry); long cm_BPlusDirBuildTree(cm_scache_t *scp, cm_user_t *userp, cm_req_t* reqp); void cm_BPlusDumpStats(void); ! int cm_MemDumpBPlusStats(FILE *outputFile, char *cookie, int lock); ! /******************* directory enumeration operations ****************/ typedef struct cm_direnum_entry { ! char * name; ! cm_fid_t fid; ! char shortName[13]; } cm_direnum_entry_t; typedef struct cm_direnum { --- 141,161 ---- Nptr lookup(Tree *B, keyT key); /******************* cache manager directory operations ***************/ ! ! int cm_BPlusCompareNormalizedKeys(keyT key1, keyT key2, int flags); ! int cm_BPlusDirLookup(cm_dirOp_t * op, clientchar_t *entry, cm_fid_t * cfid); ! int cm_BPlusDirLookupOriginalName(cm_dirOp_t * op, clientchar_t *entry, fschar_t **originalNameRetp); ! long cm_BPlusDirCreateEntry(cm_dirOp_t * op, clientchar_t *entry, cm_fid_t * cfid); ! int cm_BPlusDirDeleteEntry(cm_dirOp_t * op, clientchar_t *entry); long cm_BPlusDirBuildTree(cm_scache_t *scp, cm_user_t *userp, cm_req_t* reqp); void cm_BPlusDumpStats(void); ! int cm_MemDumpBPlusStats(FILE *outputFile, char *cookie, int lock); /******************* directory enumeration operations ****************/ typedef struct cm_direnum_entry { ! clientchar_t *name; ! cm_fid_t fid; ! normchar_t shortName[13]; } cm_direnum_entry_t; typedef struct cm_direnum { *************** *** 157,166 **** cm_direnum_entry_t entry[1]; } cm_direnum_t; ! long cm_BPlusDirEnumerate(cm_scache_t *scp, afs_uint32 locked, char *maskp, cm_direnum_t **enumpp); long cm_BPlusDirNextEnumEntry(cm_direnum_t *enump, cm_direnum_entry_t **entrypp); long cm_BPlusDirFreeEnumeration(cm_direnum_t *enump); long cm_BPlusDirEnumTest(cm_scache_t * dscp, afs_uint32 locked); long cm_InitBPlusDir(void); --- 164,174 ---- cm_direnum_entry_t entry[1]; } cm_direnum_t; ! long cm_BPlusDirEnumerate(cm_scache_t *scp, afs_uint32 locked, clientchar_t *maskp, cm_direnum_t **enumpp); long cm_BPlusDirNextEnumEntry(cm_direnum_t *enump, cm_direnum_entry_t **entrypp); long cm_BPlusDirFreeEnumeration(cm_direnum_t *enump); long cm_BPlusDirEnumTest(cm_scache_t * dscp, afs_uint32 locked); + long cm_BPlusDirEnumBulkStat(cm_scache_t *dscp, cm_direnum_t *enump, cm_user_t *userp, cm_req_t *reqp); long cm_InitBPlusDir(void); *************** *** 179,185 **** /* access keys and pointers in a node */ #define getkey(j, q) (nAdr(j).e[(q)].key) #define getnode(j, q) (nAdr(j).e[(q)].downNode) ! #define setkey(j, q, v) ((q > 0) ? nAdr(j).e[(q)].key.name = strdup((v).name) : NULL) #define setnode(j, q, v) (nAdr(j).e[(q)].downNode = (v)) /* access tree flag values */ --- 187,193 ---- /* access keys and pointers in a node */ #define getkey(j, q) (nAdr(j).e[(q)].key) #define getnode(j, q) (nAdr(j).e[(q)].downNode) ! #define setkey(j, q, v) ((q > 0) ? nAdr(j).e[(q)].key.name = cm_NormStrDup((v).name) : NULL) #define setnode(j, q, v) (nAdr(j).e[(q)].downNode = (v)) /* access tree flag values */ Index: openafs/src/WINNT/afsd/cm_buf.c diff -c openafs/src/WINNT/afsd/cm_buf.c:1.31.2.38.2.1 openafs/src/WINNT/afsd/cm_buf.c:1.31.2.41 *** openafs/src/WINNT/afsd/cm_buf.c:1.31.2.38.2.1 Sun Jun 22 23:02:06 2008 --- openafs/src/WINNT/afsd/cm_buf.c Thu Jun 26 10:38:23 2008 *************** *** 12,20 **** #include #include - #ifndef DJGPP #include - #endif #include #include #include --- 12,18 ---- *************** *** 225,236 **** while (buf_ShutdownFlag == 0) { if (!wasDirty) { - #ifndef DJGPP i = SleepEx(5000, 1); if (i != 0) continue; - #else - thrd_Sleep(5000); - #endif /* DJGPP */ } wasDirty = 0; --- 223,230 ---- *************** *** 481,489 **** "buf_IncrSyncer"); osi_assertx(phandle != NULL, "buf: can't create incremental sync proc"); - #ifndef DJGPP CloseHandle(phandle); - #endif /* !DJGPP */ } #ifdef TESTING --- 475,481 ---- *************** *** 910,915 **** --- 902,911 ---- * we hold the global lock. */ + /* Don't recycle a buffer held by the redirector. */ + if (bp->flags & CM_BUF_REDIR) + continue; + /* don't recycle someone in our own chunk */ if (!cm_FidCmp(&bp->fid, &scp->fid) && (bp->offset.LowPart & (-cm_chunkSize)) Index: openafs/src/WINNT/afsd/cm_buf.h diff -c openafs/src/WINNT/afsd/cm_buf.h:1.12.4.14 openafs/src/WINNT/afsd/cm_buf.h:1.12.4.16 *** openafs/src/WINNT/afsd/cm_buf.h:1.12.4.14 Thu Apr 24 12:22:44 2008 --- openafs/src/WINNT/afsd/cm_buf.h Thu Jun 26 12:38:29 2008 *************** *** 106,111 **** --- 106,112 ---- #define CM_BUF_WAITING 0x40 /* someone's waiting for a flag to change */ #define CM_BUF_INDL 0x80 /* in the dirty list */ #define CM_BUF_EOF 0x100 /* read 0 bytes; used for detecting EOF */ + #define CM_BUF_REDIR 0x200 /* buffer held by the redirector */ typedef struct cm_buf_ops { long (*Writep)(void *, osi_hyper_t *, long, long, struct cm_user *, *************** *** 202,207 **** --- 203,210 ---- extern long buf_ForceDataVersion(cm_scache_t * scp, afs_uint64 fromVersion, afs_uint64 toVersion); + extern int cm_DumpBufHashTable(FILE *outputFile, char *cookie, int lock); + /* error codes */ #define CM_BUF_EXISTS 1 /* buffer exists, and shouldn't */ #endif /* _BUF_H__ENV_ */ Index: openafs/src/WINNT/afsd/cm_callback.c diff -c openafs/src/WINNT/afsd/cm_callback.c:1.41.4.43 openafs/src/WINNT/afsd/cm_callback.c:1.41.4.45 *** openafs/src/WINNT/afsd/cm_callback.c:1.41.4.43 Mon Apr 14 18:44:03 2008 --- openafs/src/WINNT/afsd/cm_callback.c Thu Jun 26 12:38:29 2008 *************** *** 11,27 **** #include #include - #ifndef DJGPP #include #include - #else - #include - #endif /* !DJGPP */ #include #include #include #include "afsd.h" #include #include --- 11,24 ---- #include #include #include #include #include #include #include #include "afsd.h" + #include "smb.h" #include #include *************** *** 748,755 **** cep->cbExpires = volp->cbExpiresRO; cm_PutVolume(volp); } ! } else ! cep->cbExpires = scp->cbExpires; cep->refCount = scp->refCount; cep->opens = scp->openReads; cep->writers = scp->openWrites; --- 745,754 ---- cep->cbExpires = volp->cbExpiresRO; cm_PutVolume(volp); } ! } else { ! /* TODO: deal with time_t below */ ! cep->cbExpires = (afs_int32) scp->cbExpires; ! } cep->refCount = scp->refCount; cep->opens = scp->openReads; cep->writers = scp->openWrites; *************** *** 863,870 **** cep->cbExpires = volp->cbExpiresRO; cm_PutVolume(volp); } ! } else ! cep->cbExpires = scp->cbExpires; cep->refCount = scp->refCount; cep->opens = scp->openReads; cep->writers = scp->openWrites; --- 862,871 ---- cep->cbExpires = volp->cbExpiresRO; cm_PutVolume(volp); } ! } else { ! /* TODO: handle time_t */ ! cep->cbExpires = (afs_int32) scp->cbExpires; ! } cep->refCount = scp->refCount; cep->opens = scp->openReads; cep->writers = scp->openWrites; *************** *** 1317,1324 **** ntohl(host), ntohs(port)); if (cm_data.rootCellp) { ! t_name = (char *)malloc(strlen(cm_data.rootCellp->name)+1); ! strcpy(t_name, cm_data.rootCellp->name); } else { t_name = (char *)malloc(1); t_name[0] = '\0'; --- 1318,1324 ---- ntohl(host), ntohs(port)); if (cm_data.rootCellp) { ! t_name = strdup(cm_data.rootCellp->name); } else { t_name = (char *)malloc(1); t_name[0] = '\0'; Index: openafs/src/WINNT/afsd/cm_cell.c diff -c openafs/src/WINNT/afsd/cm_cell.c:1.23.2.13 openafs/src/WINNT/afsd/cm_cell.c:1.23.2.15 *** openafs/src/WINNT/afsd/cm_cell.c:1.23.2.13 Thu Feb 14 22:31:36 2008 --- openafs/src/WINNT/afsd/cm_cell.c Thu Jun 26 10:38:23 2008 *************** *** 10,20 **** #include #include - #ifndef DJGPP #include #include #include - #endif /* !DJGPP */ #include #include #include --- 10,18 ---- *************** *** 151,157 **** lock_ObtainRead(&cm_cellLock); for (cp = cm_data.cellNameHashTablep[hash]; cp; cp=cp->nameNextp) { ! if (stricmp(namep, cp->name) == 0) { strcpy(fullname, cp->name); break; } --- 149,155 ---- lock_ObtainRead(&cm_cellLock); for (cp = cm_data.cellNameHashTablep[hash]; cp; cp=cp->nameNextp) { ! if (cm_stricmp_utf8(namep, cp->name) == 0) { strcpy(fullname, cp->name); break; } *************** *** 178,184 **** * to the list so check again while holding the write lock */ for (cp = cm_data.cellNameHashTablep[hash]; cp; cp=cp->nameNextp) { ! if (stricmp(namep, cp->name) == 0) { strcpy(fullname, cp->name); break; } --- 176,182 ---- * to the list so check again while holding the write lock */ for (cp = cm_data.cellNameHashTablep[hash]; cp; cp=cp->nameNextp) { ! if (cm_stricmp_utf8(namep, cp->name) == 0) { strcpy(fullname, cp->name); break; } *************** *** 247,253 **** */ hash = CM_CELL_NAME_HASH(fullname); for (cp2 = cm_data.cellNameHashTablep[hash]; cp2; cp2=cp2->nameNextp) { ! if (stricmp(fullname, cp2->name) == 0) { break; } } --- 245,251 ---- */ hash = CM_CELL_NAME_HASH(fullname); for (cp2 = cm_data.cellNameHashTablep[hash]; cp2; cp2=cp2->nameNextp) { ! if (cm_stricmp_utf8(fullname, cp2->name) == 0) { break; } } Index: openafs/src/WINNT/afsd/cm_config.c diff -c openafs/src/WINNT/afsd/cm_config.c:1.26.4.4 openafs/src/WINNT/afsd/cm_config.c:1.26.4.5 *** openafs/src/WINNT/afsd/cm_config.c:1.26.4.4 Mon Apr 7 10:20:19 2008 --- openafs/src/WINNT/afsd/cm_config.c Thu Jun 26 08:45:11 2008 *************** *** 93,103 **** p = strrchr(name, '.'); if (p) { if (i == 1 && ! (!stricmp(p,".dll") || ! !stricmp(p,".exe") || ! !stricmp(p,".ini") || ! !stricmp(p,".db") || ! !stricmp(p,".drv"))) return 1; } return 0; --- 93,103 ---- p = strrchr(name, '.'); if (p) { if (i == 1 && ! (!cm_stricmp_utf8N(p,".dll") || ! !cm_stricmp_utf8N(p,".exe") || ! !cm_stricmp_utf8N(p,".ini") || ! !cm_stricmp_utf8N(p,".db") || ! !cm_stricmp_utf8N(p,".drv"))) return 1; } return 0; *************** *** 203,210 **** inRightCell, osi_LogSaveString(afsd_logp,lineBuffer)); #endif } ! else if (strnicmp(lineBuffer+1, cellNamep, ! strlen(cellNamep)) == 0) { /* partial match */ if (partial) { /* ambiguous */ fclose(tfilep); --- 203,209 ---- inRightCell, osi_LogSaveString(afsd_logp,lineBuffer)); #endif } ! else if (cm_stricmp_utf8(lineBuffer+1, cellNamep) == 0) { /* partial match */ if (partial) { /* ambiguous */ fclose(tfilep); Index: openafs/src/WINNT/afsd/cm_conn.c diff -c openafs/src/WINNT/afsd/cm_conn.c:1.49.2.43 openafs/src/WINNT/afsd/cm_conn.c:1.49.2.45 *** openafs/src/WINNT/afsd/cm_conn.c:1.49.2.43 Fri May 2 15:28:18 2008 --- openafs/src/WINNT/afsd/cm_conn.c Wed Jul 16 00:44:27 2008 *************** *** 10,18 **** #include #include - #ifndef DJGPP #include - #endif /* !DJGPP */ #include #include #include --- 10,16 ---- *************** *** 78,111 **** dummyLen = sizeof(DWORD); code = RegQueryValueEx(parmKey, "ConnDeadTimeout", NULL, NULL, (BYTE *) &dwValue, &dummyLen); ! if (code == ERROR_SUCCESS) ConnDeadtimeout = (unsigned short)dwValue; ! dummyLen = sizeof(DWORD); code = RegQueryValueEx(parmKey, "HardDeadTimeout", NULL, NULL, (BYTE *) &dwValue, &dummyLen); ! if (code == ERROR_SUCCESS) HardDeadtimeout = (unsigned short)dwValue; ! afsi_log("HardDeadTimeout is %d", HardDeadtimeout); ! dummyLen = sizeof(DWORD); code = RegQueryValueEx(parmKey, "IdleDeadTimeout", NULL, NULL, (BYTE *) &dwValue, &dummyLen); ! if (code == ERROR_SUCCESS) IdleDeadtimeout = (unsigned short)dwValue; ! afsi_log("IdleDeadTimeout is %d", IdleDeadtimeout); ! RegCloseKey(parmKey); } afsi_log("lanmanworkstation : SessTimeout %u", RDRtimeout); ! if (ConnDeadtimeout == 0) ConnDeadtimeout = (unsigned short) (RDRtimeout / 2); ! afsi_log("ConnDeadTimeout is %d", ConnDeadtimeout); ! if (HardDeadtimeout == 0) HardDeadtimeout = (unsigned short) RDRtimeout; ! afsi_log("HardDeadTimeout is %d", HardDeadtimeout); ! osi_EndOnce(&once); } } --- 76,115 ---- dummyLen = sizeof(DWORD); code = RegQueryValueEx(parmKey, "ConnDeadTimeout", NULL, NULL, (BYTE *) &dwValue, &dummyLen); ! if (code == ERROR_SUCCESS) { ConnDeadtimeout = (unsigned short)dwValue; ! afsi_log("ConnDeadTimeout is %d", ConnDeadtimeout); ! } dummyLen = sizeof(DWORD); code = RegQueryValueEx(parmKey, "HardDeadTimeout", NULL, NULL, (BYTE *) &dwValue, &dummyLen); ! if (code == ERROR_SUCCESS) { HardDeadtimeout = (unsigned short)dwValue; ! afsi_log("HardDeadTimeout is %d", HardDeadtimeout); ! } dummyLen = sizeof(DWORD); code = RegQueryValueEx(parmKey, "IdleDeadTimeout", NULL, NULL, (BYTE *) &dwValue, &dummyLen); ! if (code == ERROR_SUCCESS) { IdleDeadtimeout = (unsigned short)dwValue; ! afsi_log("IdleDeadTimeout is %d", IdleDeadtimeout); ! } RegCloseKey(parmKey); } afsi_log("lanmanworkstation : SessTimeout %u", RDRtimeout); ! if (ConnDeadtimeout == 0) { ConnDeadtimeout = (unsigned short) (RDRtimeout / 2); ! afsi_log("ConnDeadTimeout is %d", ConnDeadtimeout); ! } ! if (HardDeadtimeout == 0) { HardDeadtimeout = (unsigned short) RDRtimeout; ! afsi_log("HardDeadTimeout is %d", HardDeadtimeout); ! } ! if (ConnDeadtimeout == 0) { ! IdleDeadtimeout = (unsigned short) RDRtimeout; ! afsi_log("IdleDeadTimeout is %d", IdleDeadtimeout); ! } osi_EndOnce(&once); } } *************** *** 113,123 **** void cm_InitReq(cm_req_t *reqp) { memset((char *)reqp, 0, sizeof(cm_req_t)); - #ifndef DJGPP reqp->startTime = GetTickCount(); - #else - gettimeofday(&reqp->startTime, NULL); - #endif } static long cm_GetServerList(struct cm_fid *fidp, struct cm_user *userp, --- 117,123 ---- *************** *** 216,227 **** * and retry */ /* timeleft - get if from reqp the same way as cmXonnByMServers does */ - #ifndef DJGPP timeUsed = (GetTickCount() - reqp->startTime) / 1000; - #else - gettimeofday(&now, NULL); - timeUsed = sub_time(now, reqp->startTime) / 1000; - #endif /* leave 5 seconds margin for sleep */ if (reqp->flags & CM_REQ_NORETRY) --- 216,222 ---- *************** *** 429,472 **** { char addr[16]; char *format; - #ifndef DJGPP DWORD msgID; - #endif switch ( errorCode ) { case VNOVOL: - #ifndef DJGPP msgID = MSG_SERVER_REPORTS_VNOVOL; - #endif format = "Server %s reported volume %d as not attached."; break; case VMOVED: - #ifndef DJGPP msgID = MSG_SERVER_REPORTS_VMOVED; - #endif format = "Server %s reported volume %d as moved."; break; case VOFFLINE: - #ifndef DJGPP msgID = MSG_SERVER_REPORTS_VOFFLINE; - #endif format = "Server %s reported volume %d as offline."; break; case VSALVAGE: - #ifndef DJGPP msgID = MSG_SERVER_REPORTS_VSALVAGE; - #endif format = "Server %s reported volume %d as needs salvage."; break; case VNOSERVICE: - #ifndef DJGPP msgID = MSG_SERVER_REPORTS_VNOSERVICE; - #endif format = "Server %s reported volume %d as not in service."; break; case VIO: - #ifndef DJGPP msgID = MSG_SERVER_REPORTS_VIO; - #endif format = "Server %s reported volume %d as temporarily unaccessible."; break; } --- 424,453 ---- *************** *** 480,488 **** ((serverp->addr.sin_addr.s_addr & 0xff000000)>> 24)); osi_Log2(afsd_logp, format, osi_LogSaveString(afsd_logp,addr), fidp->volume); - #ifndef DJGPP LogEvent(EVENTLOG_WARNING_TYPE, msgID, addr, fidp->volume); - #endif } /* Mark server offline for this volume */ --- 461,467 ---- *************** *** 584,592 **** ((serverp->addr.sin_addr.s_addr & 0xff0000)>> 16), ((serverp->addr.sin_addr.s_addr & 0xff000000)>> 24)); - #ifndef DJGPP LogEvent(EVENTLOG_WARNING_TYPE, MSG_RX_HARD_DEAD_TIME_EXCEEDED, addr); - #endif /* !DJGPP */ osi_Log1(afsd_logp, "cm_Analyze: hardDeadTime exceeded addr[%s]", osi_LogSaveString(afsd_logp,addr)); --- 563,569 ---- *************** *** 793,803 **** cm_server_t *tsp; long firstError = 0; int someBusy = 0, someOffline = 0, allOffline = 1, allBusy = 1, allDown = 1; long timeUsed, timeLeft, hardTimeLeft; ! #ifdef DJGPP ! struct timeval now; ! #endif /* DJGPP */ ! *connpp = NULL; if (serversp == NULL) { --- 770,778 ---- cm_server_t *tsp; long firstError = 0; int someBusy = 0, someOffline = 0, allOffline = 1, allBusy = 1, allDown = 1; + #ifdef SET_RX_TIMEOUTS_TO_TIMELEFT long timeUsed, timeLeft, hardTimeLeft; ! #endif *connpp = NULL; if (serversp == NULL) { *************** *** 805,820 **** return CM_ERROR_ALLDOWN; } ! #ifndef DJGPP timeUsed = (GetTickCount() - reqp->startTime) / 1000; - #else - gettimeofday(&now, NULL); - timeUsed = sub_time(now, reqp->startTime) / 1000; - #endif /* leave 5 seconds margin of safety */ timeLeft = ConnDeadtimeout - timeUsed - 5; hardTimeLeft = HardDeadtimeout - timeUsed - 5; lock_ObtainRead(&cm_serverLock); for (tsrp = serversp; tsrp; tsrp=tsrp->next) { --- 780,792 ---- return CM_ERROR_ALLDOWN; } ! #ifdef SET_RX_TIMEOUTS_TO_TIMELEFT timeUsed = (GetTickCount() - reqp->startTime) / 1000; /* leave 5 seconds margin of safety */ timeLeft = ConnDeadtimeout - timeUsed - 5; hardTimeLeft = HardDeadtimeout - timeUsed - 5; + #endif lock_ObtainRead(&cm_serverLock); for (tsrp = serversp; tsrp; tsrp=tsrp->next) { *************** *** 848,853 **** --- 820,826 ---- code = cm_ConnByServer(tsp, usersp, connpp); if (code == 0) { /* cm_CBS only returns 0 */ cm_PutServer(tsp); + #ifdef SET_RX_TIMEOUTS_TO_TIMELEFT /* Set RPC timeout */ if (timeLeft > ConnDeadtimeout) timeLeft = ConnDeadtimeout; *************** *** 859,864 **** --- 832,838 ---- rx_SetConnDeadTime((*connpp)->callp, timeLeft); rx_SetConnHardDeadTime((*connpp)->callp, (u_short) hardTimeLeft); lock_ReleaseMutex(&(*connpp)->mx); + #endif return 0; } Index: openafs/src/WINNT/afsd/cm_conn.h diff -c openafs/src/WINNT/afsd/cm_conn.h:1.13.4.11 openafs/src/WINNT/afsd/cm_conn.h:1.13.4.13 *** openafs/src/WINNT/afsd/cm_conn.h:1.13.4.11 Mon Apr 28 11:06:14 2008 --- openafs/src/WINNT/afsd/cm_conn.h Wed Jul 16 00:44:27 2008 *************** *** 13,19 **** #define CM_CONN_DEFAULTRDRTIMEOUT 45 #define CM_CONN_CONNDEADTIME 0 #define CM_CONN_HARDDEADTIME 0 ! #define CM_CONN_IDLEDEADTIME 30 extern unsigned short ConnDeadtimeout; extern unsigned short HardDeadtimeout; --- 13,19 ---- #define CM_CONN_DEFAULTRDRTIMEOUT 45 #define CM_CONN_CONNDEADTIME 0 #define CM_CONN_HARDDEADTIME 0 ! #define CM_CONN_IDLEDEADTIME 0 extern unsigned short ConnDeadtimeout; extern unsigned short HardDeadtimeout; *************** *** 39,54 **** * to the cache manager functions. */ typedef struct cm_req { ! DWORD startTime; /* Quit before RDR times us out */ ! int rpcError; /* RPC error code */ ! int volumeError; /* volume error code */ ! int accessError; /* access error code */ ! struct cm_server * tokenIdleErrorServp; /* server that reported a token/idle error other than expired */ ! int tokenError; ! int idleError; ! afs_uint32 flags; ! char * tidPathp; ! char * relPathp; } cm_req_t; /* flags in cm_req structure */ --- 39,54 ---- * to the cache manager functions. */ typedef struct cm_req { ! DWORD startTime; /* Quit before RDR times us out */ ! int rpcError; /* RPC error code */ ! int