Windows: remove unnecessary DirectoryEnumEvent
authorJeffrey Altman <jaltman@your-file-system.com>
Fri, 17 Feb 2012 15:37:34 +0000 (10:37 -0500)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Fri, 17 Feb 2012 22:28:40 +0000 (14:28 -0800)
The DirectoryEnumEvent is not required to implement:

  AFSSetEnumerationEvent
  AFSClearEnumerationEvent
  AFSIsEnumerationInProgress

The DirectoryEnumCount is modified by interlocked operations
and can be used as a marker for when an enumeration is in progress.

Change-Id: I414ce2bc753b0fd60a3fac51c2cf3d264a32ab05
Reviewed-on: http://gerrit.openafs.org/6725
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>

src/WINNT/afsrdr/common/AFSRedirCommonStructs.h
src/WINNT/afsrdr/kernel/lib/AFSFcbSupport.cpp
src/WINNT/afsrdr/kernel/lib/AFSGeneric.cpp

index f813a58..2dcf80a 100644 (file)
@@ -217,8 +217,6 @@ typedef struct _AFS_NONPAGED_FCB
         struct
         {
 
-            KEVENT          DirectoryEnumEvent;
-
             LONG            DirectoryEnumCount;
 
         } Directory;
index 9f697f7..5e148e4 100644 (file)
@@ -179,14 +179,6 @@ AFSInitFcb( IN AFSDirectoryCB  *DirEntry)
             //
 
             pFcb->Header.NodeTypeCode = AFS_DIRECTORY_FCB;
-
-            //
-            // Initialize enumeration information
-            //
-
-            KeInitializeEvent( &pFcb->NPFcb->Specific.Directory.DirectoryEnumEvent,
-                               NotificationEvent,
-                               FALSE);
         }
         else if( pObjectInfo->FileType == AFS_FILE_TYPE_FILE)
         {
@@ -958,14 +950,6 @@ AFSInitRootFcb( IN ULONGLONG ProcessID,
         pFcb->NPFcb = pNPFcb;
 
         //
-        // Initialize enumeration information
-        //
-
-        KeInitializeEvent( &pFcb->NPFcb->Specific.Directory.DirectoryEnumEvent,
-                           NotificationEvent,
-                           FALSE);
-
-        //
         // Save the root Fcb in the VolumeCB
         //
 
index ec9a025..dfd8968 100644 (file)
@@ -5398,25 +5398,10 @@ AFSSetEnumerationEvent( IN AFSFcb *Fcb)
     {
 
         case AFS_DIRECTORY_FCB:
-        {
-
-            KeSetEvent( &Fcb->NPFcb->Specific.Directory.DirectoryEnumEvent,
-                        0,
-                        FALSE);
-
-            lCount = InterlockedIncrement( &Fcb->NPFcb->Specific.Directory.DirectoryEnumCount);
-
-            break;
-        }
-
         case AFS_ROOT_FCB:
         case AFS_ROOT_ALL:
         {
 
-            KeSetEvent( &Fcb->NPFcb->Specific.Directory.DirectoryEnumEvent,
-                        0,
-                        FALSE);
-
             lCount = InterlockedIncrement( &Fcb->NPFcb->Specific.Directory.DirectoryEnumCount);
 
             break;
@@ -5440,21 +5425,6 @@ AFSClearEnumerationEvent( IN AFSFcb *Fcb)
     {
 
         case AFS_DIRECTORY_FCB:
-        {
-
-            ASSERT( Fcb->NPFcb->Specific.Directory.DirectoryEnumCount > 0);
-
-            lCount = InterlockedDecrement( &Fcb->NPFcb->Specific.Directory.DirectoryEnumCount);
-
-            if( lCount == 0)
-            {
-
-                KeClearEvent( &Fcb->NPFcb->Specific.Directory.DirectoryEnumEvent);
-            }
-
-            break;
-        }
-
         case AFS_ROOT_FCB:
         case AFS_ROOT_ALL:
         {
@@ -5463,12 +5433,6 @@ AFSClearEnumerationEvent( IN AFSFcb *Fcb)
 
             lCount = InterlockedDecrement( &Fcb->NPFcb->Specific.Directory.DirectoryEnumCount);
 
-            if( lCount == 0)
-            {
-
-                KeClearEvent( &Fcb->NPFcb->Specific.Directory.DirectoryEnumEvent);
-            }
-
             break;
         }
     }
@@ -5491,30 +5455,15 @@ AFSIsEnumerationInProcess( IN AFSObjectInfoCB *ObjectInfo)
             try_return( bIsInProcess);
         }
 
-        //
-        // Depending on the type of node, set the event
-        //
-
         switch( ObjectInfo->Fcb->Header.NodeTypeCode)
         {
 
             case AFS_DIRECTORY_FCB:
-            {
-
-                if( KeReadStateEvent( &ObjectInfo->Fcb->NPFcb->Specific.Directory.DirectoryEnumEvent))
-                {
-
-                    bIsInProcess = TRUE;
-                }
-
-                break;
-            }
-
             case AFS_ROOT_FCB:
             case AFS_ROOT_ALL:
             {
 
-                if( KeReadStateEvent( &ObjectInfo->Fcb->NPFcb->Specific.Directory.DirectoryEnumEvent))
+                if( ObjectInfo->Fcb->NPFcb->Specific.Directory.DirectoryEnumCount > 0)
                 {
 
                     bIsInProcess = TRUE;