// Initialize the Ccb for the file.
//
- ntStatus = AFSInitCcb( Ccb);
+ ntStatus = AFSInitCcb( Ccb,
+ AFSGlobalRoot->DirectoryCB,
+ 0,
+ 0);
if( !NT_SUCCESS( ntStatus))
{
try_return( ntStatus);
}
- //
- // Setup the Ccb
- //
-
- (*Ccb)->DirectoryCB = AFSGlobalRoot->DirectoryCB;
-
//
// Increment the open count on this Fcb
//
// Initialize the Ccb for the file.
//
- ntStatus = AFSInitCcb( Ccb);
+ ntStatus = AFSInitCcb( Ccb,
+ VolumeCB->DirectoryCB,
+ *pDesiredAccess,
+ 0);
if( !NT_SUCCESS( ntStatus))
{
bAllocatedCcb = TRUE;
- //
- // Setup the ccb
- //
-
- (*Ccb)->DirectoryCB = VolumeCB->DirectoryCB;
-
- (*Ccb)->GrantedAccess = *pDesiredAccess;
-
//
// OK, update the share access on the fileobject
//
// Initialize the Ccb for the file.
//
- ntStatus = AFSInitCcb( Ccb);
+ ntStatus = AFSInitCcb( Ccb,
+ pDirEntry,
+ *pDesiredAccess,
+ 0);
if( !NT_SUCCESS( ntStatus))
{
bAllocatedCcb = TRUE;
- //
- // Initialize the Ccb
- //
-
- (*Ccb)->DirectoryCB = pDirEntry;
-
- (*Ccb)->GrantedAccess = *pDesiredAccess;
-
//
// If this is a file, update the headers filesizes.
//
// Initialize the Ccb for the file.
//
- ntStatus = AFSInitCcb( Ccb);
+ ntStatus = AFSInitCcb( Ccb,
+ ParentDirectoryCB,
+ *pDesiredAccess,
+ 0);
if( !NT_SUCCESS( ntStatus))
{
bAllocatedCcb = TRUE;
- //
- // Initialize the Ccb
- //
-
- (*Ccb)->DirectoryCB = ParentDirectoryCB;
-
- (*Ccb)->GrantedAccess = *pDesiredAccess;
-
if( TargetDirectoryCB != NULL &&
FsRtlAreNamesEqual( &TargetDirectoryCB->NameInformation.FileName,
TargetName,
// Initialize the Ccb for the file.
//
- ntStatus = AFSInitCcb( Ccb);
+ ntStatus = AFSInitCcb( Ccb,
+ DirectoryCB,
+ *pDesiredAccess,
+ ulFileAccess);
if( !NT_SUCCESS( ntStatus))
{
bAllocatedCcb = TRUE;
- (*Ccb)->DirectoryCB = DirectoryCB;
-
- (*Ccb)->FileAccess = ulFileAccess;
-
- (*Ccb)->GrantedAccess = *pDesiredAccess;
-
//
// Perform the access check on the target if this is a mount point or symlink
//
// Initialize the Ccb for the file.
//
- ntStatus = AFSInitCcb( Ccb);
+ ntStatus = AFSInitCcb( Ccb,
+ DirectoryCB,
+ *pDesiredAccess,
+ 0);
if( !NT_SUCCESS( ntStatus))
{
bAllocatedCcb = TRUE;
- //
- // Initialize the Ccb
- //
-
- (*Ccb)->DirectoryCB = DirectoryCB;
-
- (*Ccb)->GrantedAccess = *pDesiredAccess;
-
//
// Set the file length to zero
//
// Initialize the Ccb for the file.
//
- ntStatus = AFSInitCcb( Ccb);
+ ntStatus = AFSInitCcb( Ccb,
+ pParentObjectInfo->Specific.Directory.PIOCtlDirectoryCB,
+ 0,
+ 0);
if( !NT_SUCCESS( ntStatus))
{
bAllocatedCcb = TRUE;
- //
- // Setup the Ccb
- //
-
- (*Ccb)->DirectoryCB = pParentObjectInfo->Specific.Directory.PIOCtlDirectoryCB;
-
//
// Set the PIOCtl index
//
// Initialize the Ccb for the file.
//
- ntStatus = AFSInitCcb( Ccb);
+ ntStatus = AFSInitCcb( Ccb,
+ DirectoryCB,
+ 0,
+ 0);
if( !NT_SUCCESS( ntStatus))
{
bAllocatedCcb = TRUE;
- //
- // Setup the Ccb
- //
-
- (*Ccb)->DirectoryCB = DirectoryCB;
-
//
// Call the service to open the share
//
}
NTSTATUS
-AFSInitCcb( IN OUT AFSCcb **Ccb)
+AFSInitCcb( IN OUT AFSCcb **Ccb,
+ IN AFSDirectoryCB *DirectoryCB,
+ IN ACCESS_MASK GrantedAccess,
+ IN ULONG FileAccess)
{
NTSTATUS Status = STATUS_SUCCESS;
AFSCcb *pCcb = NULL;
+ LONG lCount;
__Enter
{
ExInitializeResourceLite( &pCcb->NPCcb->CcbLock);
+ pCcb->DirectoryCB = DirectoryCB;
+
+ lCount = InterlockedIncrement( &pCcb->DirectoryCB->DirOpenReferenceCount);
+
+ AFSDbgLogMsg( AFS_SUBSYSTEM_DIRENTRY_REF_COUNTING,
+ AFS_TRACE_LEVEL_VERBOSE,
+ "AFSInitCcb Increment count on %wZ DE %p Ccb %p Cnt %d\n",
+ &pCcb->DirectoryCB->NameInformation.FileName,
+ pCcb->DirectoryCB,
+ pCcb,
+ lCount);
+
+ pCcb->GrantedAccess = GrantedAccess;
+
+ pCcb->FileAccess = FileAccess;
+
//
// Return the Ccb
//
IN AFSCcb *Ccb)
{
+ LONG lCount;
+
AFSAcquireExcl( &Ccb->NPCcb->CcbLock,
TRUE);
AFSExFreePoolWithTag( Ccb->NotifyMask.Buffer, AFS_GENERIC_MEMORY_7_TAG);
}
+ if ( Ccb->DirectoryCB != NULL)
+ {
+
+ lCount = InterlockedDecrement( &Ccb->DirectoryCB->DirOpenReferenceCount);
+
+ AFSDbgLogMsg( AFS_SUBSYSTEM_DIRENTRY_REF_COUNTING,
+ AFS_TRACE_LEVEL_VERBOSE,
+ "AFSRemoveCcb Decrement count on %wZ DE %p Ccb %p Cnt %d\n",
+ &Ccb->DirectoryCB->NameInformation.FileName,
+ Ccb->DirectoryCB,
+ Ccb,
+ lCount);
+
+ ASSERT( lCount >= 0);
+ }
+
AFSReleaseResource( &Ccb->NPCcb->CcbLock);
//