示例#1
0
VOID FspFileNodeDelete(FSP_FILE_NODE *FileNode)
{
    PAGED_CODE();

    FSP_FSVOL_DEVICE_EXTENSION *FsvolDeviceExtension =
        FspFsvolDeviceExtension(FileNode->FsvolDeviceObject);

    FsRtlUninitializeFileLock(&FileNode->FileLock);

    FsRtlTeardownPerStreamContexts(&FileNode->Header);

    FspMetaCacheInvalidateItem(FsvolDeviceExtension->DirInfoCache, FileNode->NonPaged->DirInfo);
    FspMetaCacheInvalidateItem(FsvolDeviceExtension->SecurityCache, FileNode->Security);

    FspDeviceDereference(FileNode->FsvolDeviceObject);

    if (0 != FileNode->ExternalFileName)
        FspFree(FileNode->ExternalFileName);

    ExDeleteResourceLite(&FileNode->NonPaged->PagingIoResource);
    ExDeleteResourceLite(&FileNode->NonPaged->Resource);
    FspFree(FileNode->NonPaged);

    FspFree(FileNode);
}
示例#2
0
文件: fcb.c 项目: hoangduit/reactos
VOID
NTAPI
FatDeleteFcb(IN PFAT_IRP_CONTEXT IrpContext,
             IN PFCB Fcb)
{
    DPRINT("FatDeleteFcb %p\n", Fcb);

    if (Fcb->OpenCount != 0)
    {
        DPRINT1("Trying to delete FCB with OpenCount %d\n", Fcb->OpenCount);
        ASSERT(FALSE);
    }

    if ((Fcb->Header.NodeTypeCode == FAT_NTC_DCB) ||
        (Fcb->Header.NodeTypeCode == FAT_NTC_ROOT_DCB))
    {
        /* Make sure it's a valid deletion */
        ASSERT(Fcb->Dcb.DirectoryFileOpenCount == 0);
        ASSERT(IsListEmpty(&Fcb->Dcb.ParentDcbList));
        ASSERT(Fcb->Dcb.DirectoryFile == NULL);
    }
    else
    {
        /* Free locks */
        FsRtlUninitializeFileLock(&Fcb->Fcb.Lock);
        FsRtlUninitializeOplock(&Fcb->Fcb.Oplock);
    }

    /* Release any possible filter contexts */
    FsRtlTeardownPerStreamContexts(&Fcb->Header);

    /* Remove from parents queue */
    if (Fcb->Header.NodeTypeCode != FAT_NTC_ROOT_DCB)
    {
        RemoveEntryList(&(Fcb->ParentDcbLinks));
    }

    /* Free FullFAT handle */
    if (Fcb->FatHandle) FF_Close(Fcb->FatHandle);

    /* Remove from the splay table */
    if (FlagOn(Fcb->State, FCB_STATE_HAS_NAMES))
        FatRemoveNames(IrpContext, Fcb);

    /* Free file name buffers */
    if (Fcb->Header.NodeTypeCode != FAT_NTC_ROOT_DCB)
    {
        if (Fcb->FullFileName.Buffer)
            ExFreePool(Fcb->FullFileName.Buffer);
    }

    if (Fcb->ExactCaseLongName.Buffer)
        ExFreePool(Fcb->ExactCaseLongName.Buffer);

    /* Free this FCB, finally */
    ExFreePool(Fcb);
}
示例#3
0
文件: create.c 项目: nmlgc/dokany
NTSTATUS
DokanFreeFCB(
  __in PDokanFCB Fcb
  )
{
	PDokanVCB vcb;

	ASSERT(Fcb != NULL);

	vcb = Fcb->Vcb;

	KeEnterCriticalRegion();
	ExAcquireResourceExclusiveLite(&vcb->Resource, TRUE);
	ExAcquireResourceExclusiveLite(&Fcb->Resource, TRUE);

	InterlockedDecrement(&Fcb->FileCount);

	if (Fcb->FileCount == 0) {

		RemoveEntryList(&Fcb->NextFCB);

		DDbgPrint("  Free FCB:%p\n", Fcb);
		ExFreePool(Fcb->FileName.Buffer);

#if _WIN32_WINNT >= 0x0501
		FsRtlTeardownPerStreamContexts(&Fcb->AdvancedFCBHeader);
#else
		if (DokanFsRtlTeardownPerStreamContexts) {
			DokanFsRtlTeardownPerStreamContexts(&Fcb->AdvancedFCBHeader);
		}
#endif
		ExReleaseResourceLite(&Fcb->Resource);

		ExDeleteResourceLite(&Fcb->Resource);
		ExDeleteResourceLite(&Fcb->MainResource);
		ExDeleteResourceLite(&Fcb->PagingIoResource);

		InterlockedIncrement(&vcb->FcbFreed);
		ExFreePool(Fcb);

	} else {
		ExReleaseResourceLite(&Fcb->Resource);
	}

	ExReleaseResourceLite(&vcb->Resource);
	KeLeaveCriticalRegion();

	return STATUS_SUCCESS;
}
示例#4
0
void
AFSRemoveFcb( IN AFSFcb *Fcb)
{

    //
    // Uninitialize the file lock if it is a file
    //

    AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
                  AFS_TRACE_LEVEL_VERBOSE,
                  "AFSRemoveFcb Removing Fcb %08lX\n",
                  Fcb);

    if( Fcb->Header.NodeTypeCode == AFS_FILE_FCB)
    {

        FsRtlUninitializeFileLock( &Fcb->Specific.File.FileLock);

        //
        // The resource we allocated
        //

        ExDeleteResourceLite( &Fcb->NPFcb->Specific.File.ExtentsResource );

        ExDeleteResourceLite( &Fcb->NPFcb->Specific.File.DirtyExtentsListLock);

    }
    else if( Fcb->Header.NodeTypeCode == AFS_DIRECTORY_FCB)
    {


    }

    //
    // Tear down the FM specific contexts
    //

    FsRtlTeardownPerStreamContexts( &Fcb->Header);

    //
    // Delete the resources
    //

    ExDeleteResourceLite( &Fcb->NPFcb->Resource);

    ExDeleteResourceLite( &Fcb->NPFcb->PagingResource);

    ExDeleteResourceLite( &Fcb->NPFcb->CcbListLock);

    //
    // The non paged region
    //

    AFSExFreePool( Fcb->NPFcb);

    //
    // And the Fcb itself, which includes the name
    //

    AFSExFreePool( Fcb);

    return;
}