--- /dev/null
+/*
+ * COPYRIGHT: See COPYING in the top level directory
+ * PROJECT: ReactOS kernel
+ * FILE: drivers/filesystems/fastfat/pnp.c
+ * PURPOSE: VFAT Filesystem
+ * PROGRAMMER: Pierre Schweitzer
+ *
+ */
+
+/* INCLUDES *****************************************************************/
+
+#define NDEBUG
+#include "vfat.h"
+
+/* FUNCTIONS ****************************************************************/
+
+NTSTATUS VfatPnp(PVFAT_IRP_CONTEXT IrpContext)
+{
+ PVCB Vcb = NULL;
+ NTSTATUS Status;
+
+ /* PRECONDITION */
+ ASSERT(IrpContext);
+
+ switch (IrpContext->Stack->MinorFunction)
+ {
+ case IRP_MN_QUERY_REMOVE_DEVICE:
+ case IRP_MN_SURPRISE_REMOVAL:
+ case IRP_MN_REMOVE_DEVICE:
+ case IRP_MN_CANCEL_REMOVE_DEVICE:
+ Status = STATUS_NOT_IMPLEMENTED;
+ break;
+ default:
+ IoSkipCurrentIrpStackLocation(IrpContext->Irp);
+ Vcb = (PVCB)IrpContext->Stack->DeviceObject->DeviceExtension;
+ Status = IoCallDriver(Vcb->StorageDevice, IrpContext->Irp);
+ }
+
+ VfatFreeIrpContext(IrpContext);
+
+ return Status;
+}
#undef IoCallDriver
#undef IoCompleteRequest
+PIRP IopDeadIrp;
+
/* PRIVATE FUNCTIONS ********************************************************/
VOID
VOID
NTAPI
-IopRemoveThreadIrp(VOID)
+IopDisassociateThreadIrp(VOID)
{
- KIRQL OldIrql;
- PIRP DeadIrp;
+ KIRQL OldIrql, LockIrql;
PETHREAD IrpThread;
PLIST_ENTRY IrpEntry;
PIO_ERROR_LOG_PACKET ErrorLogEntry;
return;
}
+ /* Ensure no one will come disturb */
+ LockIrql = KeAcquireQueuedSpinLock(LockQueueIoCompletionLock);
+
/* Get the misbehaving IRP */
IrpEntry = IrpThread->IrpList.Flink;
- DeadIrp = CONTAINING_RECORD(IrpEntry, IRP, ThreadListEntry);
+ IopDeadIrp = CONTAINING_RECORD(IrpEntry, IRP, ThreadListEntry);
IOTRACE(IO_IRP_DEBUG,
"%s - Deassociating IRP %p for %p\n",
__FUNCTION__,
- DeadIrp,
+ IopDeadIrp,
IrpThread);
/* Don't cancel the IRP if it's already been completed far */
- if (DeadIrp->CurrentLocation == (DeadIrp->StackCount + 2))
+ if (IopDeadIrp->CurrentLocation == (IopDeadIrp->StackCount + 2))
{
/* Return */
+ KeReleaseQueuedSpinLock(LockQueueIoCompletionLock, LockIrql);
KeLowerIrql(OldIrql);
return;
}
/* Disown the IRP! */
- DeadIrp->Tail.Overlay.Thread = NULL;
+ IopDeadIrp->Tail.Overlay.Thread = NULL;
RemoveHeadList(&IrpThread->IrpList);
- InitializeListHead(&DeadIrp->ThreadListEntry);
+ InitializeListHead(&IopDeadIrp->ThreadListEntry);
/* Get the stack location and check if it's valid */
- IoStackLocation = IoGetCurrentIrpStackLocation(DeadIrp);
- if (DeadIrp->CurrentLocation <= DeadIrp->StackCount)
+ IoStackLocation = IoGetCurrentIrpStackLocation(IopDeadIrp);
+ if (IopDeadIrp->CurrentLocation <= IopDeadIrp->StackCount)
{
/* Get the device object */
DeviceObject = IoStackLocation->DeviceObject;
}
+ KeReleaseQueuedSpinLock(LockQueueIoCompletionLock, LockIrql);
/* Lower IRQL now, since we have the pointers we need */
KeLowerIrql(OldIrql);
if (ErrorLogEntry)
{
/* Write the entry */
- ErrorLogEntry->ErrorCode = 0xBAADF00D; /* FIXME */
+ ErrorLogEntry->ErrorCode = IO_DRIVER_CANCEL_TIMEOUT;
IoWriteErrorLogEntry(ErrorLogEntry);
}
}
IoCancelIrp(IN PIRP Irp)
{
KIRQL OldIrql;
- KIRQL IrqlAtEntry;
PDRIVER_CANCEL CancelRoutine;
IOTRACE(IO_IRP_DEBUG,
"%s - Canceling IRP %p\n",
__FUNCTION__,
Irp);
ASSERT(Irp->Type == IO_TYPE_IRP);
- IrqlAtEntry = KeGetCurrentIrql();
/* Acquire the cancel lock and cancel the IRP */
IoAcquireCancelSpinLock(&OldIrql);
/* It is, bugcheck */
KeBugCheckEx(CANCEL_STATE_IN_COMPLETED_IRP,
(ULONG_PTR)Irp,
- 0,
+ (ULONG_PTR)CancelRoutine,
0,
0);
}
/* Set the cancel IRQL And call the routine */
Irp->CancelIrql = OldIrql;
CancelRoutine(IoGetCurrentIrpStackLocation(Irp)->DeviceObject, Irp);
- ASSERT(IrqlAtEntry == KeGetCurrentIrql());
return TRUE;
}
LARGE_INTEGER Interval;
PLIST_ENTRY ListHead, NextEntry;
PIRP Irp;
+ PAGED_CODE();
+
+ /* Windows isn't using given thread, but using current. */
+ Thread = PsGetCurrentThread();
+
IOTRACE(IO_IRP_DEBUG,
"%s - Canceling IRPs for Thread %p\n",
__FUNCTION__,
{
/* Print out a message and remove the IRP */
DPRINT1("Broken driver did not complete!\n");
- IopRemoveThreadIrp();
+ IopDisassociateThreadIrp();
}
/* Raise the IRQL Again */