Windows: RefCounts, Asserts, and Trace Logging
authorJeffrey Altman <jaltman@your-file-system.com>
Mon, 26 Nov 2012 16:25:43 +0000 (11:25 -0500)
committerJeffrey Altman <jaltman@your-file-system.com>
Thu, 29 Nov 2012 23:57:37 +0000 (15:57 -0800)
commitb5876a60f7406cdf67a4802b5b6fdf772a303eff
treee1e6c78dfe1ad46ff5eebc09ff1a41a06851a349
parent438b0d8a239068c58065f7a552d45b8077f027dd
Windows: RefCounts, Asserts, and Trace Logging

Rename DirectoryCB.OpenReferenceCount to DirOpenReferenceCount
to distinguish it from the FCB.OpenReferenceCount.  This makes
it easier to search for instances within an editor or debugger.

Ensure that all InterlockedIncrement and InterlockedDecrement
calls on a reference count field assign their value to a local
'lCount' variable.  Ensure that 'lCount' is used within any
trace log messages and conditionals.

Add ASSERT( lCount >= 0) after all reference count decrements
in order to catch underflows.

Change conditionals from (RefCount == 0) to (RefCount <= 0) so
that object destruction can occur when there has been an underflow.
This is important in release builds for which ASSERT() is a no-op.

Change-Id: I1d10076464c68745ede117eef2f728f70a0003c1
Reviewed-on: http://gerrit.openafs.org/8522
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>
12 files changed:
src/WINNT/afsrdr/kernel/lib/AFSClose.cpp
src/WINNT/afsrdr/kernel/lib/AFSCommSupport.cpp
src/WINNT/afsrdr/kernel/lib/AFSCreate.cpp
src/WINNT/afsrdr/kernel/lib/AFSDirControl.cpp
src/WINNT/afsrdr/kernel/lib/AFSExtentsSupport.cpp
src/WINNT/afsrdr/kernel/lib/AFSFcbSupport.cpp
src/WINNT/afsrdr/kernel/lib/AFSFileInfo.cpp
src/WINNT/afsrdr/kernel/lib/AFSGeneric.cpp
src/WINNT/afsrdr/kernel/lib/AFSNameSupport.cpp
src/WINNT/afsrdr/kernel/lib/AFSNetworkProviderSupport.cpp
src/WINNT/afsrdr/kernel/lib/AFSWorker.cpp
src/WINNT/afsrdr/kernel/lib/Include/AFSStructs.h