[cosmetics] Fix tab-size
authorShao Miller <Shao.Miller@yrdsb.edu.on.ca>
Tue, 15 Dec 2009 03:46:16 +0000 (22:46 -0500)
committerShao Miller <Shao.Miller@yrdsb.edu.on.ca>
Tue, 15 Dec 2009 03:46:16 +0000 (22:46 -0500)
All this time the tab-size was set to two spaces.  Wrong.
It made things in git look like...  Well, gitweb, that is, looked
pretty poor.  Better now, I hope.

26 files changed:
indent.sh
indent_add.sh
src/aoe.c
src/aoe.h
src/aoedisk.c
src/aoedisk.h
src/bus.c
src/bus.h
src/debug.c
src/debug.h
src/disk.h
src/driver.c
src/driver.h
src/irp.h
src/loader.c
src/mdi.h
src/mount.c
src/mount.h
src/portable.h
src/probe.c
src/probe.h
src/protocol.c
src/protocol.h
src/ramdisk.h
src/registry.h
src/winvblock.h

index d4fa21d..55be640 100644 (file)
--- a/indent.sh
+++ b/indent.sh
@@ -1,2 +1,2 @@
 #!/bin/sh
-indent -bap -bc -bfda -bfde -bl -bli2 -bls -cbi2 -cdb -cdw -nce -ci2 -cli2 -i2 -ip2 -kr -l79 -lp -ncs -nhnl -pcs -pi2 -ppi2 -prs -psl -saf -sai -saw -sc -sob -ts2 $*
+indent -bap -bc -bfda -bfde -bl -bli2 -bls -cbi2 -cdb -cdw -nce -ci2 -cli2 -i2 -ip2 -kr -l79 -lp -ncs -nhnl -pcs -pi2 -ppi2 -prs -psl -saf -sai -saw -sc -sob -ts8 $*
index a8a9421..df4c683 100644 (file)
@@ -1,3 +1,3 @@
 #!/bin/sh
-indent -bap -bc -bfda -bfde -bl -bli2 -bls -cbi2 -cdb -cdw -nce -ci2 -cli2 -i2 -ip2 -kr -l79 -lp -ncs -nhnl -pcs -pi2 -ppi2 -prs -psl -saf -sai -saw -sc -sob -ts2 $*
+indent -bap -bc -bfda -bfde -bl -bli2 -bls -cbi2 -cdb -cdw -nce -ci2 -cli2 -i2 -ip2 -kr -l79 -lp -ncs -nhnl -pcs -pi2 -ppi2 -prs -psl -saf -sai -saw -sc -sob -ts8 $*
 git add $*
index 42e34de..9e7d3d3 100644 (file)
--- a/src/aoe.c
+++ b/src/aoe.c
 #include "bus.h"
 
 extern NTSTATUS STDCALL ZwWaitForSingleObject (
-       IN HANDLE Handle,
-       IN winvblock__bool Alertable,
-       IN PLARGE_INTEGER Timeout OPTIONAL
+  IN HANDLE Handle,
+  IN winvblock__bool Alertable,
+  IN PLARGE_INTEGER Timeout OPTIONAL
  );
 
 /* In this file */
 static VOID STDCALL AoE_Thread (
-       IN PVOID StartContext
+  IN PVOID StartContext
  );
 
 #ifdef _MSC_VER
@@ -62,44 +62,44 @@ typedef enum
 /** AoE packet */
 typedef struct _AOE_PACKET
 {
-       winvblock__uint8 ReservedFlag:2;
-       winvblock__uint8 ErrorFlag:1;
-       winvblock__uint8 ResponseFlag:1;
-       winvblock__uint8 Ver:4;
-       winvblock__uint8 Error;
-       winvblock__uint16 Major;
-       winvblock__uint8 Minor;
-       winvblock__uint8 Command;
-       winvblock__uint32 Tag;
-
-       winvblock__uint8 WriteAFlag:1;
-       winvblock__uint8 AsyncAFlag:1;
-       winvblock__uint8 Reserved1AFlag:2;
-       winvblock__uint8 DeviceHeadAFlag:1;
-       winvblock__uint8 Reserved2AFlag:1;
-       winvblock__uint8 ExtendedAFlag:1;
-       winvblock__uint8 Reserved3AFlag:1;
-       union
-       {
-               winvblock__uint8 Err;
-               winvblock__uint8 Feature;
-       };
-       winvblock__uint8 Count;
-       union
-       {
-               winvblock__uint8 Cmd;
-               winvblock__uint8 Status;
-       };
-
-       winvblock__uint8 Lba0;
-       winvblock__uint8 Lba1;
-       winvblock__uint8 Lba2;
-       winvblock__uint8 Lba3;
-       winvblock__uint8 Lba4;
-       winvblock__uint8 Lba5;
-       winvblock__uint16 Reserved;
-
-       winvblock__uint8 Data[];
+  winvblock__uint8 ReservedFlag:2;
+  winvblock__uint8 ErrorFlag:1;
+  winvblock__uint8 ResponseFlag:1;
+  winvblock__uint8 Ver:4;
+  winvblock__uint8 Error;
+  winvblock__uint16 Major;
+  winvblock__uint8 Minor;
+  winvblock__uint8 Command;
+  winvblock__uint32 Tag;
+
+  winvblock__uint8 WriteAFlag:1;
+  winvblock__uint8 AsyncAFlag:1;
+  winvblock__uint8 Reserved1AFlag:2;
+  winvblock__uint8 DeviceHeadAFlag:1;
+  winvblock__uint8 Reserved2AFlag:1;
+  winvblock__uint8 ExtendedAFlag:1;
+  winvblock__uint8 Reserved3AFlag:1;
+  union
+  {
+    winvblock__uint8 Err;
+    winvblock__uint8 Feature;
+  };
+  winvblock__uint8 Count;
+  union
+  {
+    winvblock__uint8 Cmd;
+    winvblock__uint8 Status;
+  };
+
+  winvblock__uint8 Lba0;
+  winvblock__uint8 Lba1;
+  winvblock__uint8 Lba2;
+  winvblock__uint8 Lba3;
+  winvblock__uint8 Lba4;
+  winvblock__uint8 Lba5;
+  winvblock__uint16 Reserved;
+
+  winvblock__uint8 Data[];
 } __attribute__ ( ( __packed__ ) ) AOE_PACKET, *PAOE_PACKET;
 
 #ifdef _MSC_VER
@@ -109,39 +109,39 @@ typedef struct _AOE_PACKET
 /** A request */
 typedef struct _AOE_REQUEST
 {
-       AOE_REQUESTMODE Mode;
-       ULONG SectorCount;
-       winvblock__uint8_ptr Buffer;
-       PIRP Irp;
-       ULONG TagCount;
-       ULONG TotalTags;
+  AOE_REQUESTMODE Mode;
+  ULONG SectorCount;
+  winvblock__uint8_ptr Buffer;
+  PIRP Irp;
+  ULONG TagCount;
+  ULONG TotalTags;
 } AOE_REQUEST,
 *PAOE_REQUEST;
 
 /** A tag */
 typedef struct _AOE_TAG
 {
-       AOE_TAGTYPE Type;
-       driver__dev_ext_ptr DeviceExtension;
-       PAOE_REQUEST Request;
-       ULONG Id;
-       PAOE_PACKET PacketData;
-       ULONG PacketSize;
-       LARGE_INTEGER FirstSendTime;
-       LARGE_INTEGER SendTime;
-       ULONG BufferOffset;
-       ULONG SectorCount;
-       struct _AOE_TAG *Next;
-       struct _AOE_TAG *Previous;
+  AOE_TAGTYPE Type;
+  driver__dev_ext_ptr DeviceExtension;
+  PAOE_REQUEST Request;
+  ULONG Id;
+  PAOE_PACKET PacketData;
+  ULONG PacketSize;
+  LARGE_INTEGER FirstSendTime;
+  LARGE_INTEGER SendTime;
+  ULONG BufferOffset;
+  ULONG SectorCount;
+  struct _AOE_TAG *Next;
+  struct _AOE_TAG *Previous;
 } AOE_TAG,
 *PAOE_TAG;
 
 /** A disk search */
 typedef struct _AOE_DISKSEARCH
 {
-       driver__dev_ext_ptr DeviceExtension;
-       PAOE_TAG Tag;
-       struct _AOE_DISKSEARCH *Next;
+  driver__dev_ext_ptr DeviceExtension;
+  PAOE_TAG Tag;
+  struct _AOE_DISKSEARCH *Next;
 } AOE_DISKSEARCH,
 *PAOE_DISKSEARCH;
 
@@ -164,104 +164,104 @@ static winvblock__bool AoE_Globals_Started = FALSE;
  */
 NTSTATUS STDCALL
 AoE_Start (
-       void
+  void
  )
 {
-       NTSTATUS Status;
-       OBJECT_ATTRIBUTES ObjectAttributes;
-       PVOID ThreadObject;
-
-       DBG ( "Entry\n" );
-
-       if ( AoE_Globals_Started )
-               return STATUS_SUCCESS;
-       /*
-        * Start up the protocol
-        */
-       if ( !NT_SUCCESS ( Status = Protocol_Start (  ) ) )
-               {
-                       DBG ( "Protocol startup failure!\n" );
-                       return Status;
-               }
-       /*
-        * Allocate and zero-fill the global probe tag 
-        */
-       if ( ( AoE_Globals_ProbeTag =
-                                ( PAOE_TAG ) ExAllocatePool ( NonPagedPool,
-                                                                                                                                                        sizeof ( AOE_TAG ) ) ) == NULL )
-               {
-                       DBG ( "Couldn't allocate probe tag; bye!\n" );
-                       return STATUS_INSUFFICIENT_RESOURCES;
-               }
-       RtlZeroMemory ( AoE_Globals_ProbeTag, sizeof ( AOE_TAG ) );
-
-       /*
-        * Set up the probe tag's AoE packet reference 
-        */
-       AoE_Globals_ProbeTag->PacketSize = sizeof ( AOE_PACKET );
-       /*
-        * Allocate and zero-fill the probe tag's packet reference 
-        */
-       if ( ( AoE_Globals_ProbeTag->PacketData =
-                                ( PAOE_PACKET ) ExAllocatePool ( NonPagedPool,
-                                                                                                                                                                       AoE_Globals_ProbeTag->
-                                                                                                                                                                       PacketSize ) ) == NULL )
-               {
-                       DBG ( "Couldn't allocate AoE_Globals_ProbeTag->PacketData\n" );
-                       ExFreePool ( AoE_Globals_ProbeTag );
-                       return STATUS_INSUFFICIENT_RESOURCES;
-               }
-       AoE_Globals_ProbeTag->SendTime.QuadPart = 0LL;
-       RtlZeroMemory ( AoE_Globals_ProbeTag->PacketData,
-                                                                       AoE_Globals_ProbeTag->PacketSize );
-
-       /*
-        * Initialize the probe tag's AoE packet 
-        */
-       AoE_Globals_ProbeTag->PacketData->Ver = AOEPROTOCOLVER;
-       AoE_Globals_ProbeTag->PacketData->Major =
-               htons ( ( winvblock__uint16 ) - 1 );
-       AoE_Globals_ProbeTag->PacketData->Minor = ( winvblock__uint8 ) - 1;
-       AoE_Globals_ProbeTag->PacketData->Cmd = 0xec;   /* IDENTIFY DEVICE */
-       AoE_Globals_ProbeTag->PacketData->Count = 1;
-
-       /*
-        * Initialize global spin-lock and global thread signal event 
-        */
-       KeInitializeSpinLock ( &AoE_Globals_SpinLock );
-       KeInitializeEvent ( &AoE_Globals_ThreadSignalEvent, SynchronizationEvent,
-                                                                                       FALSE );
-
-       /*
-        * Initialize object attributes 
-        */
-       InitializeObjectAttributes ( &ObjectAttributes, NULL, OBJ_KERNEL_HANDLE,
-                                                                                                                        NULL, NULL );
-
-       /*
-        * Create global thread 
-        */
-       if ( !NT_SUCCESS
-                        ( Status =
-                                PsCreateSystemThread ( &AoE_Globals_ThreadHandle, THREAD_ALL_ACCESS,
-                                                                                                                               &ObjectAttributes, NULL, NULL, AoE_Thread,
-                                                                                                                               NULL ) ) )
-               return Error ( "PsCreateSystemThread", Status );
-
-       if ( !NT_SUCCESS
-                        ( Status =
-                                ObReferenceObjectByHandle ( AoE_Globals_ThreadHandle,
-                                                                                                                                                THREAD_ALL_ACCESS, NULL, KernelMode,
-                                                                                                                                                &ThreadObject, NULL ) ) )
-               {
-                       ZwClose ( AoE_Globals_ThreadHandle );
-                       Error ( "ObReferenceObjectByHandle", Status );
-                       AoE_Globals_Stop = TRUE;
-                       KeSetEvent ( &AoE_Globals_ThreadSignalEvent, 0, FALSE );
-               }
-
-       AoE_Globals_Started = TRUE;
-       return Status;
+  NTSTATUS Status;
+  OBJECT_ATTRIBUTES ObjectAttributes;
+  PVOID ThreadObject;
+
+  DBG ( "Entry\n" );
+
+  if ( AoE_Globals_Started )
+    return STATUS_SUCCESS;
+  /*
+   * Start up the protocol
+   */
+  if ( !NT_SUCCESS ( Status = Protocol_Start (  ) ) )
+    {
+      DBG ( "Protocol startup failure!\n" );
+      return Status;
+    }
+  /*
+   * Allocate and zero-fill the global probe tag 
+   */
+  if ( ( AoE_Globals_ProbeTag =
+        ( PAOE_TAG ) ExAllocatePool ( NonPagedPool,
+                                      sizeof ( AOE_TAG ) ) ) == NULL )
+    {
+      DBG ( "Couldn't allocate probe tag; bye!\n" );
+      return STATUS_INSUFFICIENT_RESOURCES;
+    }
+  RtlZeroMemory ( AoE_Globals_ProbeTag, sizeof ( AOE_TAG ) );
+
+  /*
+   * Set up the probe tag's AoE packet reference 
+   */
+  AoE_Globals_ProbeTag->PacketSize = sizeof ( AOE_PACKET );
+  /*
+   * Allocate and zero-fill the probe tag's packet reference 
+   */
+  if ( ( AoE_Globals_ProbeTag->PacketData =
+        ( PAOE_PACKET ) ExAllocatePool ( NonPagedPool,
+                                         AoE_Globals_ProbeTag->PacketSize ) )
+       == NULL )
+    {
+      DBG ( "Couldn't allocate AoE_Globals_ProbeTag->PacketData\n" );
+      ExFreePool ( AoE_Globals_ProbeTag );
+      return STATUS_INSUFFICIENT_RESOURCES;
+    }
+  AoE_Globals_ProbeTag->SendTime.QuadPart = 0LL;
+  RtlZeroMemory ( AoE_Globals_ProbeTag->PacketData,
+                 AoE_Globals_ProbeTag->PacketSize );
+
+  /*
+   * Initialize the probe tag's AoE packet 
+   */
+  AoE_Globals_ProbeTag->PacketData->Ver = AOEPROTOCOLVER;
+  AoE_Globals_ProbeTag->PacketData->Major =
+    htons ( ( winvblock__uint16 ) - 1 );
+  AoE_Globals_ProbeTag->PacketData->Minor = ( winvblock__uint8 ) - 1;
+  AoE_Globals_ProbeTag->PacketData->Cmd = 0xec;        /* IDENTIFY DEVICE */
+  AoE_Globals_ProbeTag->PacketData->Count = 1;
+
+  /*
+   * Initialize global spin-lock and global thread signal event 
+   */
+  KeInitializeSpinLock ( &AoE_Globals_SpinLock );
+  KeInitializeEvent ( &AoE_Globals_ThreadSignalEvent, SynchronizationEvent,
+                     FALSE );
+
+  /*
+   * Initialize object attributes 
+   */
+  InitializeObjectAttributes ( &ObjectAttributes, NULL, OBJ_KERNEL_HANDLE,
+                              NULL, NULL );
+
+  /*
+   * Create global thread 
+   */
+  if ( !NT_SUCCESS
+       ( Status =
+        PsCreateSystemThread ( &AoE_Globals_ThreadHandle, THREAD_ALL_ACCESS,
+                               &ObjectAttributes, NULL, NULL, AoE_Thread,
+                               NULL ) ) )
+    return Error ( "PsCreateSystemThread", Status );
+
+  if ( !NT_SUCCESS
+       ( Status =
+        ObReferenceObjectByHandle ( AoE_Globals_ThreadHandle,
+                                    THREAD_ALL_ACCESS, NULL, KernelMode,
+                                    &ThreadObject, NULL ) ) )
+    {
+      ZwClose ( AoE_Globals_ThreadHandle );
+      Error ( "ObReferenceObjectByHandle", Status );
+      AoE_Globals_Stop = TRUE;
+      KeSetEvent ( &AoE_Globals_ThreadSignalEvent, 0, FALSE );
+    }
+
+  AoE_Globals_Started = TRUE;
+  return Status;
 }
 
 /**
@@ -269,98 +269,99 @@ AoE_Start (
  */
 VOID STDCALL
 AoE_Stop (
-       void
+  void
  )
 {
-       NTSTATUS Status;
-       PAOE_DISKSEARCH DiskSearch,
-        PreviousDiskSearch;
-       PAOE_TAG Tag;
-       KIRQL Irql;
-
-       DBG ( "Entry\n" );
-       /*
-        * If we're not already started, there's nothing to do
-        */
-       if ( !AoE_Globals_Started )
-               return;
-       /*
-        * If we're not already shutting down, signal the event 
-        */
-       if ( !AoE_Globals_Stop )
-               {
-                       AoE_Globals_Stop = TRUE;
-                       KeSetEvent ( &AoE_Globals_ThreadSignalEvent, 0, FALSE );
-                       /*
-                        * Wait until the event has been signalled 
-                        */
-                       if ( !NT_SUCCESS
-                                        ( Status =
-                                                ZwWaitForSingleObject ( AoE_Globals_ThreadHandle, FALSE,
-                                                                                                                                                NULL ) ) )
-                               Error ( "AoE_Stop ZwWaitForSingleObject", Status );
-                       ZwClose ( AoE_Globals_ThreadHandle );
-               }
-
-       /*
-        * Wait until we have the global spin-lock 
-        */
-       KeAcquireSpinLock ( &AoE_Globals_SpinLock, &Irql );
-
-       /*
-        * Free disk searches in the global disk search list 
-        */
-       DiskSearch = AoE_Globals_DiskSearchList;
-       while ( DiskSearch != NULL )
-               {
-                       KeSetEvent ( &
-                                                                        ( get_disk_ptr ( DiskSearch->DeviceExtension )->
-                                                                                SearchEvent ), 0, FALSE );
-                       PreviousDiskSearch = DiskSearch;
-                       DiskSearch = DiskSearch->Next;
-                       ExFreePool ( PreviousDiskSearch );
-               }
-
-       /*
-        * Cancel and free all tags in the global tag list 
-        */
-       Tag = AoE_Globals_TagList;
-       while ( Tag != NULL )
-               {
-                       if ( Tag->Request != NULL && --Tag->Request->TagCount == 0 )
-                               {
-                                       Tag->Request->Irp->IoStatus.Information = 0;
-                                       Tag->Request->Irp->IoStatus.Status = STATUS_CANCELLED;
-                                       IoCompleteRequest ( Tag->Request->Irp, IO_NO_INCREMENT );
-                                       ExFreePool ( Tag->Request );
-                               }
-                       if ( Tag->Next == NULL )
-                               {
-                                       ExFreePool ( Tag->PacketData );
-                                       ExFreePool ( Tag );
-                                       Tag = NULL;
-                               }
-                       else
-                               {
-                                       Tag = Tag->Next;
-                                       ExFreePool ( Tag->Previous->PacketData );
-                                       ExFreePool ( Tag->Previous );
-                               }
-               }
-       AoE_Globals_TagList = NULL;
-       AoE_Globals_TagListLast = NULL;
-
-       /*
-        * Free the global probe tag and its AoE packet 
-        */
-       ExFreePool ( AoE_Globals_ProbeTag->PacketData );
-       ExFreePool ( AoE_Globals_ProbeTag );
-
-       /*
-        * Release the global spin-lock 
-        */
-       KeReleaseSpinLock ( &AoE_Globals_SpinLock, Irql );
-       AoE_Globals_Started = FALSE;
+  NTSTATUS Status;
+  PAOE_DISKSEARCH DiskSearch,
+   PreviousDiskSearch;
+  PAOE_TAG Tag;
+  KIRQL Irql;
+
+  DBG ( "Entry\n" );
+  /*
+   * If we're not already started, there's nothing to do
+   */
+  if ( !AoE_Globals_Started )
+    return;
+  /*
+   * If we're not already shutting down, signal the event 
+   */
+  if ( !AoE_Globals_Stop )
+    {
+      AoE_Globals_Stop = TRUE;
+      KeSetEvent ( &AoE_Globals_ThreadSignalEvent, 0, FALSE );
+      /*
+       * Wait until the event has been signalled 
+       */
+      if ( !NT_SUCCESS
+          ( Status =
+            ZwWaitForSingleObject ( AoE_Globals_ThreadHandle, FALSE,
+                                    NULL ) ) )
+       Error ( "AoE_Stop ZwWaitForSingleObject", Status );
+      ZwClose ( AoE_Globals_ThreadHandle );
+    }
+
+  /*
+   * Wait until we have the global spin-lock 
+   */
+  KeAcquireSpinLock ( &AoE_Globals_SpinLock, &Irql );
+
+  /*
+   * Free disk searches in the global disk search list 
+   */
+  DiskSearch = AoE_Globals_DiskSearchList;
+  while ( DiskSearch != NULL )
+    {
+      KeSetEvent ( &
+                  ( get_disk_ptr
+                    ( DiskSearch->DeviceExtension )->SearchEvent ), 0,
+                  FALSE );
+      PreviousDiskSearch = DiskSearch;
+      DiskSearch = DiskSearch->Next;
+      ExFreePool ( PreviousDiskSearch );
+    }
+
+  /*
+   * Cancel and free all tags in the global tag list 
+   */
+  Tag = AoE_Globals_TagList;
+  while ( Tag != NULL )
+    {
+      if ( Tag->Request != NULL && --Tag->Request->TagCount == 0 )
+       {
+         Tag->Request->Irp->IoStatus.Information = 0;
+         Tag->Request->Irp->IoStatus.Status = STATUS_CANCELLED;
+         IoCompleteRequest ( Tag->Request->Irp, IO_NO_INCREMENT );
+         ExFreePool ( Tag->Request );
+       }
+      if ( Tag->Next == NULL )
+       {
+         ExFreePool ( Tag->PacketData );
+         ExFreePool ( Tag );
+         Tag = NULL;
+       }
+      else
+       {
+         Tag = Tag->Next;
+         ExFreePool ( Tag->Previous->PacketData );
+         ExFreePool ( Tag->Previous );
+       }
+    }
+  AoE_Globals_TagList = NULL;
+  AoE_Globals_TagListLast = NULL;
+
+  /*
+   * Free the global probe tag and its AoE packet 
+   */
+  ExFreePool ( AoE_Globals_ProbeTag->PacketData );
+  ExFreePool ( AoE_Globals_ProbeTag );
+
+  /*
+   * Release the global spin-lock 
+   */
+  KeReleaseSpinLock ( &AoE_Globals_SpinLock, Irql );
+  AoE_Globals_Started = FALSE;
 }
 
 /**
@@ -372,379 +373,379 @@ AoE_Stop (
  */
 winvblock__bool STDCALL
 AoE_SearchDrive (
-       IN driver__dev_ext_ptr DeviceExtension
+  IN driver__dev_ext_ptr DeviceExtension
  )
 {
-       PAOE_DISKSEARCH DiskSearch,
-        DiskSearchWalker,
-        PreviousDiskSearch;
-       LARGE_INTEGER Timeout,
-        CurrentTime;
-       PAOE_TAG Tag,
-        TagWalker;
-       KIRQL Irql,
-        InnerIrql;
-       LARGE_INTEGER MaxSectorsPerPacketSendTime;
-       ULONG MTU;
-       disk__type_ptr disk_ptr;
-
-       /*
-        * Establish a pointer into the disk device's extension space
-        */
-       disk_ptr = get_disk_ptr ( DeviceExtension );
-       if ( !NT_SUCCESS ( AoE_Start (  ) ) )
-               {
-                       DBG ( "AoE startup failure!\n" );
-                       return FALSE;
-               }
-       /*
-        * Allocate our disk search 
-        */
-       if ( ( DiskSearch =
-                                ( PAOE_DISKSEARCH ) ExAllocatePool ( NonPagedPool,
-                                                                                                                                                                                       sizeof ( AOE_DISKSEARCH ) ) ) ==
-                        NULL )
-               {
-                       DBG ( "Couldn't allocate DiskSearch; bye!\n" );
-                       return FALSE;
-               }
-
-       /*
-        * Initialize the disk search 
-        */
-       DiskSearch->DeviceExtension = DeviceExtension;
-       DiskSearch->Next = NULL;
-       disk_ptr->SearchState = SearchNIC;
-       KeResetEvent ( &disk_ptr->SearchEvent );
+  PAOE_DISKSEARCH DiskSearch,
+   DiskSearchWalker,
+   PreviousDiskSearch;
+  LARGE_INTEGER Timeout,
+   CurrentTime;
+  PAOE_TAG Tag,
+   TagWalker;
+  KIRQL Irql,
+   InnerIrql;
+  LARGE_INTEGER MaxSectorsPerPacketSendTime;
+  ULONG MTU;
+  disk__type_ptr disk_ptr;
+
+  /*
+   * Establish a pointer into the disk device's extension space
+   */
+  disk_ptr = get_disk_ptr ( DeviceExtension );
+  if ( !NT_SUCCESS ( AoE_Start (  ) ) )
+    {
+      DBG ( "AoE startup failure!\n" );
+      return FALSE;
+    }
+  /*
+   * Allocate our disk search 
+   */
+  if ( ( DiskSearch =
+        ( PAOE_DISKSEARCH ) ExAllocatePool ( NonPagedPool,
+                                             sizeof ( AOE_DISKSEARCH ) ) ) ==
+       NULL )
+    {
+      DBG ( "Couldn't allocate DiskSearch; bye!\n" );
+      return FALSE;
+    }
+
+  /*
+   * Initialize the disk search 
+   */
+  DiskSearch->DeviceExtension = DeviceExtension;
+  DiskSearch->Next = NULL;
+  disk_ptr->SearchState = SearchNIC;
+  KeResetEvent ( &disk_ptr->SearchEvent );
+
+  /*
+   * Wait until we have the global spin-lock 
+   */
+  KeAcquireSpinLock ( &AoE_Globals_SpinLock, &Irql );
+
+  /*
+   * Add our disk search to the global list of disk searches 
+   */
+  if ( AoE_Globals_DiskSearchList == NULL )
+    {
+      AoE_Globals_DiskSearchList = DiskSearch;
+    }
+  else
+    {
+      DiskSearchWalker = AoE_Globals_DiskSearchList;
+      while ( DiskSearchWalker->Next )
+       DiskSearchWalker = DiskSearchWalker->Next;
+      DiskSearchWalker->Next = DiskSearch;
+    }
+
+  /*
+   * Release the global spin-lock 
+   */
+  KeReleaseSpinLock ( &AoE_Globals_SpinLock, Irql );
+
+  /*
+   * We go through all the states until the disk is ready for use 
+   */
+  while ( TRUE )
+    {
+      /*
+       * Wait for our device's extension's search to be signalled 
+       */
+      /*
+       * TODO: Make the below value a #defined constant 
+       */
+      /*
+       * 500.000 * 100ns = 50.000.000 ns = 50ms 
+       */
+      Timeout.QuadPart = -500000LL;
+      KeWaitForSingleObject ( &disk_ptr->SearchEvent, Executive, KernelMode,
+                             FALSE, &Timeout );
+      if ( AoE_Globals_Stop )
+       {
+         DBG ( "AoE is shutting down; bye!\n" );
+         return FALSE;
+       }
 
-       /*
-        * Wait until we have the global spin-lock 
-        */
-       KeAcquireSpinLock ( &AoE_Globals_SpinLock, &Irql );
+      /*
+       * Wait until we have the device extension's spin-lock 
+       */
+      KeAcquireSpinLock ( &disk_ptr->SpinLock, &Irql );
 
-       /*
-        * Add our disk search to the global list of disk searches 
-        */
-       if ( AoE_Globals_DiskSearchList == NULL )
+      if ( disk_ptr->SearchState == SearchNIC )
+       {
+         if ( !Protocol_SearchNIC ( disk_ptr->AoE.ClientMac ) )
+           {
+             KeReleaseSpinLock ( &disk_ptr->SpinLock, Irql );
+             continue;
+           }
+         else
+           {
+             /*
+              * We found the adapter to use, get MTU next 
+              */
+             disk_ptr->AoE.MTU = Protocol_GetMTU ( disk_ptr->AoE.ClientMac );
+             disk_ptr->SearchState = GetSize;
+           }
+       }
+
+      if ( disk_ptr->SearchState == GettingSize )
+       {
+         /*
+          * Still getting the disk's size 
+          */
+         KeReleaseSpinLock ( &disk_ptr->SpinLock, Irql );
+         continue;
+       }
+      if ( disk_ptr->SearchState == GettingGeometry )
+       {
+         /*
+          * Still getting the disk's geometry 
+          */
+         KeReleaseSpinLock ( &disk_ptr->SpinLock, Irql );
+         continue;
+       }
+      if ( disk_ptr->SearchState == GettingMaxSectorsPerPacket )
+       {
+         KeQuerySystemTime ( &CurrentTime );
+         /*
+          * TODO: Make the below value a #defined constant 
+          */
+         /*
+          * 2.500.000 * 100ns = 250.000.000 ns = 250ms 
+          */
+         if ( CurrentTime.QuadPart >
+              MaxSectorsPerPacketSendTime.QuadPart + 2500000LL )
+           {
+             DBG ( "No reply after 250ms for MaxSectorsPerPacket %d, "
+                   "giving up\n", disk_ptr->AoE.MaxSectorsPerPacket );
+             disk_ptr->AoE.MaxSectorsPerPacket--;
+             disk_ptr->SearchState = Done;
+           }
+         else
+           {
+             /*
+              * Still getting the maximum sectors per packet count 
+              */
+             KeReleaseSpinLock ( &disk_ptr->SpinLock, Irql );
+             continue;
+           }
+       }
+
+      if ( disk_ptr->SearchState == Done )
+       {
+         /*
+          * We've finished the disk search; perform clean-up 
+          */
+         KeAcquireSpinLock ( &AoE_Globals_SpinLock, &InnerIrql );
+
+         /*
+          * Tag clean-up: Find out if our tag is in the global tag list 
+          */
+         TagWalker = AoE_Globals_TagList;
+         while ( TagWalker != NULL && TagWalker != Tag )
+           TagWalker = TagWalker->Next;
+         if ( TagWalker != NULL )
+           {
+             /*
+              * We found it.  If it's at the beginning of the list, adjust
+              * the list to point the the next tag
+              */
+             if ( Tag->Previous == NULL )
+               AoE_Globals_TagList = Tag->Next;
+             else
+               /*
+                * Remove our tag from the list 
+                */
+               Tag->Previous->Next = Tag->Next;
+             /*
+              * If we 're at the end of the list, adjust the list's end to
+              * point to the penultimate tag
+              */
+             if ( Tag->Next == NULL )
+               AoE_Globals_TagListLast = Tag->Previous;
+             else
+               /*
+                * Remove our tag from the list 
+                */
+               Tag->Next->Previous = Tag->Previous;
+             AoE_Globals_OutstandingTags--;
+             if ( AoE_Globals_OutstandingTags < 0 )
+               DBG ( "AoE_Globals_OutstandingTags < 0!!\n" );
+             /*
+              * Free our tag and its AoE packet 
+              */
+             ExFreePool ( Tag->PacketData );
+             ExFreePool ( Tag );
+           }
+
+         /*
+          * Disk search clean-up 
+          */
+         if ( AoE_Globals_DiskSearchList == NULL )
+           {
+             DBG ( "AoE_Globals_DiskSearchList == NULL!!\n" );
+           }
+         else
+           {
+             /*
+              * Find our disk search in the global list of disk searches 
+              */
+             DiskSearchWalker = AoE_Globals_DiskSearchList;
+             while ( DiskSearchWalker
+                     && DiskSearchWalker->DeviceExtension != DeviceExtension )
                {
-                       AoE_Globals_DiskSearchList = DiskSearch;
+                 PreviousDiskSearch = DiskSearchWalker;
+                 DiskSearchWalker = DiskSearchWalker->Next;
                }
-       else
+             if ( DiskSearchWalker )
                {
-                       DiskSearchWalker = AoE_Globals_DiskSearchList;
-                       while ( DiskSearchWalker->Next )
-                               DiskSearchWalker = DiskSearchWalker->Next;
-                       DiskSearchWalker->Next = DiskSearch;
+                 /*
+                  * We found our disk search.  If it's the first one in
+                  * the list, adjust the list and remove it
+                  */
+                 if ( DiskSearchWalker == AoE_Globals_DiskSearchList )
+                   AoE_Globals_DiskSearchList = DiskSearchWalker->Next;
+                 else
+                   /*
+                    * Just remove it 
+                    */
+                   PreviousDiskSearch->Next = DiskSearchWalker->Next;
+                 /*
+                  * Free our disk search 
+                  */
+                 ExFreePool ( DiskSearchWalker );
                }
-
-       /*
-        * Release the global spin-lock 
-        */
-       KeReleaseSpinLock ( &AoE_Globals_SpinLock, Irql );
-
-       /*
-        * We go through all the states until the disk is ready for use 
-        */
-       while ( TRUE )
+             else
                {
-                       /*
-                        * Wait for our device's extension's search to be signalled 
-                        */
-                       /*
-                        * TODO: Make the below value a #defined constant 
-                        */
-                       /*
-                        * 500.000 * 100ns = 50.000.000 ns = 50ms 
-                        */
-                       Timeout.QuadPart = -500000LL;
-                       KeWaitForSingleObject ( &disk_ptr->SearchEvent, Executive, KernelMode,
-                                                                                                                       FALSE, &Timeout );
-                       if ( AoE_Globals_Stop )
-                               {
-                                       DBG ( "AoE is shutting down; bye!\n" );
-                                       return FALSE;
-                               }
-
-                       /*
-                        * Wait until we have the device extension's spin-lock 
-                        */
-                       KeAcquireSpinLock ( &disk_ptr->SpinLock, &Irql );
-
-                       if ( disk_ptr->SearchState == SearchNIC )
-                               {
-                                       if ( !Protocol_SearchNIC ( disk_ptr->AoE.ClientMac ) )
-                                               {
-                                                       KeReleaseSpinLock ( &disk_ptr->SpinLock, Irql );
-                                                       continue;
-                                               }
-                                       else
-                                               {
-                                                       /*
-                                                        * We found the adapter to use, get MTU next 
-                                                        */
-                                                       disk_ptr->AoE.MTU = Protocol_GetMTU ( disk_ptr->AoE.ClientMac );
-                                                       disk_ptr->SearchState = GetSize;
-                                               }
-                               }
-
-                       if ( disk_ptr->SearchState == GettingSize )
-                               {
-                                       /*
-                                        * Still getting the disk's size 
-                                        */
-                                       KeReleaseSpinLock ( &disk_ptr->SpinLock, Irql );
-                                       continue;
-                               }
-                       if ( disk_ptr->SearchState == GettingGeometry )
-                               {
-                                       /*
-                                        * Still getting the disk's geometry 
-                                        */
-                                       KeReleaseSpinLock ( &disk_ptr->SpinLock, Irql );
-                                       continue;
-                               }
-                       if ( disk_ptr->SearchState == GettingMaxSectorsPerPacket )
-                               {
-                                       KeQuerySystemTime ( &CurrentTime );
-                                       /*
-                                        * TODO: Make the below value a #defined constant 
-                                        */
-                                       /*
-                                        * 2.500.000 * 100ns = 250.000.000 ns = 250ms 
-                                        */
-                                       if ( CurrentTime.QuadPart >
-                                                        MaxSectorsPerPacketSendTime.QuadPart + 2500000LL )
-                                               {
-                                                       DBG ( "No reply after 250ms for MaxSectorsPerPacket %d, "
-                                                                               "giving up\n", disk_ptr->AoE.MaxSectorsPerPacket );
-                                                       disk_ptr->AoE.MaxSectorsPerPacket--;
-                                                       disk_ptr->SearchState = Done;
-                                               }
-                                       else
-                                               {
-                                                       /*
-                                                        * Still getting the maximum sectors per packet count 
-                                                        */
-                                                       KeReleaseSpinLock ( &disk_ptr->SpinLock, Irql );
-                                                       continue;
-                                               }
-                               }
-
-                       if ( disk_ptr->SearchState == Done )
-                               {
-                                       /*
-                                        * We've finished the disk search; perform clean-up 
-                                        */
-                                       KeAcquireSpinLock ( &AoE_Globals_SpinLock, &InnerIrql );
-
-                                       /*
-                                        * Tag clean-up: Find out if our tag is in the global tag list 
-                                        */
-                                       TagWalker = AoE_Globals_TagList;
-                                       while ( TagWalker != NULL && TagWalker != Tag )
-                                               TagWalker = TagWalker->Next;
-                                       if ( TagWalker != NULL )
-                                               {
-                                                       /*
-                                                        * We found it.  If it's at the beginning of the list, adjust
-                                                        * the list to point the the next tag
-                                                        */
-                                                       if ( Tag->Previous == NULL )
-                                                               AoE_Globals_TagList = Tag->Next;
-                                                       else
-                                                               /*
-                                                                * Remove our tag from the list 
-                                                                */
-                                                               Tag->Previous->Next = Tag->Next;
-                                                       /*
-                                                        * If we 're at the end of the list, adjust the list's end to
-                                                        * point to the penultimate tag
-                                                        */
-                                                       if ( Tag->Next == NULL )
-                                                               AoE_Globals_TagListLast = Tag->Previous;
-                                                       else
-                                                               /*
-                                                                * Remove our tag from the list 
-                                                                */
-                                                               Tag->Next->Previous = Tag->Previous;
-                                                       AoE_Globals_OutstandingTags--;
-                                                       if ( AoE_Globals_OutstandingTags < 0 )
-                                                               DBG ( "AoE_Globals_OutstandingTags < 0!!\n" );
-                                                       /*
-                                                        * Free our tag and its AoE packet 
-                                                        */
-                                                       ExFreePool ( Tag->PacketData );
-                                                       ExFreePool ( Tag );
-                                               }
-
-                                       /*
-                                        * Disk search clean-up 
-                                        */
-                                       if ( AoE_Globals_DiskSearchList == NULL )
-                                               {
-                                                       DBG ( "AoE_Globals_DiskSearchList == NULL!!\n" );
-                                               }
-                                       else
-                                               {
-                                                       /*
-                                                        * Find our disk search in the global list of disk searches 
-                                                        */
-                                                       DiskSearchWalker = AoE_Globals_DiskSearchList;
-                                                       while ( DiskSearchWalker
-                                                                                       && DiskSearchWalker->DeviceExtension != DeviceExtension )
-                                                               {
-                                                                       PreviousDiskSearch = DiskSearchWalker;
-                                                                       DiskSearchWalker = DiskSearchWalker->Next;
-                                                               }
-                                                       if ( DiskSearchWalker )
-                                                               {
-                                                                       /*
-                                                                        * We found our disk search.  If it's the first one in
-                                                                        * the list, adjust the list and remove it
-                                                                        */
-                                                                       if ( DiskSearchWalker == AoE_Globals_DiskSearchList )
-                                                                               AoE_Globals_DiskSearchList = DiskSearchWalker->Next;
-                                                                       else
-                                                                               /*
-                                                                                * Just remove it 
-                                                                                */
-                                                                               PreviousDiskSearch->Next = DiskSearchWalker->Next;
-                                                                       /*
-                                                                        * Free our disk search 
-                                                                        */
-                                                                       ExFreePool ( DiskSearchWalker );
-                                                               }
-                                                       else
-                                                               {
-                                                                       DBG ( "Disk not found in AoE_Globals_DiskSearchList!!\n" );
-                                                               }
-                                               }
-
-                                       /*
-                                        * Release global and device extension spin-locks 
-                                        */
-                                       KeReleaseSpinLock ( &AoE_Globals_SpinLock, InnerIrql );
-                                       KeReleaseSpinLock ( &disk_ptr->SpinLock, Irql );
-
-                                       DBG ( "Disk size: %I64uM cylinders: %I64u heads: %u "
-                                                               "sectors: %u sectors per packet: %u\n",
-                                                               disk_ptr->LBADiskSize / 2048, disk_ptr->Cylinders,
-                                                               disk_ptr->Heads, disk_ptr->Sectors,
-                                                               disk_ptr->AoE.MaxSectorsPerPacket );
-                                       return TRUE;
-                               }
-
-                       /*
-                        * if ( DeviceExtension->Disk.SearchState == Done ) 
-                        */
-                       /*
-                        * Establish our tag 
-                        */
-                       if ( ( Tag =
-                                                ( PAOE_TAG ) ExAllocatePool ( NonPagedPool,
-                                                                                                                                                                        sizeof ( AOE_TAG ) ) ) == NULL )
-                               {
-                                       DBG ( "Couldn't allocate Tag\n" );
-                                       KeReleaseSpinLock ( &disk_ptr->SpinLock, Irql );
-                                       /*
-                                        * Maybe next time around 
-                                        */
-                                       continue;
-                               }
-                       RtlZeroMemory ( Tag, sizeof ( AOE_TAG ) );
-                       Tag->Type = AoE_SearchDriveType;
-                       Tag->DeviceExtension = DeviceExtension;
-
-                       /*
-                        * Establish our tag's AoE packet 
-                        */
-                       Tag->PacketSize = sizeof ( AOE_PACKET );
-                       if ( ( Tag->PacketData =
-                                                ( PAOE_PACKET ) ExAllocatePool ( NonPagedPool,
-                                                                                                                                                                                       Tag->PacketSize ) ) == NULL )
-                               {
-                                       DBG ( "Couldn't allocate Tag->PacketData\n" );
-                                       ExFreePool ( Tag );
-                                       Tag = NULL;
-                                       KeReleaseSpinLock ( &disk_ptr->SpinLock, Irql );
-                                       /*
-                                        * Maybe next time around 
-                                        */
-                                       continue;
-                               }
-                       RtlZeroMemory ( Tag->PacketData, Tag->PacketSize );
-                       Tag->PacketData->Ver = AOEPROTOCOLVER;
-                       Tag->PacketData->Major =
-                               htons ( ( winvblock__uint16 ) disk_ptr->AoE.Major );
-                       Tag->PacketData->Minor = ( winvblock__uint8 ) disk_ptr->AoE.Minor;
-                       Tag->PacketData->ExtendedAFlag = TRUE;
-
-                       /*
-                        * Initialize the packet appropriately based on our current phase 
-                        */
-                       switch ( disk_ptr->SearchState )
-                               {
-                                       case GetSize:
-                                               /*
-                                                * TODO: Make the below value into a #defined constant 
-                                                */
-                                               Tag->PacketData->Cmd = 0xec;    /* IDENTIFY DEVICE */
-                                               Tag->PacketData->Count = 1;
-                                               disk_ptr->SearchState = GettingSize;
-                                               break;
-                                       case GetGeometry:
-                                               /*
-                                                * TODO: Make the below value into a #defined constant 
-                                                */
-                                               Tag->PacketData->Cmd = 0x24;    /* READ SECTOR */
-                                               Tag->PacketData->Count = 1;
-                                               disk_ptr->SearchState = GettingGeometry;
-                                               break;
-                                       case GetMaxSectorsPerPacket:
-                                               /*
-                                                * TODO: Make the below value into a #defined constant 
-                                                */
-                                               Tag->PacketData->Cmd = 0x24;    /* READ SECTOR */
-                                               Tag->PacketData->Count =
-                                                       ( winvblock__uint8 ) ( ++disk_ptr->AoE.MaxSectorsPerPacket );
-                                               KeQuerySystemTime ( &MaxSectorsPerPacketSendTime );
-                                               disk_ptr->SearchState = GettingMaxSectorsPerPacket;
-                                               /*
-                                                * TODO: Make the below value into a #defined constant 
-                                                */
-                                               disk_ptr->AoE.Timeout = 200000;
-                                               break;
-                                       default:
-                                               DBG ( "Undefined SearchState!!\n" );
-                                               ExFreePool ( Tag->PacketData );
-                                               ExFreePool ( Tag );
-                                               /*
-                                                * TODO: Do we need to nullify Tag here? 
-                                                */
-                                               KeReleaseSpinLock ( &disk_ptr->SpinLock, Irql );
-                                               continue;
-                                               break;
-                               }
-
-                       /*
-                        * Enqueue our tag 
-                        */
-                       Tag->Next = NULL;
-                       KeAcquireSpinLock ( &AoE_Globals_SpinLock, &InnerIrql );
-                       if ( AoE_Globals_TagList == NULL )
-                               {
-                                       AoE_Globals_TagList = Tag;
-                                       Tag->Previous = NULL;
-                               }
-                       else
-                               {
-                                       AoE_Globals_TagListLast->Next = Tag;
-                                       Tag->Previous = AoE_Globals_TagListLast;
-                               }
-                       AoE_Globals_TagListLast = Tag;
-                       KeReleaseSpinLock ( &AoE_Globals_SpinLock, InnerIrql );
-                       KeReleaseSpinLock ( &disk_ptr->SpinLock, Irql );
+                 DBG ( "Disk not found in AoE_Globals_DiskSearchList!!\n" );
                }
+           }
+
+         /*
+          * Release global and device extension spin-locks 
+          */
+         KeReleaseSpinLock ( &AoE_Globals_SpinLock, InnerIrql );
+         KeReleaseSpinLock ( &disk_ptr->SpinLock, Irql );
+
+         DBG ( "Disk size: %I64uM cylinders: %I64u heads: %u "
+               "sectors: %u sectors per packet: %u\n",
+               disk_ptr->LBADiskSize / 2048, disk_ptr->Cylinders,
+               disk_ptr->Heads, disk_ptr->Sectors,
+               disk_ptr->AoE.MaxSectorsPerPacket );
+         return TRUE;
+       }
+
+      /*
+       * if ( DeviceExtension->Disk.SearchState == Done ) 
+       */
+      /*
+       * Establish our tag 
+       */
+      if ( ( Tag =
+            ( PAOE_TAG ) ExAllocatePool ( NonPagedPool,
+                                          sizeof ( AOE_TAG ) ) ) == NULL )
+       {
+         DBG ( "Couldn't allocate Tag\n" );
+         KeReleaseSpinLock ( &disk_ptr->SpinLock, Irql );
+         /*
+          * Maybe next time around 
+          */
+         continue;
+       }
+      RtlZeroMemory ( Tag, sizeof ( AOE_TAG ) );
+      Tag->Type = AoE_SearchDriveType;
+      Tag->DeviceExtension = DeviceExtension;
+
+      /*
+       * Establish our tag's AoE packet 
+       */
+      Tag->PacketSize = sizeof ( AOE_PACKET );
+      if ( ( Tag->PacketData =
+            ( PAOE_PACKET ) ExAllocatePool ( NonPagedPool,
+                                             Tag->PacketSize ) ) == NULL )
+       {
+         DBG ( "Couldn't allocate Tag->PacketData\n" );
+         ExFreePool ( Tag );
+         Tag = NULL;
+         KeReleaseSpinLock ( &disk_ptr->SpinLock, Irql );
+         /*
+          * Maybe next time around 
+          */
+         continue;
+       }
+      RtlZeroMemory ( Tag->PacketData, Tag->PacketSize );
+      Tag->PacketData->Ver = AOEPROTOCOLVER;
+      Tag->PacketData->Major =
+       htons ( ( winvblock__uint16 ) disk_ptr->AoE.Major );
+      Tag->PacketData->Minor = ( winvblock__uint8 ) disk_ptr->AoE.Minor;
+      Tag->PacketData->ExtendedAFlag = TRUE;
+
+      /*
+       * Initialize the packet appropriately based on our current phase 
+       */
+      switch ( disk_ptr->SearchState )
+       {
+         case GetSize:
+           /*
+            * TODO: Make the below value into a #defined constant 
+            */
+           Tag->PacketData->Cmd = 0xec;        /* IDENTIFY DEVICE */
+           Tag->PacketData->Count = 1;
+           disk_ptr->SearchState = GettingSize;
+           break;
+         case GetGeometry:
+           /*
+            * TODO: Make the below value into a #defined constant 
+            */
+           Tag->PacketData->Cmd = 0x24;        /* READ SECTOR */
+           Tag->PacketData->Count = 1;
+           disk_ptr->SearchState = GettingGeometry;
+           break;
+         case GetMaxSectorsPerPacket:
+           /*
+            * TODO: Make the below value into a #defined constant 
+            */
+           Tag->PacketData->Cmd = 0x24;        /* READ SECTOR */
+           Tag->PacketData->Count =
+             ( winvblock__uint8 ) ( ++disk_ptr->AoE.MaxSectorsPerPacket );
+           KeQuerySystemTime ( &MaxSectorsPerPacketSendTime );
+           disk_ptr->SearchState = GettingMaxSectorsPerPacket;
+           /*
+            * TODO: Make the below value into a #defined constant 
+            */
+           disk_ptr->AoE.Timeout = 200000;
+           break;
+         default:
+           DBG ( "Undefined SearchState!!\n" );
+           ExFreePool ( Tag->PacketData );
+           ExFreePool ( Tag );
+           /*
+            * TODO: Do we need to nullify Tag here? 
+            */
+           KeReleaseSpinLock ( &disk_ptr->SpinLock, Irql );
+           continue;
+           break;
+       }
+
+      /*
+       * Enqueue our tag 
+       */
+      Tag->Next = NULL;
+      KeAcquireSpinLock ( &AoE_Globals_SpinLock, &InnerIrql );
+      if ( AoE_Globals_TagList == NULL )
+       {
+         AoE_Globals_TagList = Tag;
+         Tag->Previous = NULL;
+       }
+      else
+       {
+         AoE_Globals_TagListLast->Next = Tag;
+         Tag->Previous = AoE_Globals_TagListLast;
+       }
+      AoE_Globals_TagListLast = Tag;
+      KeReleaseSpinLock ( &AoE_Globals_SpinLock, InnerIrql );
+      KeReleaseSpinLock ( &disk_ptr->SpinLock, Irql );
+    }
 }
 
 /**
@@ -759,272 +760,272 @@ AoE_SearchDrive (
  */
 NTSTATUS STDCALL
 AoE_Request (
-       IN driver__dev_ext_ptr DeviceExtension,
-       IN AOE_REQUESTMODE Mode,
-       IN LONGLONG StartSector,
-       IN ULONG SectorCount,
-       IN winvblock__uint8_ptr Buffer,
-       IN PIRP Irp
+  IN driver__dev_ext_ptr DeviceExtension,
+  IN AOE_REQUESTMODE Mode,
+  IN LONGLONG StartSector,
+  IN ULONG SectorCount,
+  IN winvblock__uint8_ptr Buffer,
+  IN PIRP Irp
  )
 {
-       PAOE_REQUEST Request;
-       PAOE_TAG Tag,
-        NewTagList = NULL,
-               PreviousTag = NULL;
-       KIRQL Irql;
-       ULONG i;
-       PHYSICAL_ADDRESS PhysicalAddress;
-       winvblock__uint8_ptr PhysicalMemory;
-       disk__type_ptr disk_ptr;
-
-       /*
-        * Establish a pointer into the disk device's extension space
-        */
-       disk_ptr = get_disk_ptr ( DeviceExtension );
-       if ( AoE_Globals_Stop )
-               {
-                       /*
-                        * Shutting down AoE; we can't service this request 
-                        */
-                       Irp->IoStatus.Information = 0;
-                       Irp->IoStatus.Status = STATUS_CANCELLED;
-                       IoCompleteRequest ( Irp, IO_NO_INCREMENT );
-                       return STATUS_CANCELLED;
-               }
-
-       if ( SectorCount < 1 )
-               {
-                       /*
-                        * A silly request 
-                        */
-                       DBG ( "SectorCount < 1; cancelling\n" );
-                       Irp->IoStatus.Information = 0;
-                       Irp->IoStatus.Status = STATUS_CANCELLED;
-                       IoCompleteRequest ( Irp, IO_NO_INCREMENT );
-                       return STATUS_CANCELLED;
-               }
-
-       /*
-        * Handle the Ram disk case
-        */
-       if ( disk_ptr->IsRamdisk )
-               {
-                       PhysicalAddress.QuadPart =
-                               disk_ptr->RAMDisk.DiskBuf + ( StartSector * disk_ptr->SectorSize );
-                       /*
-                        * Possible precision loss
-                        */
-                       PhysicalMemory =
-                               MmMapIoSpace ( PhysicalAddress, SectorCount * disk_ptr->SectorSize,
-                                                                                        MmNonCached );
-                       if ( !PhysicalMemory )
-                               {
-                                       DBG ( "Could not map memory for RAM disk!\n" );
-                                       Irp->IoStatus.Information = 0;
-                                       Irp->IoStatus.Status = STATUS_INSUFFICIENT_RESOURCES;
-                                       IoCompleteRequest ( Irp, IO_NO_INCREMENT );
-                                       return STATUS_INSUFFICIENT_RESOURCES;
-                               }
-                       if ( Mode == AoE_RequestMode_Write )
-                               RtlCopyMemory ( PhysicalMemory, Buffer,
-                                                                                               SectorCount * disk_ptr->SectorSize );
-                       else
-                               RtlCopyMemory ( Buffer, PhysicalMemory,
-                                                                                               SectorCount * disk_ptr->SectorSize );
-                       MmUnmapIoSpace ( PhysicalMemory, SectorCount * disk_ptr->SectorSize );
-                       Irp->IoStatus.Information = SectorCount * disk_ptr->SectorSize;
-                       Irp->IoStatus.Status = STATUS_SUCCESS;
-                       IoCompleteRequest ( Irp, IO_NO_INCREMENT );
-                       return STATUS_SUCCESS;
-               }
-
-       /*
-        * Allocate and zero-fill our request 
-        */
-       if ( ( Request =
-                                ( PAOE_REQUEST ) ExAllocatePool ( NonPagedPool,
-                                                                                                                                                                        sizeof ( AOE_REQUEST ) ) ) == NULL )
-               {
-                       DBG ( "Couldn't allocate Request; bye!\n" );
-                       Irp->IoStatus.Information = 0;
-                       Irp->IoStatus.Status = STATUS_INSUFFICIENT_RESOURCES;
-                       IoCompleteRequest ( Irp, IO_NO_INCREMENT );
-                       return STATUS_INSUFFICIENT_RESOURCES;
-               }
-       RtlZeroMemory ( Request, sizeof ( AOE_REQUEST ) );
-
-       /*
-        * Initialize the request 
-        */
-       Request->Mode = Mode;
-       Request->SectorCount = SectorCount;
-       Request->Buffer = Buffer;
-       Request->Irp = Irp;
-       Request->TagCount = 0;
-
-       /*
-        * Split the requested sectors into packets in tags
-        */
-       for ( i = 0; i < SectorCount; i += disk_ptr->AoE.MaxSectorsPerPacket )
-               {
-                       /*
-                        * Allocate each tag 
-                        */
-                       if ( ( Tag =
-                                                ( PAOE_TAG ) ExAllocatePool ( NonPagedPool,
-                                                                                                                                                                        sizeof ( AOE_TAG ) ) ) == NULL )
-                               {
-                                       DBG ( "Couldn't allocate Tag; bye!\n" );
-                                       /*
-                                        * We failed while allocating tags; free the ones we built 
-                                        */
-                                       Tag = NewTagList;
-                                       while ( Tag != NULL )
-                                               {
-                                                       PreviousTag = Tag;
-                                                       Tag = Tag->Next;
-                                                       ExFreePool ( PreviousTag->PacketData );
-                                                       ExFreePool ( PreviousTag );
-                                               }
-                                       ExFreePool ( Request );
-                                       Irp->IoStatus.Information = 0;
-                                       Irp->IoStatus.Status = STATUS_INSUFFICIENT_RESOURCES;
-                                       IoCompleteRequest ( Irp, IO_NO_INCREMENT );
-                                       return STATUS_INSUFFICIENT_RESOURCES;
-                               }
-
-                       /*
-                        * Initialize each tag 
-                        */
-                       RtlZeroMemory ( Tag, sizeof ( AOE_TAG ) );
-                       Tag->Type = AoE_RequestType;
-                       Tag->Request = Request;
-                       Tag->DeviceExtension = DeviceExtension;
-                       Request->TagCount++;
-                       Tag->Id = 0;
-                       Tag->BufferOffset = i * disk_ptr->SectorSize;
-                       Tag->SectorCount =
-                               ( ( SectorCount - i ) <
-                                       disk_ptr->AoE.MaxSectorsPerPacket ? SectorCount -
-                                       i : disk_ptr->AoE.MaxSectorsPerPacket );
-
-                       /*
-                        * Allocate and initialize each tag's AoE packet 
-                        */
-                       Tag->PacketSize = sizeof ( AOE_PACKET );
-                       if ( Mode == AoE_RequestMode_Write )
-                               Tag->PacketSize += Tag->SectorCount * disk_ptr->SectorSize;
-                       if ( ( Tag->PacketData =
-                                                ( PAOE_PACKET ) ExAllocatePool ( NonPagedPool,
-                                                                                                                                                                                       Tag->PacketSize ) ) == NULL )
-                               {
-                                       DBG ( "Couldn't allocate Tag->PacketData; bye!\n" );
-                                       /*
-                                        * We failed while allocating an AoE packet; free
-                                        * the tags we built
-                                        */
-                                       ExFreePool ( Tag );
-                                       Tag = NewTagList;
-                                       while ( Tag != NULL )
-                                               {
-                                                       PreviousTag = Tag;
-                                                       Tag = Tag->Next;
-                                                       ExFreePool ( PreviousTag->PacketData );
-                                                       ExFreePool ( PreviousTag );
-                                               }
-                                       ExFreePool ( Request );
-                                       Irp->IoStatus.Information = 0;
-                                       Irp->IoStatus.Status = STATUS_INSUFFICIENT_RESOURCES;
-                                       IoCompleteRequest ( Irp, IO_NO_INCREMENT );
-                                       return STATUS_INSUFFICIENT_RESOURCES;
-                               }
-                       RtlZeroMemory ( Tag->PacketData, Tag->PacketSize );
-                       Tag->PacketData->Ver = AOEPROTOCOLVER;
-                       Tag->PacketData->Major =
-                               htons ( ( winvblock__uint16 ) disk_ptr->AoE.Major );
-                       Tag->PacketData->Minor = ( winvblock__uint8 ) disk_ptr->AoE.Minor;
-                       Tag->PacketData->Tag = 0;
-                       Tag->PacketData->Command = 0;
-                       Tag->PacketData->ExtendedAFlag = TRUE;
-                       if ( Mode == AoE_RequestMode_Read )
-                               {
-                                       Tag->PacketData->Cmd = 0x24;    /* READ SECTOR */
-                               }
-                       else
-                               {
-                                       Tag->PacketData->Cmd = 0x34;    /* WRITE SECTOR */
-                                       Tag->PacketData->WriteAFlag = 1;
-                               }
-                       Tag->PacketData->Count = ( winvblock__uint8 ) Tag->SectorCount;
-                       Tag->PacketData->Lba0 =
-                               ( winvblock__uint8 ) ( ( ( StartSector + i ) >> 0 ) & 255 );
-                       Tag->PacketData->Lba1 =
-                               ( winvblock__uint8 ) ( ( ( StartSector + i ) >> 8 ) & 255 );
-                       Tag->PacketData->Lba2 =
-                               ( winvblock__uint8 ) ( ( ( StartSector + i ) >> 16 ) & 255 );
-                       Tag->PacketData->Lba3 =
-                               ( winvblock__uint8 ) ( ( ( StartSector + i ) >> 24 ) & 255 );
-                       Tag->PacketData->Lba4 =
-                               ( winvblock__uint8 ) ( ( ( StartSector + i ) >> 32 ) & 255 );
-                       Tag->PacketData->Lba5 =
-                               ( winvblock__uint8 ) ( ( ( StartSector + i ) >> 40 ) & 255 );
-
-                       /*
-                        * For a write request, copy from the buffer into the AoE packet 
-                        */
-                       if ( Mode == AoE_RequestMode_Write )
-                               RtlCopyMemory ( Tag->PacketData->Data, &Buffer[Tag->BufferOffset],
-                                                                                               Tag->SectorCount * disk_ptr->SectorSize );
-
-                       /*
-                        * Add this tag to the request's tag list 
-                        */
-                       Tag->Previous = PreviousTag;
-                       Tag->Next = NULL;
-                       if ( NewTagList == NULL )
-                               {
-                                       NewTagList = Tag;
-                               }
-                       else
-                               {
-                                       PreviousTag->Next = Tag;
-                               }
-                       PreviousTag = Tag;
-               }
-       /*
-        * Split the requested sectors into packets in tags
-        */
-       Request->TotalTags = Request->TagCount;
-
-       /*
-        * Wait until we have the global spin-lock 
-        */
-       KeAcquireSpinLock ( &AoE_Globals_SpinLock, &Irql );
-
-       /*
-        * Enqueue our request's tag list to the global tag list 
-        */
-       if ( AoE_Globals_TagListLast == NULL )
-               {
-                       AoE_Globals_TagList = NewTagList;
-               }
-       else
-               {
-                       AoE_Globals_TagListLast->Next = NewTagList;
-                       NewTagList->Previous = AoE_Globals_TagListLast;
-               }
-       /*
-        * Adjust the global list to reflect our last tag 
-        */
-       AoE_Globals_TagListLast = Tag;
-
-       Irp->IoStatus.Information = 0;
-       Irp->IoStatus.Status = STATUS_PENDING;
-       IoMarkIrpPending ( Irp );
-
-       KeReleaseSpinLock ( &AoE_Globals_SpinLock, Irql );
-       KeSetEvent ( &AoE_Globals_ThreadSignalEvent, 0, FALSE );
-       return STATUS_PENDING;
+  PAOE_REQUEST Request;
+  PAOE_TAG Tag,
+   NewTagList = NULL,
+    PreviousTag = NULL;
+  KIRQL Irql;
+  ULONG i;
+  PHYSICAL_ADDRESS PhysicalAddress;
+  winvblock__uint8_ptr PhysicalMemory;
+  disk__type_ptr disk_ptr;
+
+  /*
+   * Establish a pointer into the disk device's extension space
+   */
+  disk_ptr = get_disk_ptr ( DeviceExtension );
+  if ( AoE_Globals_Stop )
+    {
+      /*
+       * Shutting down AoE; we can't service this request 
+       */
+      Irp->IoStatus.Information = 0;
+      Irp->IoStatus.Status = STATUS_CANCELLED;
+      IoCompleteRequest ( Irp, IO_NO_INCREMENT );
+      return STATUS_CANCELLED;
+    }
+
+  if ( SectorCount < 1 )
+    {
+      /*
+       * A silly request 
+       */
+      DBG ( "SectorCount < 1; cancelling\n" );
+      Irp->IoStatus.Information = 0;
+      Irp->IoStatus.Status = STATUS_CANCELLED;
+      IoCompleteRequest ( Irp, IO_NO_INCREMENT );
+      return STATUS_CANCELLED;
+    }
+
+  /*
+   * Handle the Ram disk case
+   */
+  if ( disk_ptr->IsRamdisk )
+    {
+      PhysicalAddress.QuadPart =
+       disk_ptr->RAMDisk.DiskBuf + ( StartSector * disk_ptr->SectorSize );
+      /*
+       * Possible precision loss
+       */
+      PhysicalMemory =
+       MmMapIoSpace ( PhysicalAddress, SectorCount * disk_ptr->SectorSize,
+                      MmNonCached );
+      if ( !PhysicalMemory )
+       {
+         DBG ( "Could not map memory for RAM disk!\n" );
+         Irp->IoStatus.Information = 0;
+         Irp->IoStatus.Status = STATUS_INSUFFICIENT_RESOURCES;
+         IoCompleteRequest ( Irp, IO_NO_INCREMENT );
+         return STATUS_INSUFFICIENT_RESOURCES;
+       }
+      if ( Mode == AoE_RequestMode_Write )
+       RtlCopyMemory ( PhysicalMemory, Buffer,
+                       SectorCount * disk_ptr->SectorSize );
+      else
+       RtlCopyMemory ( Buffer, PhysicalMemory,
+                       SectorCount * disk_ptr->SectorSize );
+      MmUnmapIoSpace ( PhysicalMemory, SectorCount * disk_ptr->SectorSize );
+      Irp->IoStatus.Information = SectorCount * disk_ptr->SectorSize;
+      Irp->IoStatus.Status = STATUS_SUCCESS;
+      IoCompleteRequest ( Irp, IO_NO_INCREMENT );
+      return STATUS_SUCCESS;
+    }
+
+  /*
+   * Allocate and zero-fill our request 
+   */
+  if ( ( Request =
+        ( PAOE_REQUEST ) ExAllocatePool ( NonPagedPool,
+                                          sizeof ( AOE_REQUEST ) ) ) == NULL )
+    {
+      DBG ( "Couldn't allocate Request; bye!\n" );
+      Irp->IoStatus.Information = 0;
+      Irp->IoStatus.Status = STATUS_INSUFFICIENT_RESOURCES;
+      IoCompleteRequest ( Irp, IO_NO_INCREMENT );
+      return STATUS_INSUFFICIENT_RESOURCES;
+    }
+  RtlZeroMemory ( Request, sizeof ( AOE_REQUEST ) );
+
+  /*
+   * Initialize the request 
+   */
+  Request->Mode = Mode;
+  Request->SectorCount = SectorCount;
+  Request->Buffer = Buffer;
+  Request->Irp = Irp;
+  Request->TagCount = 0;
+
+  /*
+   * Split the requested sectors into packets in tags
+   */
+  for ( i = 0; i < SectorCount; i += disk_ptr->AoE.MaxSectorsPerPacket )
+    {
+      /*
+       * Allocate each tag 
+       */
+      if ( ( Tag =
+            ( PAOE_TAG ) ExAllocatePool ( NonPagedPool,
+                                          sizeof ( AOE_TAG ) ) ) == NULL )
+       {
+         DBG ( "Couldn't allocate Tag; bye!\n" );
+         /*
+          * We failed while allocating tags; free the ones we built 
+          */
+         Tag = NewTagList;
+         while ( Tag != NULL )
+           {
+             PreviousTag = Tag;
+             Tag = Tag->Next;
+             ExFreePool ( PreviousTag->PacketData );
+             ExFreePool ( PreviousTag );
+           }
+         ExFreePool ( Request );
+         Irp->IoStatus.Information = 0;
+         Irp->IoStatus.Status = STATUS_INSUFFICIENT_RESOURCES;
+         IoCompleteRequest ( Irp, IO_NO_INCREMENT );
+         return STATUS_INSUFFICIENT_RESOURCES;
+       }
+
+      /*
+       * Initialize each tag 
+       */
+      RtlZeroMemory ( Tag, sizeof ( AOE_TAG ) );
+      Tag->Type = AoE_RequestType;
+      Tag->Request = Request;
+      Tag->DeviceExtension = DeviceExtension;
+      Request->TagCount++;
+      Tag->Id = 0;
+      Tag->BufferOffset = i * disk_ptr->SectorSize;
+      Tag->SectorCount =
+       ( ( SectorCount - i ) <
+         disk_ptr->AoE.MaxSectorsPerPacket ? SectorCount -
+         i : disk_ptr->AoE.MaxSectorsPerPacket );
+
+      /*
+       * Allocate and initialize each tag's AoE packet 
+       */
+      Tag->PacketSize = sizeof ( AOE_PACKET );
+      if ( Mode == AoE_RequestMode_Write )
+       Tag->PacketSize += Tag->SectorCount * disk_ptr->SectorSize;
+      if ( ( Tag->PacketData =
+            ( PAOE_PACKET ) ExAllocatePool ( NonPagedPool,
+                                             Tag->PacketSize ) ) == NULL )
+       {
+         DBG ( "Couldn't allocate Tag->PacketData; bye!\n" );
+         /*
+          * We failed while allocating an AoE packet; free
+          * the tags we built
+          */
+         ExFreePool ( Tag );
+         Tag = NewTagList;
+         while ( Tag != NULL )
+           {
+             PreviousTag = Tag;
+             Tag = Tag->Next;
+             ExFreePool ( PreviousTag->PacketData );
+             ExFreePool ( PreviousTag );
+           }
+         ExFreePool ( Request );
+         Irp->IoStatus.Information = 0;
+         Irp->IoStatus.Status = STATUS_INSUFFICIENT_RESOURCES;
+         IoCompleteRequest ( Irp, IO_NO_INCREMENT );
+         return STATUS_INSUFFICIENT_RESOURCES;
+       }
+      RtlZeroMemory ( Tag->PacketData, Tag->PacketSize );
+      Tag->PacketData->Ver = AOEPROTOCOLVER;
+      Tag->PacketData->Major =
+       htons ( ( winvblock__uint16 ) disk_ptr->AoE.Major );
+      Tag->PacketData->Minor = ( winvblock__uint8 ) disk_ptr->AoE.Minor;
+      Tag->PacketData->Tag = 0;
+      Tag->PacketData->Command = 0;
+      Tag->PacketData->ExtendedAFlag = TRUE;
+      if ( Mode == AoE_RequestMode_Read )
+       {
+         Tag->PacketData->Cmd = 0x24;  /* READ SECTOR */
+       }
+      else
+       {
+         Tag->PacketData->Cmd = 0x34;  /* WRITE SECTOR */
+         Tag->PacketData->WriteAFlag = 1;
+       }
+      Tag->PacketData->Count = ( winvblock__uint8 ) Tag->SectorCount;
+      Tag->PacketData->Lba0 =
+       ( winvblock__uint8 ) ( ( ( StartSector + i ) >> 0 ) & 255 );
+      Tag->PacketData->Lba1 =
+       ( winvblock__uint8 ) ( ( ( StartSector + i ) >> 8 ) & 255 );
+      Tag->PacketData->Lba2 =
+       ( winvblock__uint8 ) ( ( ( StartSector + i ) >> 16 ) & 255 );
+      Tag->PacketData->Lba3 =
+       ( winvblock__uint8 ) ( ( ( StartSector + i ) >> 24 ) & 255 );
+      Tag->PacketData->Lba4 =
+       ( winvblock__uint8 ) ( ( ( StartSector + i ) >> 32 ) & 255 );
+      Tag->PacketData->Lba5 =
+       ( winvblock__uint8 ) ( ( ( StartSector + i ) >> 40 ) & 255 );
+
+      /*
+       * For a write request, copy from the buffer into the AoE packet 
+       */
+      if ( Mode == AoE_RequestMode_Write )
+       RtlCopyMemory ( Tag->PacketData->Data, &Buffer[Tag->BufferOffset],
+                       Tag->SectorCount * disk_ptr->SectorSize );
+
+      /*
+       * Add this tag to the request's tag list 
+       */
+      Tag->Previous = PreviousTag;
+      Tag->Next = NULL;
+      if ( NewTagList == NULL )
+       {
+         NewTagList = Tag;
+       }
+      else
+       {
+         PreviousTag->Next = Tag;
+       }
+      PreviousTag = Tag;
+    }
+  /*
+   * Split the requested sectors into packets in tags
+   */
+  Request->TotalTags = Request->TagCount;
+
+  /*
+   * Wait until we have the global spin-lock 
+   */
+  KeAcquireSpinLock ( &AoE_Globals_SpinLock, &Irql );
+
+  /*
+   * Enqueue our request's tag list to the global tag list 
+   */
+  if ( AoE_Globals_TagListLast == NULL )
+    {
+      AoE_Globals_TagList = NewTagList;
+    }
+  else
+    {
+      AoE_Globals_TagListLast->Next = NewTagList;
+      NewTagList->Previous = AoE_Globals_TagListLast;
+    }
+  /*
+   * Adjust the global list to reflect our last tag 
+   */
+  AoE_Globals_TagListLast = Tag;
+
+  Irp->IoStatus.Information = 0;
+  Irp->IoStatus.Status = STATUS_PENDING;
+  IoMarkIrpPending ( Irp );
+
+  KeReleaseSpinLock ( &AoE_Globals_SpinLock, Irql );
+  KeSetEvent ( &AoE_Globals_ThreadSignalEvent, 0, FALSE );
+  return STATUS_PENDING;
 }
 
 /**
@@ -1037,382 +1038,383 @@ AoE_Request (
  */
 NTSTATUS STDCALL
 AoE_Reply (
-       IN winvblock__uint8_ptr SourceMac,
-       IN winvblock__uint8_ptr DestinationMac,
-       IN winvblock__uint8_ptr Data,
-       IN winvblock__uint32 DataSize
+  IN winvblock__uint8_ptr SourceMac,
+  IN winvblock__uint8_ptr DestinationMac,
+  IN winvblock__uint8_ptr Data,
+  IN winvblock__uint32 DataSize
  )
 {
-       PAOE_PACKET Reply = ( PAOE_PACKET ) Data;
-       LONGLONG LBASize;
-       PAOE_TAG Tag;
-       KIRQL Irql;
-       winvblock__bool Found = FALSE;
-       LARGE_INTEGER CurrentTime;
-       disk__type_ptr disk_ptr;
-
-       /*
-        * Discard non-responses 
-        */
-       if ( !Reply->ResponseFlag )
-               return STATUS_SUCCESS;
-
-       /*
-        * If the response matches our probe, add the AoE disk device 
-        */
-       if ( AoE_Globals_ProbeTag->Id == Reply->Tag )
-               {
-                       RtlCopyMemory ( &LBASize, &Reply->Data[200], sizeof ( LONGLONG ) );
-                       Bus_AddTarget ( DestinationMac, SourceMac, ntohs ( Reply->Major ),
-                                                                                       Reply->Minor, LBASize );
-                       return STATUS_SUCCESS;
-               }
-
-       /*
-        * Wait until we have the global spin-lock 
-        */
-       KeAcquireSpinLock ( &AoE_Globals_SpinLock, &Irql );
-
-       /*
-        * Search for request tag 
-        */
-       if ( AoE_Globals_TagList == NULL )
-               {
-                       KeReleaseSpinLock ( &AoE_Globals_SpinLock, Irql );
-                       return STATUS_SUCCESS;
-               }
-       Tag = AoE_Globals_TagList;
-       while ( Tag != NULL )
+  PAOE_PACKET Reply = ( PAOE_PACKET ) Data;
+  LONGLONG LBASize;
+  PAOE_TAG Tag;
+  KIRQL Irql;
+  winvblock__bool Found = FALSE;
+  LARGE_INTEGER CurrentTime;
+  disk__type_ptr disk_ptr;
+
+  /*
+   * Discard non-responses 
+   */
+  if ( !Reply->ResponseFlag )
+    return STATUS_SUCCESS;
+
+  /*
+   * If the response matches our probe, add the AoE disk device 
+   */
+  if ( AoE_Globals_ProbeTag->Id == Reply->Tag )
+    {
+      RtlCopyMemory ( &LBASize, &Reply->Data[200], sizeof ( LONGLONG ) );
+      Bus_AddTarget ( DestinationMac, SourceMac, ntohs ( Reply->Major ),
+                     Reply->Minor, LBASize );
+      return STATUS_SUCCESS;
+    }
+
+  /*
+   * Wait until we have the global spin-lock 
+   */
+  KeAcquireSpinLock ( &AoE_Globals_SpinLock, &Irql );
+
+  /*
+   * Search for request tag 
+   */
+  if ( AoE_Globals_TagList == NULL )
+    {
+      KeReleaseSpinLock ( &AoE_Globals_SpinLock, Irql );
+      return STATUS_SUCCESS;
+    }
+  Tag = AoE_Globals_TagList;
+  while ( Tag != NULL )
+    {
+      if ( ( Tag->Id == Reply->Tag )
+          && ( Tag->PacketData->Major == Reply->Major )
+          && ( Tag->PacketData->Minor == Reply->Minor ) )
+       {
+         Found = TRUE;
+         break;
+       }
+      Tag = Tag->Next;
+    }
+  if ( !Found )
+    {
+      KeReleaseSpinLock ( &AoE_Globals_SpinLock, Irql );
+      return STATUS_SUCCESS;
+    }
+  else
+    {
+      /*
+       * Remove the tag from the global tag list 
+       */
+      if ( Tag->Previous == NULL )
+       AoE_Globals_TagList = Tag->Next;
+      else
+       Tag->Previous->Next = Tag->Next;
+      if ( Tag->Next == NULL )
+       AoE_Globals_TagListLast = Tag->Previous;
+      else
+       Tag->Next->Previous = Tag->Previous;
+      AoE_Globals_OutstandingTags--;
+      if ( AoE_Globals_OutstandingTags < 0 )
+       DBG ( "AoE_Globals_OutstandingTags < 0!!\n" );
+      KeSetEvent ( &AoE_Globals_ThreadSignalEvent, 0, FALSE );
+    }
+  KeReleaseSpinLock ( &AoE_Globals_SpinLock, Irql );
+
+  /*
+   * Establish a pointer into the disk device's extension space
+   */
+  disk_ptr = get_disk_ptr ( Tag->DeviceExtension );
+
+  /*
+   * If our tag was a discovery request, note the server 
+   */
+  if ( RtlCompareMemory
+       ( disk_ptr->AoE.ServerMac, "\xff\xff\xff\xff\xff\xff", 6 ) == 6 )
+    {
+      RtlCopyMemory ( disk_ptr->AoE.ServerMac, SourceMac, 6 );
+      DBG ( "Major: %d minor: %d found on server "
+           "%02x:%02x:%02x:%02x:%02x:%02x\n", disk_ptr->AoE.Major,
+           disk_ptr->AoE.Minor, SourceMac[0], SourceMac[1], SourceMac[2],
+           SourceMac[3], SourceMac[4], SourceMac[5] );
+    }
+
+  KeQuerySystemTime ( &CurrentTime );
+  disk_ptr->AoE.Timeout -=
+    ( ULONG ) ( ( disk_ptr->AoE.Timeout -
+                 ( CurrentTime.QuadPart -
+                   Tag->FirstSendTime.QuadPart ) ) / 1024 );
+  /*
+   * TODO: Replace the values below with #defined constants 
+   */
+  if ( disk_ptr->AoE.Timeout > 100000000 )
+    disk_ptr->AoE.Timeout = 100000000;
+
+  switch ( Tag->Type )
+    {
+      case AoE_SearchDriveType:
+       KeAcquireSpinLock ( &disk_ptr->SpinLock, &Irql );
+       switch ( disk_ptr->SearchState )
+         {
+           case GettingSize:
+             /*
+              * The reply tells us the disk size 
+              */
+             RtlCopyMemory ( &disk_ptr->LBADiskSize, &Reply->Data[200],
+                             sizeof ( LONGLONG ) );
+             /*
+              * Next we are concerned with the disk geometry 
+              */
+             disk_ptr->SearchState = GetGeometry;
+             break;
+           case GettingGeometry:
+             /*
+              * FIXME: use real values from partition table 
+              */
+             disk_ptr->SectorSize = 512;
+             disk_ptr->Heads = 255;
+             disk_ptr->Sectors = 63;
+             disk_ptr->Cylinders =
+               disk_ptr->LBADiskSize / ( disk_ptr->Heads *
+                                         disk_ptr->Sectors );
+             disk_ptr->LBADiskSize =
+               disk_ptr->Cylinders * disk_ptr->Heads * disk_ptr->Sectors;
+             /*
+              * Next we are concerned with the maximum sectors per packet 
+              */
+             disk_ptr->SearchState = GetMaxSectorsPerPacket;
+             break;
+           case GettingMaxSectorsPerPacket:
+             DataSize -= sizeof ( AOE_PACKET );
+             if ( DataSize <
+                  ( disk_ptr->AoE.MaxSectorsPerPacket *
+                    disk_ptr->SectorSize ) )
                {
-                       if ( ( Tag->Id == Reply->Tag )
-                                        && ( Tag->PacketData->Major == Reply->Major )
-                                        && ( Tag->PacketData->Minor == Reply->Minor ) )
-                               {
-                                       Found = TRUE;
-                                       break;
-                               }
-                       Tag = Tag->Next;
+                 DBG ( "Packet size too low while getting "
+                       "MaxSectorsPerPacket (tried %d, got size of %d)\n",
+                       disk_ptr->AoE.MaxSectorsPerPacket, DataSize );
+                 disk_ptr->AoE.MaxSectorsPerPacket--;
+                 disk_ptr->SearchState = Done;
                }
-       if ( !Found )
+             else if ( disk_ptr->AoE.MTU <
+                       ( sizeof ( AOE_PACKET ) +
+                         ( ( disk_ptr->AoE.MaxSectorsPerPacket +
+                             1 ) * disk_ptr->SectorSize ) ) )
                {
-                       KeReleaseSpinLock ( &AoE_Globals_SpinLock, Irql );
-                       return STATUS_SUCCESS;
+                 DBG ( "Got MaxSectorsPerPacket %d at size of %d. "
+                       "MTU of %d reached\n",
+                       disk_ptr->AoE.MaxSectorsPerPacket, DataSize,
+                       disk_ptr->AoE.MTU );
+                 disk_ptr->SearchState = Done;
                }
-       else
+             else
                {
-                       /*
-                        * Remove the tag from the global tag list 
-                        */
-                       if ( Tag->Previous == NULL )
-                               AoE_Globals_TagList = Tag->Next;
-                       else
-                               Tag->Previous->Next = Tag->Next;
-                       if ( Tag->Next == NULL )
-                               AoE_Globals_TagListLast = Tag->Previous;
-                       else
-                               Tag->Next->Previous = Tag->Previous;
-                       AoE_Globals_OutstandingTags--;
-                       if ( AoE_Globals_OutstandingTags < 0 )
-                               DBG ( "AoE_Globals_OutstandingTags < 0!!\n" );
-                       KeSetEvent ( &AoE_Globals_ThreadSignalEvent, 0, FALSE );
+                 DBG ( "Got MaxSectorsPerPacket %d at size of %d, "
+                       "trying next...\n", disk_ptr->AoE.MaxSectorsPerPacket,
+                       DataSize );
+                 disk_ptr->SearchState = GetMaxSectorsPerPacket;
                }
-       KeReleaseSpinLock ( &AoE_Globals_SpinLock, Irql );
-
+             break;
+           default:
+             DBG ( "Undefined SearchState!\n" );
+             break;
+         }
+       KeReleaseSpinLock ( &disk_ptr->SpinLock, Irql );
+       KeSetEvent ( &disk_ptr->SearchEvent, 0, FALSE );
+       break;
+      case AoE_RequestType:
        /*
-        * Establish a pointer into the disk device's extension space
+        * If the reply is in response to a read request, get our data! 
         */
-       disk_ptr = get_disk_ptr ( Tag->DeviceExtension );
-
-       /*
-        * If our tag was a discovery request, note the server 
-        */
-       if ( RtlCompareMemory
-                        ( disk_ptr->AoE.ServerMac, "\xff\xff\xff\xff\xff\xff", 6 ) == 6 )
-               {
-                       RtlCopyMemory ( disk_ptr->AoE.ServerMac, SourceMac, 6 );
-                       DBG ( "Major: %d minor: %d found on server "
-                                               "%02x:%02x:%02x:%02x:%02x:%02x\n", disk_ptr->AoE.Major,
-                                               disk_ptr->AoE.Minor, SourceMac[0], SourceMac[1], SourceMac[2],
-                                               SourceMac[3], SourceMac[4], SourceMac[5] );
-               }
-
-       KeQuerySystemTime ( &CurrentTime );
-       disk_ptr->AoE.Timeout -=
-               ( ULONG ) ( ( disk_ptr->AoE.Timeout -
-                                                                       ( CurrentTime.QuadPart -
-                                                                               Tag->FirstSendTime.QuadPart ) ) / 1024 );
+       if ( Tag->Request->Mode == AoE_RequestMode_Read )
+         RtlCopyMemory ( &Tag->Request->Buffer[Tag->BufferOffset],
+                         Reply->Data,
+                         Tag->SectorCount * disk_ptr->SectorSize );
        /*
-        * TODO: Replace the values below with #defined constants 
+        * If this is the last reply expected for the read request,
+        * complete the IRP and free the request
         */
-       if ( disk_ptr->AoE.Timeout > 100000000 )
-               disk_ptr->AoE.Timeout = 100000000;
-
-       switch ( Tag->Type )
-               {
-                       case AoE_SearchDriveType:
-                               KeAcquireSpinLock ( &disk_ptr->SpinLock, &Irql );
-                               switch ( disk_ptr->SearchState )
-                                       {
-                                               case GettingSize:
-                                                       /*
-                                                        * The reply tells us the disk size 
-                                                        */
-                                                       RtlCopyMemory ( &disk_ptr->LBADiskSize, &Reply->Data[200],
-                                                                                                                       sizeof ( LONGLONG ) );
-                                                       /*
-                                                        * Next we are concerned with the disk geometry 
-                                                        */
-                                                       disk_ptr->SearchState = GetGeometry;
-                                                       break;
-                                               case GettingGeometry:
-                                                       /*
-                                                        * FIXME: use real values from partition table 
-                                                        */
-                                                       disk_ptr->SectorSize = 512;
-                                                       disk_ptr->Heads = 255;
-                                                       disk_ptr->Sectors = 63;
-                                                       disk_ptr->Cylinders =
-                                                               disk_ptr->LBADiskSize / ( disk_ptr->Heads *
-                                                                                                                                                                       disk_ptr->Sectors );
-                                                       disk_ptr->LBADiskSize =
-                                                               disk_ptr->Cylinders * disk_ptr->Heads * disk_ptr->Sectors;
-                                                       /*
-                                                        * Next we are concerned with the maximum sectors per packet 
-                                                        */
-                                                       disk_ptr->SearchState = GetMaxSectorsPerPacket;
-                                                       break;
-                                               case GettingMaxSectorsPerPacket:
-                                                       DataSize -= sizeof ( AOE_PACKET );
-                                                       if ( DataSize <
-                                                                        ( disk_ptr->AoE.MaxSectorsPerPacket *
-                                                                                disk_ptr->SectorSize ) )
-                                                               {
-                                                                       DBG ( "Packet size too low while getting "
-                                                                                               "MaxSectorsPerPacket (tried %d, got size of %d)\n",
-                                                                                               disk_ptr->AoE.MaxSectorsPerPacket, DataSize );
-                                                                       disk_ptr->AoE.MaxSectorsPerPacket--;
-                                                                       disk_ptr->SearchState = Done;
-                                                               }
-                                                       else if ( disk_ptr->AoE.MTU <
-                                                                                               ( sizeof ( AOE_PACKET ) +
-                                                                                                       ( ( disk_ptr->AoE.MaxSectorsPerPacket +
-                                                                                                                       1 ) * disk_ptr->SectorSize ) ) )
-                                                               {
-                                                                       DBG ( "Got MaxSectorsPerPacket %d at size of %d. "
-                                                                                               "MTU of %d reached\n",
-                                                                                               disk_ptr->AoE.MaxSectorsPerPacket, DataSize,
-                                                                                               disk_ptr->AoE.MTU );
-                                                                       disk_ptr->SearchState = Done;
-                                                               }
-                                                       else
-                                                               {
-                                                                       DBG ( "Got MaxSectorsPerPacket %d at size of %d, "
-                                                                                               "trying next...\n", disk_ptr->AoE.MaxSectorsPerPacket,
-                                                                                               DataSize );
-                                                                       disk_ptr->SearchState = GetMaxSectorsPerPacket;
-                                                               }
-                                                       break;
-                                               default:
-                                                       DBG ( "Undefined SearchState!\n" );
-                                                       break;
-                                       }
-                               KeReleaseSpinLock ( &disk_ptr->SpinLock, Irql );
-                               KeSetEvent ( &disk_ptr->SearchEvent, 0, FALSE );
-                               break;
-                       case AoE_RequestType:
-                               /*
-                                * If the reply is in response to a read request, get our data! 
-                                */
-                               if ( Tag->Request->Mode == AoE_RequestMode_Read )
-                                       RtlCopyMemory ( &Tag->Request->Buffer[Tag->BufferOffset],
-                                                                                                       Reply->Data,
-                                                                                                       Tag->SectorCount * disk_ptr->SectorSize );
-                               /*
-                                * If this is the last reply expected for the read request,
-                                * complete the IRP and free the request
-                                */
-                               if ( InterlockedDecrement ( &Tag->Request->TagCount ) == 0 )
-                                       {
-                                               Tag->Request->Irp->IoStatus.Information =
-                                                       Tag->Request->SectorCount * disk_ptr->SectorSize;
-                                               Tag->Request->Irp->IoStatus.Status = STATUS_SUCCESS;
-                                               Driver_CompletePendingIrp ( Tag->Request->Irp );
-                                               ExFreePool ( Tag->Request );
-                                       }
-                               break;
-                       default:
-                               DBG ( "Unknown tag type!!\n" );
-                               break;
-               }
-
-       KeSetEvent ( &AoE_Globals_ThreadSignalEvent, 0, FALSE );
-       ExFreePool ( Tag->PacketData );
-       ExFreePool ( Tag );
-       return STATUS_SUCCESS;
+       if ( InterlockedDecrement ( &Tag->Request->TagCount ) == 0 )
+         {
+           Tag->Request->Irp->IoStatus.Information =
+             Tag->Request->SectorCount * disk_ptr->SectorSize;
+           Tag->Request->Irp->IoStatus.Status = STATUS_SUCCESS;
+           Driver_CompletePendingIrp ( Tag->Request->Irp );
+           ExFreePool ( Tag->Request );
+         }
+       break;
+      default:
+       DBG ( "Unknown tag type!!\n" );
+       break;
+    }
+
+  KeSetEvent ( &AoE_Globals_ThreadSignalEvent, 0, FALSE );
+  ExFreePool ( Tag->PacketData );
+  ExFreePool ( Tag );
+  return STATUS_SUCCESS;
 }
 
 VOID STDCALL
 AoE_ResetProbe (
-       void
+  void
  )
 {
-       AoE_Globals_ProbeTag->SendTime.QuadPart = 0LL;
+  AoE_Globals_ProbeTag->SendTime.QuadPart = 0LL;
 }
 
 static VOID STDCALL
 AoE_Thread (
-       IN PVOID StartContext
+  IN PVOID StartContext
  )
 {
-       LARGE_INTEGER Timeout,
-        CurrentTime,
-        ProbeTime,
-        ReportTime;
-       ULONG NextTagId = 1;
-       PAOE_TAG Tag;
-       KIRQL Irql;
-       ULONG Sends = 0;
-       ULONG Resends = 0;
-       ULONG ResendFails = 0;
-       ULONG Fails = 0;
-       ULONG RequestTimeout = 0;
-       disk__type_ptr disk_ptr;
-
-       DBG ( "Entry\n" );
-       ReportTime.QuadPart = 0LL;
-       ProbeTime.QuadPart = 0LL;
-
-       while ( TRUE )
+  LARGE_INTEGER Timeout,
+   CurrentTime,
+   ProbeTime,
+   ReportTime;
+  ULONG NextTagId = 1;
+  PAOE_TAG Tag;
+  KIRQL Irql;
+  ULONG Sends = 0;
+  ULONG Resends = 0;
+  ULONG ResendFails = 0;
+  ULONG Fails = 0;
+  ULONG RequestTimeout = 0;
+  disk__type_ptr disk_ptr;
+
+  DBG ( "Entry\n" );
+  ReportTime.QuadPart = 0LL;
+  ProbeTime.QuadPart = 0LL;
+
+  while ( TRUE )
+    {
+      /*
+       * TODO: Make the below value a #defined constant 
+       */
+      /*
+       * 100.000 * 100ns = 10.000.000 ns = 10ms
+       */
+      Timeout.QuadPart = -100000LL;
+      KeWaitForSingleObject ( &AoE_Globals_ThreadSignalEvent, Executive,
+                             KernelMode, FALSE, &Timeout );
+      KeResetEvent ( &AoE_Globals_ThreadSignalEvent );
+      if ( AoE_Globals_Stop )
+       {
+         DBG ( "Stopping...\n" );
+         PsTerminateSystemThread ( STATUS_SUCCESS );
+       }
+      Bus_CleanupTargetList (  );
+
+      KeQuerySystemTime ( &CurrentTime );
+      /*
+       * TODO: Make the below value a #defined constant 
+       */
+      if ( CurrentTime.QuadPart > ( ReportTime.QuadPart + 10000000LL ) )
+       {
+         DBG ( "Sends: %d  Resends: %d  ResendFails: %d  Fails: %d  "
+               "AoE_Globals_OutstandingTags: %d  RequestTimeout: %d\n", Sends,
+               Resends, ResendFails, Fails, AoE_Globals_OutstandingTags,
+               RequestTimeout );
+         Sends = 0;
+         Resends = 0;
+         ResendFails = 0;
+         Fails = 0;
+         KeQuerySystemTime ( &ReportTime );
+       }
+
+      /*
+       * TODO: Make the below value a #defined constant 
+       */
+      if ( CurrentTime.QuadPart >
+          ( AoE_Globals_ProbeTag->SendTime.QuadPart + 100000000LL ) )
+       {
+         AoE_Globals_ProbeTag->Id = NextTagId++;
+         if ( NextTagId == 0 )
+           NextTagId++;
+         AoE_Globals_ProbeTag->PacketData->Tag = AoE_Globals_ProbeTag->Id;
+         Protocol_Send ( "\xff\xff\xff\xff\xff\xff",
+                         "\xff\xff\xff\xff\xff\xff",
+                         ( winvblock__uint8_ptr )
+                         AoE_Globals_ProbeTag->PacketData,
+                         AoE_Globals_ProbeTag->PacketSize, NULL );
+         KeQuerySystemTime ( &AoE_Globals_ProbeTag->SendTime );
+       }
+
+      KeAcquireSpinLock ( &AoE_Globals_SpinLock, &Irql );
+      if ( AoE_Globals_TagList == NULL )
+       {
+         KeReleaseSpinLock ( &AoE_Globals_SpinLock, Irql );
+         continue;
+       }
+      Tag = AoE_Globals_TagList;
+      while ( Tag != NULL )
+       {
+         /*
+          * Establish a pointer into the disk device's extension space
+          */
+         disk_ptr = get_disk_ptr ( Tag->DeviceExtension );
+
+         RequestTimeout = disk_ptr->AoE.Timeout;
+         if ( Tag->Id == 0 )
+           {
+             if ( AoE_Globals_OutstandingTags <= 64 )
+               {
+                 /*
+                  * if ( AoE_Globals_OutstandingTags <= 102400 ) { 
+                  */
+                 if ( AoE_Globals_OutstandingTags < 0 )
+                   DBG ( "AoE_Globals_OutstandingTags < 0!!\n" );
+                 Tag->Id = NextTagId++;
+                 if ( NextTagId == 0 )
+                   NextTagId++;
+                 Tag->PacketData->Tag = Tag->Id;
+                 if ( Protocol_Send
+                      ( disk_ptr->AoE.ClientMac, disk_ptr->AoE.ServerMac,
+                        ( winvblock__uint8_ptr ) Tag->PacketData,
+                        Tag->PacketSize, Tag ) )
+                   {
+                     KeQuerySystemTime ( &Tag->FirstSendTime );
+                     KeQuerySystemTime ( &Tag->SendTime );
+                     AoE_Globals_OutstandingTags++;
+                     Sends++;
+                   }
+                 else
+                   {
+                     Fails++;
+                     Tag->Id = 0;
+                     break;
+                   }
+               }
+           }
+         else
+           {
+             KeQuerySystemTime ( &CurrentTime );
+             if ( CurrentTime.QuadPart >
+                  ( Tag->SendTime.QuadPart +
+                    ( LONGLONG ) ( disk_ptr->AoE.Timeout * 2 ) ) )
                {
-                       /*
-                        * TODO: Make the below value a #defined constant 
-                        */
-                       /*
-                        * 100.000 * 100ns = 10.000.000 ns = 10ms
-                        */
-                       Timeout.QuadPart = -100000LL;
-                       KeWaitForSingleObject ( &AoE_Globals_ThreadSignalEvent, Executive,
-                                                                                                                       KernelMode, FALSE, &Timeout );
-                       KeResetEvent ( &AoE_Globals_ThreadSignalEvent );
-                       if ( AoE_Globals_Stop )
-                               {
-                                       DBG ( "Stopping...\n" );
-                                       PsTerminateSystemThread ( STATUS_SUCCESS );
-                               }
-                       Bus_CleanupTargetList (  );
-
-                       KeQuerySystemTime ( &CurrentTime );
-                       /*
-                        * TODO: Make the below value a #defined constant 
-                        */
-                       if ( CurrentTime.QuadPart > ( ReportTime.QuadPart + 10000000LL ) )
-                               {
-                                       DBG ( "Sends: %d  Resends: %d  ResendFails: %d  Fails: %d  "
-                                                               "AoE_Globals_OutstandingTags: %d  RequestTimeout: %d\n", Sends,
-                                                               Resends, ResendFails, Fails, AoE_Globals_OutstandingTags,
-                                                               RequestTimeout );
-                                       Sends = 0;
-                                       Resends = 0;
-                                       ResendFails = 0;
-                                       Fails = 0;
-                                       KeQuerySystemTime ( &ReportTime );
-                               }
-
-                       /*
-                        * TODO: Make the below value a #defined constant 
-                        */
-                       if ( CurrentTime.QuadPart >
-                                        ( AoE_Globals_ProbeTag->SendTime.QuadPart + 100000000LL ) )
-                               {
-                                       AoE_Globals_ProbeTag->Id = NextTagId++;
-                                       if ( NextTagId == 0 )
-                                               NextTagId++;
-                                       AoE_Globals_ProbeTag->PacketData->Tag = AoE_Globals_ProbeTag->Id;
-                                       Protocol_Send ( "\xff\xff\xff\xff\xff\xff",
-                                                                                                       "\xff\xff\xff\xff\xff\xff",
-                                                                                                       ( winvblock__uint8_ptr ) AoE_Globals_ProbeTag->
-                                                                                                       PacketData, AoE_Globals_ProbeTag->PacketSize, NULL );
-                                       KeQuerySystemTime ( &AoE_Globals_ProbeTag->SendTime );
-                               }
-
-                       KeAcquireSpinLock ( &AoE_Globals_SpinLock, &Irql );
-                       if ( AoE_Globals_TagList == NULL )
-                               {
-                                       KeReleaseSpinLock ( &AoE_Globals_SpinLock, Irql );
-                                       continue;
-                               }
-                       Tag = AoE_Globals_TagList;
-                       while ( Tag != NULL )
-                               {
-                                       /*
-                                        * Establish a pointer into the disk device's extension space
-                                        */
-                                       disk_ptr = get_disk_ptr ( Tag->DeviceExtension );
-
-                                       RequestTimeout = disk_ptr->AoE.Timeout;
-                                       if ( Tag->Id == 0 )
-                                               {
-                                                       if ( AoE_Globals_OutstandingTags <= 64 )
-                                                               {
-                                                                       /*
-                                                                        * if ( AoE_Globals_OutstandingTags <= 102400 ) { 
-                                                                        */
-                                                                       if ( AoE_Globals_OutstandingTags < 0 )
-                                                                               DBG ( "AoE_Globals_OutstandingTags < 0!!\n" );
-                                                                       Tag->Id = NextTagId++;
-                                                                       if ( NextTagId == 0 )
-                                                                               NextTagId++;
-                                                                       Tag->PacketData->Tag = Tag->Id;
-                                                                       if ( Protocol_Send
-                                                                                        ( disk_ptr->AoE.ClientMac, disk_ptr->AoE.ServerMac,
-                                                                                                ( winvblock__uint8_ptr ) Tag->PacketData,
-                                                                                                Tag->PacketSize, Tag ) )
-                                                                               {
-                                                                                       KeQuerySystemTime ( &Tag->FirstSendTime );
-                                                                                       KeQuerySystemTime ( &Tag->SendTime );
-                                                                                       AoE_Globals_OutstandingTags++;
-                                                                                       Sends++;
-                                                                               }
-                                                                       else
-                                                                               {
-                                                                                       Fails++;
-                                                                                       Tag->Id = 0;
-                                                                                       break;
-                                                                               }
-                                                               }
-                                               }
-                                       else
-                                               {
-                                                       KeQuerySystemTime ( &CurrentTime );
-                                                       if ( CurrentTime.QuadPart >
-                                                                        ( Tag->SendTime.QuadPart +
-                                                                                ( LONGLONG ) ( disk_ptr->AoE.Timeout * 2 ) ) )
-                                                               {
-                                                                       if ( Protocol_Send
-                                                                                        ( disk_ptr->AoE.ClientMac, disk_ptr->AoE.ServerMac,
-                                                                                                ( winvblock__uint8_ptr ) Tag->PacketData,
-                                                                                                Tag->PacketSize, Tag ) )
-                                                                               {
-                                                                                       KeQuerySystemTime ( &Tag->SendTime );
-                                                                                       disk_ptr->AoE.Timeout += disk_ptr->AoE.Timeout / 1000;
-                                                                                       if ( disk_ptr->AoE.Timeout > 100000000 )
-                                                                                               disk_ptr->AoE.Timeout = 100000000;
-                                                                                       Resends++;
-                                                                               }
-                                                                       else
-                                                                               {
-                                                                                       ResendFails++;
-                                                                                       break;
-                                                                               }
-                                                               }
-                                               }
-                                       Tag = Tag->Next;
-                                       if ( Tag == AoE_Globals_TagList )
-                                               {
-                                                       DBG ( "Taglist Cyclic!!\n" );
-                                                       break;
-                                               }
-                               }
-                       KeReleaseSpinLock ( &AoE_Globals_SpinLock, Irql );
+                 if ( Protocol_Send
+                      ( disk_ptr->AoE.ClientMac, disk_ptr->AoE.ServerMac,
+                        ( winvblock__uint8_ptr ) Tag->PacketData,
+                        Tag->PacketSize, Tag ) )
+                   {
+                     KeQuerySystemTime ( &Tag->SendTime );
+                     disk_ptr->AoE.Timeout += disk_ptr->AoE.Timeout / 1000;
+                     if ( disk_ptr->AoE.Timeout > 100000000 )
+                       disk_ptr->AoE.Timeout = 100000000;
+                     Resends++;
+                   }
+                 else
+                   {
+                     ResendFails++;
+                     break;
+                   }
                }
+           }
+         Tag = Tag->Next;
+         if ( Tag == AoE_Globals_TagList )
+           {
+             DBG ( "Taglist Cyclic!!\n" );
+             break;
+           }
+       }
+      KeReleaseSpinLock ( &AoE_Globals_SpinLock, Irql );
+    }
 }
index c9a9f7a..889b7f8 100644 (file)
--- a/src/aoe.h
+++ b/src/aoe.h
@@ -39,30 +39,30 @@ typedef enum
 *PAOE_REQUESTMODE;
 
 extern winvblock__bool STDCALL AoE_SearchDrive (
-       IN driver__dev_ext_ptr DeviceExtension
+  IN driver__dev_ext_ptr DeviceExtension
  );
 extern NTSTATUS STDCALL AoE_Request (
-       IN driver__dev_ext_ptr DeviceExtension,
-       IN AOE_REQUESTMODE Mode,
-       IN LONGLONG StartSector,
-       IN ULONG SectorCount,
-       IN winvblock__uint8_ptr Buffer,
-       IN PIRP Irp
+  IN driver__dev_ext_ptr DeviceExtension,
+  IN AOE_REQUESTMODE Mode,
+  IN LONGLONG StartSector,
+  IN ULONG SectorCount,
+  IN winvblock__uint8_ptr Buffer,
+  IN PIRP Irp
  );
 extern NTSTATUS STDCALL AoE_Reply (
-       IN winvblock__uint8_ptr SourceMac,
-       IN winvblock__uint8_ptr DestinationMac,
-       IN winvblock__uint8_ptr Data,
-       IN winvblock__uint32 DataSize
+  IN winvblock__uint8_ptr SourceMac,
+  IN winvblock__uint8_ptr DestinationMac,
+  IN winvblock__uint8_ptr Data,
+  IN winvblock__uint32 DataSize
  );
 extern VOID STDCALL AoE_ResetProbe (
-       void
+  void
  );
 extern NTSTATUS STDCALL AoE_Start (
-       void
+  void
  );
 extern VOID STDCALL AoE_Stop (
-       void
+  void
  );
 
-#endif                                                                                                 /* _AOE_H */
+#endif                         /* _AOE_H */
index 26b5f6f..96255e9 100644 (file)
 #ifndef _MSC_VER
 static long long
 __divdi3 (
-       long long u,
-       long long v
+  long long u,
+  long long v
  )
 {
-       return u / v;
+  return u / v;
 }
 #endif
 
 #if _WIN32_WINNT <= 0x0500
-#  if 0                                                                                                        /* FIXME: To build with WINDDK 6001.18001 */
+#  if 0                                /* FIXME: To build with WINDDK 6001.18001 */
 #    ifdef _MSC_VER
 #      pragma pack(1)
 #    endif
 typedef union _EIGHT_BYTE
 {
-       struct
-       {
-               winvblock__uint8 Byte0;
-               winvblock__uint8 Byte1;
-               winvblock__uint8 Byte2;
-               winvblock__uint8 Byte3;
-               winvblock__uint8 Byte4;
-               winvblock__uint8 Byte5;
-               winvblock__uint8 Byte6;
-               winvblock__uint8 Byte7;
-       };
-       ULONGLONG AsULongLong;
+  struct
+  {
+    winvblock__uint8 Byte0;
+    winvblock__uint8 Byte1;
+    winvblock__uint8 Byte2;
+    winvblock__uint8 Byte3;
+    winvblock__uint8 Byte4;
+    winvblock__uint8 Byte5;
+    winvblock__uint8 Byte6;
+    winvblock__uint8 Byte7;
+  };
+  ULONGLONG AsULongLong;
 } __attribute__ ( ( __packed__ ) ) EIGHT_BYTE, *PEIGHT_BYTE;
 #    ifdef _MSC_VER
 #      pragma pack()
 #    endif
-#  endif                                                                                               /* To build with WINDDK 6001.18001 */
+#  endif                       /* To build with WINDDK 6001.18001 */
 
 #  define REVERSE_BYTES_QUAD(Destination, Source) { \
   PEIGHT_BYTE d = (PEIGHT_BYTE)(Destination);     \
@@ -93,872 +93,870 @@ typedef union _EIGHT_BYTE
   d->Byte1 = s->Byte6;                            \
   d->Byte0 = s->Byte7;                            \
 }
-#endif                                                                                                 /* if _WIN32_WINNT <= 0x0500 */
+#endif                         /* if _WIN32_WINNT <= 0x0500 */
 
 #if _WIN32_WINNT < 0x0502
-#  if 0                                                                                                        /* FIXME: To build with WINDDK 6001.18001 */
+#  if 0                                /* FIXME: To build with WINDDK 6001.18001 */
 #    ifdef _MSC_VER
 #      pragma pack(1)
 #    endif
 typedef struct _READ_CAPACITY_DATA_EX
 {
-       LARGE_INTEGER LogicalBlockAddress;
-       ULONG BytesPerBlock;
+  LARGE_INTEGER LogicalBlockAddress;
+  ULONG BytesPerBlock;
 } __attribute__ ( ( __packed__ ) ) READ_CAPACITY_DATA_EX,
-       *PREAD_CAPACITY_DATA_EX;
+  *PREAD_CAPACITY_DATA_EX;
 #    ifdef _MSC_VER
 #      pragma pack()
 #    endif
-#  endif                                                                                               /* To build with WINDDK 6001.18001 */
-#endif                                                                                                 /* _WIN32_WINNT < 0x0502 */
+#  endif                       /* To build with WINDDK 6001.18001 */
+#endif                         /* _WIN32_WINNT < 0x0502 */
 
 #ifdef _MSC_VER
 #  pragma pack(1)
 #endif
 typedef struct _DISK_CDB16
 {
-       winvblock__uint8 OperationCode;
-       winvblock__uint8 Reserved1:3;
-       winvblock__uint8 ForceUnitAccess:1;
-       winvblock__uint8 DisablePageOut:1;
-       winvblock__uint8 Protection:3;
-       winvblock__uint8 LogicalBlock[8];
-       winvblock__uint8 TransferLength[4];
-       winvblock__uint8 Reserved2;
-       winvblock__uint8 Control;
+  winvblock__uint8 OperationCode;
+  winvblock__uint8 Reserved1:3;
+  winvblock__uint8 ForceUnitAccess:1;
+  winvblock__uint8 DisablePageOut:1;
+  winvblock__uint8 Protection:3;
+  winvblock__uint8 LogicalBlock[8];
+  winvblock__uint8 TransferLength[4];
+  winvblock__uint8 Reserved2;
+  winvblock__uint8 Control;
 } __attribute__ ( ( __packed__ ) ) DISK_CDB16, *PDISK_CDB16;
 #ifdef _MSC_VER
 #  pragma pack()
 #endif
 
 DEFINE_GUID ( GUID_BUS_TYPE_INTERNAL, 0x2530ea73L, 0x086b, 0x11d1, 0xa0, 0x9f,
-                                                       0x00, 0xc0, 0x4f, 0xc3, 0x40, 0xb1 );
+             0x00, 0xc0, 0x4f, 0xc3, 0x40, 0xb1 );
 
 irp__handler_decl ( Disk_DispatchPnP )
 {
-       NTSTATUS Status;
-       PDEVICE_RELATIONS DeviceRelations;
-       PPNP_BUS_INFORMATION PnPBusInformation;
-       PDEVICE_CAPABILITIES DeviceCapabilities;
-       DEVICE_CAPABILITIES ParentDeviceCapabilities;
-       PWCHAR String;
-       ULONG StringLength;
-       disk__type_ptr disk_ptr;
+  NTSTATUS Status;
+  PDEVICE_RELATIONS DeviceRelations;
+  PPNP_BUS_INFORMATION PnPBusInformation;
+  PDEVICE_CAPABILITIES DeviceCapabilities;
+  DEVICE_CAPABILITIES ParentDeviceCapabilities;
+  PWCHAR String;
+  ULONG StringLength;
+  disk__type_ptr disk_ptr;
 
+  /*
+   * Establish a pointer into the disk device's extension space
+   */
+  disk_ptr = get_disk_ptr ( DeviceExtension );
+  switch ( Stack->MinorFunction )
+    {
+      case IRP_MN_QUERY_ID:
        /*
-        * Establish a pointer into the disk device's extension space
+        * TODO: AoE specifics are in here; move them
         */
-       disk_ptr = get_disk_ptr ( DeviceExtension );
-       switch ( Stack->MinorFunction )
+       if ( ( String =
+              ( PWCHAR ) ExAllocatePool ( NonPagedPool,
+                                          ( 512 * sizeof ( WCHAR ) ) ) ) ==
+            NULL )
+         {
+           DBG ( "ExAllocatePool IRP_MN_QUERY_ID\n" );
+           Status = STATUS_INSUFFICIENT_RESOURCES;
+           break;
+         }
+       RtlZeroMemory ( String, ( 512 * sizeof ( WCHAR ) ) );
+       switch ( Stack->Parameters.QueryId.IdType )
+         {
+           case BusQueryDeviceID:
+             if ( disk_ptr->IsRamdisk )
+               {
+                 StringLength =
+                   swprintf ( String, L"WinVBlock\\RAMDisk%08x",
+                              disk_ptr->RAMDisk.DiskBuf ) + 1;
+               }
+             else
+               {
+                 StringLength =
+                   swprintf ( String, L"WinVBlock\\AoEe%d.%d",
+                              disk_ptr->AoE.Major, disk_ptr->AoE.Minor ) + 1;
+               }
+             if ( ( Irp->IoStatus.Information =
+                    ( ULONG_PTR ) ExAllocatePool ( PagedPool,
+                                                   StringLength *
+                                                   sizeof ( WCHAR ) ) ) == 0 )
+               {
+                 DBG ( "ExAllocatePool BusQueryDeviceID\n" );
+                 Status = STATUS_INSUFFICIENT_RESOURCES;
+                 break;
+               }
+             RtlCopyMemory ( ( PWCHAR ) Irp->IoStatus.Information, String,
+                             StringLength * sizeof ( WCHAR ) );
+             Status = STATUS_SUCCESS;
+             break;
+           case BusQueryInstanceID:
+             if ( disk_ptr->IsRamdisk )
+               {
+                 StringLength =
+                   swprintf ( String, L"RAMDisk%08x",
+                              disk_ptr->RAMDisk.DiskBuf ) + 1;
+               }
+             else
+               {
+                 StringLength =
+                   swprintf ( String, L"AOEDISK%d.%d", disk_ptr->AoE.Major,
+                              disk_ptr->AoE.Minor ) + 1;
+               }
+             if ( ( Irp->IoStatus.Information =
+                    ( ULONG_PTR ) ExAllocatePool ( PagedPool,
+                                                   StringLength *
+                                                   sizeof ( WCHAR ) ) ) == 0 )
+               {
+                 DBG ( "ExAllocatePool BusQueryInstanceID\n" );
+                 Status = STATUS_INSUFFICIENT_RESOURCES;
+                 break;
+               }
+             RtlCopyMemory ( ( PWCHAR ) Irp->IoStatus.Information, String,
+                             StringLength * sizeof ( WCHAR ) );
+             Status = STATUS_SUCCESS;
+             break;
+           case BusQueryHardwareIDs:
+             if ( disk_ptr->IsRamdisk )
+               {
+                 StringLength =
+                   swprintf ( String, L"WinVBlock\\RAMDisk%08x",
+                              disk_ptr->RAMDisk.DiskBuf ) + 1;
+                 StringLength +=
+                   swprintf ( &String[StringLength],
+                              disk_ptr->DiskType ==
+                              OpticalDisc ? L"GenCdRom" : disk_ptr->DiskType
+                              ==
+                              FloppyDisk ? L"GenSFloppy" : L"GenDisk" ) + 4;
+               }
+             else
+               {
+                 StringLength =
+                   swprintf ( String, L"WinVBlock\\AoEe%d.%d",
+                              disk_ptr->AoE.Major, disk_ptr->AoE.Minor ) + 1;
+                 StringLength +=
+                   swprintf ( &String[StringLength], L"GenDisk" ) + 4;
+               }
+             if ( ( Irp->IoStatus.Information =
+                    ( ULONG_PTR ) ExAllocatePool ( PagedPool,
+                                                   StringLength *
+                                                   sizeof ( WCHAR ) ) ) == 0 )
+               {
+                 DBG ( "ExAllocatePool BusQueryHardwareIDs\n" );
+                 Status = STATUS_INSUFFICIENT_RESOURCES;
+                 break;
+               }
+             RtlCopyMemory ( ( PWCHAR ) Irp->IoStatus.Information, String,
+                             StringLength * sizeof ( WCHAR ) );
+             Status = STATUS_SUCCESS;
+             break;
+           case BusQueryCompatibleIDs:
+             if ( disk_ptr->IsRamdisk )
                {
-                       case IRP_MN_QUERY_ID:
-                               /*
-                                * TODO: AoE specifics are in here; move them
-                                */
-                               if ( ( String =
-                                                        ( PWCHAR ) ExAllocatePool ( NonPagedPool,
-                                                                                                                                                                        ( 512 * sizeof ( WCHAR ) ) ) ) ==
-                                                NULL )
-                                       {
-                                               DBG ( "ExAllocatePool IRP_MN_QUERY_ID\n" );
-                                               Status = STATUS_INSUFFICIENT_RESOURCES;
-                                               break;
-                                       }
-                               RtlZeroMemory ( String, ( 512 * sizeof ( WCHAR ) ) );
-                               switch ( Stack->Parameters.QueryId.IdType )
-                                       {
-                                               case BusQueryDeviceID:
-                                                       if ( disk_ptr->IsRamdisk )
-                                                               {
-                                                                       StringLength =
-                                                                               swprintf ( String, L"WinVBlock\\RAMDisk%08x",
-                                                                                                                        disk_ptr->RAMDisk.DiskBuf ) + 1;
-                                                               }
-                                                       else
-                                                               {
-                                                                       StringLength =
-                                                                               swprintf ( String, L"WinVBlock\\AoEe%d.%d",
-                                                                                                                        disk_ptr->AoE.Major, disk_ptr->AoE.Minor ) + 1;
-                                                               }
-                                                       if ( ( Irp->IoStatus.Information =
-                                                                                ( ULONG_PTR ) ExAllocatePool ( PagedPool,
-                                                                                                                                                                                                               StringLength *
-                                                                                                                                                                                                               sizeof ( WCHAR ) ) ) == 0 )
-                                                               {
-                                                                       DBG ( "ExAllocatePool BusQueryDeviceID\n" );
-                                                                       Status = STATUS_INSUFFICIENT_RESOURCES;
-                                                                       break;
-                                                               }
-                                                       RtlCopyMemory ( ( PWCHAR ) Irp->IoStatus.Information, String,
-                                                                                                                       StringLength * sizeof ( WCHAR ) );
-                                                       Status = STATUS_SUCCESS;
-                                                       break;
-                                               case BusQueryInstanceID:
-                                                       if ( disk_ptr->IsRamdisk )
-                                                               {
-                                                                       StringLength =
-                                                                               swprintf ( String, L"RAMDisk%08x",
-                                                                                                                        disk_ptr->RAMDisk.DiskBuf ) + 1;
-                                                               }
-                                                       else
-                                                               {
-                                                                       StringLength =
-                                                                               swprintf ( String, L"AOEDISK%d.%d", disk_ptr->AoE.Major,
-                                                                                                                        disk_ptr->AoE.Minor ) + 1;
-                                                               }
-                                                       if ( ( Irp->IoStatus.Information =
-                                                                                ( ULONG_PTR ) ExAllocatePool ( PagedPool,
-                                                                                                                                                                                                               StringLength *
-                                                                                                                                                                                                               sizeof ( WCHAR ) ) ) == 0 )
-                                                               {
-                                                                       DBG ( "ExAllocatePool BusQueryInstanceID\n" );
-                                                                       Status = STATUS_INSUFFICIENT_RESOURCES;
-                                                                       break;
-                                                               }
-                                                       RtlCopyMemory ( ( PWCHAR ) Irp->IoStatus.Information, String,
-                                                                                                                       StringLength * sizeof ( WCHAR ) );
-                                                       Status = STATUS_SUCCESS;
-                                                       break;
-                                               case BusQueryHardwareIDs:
-                                                       if ( disk_ptr->IsRamdisk )
-                                                               {
-                                                                       StringLength =
-                                                                               swprintf ( String, L"WinVBlock\\RAMDisk%08x",
-                                                                                                                        disk_ptr->RAMDisk.DiskBuf ) + 1;
-                                                                       StringLength +=
-                                                                               swprintf ( &String[StringLength],
-                                                                                                                        disk_ptr->DiskType ==
-                                                                                                                        OpticalDisc ? L"GenCdRom" : disk_ptr->
-                                                                                                                        DiskType ==
-                                                                                                                        FloppyDisk ? L"GenSFloppy" : L"GenDisk" ) + 4;
-                                                               }
-                                                       else
-                                                               {
-                                                                       StringLength =
-                                                                               swprintf ( String, L"WinVBlock\\AoEe%d.%d",
-                                                                                                                        disk_ptr->AoE.Major, disk_ptr->AoE.Minor ) + 1;
-                                                                       StringLength +=
-                                                                               swprintf ( &String[StringLength], L"GenDisk" ) + 4;
-                                                               }
-                                                       if ( ( Irp->IoStatus.Information =
-                                                                                ( ULONG_PTR ) ExAllocatePool ( PagedPool,
-                                                                                                                                                                                                               StringLength *
-                                                                                                                                                                                                               sizeof ( WCHAR ) ) ) == 0 )
-                                                               {
-                                                                       DBG ( "ExAllocatePool BusQueryHardwareIDs\n" );
-                                                                       Status = STATUS_INSUFFICIENT_RESOURCES;
-                                                                       break;
-                                                               }
-                                                       RtlCopyMemory ( ( PWCHAR ) Irp->IoStatus.Information, String,
-                                                                                                                       StringLength * sizeof ( WCHAR ) );
-                                                       Status = STATUS_SUCCESS;
-                                                       break;
-                                               case BusQueryCompatibleIDs:
-                                                       if ( disk_ptr->IsRamdisk )
-                                                               {
-                                                                       StringLength =
-                                                                               swprintf ( String,
-                                                                                                                        disk_ptr->DiskType ==
-                                                                                                                        OpticalDisc ? L"GenCdRom" : disk_ptr->
-                                                                                                                        DiskType ==
-                                                                                                                        FloppyDisk ? L"GenSFloppy" : L"GenDisk" ) + 4;
-                                                               }
-                                                       else
-                                                               {
-                                                                       StringLength = swprintf ( String, L"GenDisk" ) + 4;
-                                                               }
-                                                       if ( ( Irp->IoStatus.Information =
-                                                                                ( ULONG_PTR ) ExAllocatePool ( PagedPool,
-                                                                                                                                                                                                               StringLength *
-                                                                                                                                                                                                               sizeof ( WCHAR ) ) ) == 0 )
-                                                               {
-                                                                       DBG ( "ExAllocatePool BusQueryCompatibleIDs\n" );
-                                                                       Status = STATUS_INSUFFICIENT_RESOURCES;
-                                                                       break;
-                                                               }
-                                                       RtlCopyMemory ( ( PWCHAR ) Irp->IoStatus.Information, String,
-                                                                                                                       StringLength * sizeof ( WCHAR ) );
-                                                       Status = STATUS_SUCCESS;
-                                                       break;
-                                               default:
-                                                       Irp->IoStatus.Information = 0;
-                                                       Status = STATUS_NOT_SUPPORTED;
-                                       }
-                               ExFreePool ( String );
-                               break;
-                       case IRP_MN_QUERY_DEVICE_TEXT:
-                               if ( ( String =
-                                                        ( PWCHAR ) ExAllocatePool ( NonPagedPool,
-                                                                                                                                                                        ( 512 * sizeof ( WCHAR ) ) ) ) ==
-                                                NULL )
-                                       {
-                                               DBG ( "ExAllocatePool IRP_MN_QUERY_DEVICE_TEXT\n" );
-                                               Status = STATUS_INSUFFICIENT_RESOURCES;
-                                               break;
-                                       }
-                               RtlZeroMemory ( String, ( 512 * sizeof ( WCHAR ) ) );
-                               switch ( Stack->Parameters.QueryDeviceText.DeviceTextType )
-                                       {
-                                               case DeviceTextDescription:
-                                                       StringLength = swprintf ( String, L"WinVBlock Disk" ) + 1;
-                                                       if ( ( Irp->IoStatus.Information =
-                                                                                ( ULONG_PTR ) ExAllocatePool ( PagedPool,
-                                                                                                                                                                                                               StringLength *
-                                                                                                                                                                                                               sizeof ( WCHAR ) ) ) == 0 )
-                                                               {
-                                                                       DBG ( "ExAllocatePool DeviceTextDescription\n" );
-                                                                       Status = STATUS_INSUFFICIENT_RESOURCES;
-                                                                       break;
-                                                               }
-                                                       RtlCopyMemory ( ( PWCHAR ) Irp->IoStatus.Information, String,
-                                                                                                                       StringLength * sizeof ( WCHAR ) );
-                                                       Status = STATUS_SUCCESS;
-                                                       break;
-                                               case DeviceTextLocationInformation:
-                                                       StringLength =
-                                                               swprintf ( String, L"WinVBlock AoE e%d.%d",
-                                                                                                        disk_ptr->AoE.Major, disk_ptr->AoE.Minor ) + 1;
-                                                       if ( ( Irp->IoStatus.Information =
-                                                                                ( ULONG_PTR ) ExAllocatePool ( PagedPool,
-                                                                                                                                                                                                               StringLength *
-                                                                                                                                                                                                               sizeof ( WCHAR ) ) ) == 0 )
-                                                               {
-                                                                       DBG ( "ExAllocatePool DeviceTextLocationInformation\n" );
-                                                                       Status = STATUS_INSUFFICIENT_RESOURCES;
-                                                                       break;
-                                                               }
-                                                       RtlCopyMemory ( ( PWCHAR ) Irp->IoStatus.Information, String,
-                                                                                                                       StringLength * sizeof ( WCHAR ) );
-                                                       Status = STATUS_SUCCESS;
-                                                       break;
-                                               default:
-                                                       Irp->IoStatus.Information = 0;
-                                                       Status = STATUS_NOT_SUPPORTED;
-                                       }
-                               ExFreePool ( String );
-                               break;
-                       case IRP_MN_QUERY_DEVICE_RELATIONS:
-                               if ( Stack->Parameters.QueryDeviceRelations.Type !=
-                                                TargetDeviceRelation )
-                                       {
-                                               Status = Irp->IoStatus.Status;
-                                               break;
-                                       }
-                               if ( ( DeviceRelations =
-                                                        ( PDEVICE_RELATIONS ) ExAllocatePool ( PagedPool,
-                                                                                                                                                                                                                       sizeof
-                                                                                                                                                                                                                       ( DEVICE_RELATIONS ) +
-                                                                                                                                                                                                                       sizeof
-                                                                                                                                                                                                                       ( PDEVICE_OBJECT ) ) ) ==
-                                                NULL )
-                                       {
-                                               DBG ( "ExAllocatePool IRP_MN_QUERY_DEVICE_RELATIONS\n" );
-                                               Status = STATUS_INSUFFICIENT_RESOURCES;
-                                               break;
-                                       }
-                               DeviceRelations->Objects[0] = DeviceExtension->Self;
-                               DeviceRelations->Count = 1;
-                               ObReferenceObject ( DeviceExtension->Self );
-                               Irp->IoStatus.Information = ( ULONG_PTR ) DeviceRelations;
-                               Status = STATUS_SUCCESS;
-                               break;
-                       case IRP_MN_QUERY_BUS_INFORMATION:
-                               if ( ( PnPBusInformation =
-                                                        ( PPNP_BUS_INFORMATION ) ExAllocatePool ( PagedPool,
-                                                                                                                                                                                                                                sizeof
-                                                                                                                                                                                                                                ( PNP_BUS_INFORMATION ) ) )
-                                                == NULL )
-                                       {
-                                               DBG ( "ExAllocatePool IRP_MN_QUERY_BUS_INFORMATION\n" );
-                                               Status = STATUS_INSUFFICIENT_RESOURCES;
-                                               break;
-                                       }
-                               PnPBusInformation->BusTypeGuid = GUID_BUS_TYPE_INTERNAL;
-                               PnPBusInformation->LegacyBusType = PNPBus;
-                               PnPBusInformation->BusNumber = 0;
-                               Irp->IoStatus.Information = ( ULONG_PTR ) PnPBusInformation;
-                               Status = STATUS_SUCCESS;
-                               break;
-                       case IRP_MN_QUERY_CAPABILITIES:
-                               DeviceCapabilities = Stack->Parameters.DeviceCapabilities.Capabilities;
-                               if ( DeviceCapabilities->Version != 1
-                                                || DeviceCapabilities->Size < sizeof ( DEVICE_CAPABILITIES ) )
-                                       {
-                                               Status = STATUS_UNSUCCESSFUL;
-                                               break;
-                                       }
-                               if ( !NT_SUCCESS
-                                                ( Status =
-                                                        Bus_GetDeviceCapabilities ( get_bus_ptr
-                                                                                                                                                                        ( disk_ptr->Parent->
-                                                                                                                                                                                DeviceExtension )->
-                                                                                                                                                                        LowerDeviceObject,
-                                                                                                                                                                        &ParentDeviceCapabilities ) ) )
-                                       break;
-                               RtlCopyMemory ( DeviceCapabilities->DeviceState,
-                                                                                               ParentDeviceCapabilities.DeviceState,
-                                                                                               ( PowerSystemShutdown +
-                                                                                                       1 ) * sizeof ( DEVICE_POWER_STATE ) );
-                               DeviceCapabilities->DeviceState[PowerSystemWorking] = PowerDeviceD0;
-                               if ( DeviceCapabilities->DeviceState[PowerSystemSleeping1] !=
-                                                PowerDeviceD0 )
-                                       DeviceCapabilities->DeviceState[PowerSystemSleeping1] =
-                                               PowerDeviceD1;
-                               if ( DeviceCapabilities->DeviceState[PowerSystemSleeping2] !=
-                                                PowerDeviceD0 )
-                                       DeviceCapabilities->DeviceState[PowerSystemSleeping2] =
-                                               PowerDeviceD3;
+                 StringLength =
+                   swprintf ( String,
+                              disk_ptr->DiskType ==
+                              OpticalDisc ? L"GenCdRom" : disk_ptr->DiskType
+                              ==
+                              FloppyDisk ? L"GenSFloppy" : L"GenDisk" ) + 4;
+               }
+             else
+               {
+                 StringLength = swprintf ( String, L"GenDisk" ) + 4;
+               }
+             if ( ( Irp->IoStatus.Information =
+                    ( ULONG_PTR ) ExAllocatePool ( PagedPool,
+                                                   StringLength *
+                                                   sizeof ( WCHAR ) ) ) == 0 )
+               {
+                 DBG ( "ExAllocatePool BusQueryCompatibleIDs\n" );
+                 Status = STATUS_INSUFFICIENT_RESOURCES;
+                 break;
+               }
+             RtlCopyMemory ( ( PWCHAR ) Irp->IoStatus.Information, String,
+                             StringLength * sizeof ( WCHAR ) );
+             Status = STATUS_SUCCESS;
+             break;
+           default:
+             Irp->IoStatus.Information = 0;
+             Status = STATUS_NOT_SUPPORTED;
+         }
+       ExFreePool ( String );
+       break;
+      case IRP_MN_QUERY_DEVICE_TEXT:
+       if ( ( String =
+              ( PWCHAR ) ExAllocatePool ( NonPagedPool,
+                                          ( 512 * sizeof ( WCHAR ) ) ) ) ==
+            NULL )
+         {
+           DBG ( "ExAllocatePool IRP_MN_QUERY_DEVICE_TEXT\n" );
+           Status = STATUS_INSUFFICIENT_RESOURCES;
+           break;
+         }
+       RtlZeroMemory ( String, ( 512 * sizeof ( WCHAR ) ) );
+       switch ( Stack->Parameters.QueryDeviceText.DeviceTextType )
+         {
+           case DeviceTextDescription:
+             StringLength = swprintf ( String, L"WinVBlock Disk" ) + 1;
+             if ( ( Irp->IoStatus.Information =
+                    ( ULONG_PTR ) ExAllocatePool ( PagedPool,
+                                                   StringLength *
+                                                   sizeof ( WCHAR ) ) ) == 0 )
+               {
+                 DBG ( "ExAllocatePool DeviceTextDescription\n" );
+                 Status = STATUS_INSUFFICIENT_RESOURCES;
+                 break;
+               }
+             RtlCopyMemory ( ( PWCHAR ) Irp->IoStatus.Information, String,
+                             StringLength * sizeof ( WCHAR ) );
+             Status = STATUS_SUCCESS;
+             break;
+           case DeviceTextLocationInformation:
+             StringLength =
+               swprintf ( String, L"WinVBlock AoE e%d.%d",
+                          disk_ptr->AoE.Major, disk_ptr->AoE.Minor ) + 1;
+             if ( ( Irp->IoStatus.Information =
+                    ( ULONG_PTR ) ExAllocatePool ( PagedPool,
+                                                   StringLength *
+                                                   sizeof ( WCHAR ) ) ) == 0 )
+               {
+                 DBG ( "ExAllocatePool DeviceTextLocationInformation\n" );
+                 Status = STATUS_INSUFFICIENT_RESOURCES;
+                 break;
+               }
+             RtlCopyMemory ( ( PWCHAR ) Irp->IoStatus.Information, String,
+                             StringLength * sizeof ( WCHAR ) );
+             Status = STATUS_SUCCESS;
+             break;
+           default:
+             Irp->IoStatus.Information = 0;
+             Status = STATUS_NOT_SUPPORTED;
+         }
+       ExFreePool ( String );
+       break;
+      case IRP_MN_QUERY_DEVICE_RELATIONS:
+       if ( Stack->Parameters.QueryDeviceRelations.Type !=
+            TargetDeviceRelation )
+         {
+           Status = Irp->IoStatus.Status;
+           break;
+         }
+       if ( ( DeviceRelations =
+              ( PDEVICE_RELATIONS ) ExAllocatePool ( PagedPool,
+                                                     sizeof
+                                                     ( DEVICE_RELATIONS ) +
+                                                     sizeof
+                                                     ( PDEVICE_OBJECT ) ) ) ==
+            NULL )
+         {
+           DBG ( "ExAllocatePool IRP_MN_QUERY_DEVICE_RELATIONS\n" );
+           Status = STATUS_INSUFFICIENT_RESOURCES;
+           break;
+         }
+       DeviceRelations->Objects[0] = DeviceExtension->Self;
+       DeviceRelations->Count = 1;
+       ObReferenceObject ( DeviceExtension->Self );
+       Irp->IoStatus.Information = ( ULONG_PTR ) DeviceRelations;
+       Status = STATUS_SUCCESS;
+       break;
+      case IRP_MN_QUERY_BUS_INFORMATION:
+       if ( ( PnPBusInformation =
+              ( PPNP_BUS_INFORMATION ) ExAllocatePool ( PagedPool,
+                                                        sizeof
+                                                        ( PNP_BUS_INFORMATION ) ) )
+            == NULL )
+         {
+           DBG ( "ExAllocatePool IRP_MN_QUERY_BUS_INFORMATION\n" );
+           Status = STATUS_INSUFFICIENT_RESOURCES;
+           break;
+         }
+       PnPBusInformation->BusTypeGuid = GUID_BUS_TYPE_INTERNAL;
+       PnPBusInformation->LegacyBusType = PNPBus;
+       PnPBusInformation->BusNumber = 0;
+       Irp->IoStatus.Information = ( ULONG_PTR ) PnPBusInformation;
+       Status = STATUS_SUCCESS;
+       break;
+      case IRP_MN_QUERY_CAPABILITIES:
+       DeviceCapabilities = Stack->Parameters.DeviceCapabilities.Capabilities;
+       if ( DeviceCapabilities->Version != 1
+            || DeviceCapabilities->Size < sizeof ( DEVICE_CAPABILITIES ) )
+         {
+           Status = STATUS_UNSUCCESSFUL;
+           break;
+         }
+       if ( !NT_SUCCESS
+            ( Status =
+              Bus_GetDeviceCapabilities ( get_bus_ptr
+                                          ( disk_ptr->
+                                            Parent->DeviceExtension )->LowerDeviceObject,
+                                          &ParentDeviceCapabilities ) ) )
+         break;
+       RtlCopyMemory ( DeviceCapabilities->DeviceState,
+                       ParentDeviceCapabilities.DeviceState,
+                       ( PowerSystemShutdown +
+                         1 ) * sizeof ( DEVICE_POWER_STATE ) );
+       DeviceCapabilities->DeviceState[PowerSystemWorking] = PowerDeviceD0;
+       if ( DeviceCapabilities->DeviceState[PowerSystemSleeping1] !=
+            PowerDeviceD0 )
+         DeviceCapabilities->DeviceState[PowerSystemSleeping1] =
+           PowerDeviceD1;
+       if ( DeviceCapabilities->DeviceState[PowerSystemSleeping2] !=
+            PowerDeviceD0 )
+         DeviceCapabilities->DeviceState[PowerSystemSleeping2] =
+           PowerDeviceD3;
 /*      if (DeviceCapabilities->DeviceState[PowerSystemSleeping3] !=
  *          PowerDeviceD0)
  *         DeviceCapabilities->DeviceState[PowerSystemSleeping3] =
  *             PowerDeviceD3;
  */
-                               DeviceCapabilities->DeviceWake = PowerDeviceD1;
-                               DeviceCapabilities->DeviceD1 = TRUE;
-                               DeviceCapabilities->DeviceD2 = FALSE;
-                               DeviceCapabilities->WakeFromD0 = FALSE;
-                               DeviceCapabilities->WakeFromD1 = FALSE;
-                               DeviceCapabilities->WakeFromD2 = FALSE;
-                               DeviceCapabilities->WakeFromD3 = FALSE;
-                               DeviceCapabilities->D1Latency = 0;
-                               DeviceCapabilities->D2Latency = 0;
-                               DeviceCapabilities->D3Latency = 0;
-                               DeviceCapabilities->EjectSupported = FALSE;
-                               DeviceCapabilities->HardwareDisabled = FALSE;
-                               DeviceCapabilities->Removable = FALSE;
-                               DeviceCapabilities->SurpriseRemovalOK = FALSE;
-                               DeviceCapabilities->UniqueID = FALSE;
-                               DeviceCapabilities->SilentInstall = FALSE;
+       DeviceCapabilities->DeviceWake = PowerDeviceD1;
+       DeviceCapabilities->DeviceD1 = TRUE;
+       DeviceCapabilities->DeviceD2 = FALSE;
+       DeviceCapabilities->WakeFromD0 = FALSE;
+       DeviceCapabilities->WakeFromD1 = FALSE;
+       DeviceCapabilities->WakeFromD2 = FALSE;
+       DeviceCapabilities->WakeFromD3 = FALSE;
+       DeviceCapabilities->D1Latency = 0;
+       DeviceCapabilities->D2Latency = 0;
+       DeviceCapabilities->D3Latency = 0;
+       DeviceCapabilities->EjectSupported = FALSE;
+       DeviceCapabilities->HardwareDisabled = FALSE;
+       DeviceCapabilities->Removable = FALSE;
+       DeviceCapabilities->SurpriseRemovalOK = FALSE;
+       DeviceCapabilities->UniqueID = FALSE;
+       DeviceCapabilities->SilentInstall = FALSE;
 /*      DeviceCapabilities->Address = DeviceObject->SerialNo;
  *      DeviceCapabilities->UINumber = DeviceObject->SerialNo;
  */
-                               Status = STATUS_SUCCESS;
-                               break;
-                       case IRP_MN_DEVICE_USAGE_NOTIFICATION:
-                               if ( Stack->Parameters.UsageNotification.InPath )
-                                       {
-                                               disk_ptr->SpecialFileCount++;
-                                       }
-                               else
-                                       {
-                                               disk_ptr->SpecialFileCount--;
-                                       }
-                               Irp->IoStatus.Information = 0;
-                               Status = STATUS_SUCCESS;
-                               break;
-                       case IRP_MN_QUERY_PNP_DEVICE_STATE:
-                               Irp->IoStatus.Information = 0;
-                               Status = STATUS_SUCCESS;
-                               break;
-                       case IRP_MN_START_DEVICE:
-                               DeviceExtension->OldState = DeviceExtension->State;
-                               DeviceExtension->State = Started;
-                               Status = STATUS_SUCCESS;
-                               break;
-                       case IRP_MN_QUERY_STOP_DEVICE:
-                               DeviceExtension->OldState = DeviceExtension->State;
-                               DeviceExtension->State = StopPending;
-                               Status = STATUS_SUCCESS;
-                               break;
-                       case IRP_MN_CANCEL_STOP_DEVICE:
-                               DeviceExtension->State = DeviceExtension->OldState;
-                               Status = STATUS_SUCCESS;
-                               break;
-                       case IRP_MN_STOP_DEVICE:
-                               DeviceExtension->OldState = DeviceExtension->State;
-                               DeviceExtension->State = Stopped;
-                               Status = STATUS_SUCCESS;
-                               break;
-                       case IRP_MN_QUERY_REMOVE_DEVICE:
-                               DeviceExtension->OldState = DeviceExtension->State;
-                               DeviceExtension->State = RemovePending;
-                               Status = STATUS_SUCCESS;
-                               break;
-                       case IRP_MN_REMOVE_DEVICE:
-                               DeviceExtension->OldState = DeviceExtension->State;
-                               DeviceExtension->State = NotStarted;
-                               if ( disk_ptr->Unmount )
-                                       {
-                                               IoDeleteDevice ( DeviceExtension->Self );
-                                               Status = STATUS_NO_SUCH_DEVICE;
-                                       }
-                               else
-                                       {
-                                               Status = STATUS_SUCCESS;
-                                       }
-                               break;
-                       case IRP_MN_CANCEL_REMOVE_DEVICE:
-                               DeviceExtension->State = DeviceExtension->OldState;
-                               Status = STATUS_SUCCESS;
-                               break;
-                       case IRP_MN_SURPRISE_REMOVAL:
-                               DeviceExtension->OldState = DeviceExtension->State;
-                               DeviceExtension->State = SurpriseRemovePending;
-                               Status = STATUS_SUCCESS;
-                               break;
-                       default:
-                               Status = Irp->IoStatus.Status;
-               }
+       Status = STATUS_SUCCESS;
+       break;
+      case IRP_MN_DEVICE_USAGE_NOTIFICATION:
+       if ( Stack->Parameters.UsageNotification.InPath )
+         {
+           disk_ptr->SpecialFileCount++;
+         }
+       else
+         {
+           disk_ptr->SpecialFileCount--;
+         }
+       Irp->IoStatus.Information = 0;
+       Status = STATUS_SUCCESS;
+       break;
+      case IRP_MN_QUERY_PNP_DEVICE_STATE:
+       Irp->IoStatus.Information = 0;
+       Status = STATUS_SUCCESS;
+       break;
+      case IRP_MN_START_DEVICE:
+       DeviceExtension->OldState = DeviceExtension->State;
+       DeviceExtension->State = Started;
+       Status = STATUS_SUCCESS;
+       break;
+      case IRP_MN_QUERY_STOP_DEVICE:
+       DeviceExtension->OldState = DeviceExtension->State;
+       DeviceExtension->State = StopPending;
+       Status = STATUS_SUCCESS;
+       break;
+      case IRP_MN_CANCEL_STOP_DEVICE:
+       DeviceExtension->State = DeviceExtension->OldState;
+       Status = STATUS_SUCCESS;
+       break;
+      case IRP_MN_STOP_DEVICE:
+       DeviceExtension->OldState = DeviceExtension->State;
+       DeviceExtension->State = Stopped;
+       Status = STATUS_SUCCESS;
+       break;
+      case IRP_MN_QUERY_REMOVE_DEVICE:
+       DeviceExtension->OldState = DeviceExtension->State;
+       DeviceExtension->State = RemovePending;
+       Status = STATUS_SUCCESS;
+       break;
+      case IRP_MN_REMOVE_DEVICE:
+       DeviceExtension->OldState = DeviceExtension->State;
+       DeviceExtension->State = NotStarted;
+       if ( disk_ptr->Unmount )
+         {
+           IoDeleteDevice ( DeviceExtension->Self );
+           Status = STATUS_NO_SUCH_DEVICE;
+         }
+       else
+         {
+           Status = STATUS_SUCCESS;
+         }
+       break;
+      case IRP_MN_CANCEL_REMOVE_DEVICE:
+       DeviceExtension->State = DeviceExtension->OldState;
+       Status = STATUS_SUCCESS;
+       break;
+      case IRP_MN_SURPRISE_REMOVAL:
+       DeviceExtension->OldState = DeviceExtension->State;
+       DeviceExtension->State = SurpriseRemovePending;
+       Status = STATUS_SUCCESS;
+       break;
+      default:
+       Status = Irp->IoStatus.Status;
+    }
 
-       Irp->IoStatus.Status = Status;
-       IoCompleteRequest ( Irp, IO_NO_INCREMENT );
-       return Status;
+  Irp->IoStatus.Status = Status;
+  IoCompleteRequest ( Irp, IO_NO_INCREMENT );
+  return Status;
 }
 
 irp__handler_decl ( Disk_DispatchSCSI )
 {
-       NTSTATUS Status;
-       PSCSI_REQUEST_BLOCK Srb;
-       PCDB Cdb;
-       LONGLONG StartSector;
-       ULONG SectorCount,
-        Temp;
-       LONGLONG LargeTemp;
-       PMODE_PARAMETER_HEADER ModeParameterHeader;
-       disk__type_ptr disk_ptr;
+  NTSTATUS Status;
+  PSCSI_REQUEST_BLOCK Srb;
+  PCDB Cdb;
+  LONGLONG StartSector;
+  ULONG SectorCount,
+   Temp;
+  LONGLONG LargeTemp;
+  PMODE_PARAMETER_HEADER ModeParameterHeader;
+  disk__type_ptr disk_ptr;
 
-       /*
-        * Establish a pointer into the disk device's extension space
-        */
-       disk_ptr = get_disk_ptr ( DeviceExtension );
-       Srb = Stack->Parameters.Scsi.Srb;
-       Cdb = ( PCDB ) Srb->Cdb;
+  /*
+   * Establish a pointer into the disk device's extension space
+   */
+  disk_ptr = get_disk_ptr ( DeviceExtension );
+  Srb = Stack->Parameters.Scsi.Srb;
+  Cdb = ( PCDB ) Srb->Cdb;
 
-       Srb->SrbStatus = SRB_STATUS_INVALID_REQUEST;
-       Srb->ScsiStatus = SCSISTAT_GOOD;
-       Irp->IoStatus.Information = 0;
-       Status = STATUS_SUCCESS;
-       if ( Srb->Lun == 0 )
-               {
-                       switch ( Srb->Function )
-                               {
-                                       case SRB_FUNCTION_EXECUTE_SCSI:
-                                               switch ( Cdb->AsByte[0] )
-                                                       {
-                                                               case SCSIOP_TEST_UNIT_READY:
-                                                                       Srb->SrbStatus = SRB_STATUS_SUCCESS;
-                                                                       break;
-                                                               case SCSIOP_READ:
-                                                               case SCSIOP_READ16:
-                                                               case SCSIOP_WRITE:
-                                                               case SCSIOP_WRITE16:
-                                                                       if ( Cdb->AsByte[0] == SCSIOP_READ16
-                                                                                        || Cdb->AsByte[0] == SCSIOP_WRITE16 )
-                                                                               {
-                                                                                       REVERSE_BYTES_QUAD ( &StartSector,
-                                                                                                                                                                        &( ( ( PDISK_CDB16 ) Cdb )->
-                                                                                                                                                                                       LogicalBlock[0] ) );
-                                                                                       REVERSE_BYTES ( &SectorCount,
-                                                                                                                                                       &( ( ( PDISK_CDB16 ) Cdb )->
-                                                                                                                                                                TransferLength[0] ) );
-                                                                               }
-                                                                       else
-                                                                               {
-                                                                                       StartSector =
-                                                                                               ( Cdb->CDB10.LogicalBlockByte0 << 24 ) +
-                                                                                               ( Cdb->CDB10.LogicalBlockByte1 << 16 ) +
-                                                                                               ( Cdb->CDB10.LogicalBlockByte2 << 8 ) +
-                                                                                               Cdb->CDB10.LogicalBlockByte3;
-                                                                                       SectorCount =
-                                                                                               ( Cdb->CDB10.TransferBlocksMsb << 8 ) +
-                                                                                               Cdb->CDB10.TransferBlocksLsb;
-                                                                               }
-                                                                       if ( StartSector >= disk_ptr->LBADiskSize )
-                                                                               {
-                                                                                       DBG ( "Fixed SectorCount (StartSector off disk)!!\n" );
-                                                                                       SectorCount = 0;
-                                                                               }
-                                                                       if ( ( StartSector + SectorCount > disk_ptr->LBADiskSize )
-                                                                                        && SectorCount != 0 )
-                                                                               {
-                                                                                       DBG ( "Fixed SectorCount (StartSector + "
-                                                                                                               "SectorCount off disk)!!\n" );
-                                                                                       SectorCount =
-                                                                                               ( ULONG ) ( disk_ptr->LBADiskSize - StartSector );
-                                                                               }
-                                                                       if ( SectorCount * disk_ptr->SectorSize >
-                                                                                        Srb->DataTransferLength )
-                                                                               {
-                                                                                       DBG ( "Fixed SectorCount (DataTransferLength "
-                                                                                                               "too small)!!\n" );
-                                                                                       SectorCount =
-                                                                                               Srb->DataTransferLength / disk_ptr->SectorSize;
-                                                                               }
-                                                                       if ( Srb->DataTransferLength % disk_ptr->SectorSize != 0 )
-                                                                               DBG ( "DataTransferLength not aligned!!\n" );
-                                                                       if ( Srb->DataTransferLength >
-                                                                                        SectorCount * disk_ptr->SectorSize )
-                                                                               DBG ( "DataTransferLength too big!!\n" );
+  Srb->SrbStatus = SRB_STATUS_INVALID_REQUEST;
+  Srb->ScsiStatus = SCSISTAT_GOOD;
+  Irp->IoStatus.Information = 0;
+  Status = STATUS_SUCCESS;
+  if ( Srb->Lun == 0 )
+    {
+      switch ( Srb->Function )
+       {
+         case SRB_FUNCTION_EXECUTE_SCSI:
+           switch ( Cdb->AsByte[0] )
+             {
+               case SCSIOP_TEST_UNIT_READY:
+                 Srb->SrbStatus = SRB_STATUS_SUCCESS;
+                 break;
+               case SCSIOP_READ:
+               case SCSIOP_READ16:
+               case SCSIOP_WRITE:
+               case SCSIOP_WRITE16:
+                 if ( Cdb->AsByte[0] == SCSIOP_READ16
+                      || Cdb->AsByte[0] == SCSIOP_WRITE16 )
+                   {
+                     REVERSE_BYTES_QUAD ( &StartSector,
+                                          &( ( ( PDISK_CDB16 )
+                                               Cdb )->LogicalBlock[0] ) );
+                     REVERSE_BYTES ( &SectorCount,
+                                     &( ( ( PDISK_CDB16 )
+                                          Cdb )->TransferLength[0] ) );
+                   }
+                 else
+                   {
+                     StartSector =
+                       ( Cdb->CDB10.LogicalBlockByte0 << 24 ) +
+                       ( Cdb->CDB10.LogicalBlockByte1 << 16 ) +
+                       ( Cdb->CDB10.LogicalBlockByte2 << 8 ) +
+                       Cdb->CDB10.LogicalBlockByte3;
+                     SectorCount =
+                       ( Cdb->CDB10.TransferBlocksMsb << 8 ) +
+                       Cdb->CDB10.TransferBlocksLsb;
+                   }
+                 if ( StartSector >= disk_ptr->LBADiskSize )
+                   {
+                     DBG ( "Fixed SectorCount (StartSector off disk)!!\n" );
+                     SectorCount = 0;
+                   }
+                 if ( ( StartSector + SectorCount > disk_ptr->LBADiskSize )
+                      && SectorCount != 0 )
+                   {
+                     DBG ( "Fixed SectorCount (StartSector + "
+                           "SectorCount off disk)!!\n" );
+                     SectorCount =
+                       ( ULONG ) ( disk_ptr->LBADiskSize - StartSector );
+                   }
+                 if ( SectorCount * disk_ptr->SectorSize >
+                      Srb->DataTransferLength )
+                   {
+                     DBG ( "Fixed SectorCount (DataTransferLength "
+                           "too small)!!\n" );
+                     SectorCount =
+                       Srb->DataTransferLength / disk_ptr->SectorSize;
+                   }
+                 if ( Srb->DataTransferLength % disk_ptr->SectorSize != 0 )
+                   DBG ( "DataTransferLength not aligned!!\n" );
+                 if ( Srb->DataTransferLength >
+                      SectorCount * disk_ptr->SectorSize )
+                   DBG ( "DataTransferLength too big!!\n" );
 
-                                                                       Srb->DataTransferLength = SectorCount * disk_ptr->SectorSize;
-                                                                       Srb->SrbStatus = SRB_STATUS_SUCCESS;
-                                                                       if ( SectorCount == 0 )
-                                                                               {
-                                                                                       Irp->IoStatus.Information = 0;
-                                                                                       break;
-                                                                               }
+                 Srb->DataTransferLength = SectorCount * disk_ptr->SectorSize;
+                 Srb->SrbStatus = SRB_STATUS_SUCCESS;
+                 if ( SectorCount == 0 )
+                   {
+                     Irp->IoStatus.Information = 0;
+                     break;
+                   }
 
-                                                                       if ( ( ( ( winvblock__uint8_ptr ) Srb->DataBuffer -
-                                                                                                        ( winvblock__uint8_ptr )
-                                                                                                        MmGetMdlVirtualAddress ( Irp->MdlAddress ) ) +
-                                                                                                ( winvblock__uint8_ptr )
-                                                                                                MmGetSystemAddressForMdlSafe ( Irp->MdlAddress,
-                                                                                                                                                                                                                               HighPagePriority ) ) ==
-                                                                                        NULL )
-                                                                               {
-                                                                                       Status = STATUS_INSUFFICIENT_RESOURCES;
-                                                                                       Irp->IoStatus.Information = 0;
-                                                                                       break;
-                                                                               }
+                 if ( ( ( ( winvblock__uint8_ptr ) Srb->DataBuffer -
+                          ( winvblock__uint8_ptr )
+                          MmGetMdlVirtualAddress ( Irp->MdlAddress ) ) +
+                        ( winvblock__uint8_ptr )
+                        MmGetSystemAddressForMdlSafe ( Irp->MdlAddress,
+                                                       HighPagePriority ) ) ==
+                      NULL )
+                   {
+                     Status = STATUS_INSUFFICIENT_RESOURCES;
+                     Irp->IoStatus.Information = 0;
+                     break;
+                   }
 
-                                                                       if ( Cdb->AsByte[0] == SCSIOP_READ
-                                                                                        || Cdb->AsByte[0] == SCSIOP_READ16 )
-                                                                               {
-                                                                                       return AoE_Request ( DeviceExtension,
-                                                                                                                                                                        AoE_RequestMode_Read, StartSector,
-                                                                                                                                                                        SectorCount,
-                                                                                                                                                                        ( ( winvblock__uint8_ptr )
-                                                                                                                                                                                Srb->DataBuffer -
-                                                                                                                                                                                ( winvblock__uint8_ptr )
-                                                                                                                                                                                MmGetMdlVirtualAddress ( Irp->
-                                                                                                                                                                                                                                                                                       MdlAddress ) )
-                                                                                                                                                                        +
-                                                                                                                                                                        ( winvblock__uint8_ptr )
-                                                                                                                                                                        MmGetSystemAddressForMdlSafe ( Irp->
-                                                                                                                                                                                                                                                                                                       MdlAddress,
-                                                                                                                                                                                                                                                                                                       HighPagePriority ),
-                                                                                                                                                                        Irp );
-                                                                               }
-                                                                       else
-                                                                               {
-                                                                                       return AoE_Request ( DeviceExtension,
-                                                                                                                                                                        AoE_RequestMode_Write, StartSector,
-                                                                                                                                                                        SectorCount,
-                                                                                                                                                                        ( ( winvblock__uint8_ptr )
-                                                                                                                                                                                Srb->DataBuffer -
-                                                                                                                                                                                ( winvblock__uint8_ptr )
-                                                                                                                                                                                MmGetMdlVirtualAddress ( Irp->
-                                                                                                                                                                                                                                                                                       MdlAddress ) )
-                                                                                                                                                                        +
-                                                                                                                                                                        ( winvblock__uint8_ptr )
-                                                                                                                                                                        MmGetSystemAddressForMdlSafe ( Irp->
-                                                                                                                                                                                                                                                                                                       MdlAddress,
-                                                                                                                                                                                                                                                                                                       HighPagePriority ),
-                                                                                                                                                                        Irp );
-                                                                               }
-                                                                       break;
-                                                               case SCSIOP_VERIFY:
-                                                               case SCSIOP_VERIFY16:
-                                                                       if ( Cdb->AsByte[0] == SCSIOP_VERIFY16 )
-                                                                               {
-                                                                                       REVERSE_BYTES_QUAD ( &StartSector,
-                                                                                                                                                                        &( ( ( PDISK_CDB16 ) Cdb )->
-                                                                                                                                                                                       LogicalBlock[0] ) );
-                                                                                       REVERSE_BYTES ( &SectorCount,
-                                                                                                                                                       &( ( ( PDISK_CDB16 ) Cdb )->
-                                                                                                                                                                TransferLength[0] ) );
-                                                                               }
-                                                                       else
-                                                                               {
-                                                                                       StartSector =
-                                                                                               ( Cdb->CDB10.LogicalBlockByte0 << 24 ) +
-                                                                                               ( Cdb->CDB10.LogicalBlockByte1 << 16 ) +
-                                                                                               ( Cdb->CDB10.LogicalBlockByte2 << 8 ) +
-                                                                                               Cdb->CDB10.LogicalBlockByte3;
-                                                                                       SectorCount =
-                                                                                               ( Cdb->CDB10.TransferBlocksMsb << 8 ) +
-                                                                                               Cdb->CDB10.TransferBlocksLsb;
-                                                                               }
+                 if ( Cdb->AsByte[0] == SCSIOP_READ
+                      || Cdb->AsByte[0] == SCSIOP_READ16 )
+                   {
+                     return AoE_Request ( DeviceExtension,
+                                          AoE_RequestMode_Read, StartSector,
+                                          SectorCount,
+                                          ( ( winvblock__uint8_ptr ) Srb->
+                                            DataBuffer -
+                                            ( winvblock__uint8_ptr )
+                                            MmGetMdlVirtualAddress
+                                            ( Irp->MdlAddress ) ) +
+                                          ( winvblock__uint8_ptr )
+                                          MmGetSystemAddressForMdlSafe
+                                          ( Irp->MdlAddress,
+                                            HighPagePriority ), Irp );
+                   }
+                 else
+                   {
+                     return AoE_Request ( DeviceExtension,
+                                          AoE_RequestMode_Write, StartSector,
+                                          SectorCount,
+                                          ( ( winvblock__uint8_ptr ) Srb->
+                                            DataBuffer -
+                                            ( winvblock__uint8_ptr )
+                                            MmGetMdlVirtualAddress
+                                            ( Irp->MdlAddress ) ) +
+                                          ( winvblock__uint8_ptr )
+                                          MmGetSystemAddressForMdlSafe
+                                          ( Irp->MdlAddress,
+                                            HighPagePriority ), Irp );
+                   }
+                 break;
+               case SCSIOP_VERIFY:
+               case SCSIOP_VERIFY16:
+                 if ( Cdb->AsByte[0] == SCSIOP_VERIFY16 )
+                   {
+                     REVERSE_BYTES_QUAD ( &StartSector,
+                                          &( ( ( PDISK_CDB16 )
+                                               Cdb )->LogicalBlock[0] ) );
+                     REVERSE_BYTES ( &SectorCount,
+                                     &( ( ( PDISK_CDB16 )
+                                          Cdb )->TransferLength[0] ) );
+                   }
+                 else
+                   {
+                     StartSector =
+                       ( Cdb->CDB10.LogicalBlockByte0 << 24 ) +
+                       ( Cdb->CDB10.LogicalBlockByte1 << 16 ) +
+                       ( Cdb->CDB10.LogicalBlockByte2 << 8 ) +
+                       Cdb->CDB10.LogicalBlockByte3;
+                     SectorCount =
+                       ( Cdb->CDB10.TransferBlocksMsb << 8 ) +
+                       Cdb->CDB10.TransferBlocksLsb;
+                   }
 /*            Srb->DataTransferLength = SectorCount * SECTORSIZE;
  */
-                                                                       Srb->SrbStatus = SRB_STATUS_SUCCESS;
-                                                                       break;
-                                                               case SCSIOP_READ_CAPACITY:
-                                                                       Temp = disk_ptr->SectorSize;
-                                                                       REVERSE_BYTES ( &
-                                                                                                                                       ( ( ( PREAD_CAPACITY_DATA ) Srb->
-                                                                                                                                                       DataBuffer )->BytesPerBlock ), &Temp );
-                                                                       if ( ( disk_ptr->LBADiskSize - 1 ) > 0xffffffff )
-                                                                               {
-                                                                                       ( ( PREAD_CAPACITY_DATA ) Srb->DataBuffer )->
-                                                                                               LogicalBlockAddress = -1;
-                                                                               }
-                                                                       else
-                                                                               {
-                                                                                       Temp = ( ULONG ) ( disk_ptr->LBADiskSize - 1 );
-                                                                                       REVERSE_BYTES ( &
-                                                                                                                                                       ( ( ( PREAD_CAPACITY_DATA ) Srb->
-                                                                                                                                                                       DataBuffer )->LogicalBlockAddress ),
-                                                                                                                                                       &Temp );
-                                                                               }
-                                                                       Irp->IoStatus.Information = sizeof ( READ_CAPACITY_DATA );
-                                                                       Srb->SrbStatus = SRB_STATUS_SUCCESS;
-                                                                       Status = STATUS_SUCCESS;
-                                                                       break;
-                                                               case SCSIOP_READ_CAPACITY16:
-                                                                       Temp = disk_ptr->SectorSize;
-                                                                       REVERSE_BYTES ( &
-                                                                                                                                       ( ( ( PREAD_CAPACITY_DATA_EX ) Srb->
-                                                                                                                                                       DataBuffer )->BytesPerBlock ), &Temp );
-                                                                       LargeTemp = disk_ptr->LBADiskSize - 1;
-                                                                       REVERSE_BYTES_QUAD ( &
-                                                                                                                                                        ( ( ( PREAD_CAPACITY_DATA_EX ) Srb->
-                                                                                                                                                                        DataBuffer )->LogicalBlockAddress.
-                                                                                                                                                                QuadPart ), &LargeTemp );
-                                                                       Irp->IoStatus.Information = sizeof ( READ_CAPACITY_DATA_EX );
-                                                                       Srb->SrbStatus = SRB_STATUS_SUCCESS;
-                                                                       Status = STATUS_SUCCESS;
-                                                                       break;
-                                                               case SCSIOP_MODE_SENSE:
-                                                                       if ( Srb->DataTransferLength <
-                                                                                        sizeof ( MODE_PARAMETER_HEADER ) )
-                                                                               {
-                                                                                       Srb->SrbStatus = SRB_STATUS_DATA_OVERRUN;
-                                                                                       break;
-                                                                               }
-                                                                       ModeParameterHeader =
-                                                                               ( PMODE_PARAMETER_HEADER ) Srb->DataBuffer;
-                                                                       RtlZeroMemory ( ModeParameterHeader,
-                                                                                                                                       Srb->DataTransferLength );
-                                                                       ModeParameterHeader->ModeDataLength =
-                                                                               sizeof ( MODE_PARAMETER_HEADER );
-                                                                       ModeParameterHeader->MediumType = FixedMedia;
-                                                                       ModeParameterHeader->BlockDescriptorLength = 0;
-                                                                       Srb->DataTransferLength = sizeof ( MODE_PARAMETER_HEADER );
-                                                                       Irp->IoStatus.Information = sizeof ( MODE_PARAMETER_HEADER );
-                                                                       Srb->SrbStatus = SRB_STATUS_SUCCESS;
-                                                                       break;
-                                                               case SCSIOP_MEDIUM_REMOVAL:
-                                                                       Irp->IoStatus.Information = 0;
-                                                                       Srb->SrbStatus = SRB_STATUS_SUCCESS;
-                                                                       Status = STATUS_SUCCESS;
-                                                                       break;
-                                                               case SCSIOP_READ_TOC:
-                                                                       /*
-                                                                        * With thanks to Olof's ImDisk source 
-                                                                        */
-                                                                       {
-                                                                               PCDROM_TOC TableOfContents =
-                                                                                       ( PCDROM_TOC ) Srb->DataBuffer;
+                 Srb->SrbStatus = SRB_STATUS_SUCCESS;
+                 break;
+               case SCSIOP_READ_CAPACITY:
+                 Temp = disk_ptr->SectorSize;
+                 REVERSE_BYTES ( &
+                                 ( ( ( PREAD_CAPACITY_DATA )
+                                     Srb->DataBuffer )->BytesPerBlock ),
+                                 &Temp );
+                 if ( ( disk_ptr->LBADiskSize - 1 ) > 0xffffffff )
+                   {
+                     ( ( PREAD_CAPACITY_DATA ) Srb->
+                       DataBuffer )->LogicalBlockAddress = -1;
+                   }
+                 else
+                   {
+                     Temp = ( ULONG ) ( disk_ptr->LBADiskSize - 1 );
+                     REVERSE_BYTES ( &
+                                     ( ( ( PREAD_CAPACITY_DATA )
+                                         Srb->DataBuffer )->
+                                       LogicalBlockAddress ), &Temp );
+                   }
+                 Irp->IoStatus.Information = sizeof ( READ_CAPACITY_DATA );
+                 Srb->SrbStatus = SRB_STATUS_SUCCESS;
+                 Status = STATUS_SUCCESS;
+                 break;
+               case SCSIOP_READ_CAPACITY16:
+                 Temp = disk_ptr->SectorSize;
+                 REVERSE_BYTES ( &
+                                 ( ( ( PREAD_CAPACITY_DATA_EX )
+                                     Srb->DataBuffer )->BytesPerBlock ),
+                                 &Temp );
+                 LargeTemp = disk_ptr->LBADiskSize - 1;
+                 REVERSE_BYTES_QUAD ( &
+                                      ( ( ( PREAD_CAPACITY_DATA_EX )
+                                          Srb->DataBuffer )->
+                                        LogicalBlockAddress.QuadPart ),
+                                      &LargeTemp );
+                 Irp->IoStatus.Information = sizeof ( READ_CAPACITY_DATA_EX );
+                 Srb->SrbStatus = SRB_STATUS_SUCCESS;
+                 Status = STATUS_SUCCESS;
+                 break;
+               case SCSIOP_MODE_SENSE:
+                 if ( Srb->DataTransferLength <
+                      sizeof ( MODE_PARAMETER_HEADER ) )
+                   {
+                     Srb->SrbStatus = SRB_STATUS_DATA_OVERRUN;
+                     break;
+                   }
+                 ModeParameterHeader =
+                   ( PMODE_PARAMETER_HEADER ) Srb->DataBuffer;
+                 RtlZeroMemory ( ModeParameterHeader,
+                                 Srb->DataTransferLength );
+                 ModeParameterHeader->ModeDataLength =
+                   sizeof ( MODE_PARAMETER_HEADER );
+                 ModeParameterHeader->MediumType = FixedMedia;
+                 ModeParameterHeader->BlockDescriptorLength = 0;
+                 Srb->DataTransferLength = sizeof ( MODE_PARAMETER_HEADER );
+                 Irp->IoStatus.Information = sizeof ( MODE_PARAMETER_HEADER );
+                 Srb->SrbStatus = SRB_STATUS_SUCCESS;
+                 break;
+               case SCSIOP_MEDIUM_REMOVAL:
+                 Irp->IoStatus.Information = 0;
+                 Srb->SrbStatus = SRB_STATUS_SUCCESS;
+                 Status = STATUS_SUCCESS;
+                 break;
+               case SCSIOP_READ_TOC:
+                 /*
+                  * With thanks to Olof's ImDisk source 
+                  */
+                 {
+                   PCDROM_TOC TableOfContents =
+                     ( PCDROM_TOC ) Srb->DataBuffer;
 
-                                                                               if ( Srb->DataTransferLength < sizeof ( CDROM_TOC ) )
-                                                                                       {
-                                                                                               Irp->IoStatus.Information = 0;
-                                                                                               Srb->SrbStatus = SRB_STATUS_DATA_OVERRUN;
-                                                                                               Status = STATUS_BUFFER_TOO_SMALL;
-                                                                                               break;
-                                                                                       }
-                                                                               RtlZeroMemory ( TableOfContents, sizeof ( CDROM_TOC ) );
+                   if ( Srb->DataTransferLength < sizeof ( CDROM_TOC ) )
+                     {
+                       Irp->IoStatus.Information = 0;
+                       Srb->SrbStatus = SRB_STATUS_DATA_OVERRUN;
+                       Status = STATUS_BUFFER_TOO_SMALL;
+                       break;
+                     }
+                   RtlZeroMemory ( TableOfContents, sizeof ( CDROM_TOC ) );
 
-                                                                               TableOfContents->FirstTrack = 1;
-                                                                               TableOfContents->LastTrack = 1;
-                                                                               TableOfContents->TrackData[0].Control = 4;
-                                                                       }
-                                                                       Irp->IoStatus.Information = sizeof ( CDROM_TOC );
-                                                                       Srb->SrbStatus = SRB_STATUS_SUCCESS;
-                                                                       Status = STATUS_SUCCESS;
-                                                                       break;
-                                                               default:
-                                                                       DBG ( "Invalid SCSIOP (%02x)!!\n", Cdb->AsByte[0] );
-                                                                       Srb->SrbStatus = SRB_STATUS_ERROR;
-                                                                       Status = STATUS_NOT_IMPLEMENTED;
-                                                       }
-                                               break;
-                                       case SRB_FUNCTION_IO_CONTROL:
-                                               Srb->SrbStatus = SRB_STATUS_INVALID_REQUEST;
-                                               break;
-                                       case SRB_FUNCTION_CLAIM_DEVICE:
-                                               Srb->DataBuffer = DeviceObject;
-                                               break;
-                                       case SRB_FUNCTION_RELEASE_DEVICE:
-                                               ObDereferenceObject ( DeviceObject );
-                                               break;
-                                       case SRB_FUNCTION_SHUTDOWN:
-                                       case SRB_FUNCTION_FLUSH:
-                                               Srb->SrbStatus = SRB_STATUS_SUCCESS;
-                                               break;
-                                       default:
-                                               DBG ( "Invalid SRB FUNCTION (%08x)!!\n", Srb->Function );
-                                               Status = STATUS_NOT_IMPLEMENTED;
-                               }
-               }
-       else
-               {
-                       DBG ( "Invalid Lun!!\n" );
-               }
+                   TableOfContents->FirstTrack = 1;
+                   TableOfContents->LastTrack = 1;
+                   TableOfContents->TrackData[0].Control = 4;
+                 }
+                 Irp->IoStatus.Information = sizeof ( CDROM_TOC );
+                 Srb->SrbStatus = SRB_STATUS_SUCCESS;
+                 Status = STATUS_SUCCESS;
+                 break;
+               default:
+                 DBG ( "Invalid SCSIOP (%02x)!!\n", Cdb->AsByte[0] );
+                 Srb->SrbStatus = SRB_STATUS_ERROR;
+                 Status = STATUS_NOT_IMPLEMENTED;
+             }
+           break;
+         case SRB_FUNCTION_IO_CONTROL:
+           Srb->SrbStatus = SRB_STATUS_INVALID_REQUEST;
+           break;
+         case SRB_FUNCTION_CLAIM_DEVICE:
+           Srb->DataBuffer = DeviceObject;
+           break;
+         case SRB_FUNCTION_RELEASE_DEVICE:
+           ObDereferenceObject ( DeviceObject );
+           break;
+         case SRB_FUNCTION_SHUTDOWN:
+         case SRB_FUNCTION_FLUSH:
+           Srb->SrbStatus = SRB_STATUS_SUCCESS;
+           break;
+         default:
+           DBG ( "Invalid SRB FUNCTION (%08x)!!\n", Srb->Function );
+           Status = STATUS_NOT_IMPLEMENTED;
+       }
+    }
+  else
+    {
+      DBG ( "Invalid Lun!!\n" );
+    }
 
-       Irp->IoStatus.Status = Status;
-       IoCompleteRequest ( Irp, IO_NO_INCREMENT );
-       return Status;
+  Irp->IoStatus.Status = Status;
+  IoCompleteRequest ( Irp, IO_NO_INCREMENT );
+  return Status;
 }
 
 irp__handler_decl ( Disk_DispatchDeviceControl )
 {
-       NTSTATUS Status;
-       ULONG CopySize;
-       PSTORAGE_PROPERTY_QUERY StoragePropertyQuery;
-       STORAGE_ADAPTER_DESCRIPTOR StorageAdapterDescriptor;
-       STORAGE_DEVICE_DESCRIPTOR StorageDeviceDescriptor;
-       DISK_GEOMETRY DiskGeometry;
-       SCSI_ADDRESS ScsiAdress;
-       disk__type_ptr disk_ptr;
+  NTSTATUS Status;
+  ULONG CopySize;
+  PSTORAGE_PROPERTY_QUERY StoragePropertyQuery;
+  STORAGE_ADAPTER_DESCRIPTOR StorageAdapterDescriptor;
+  STORAGE_DEVICE_DESCRIPTOR StorageDeviceDescriptor;
+  DISK_GEOMETRY DiskGeometry;
+  SCSI_ADDRESS ScsiAdress;
+  disk__type_ptr disk_ptr;
 
-       /*
-        * Establish a pointer into the disk device's extension space
-        */
-       disk_ptr = get_disk_ptr ( DeviceExtension );
-       switch ( Stack->Parameters.DeviceIoControl.IoControlCode )
-               {
-                       case IOCTL_STORAGE_QUERY_PROPERTY:
-                               StoragePropertyQuery = Irp->AssociatedIrp.SystemBuffer;
-                               Status = STATUS_INVALID_PARAMETER;
+  /*
+   * Establish a pointer into the disk device's extension space
+   */
+  disk_ptr = get_disk_ptr ( DeviceExtension );
+  switch ( Stack->Parameters.DeviceIoControl.IoControlCode )
+    {
+      case IOCTL_STORAGE_QUERY_PROPERTY:
+       StoragePropertyQuery = Irp->AssociatedIrp.SystemBuffer;
+       Status = STATUS_INVALID_PARAMETER;
 
-                               if ( StoragePropertyQuery->PropertyId == StorageAdapterProperty
-                                                && StoragePropertyQuery->QueryType == PropertyStandardQuery )
-                                       {
-                                               CopySize =
-                                                       ( Stack->Parameters.DeviceIoControl.OutputBufferLength <
-                                                               sizeof ( STORAGE_ADAPTER_DESCRIPTOR ) ? Stack->Parameters.
-                                                               DeviceIoControl.OutputBufferLength :
-                                                               sizeof ( STORAGE_ADAPTER_DESCRIPTOR ) );
-                                               StorageAdapterDescriptor.Version =
-                                                       sizeof ( STORAGE_ADAPTER_DESCRIPTOR );
-                                               StorageAdapterDescriptor.Size =
-                                                       sizeof ( STORAGE_ADAPTER_DESCRIPTOR );
-                                               StorageAdapterDescriptor.MaximumTransferLength =
-                                                       disk_ptr->SectorSize * disk_ptr->AoE.MaxSectorsPerPacket;
+       if ( StoragePropertyQuery->PropertyId == StorageAdapterProperty
+            && StoragePropertyQuery->QueryType == PropertyStandardQuery )
+         {
+           CopySize =
+             ( Stack->Parameters.DeviceIoControl.OutputBufferLength <
+               sizeof ( STORAGE_ADAPTER_DESCRIPTOR ) ? Stack->
+               Parameters.DeviceIoControl.
+               OutputBufferLength : sizeof ( STORAGE_ADAPTER_DESCRIPTOR ) );
+           StorageAdapterDescriptor.Version =
+             sizeof ( STORAGE_ADAPTER_DESCRIPTOR );
+           StorageAdapterDescriptor.Size =
+             sizeof ( STORAGE_ADAPTER_DESCRIPTOR );
+           StorageAdapterDescriptor.MaximumTransferLength =
+             disk_ptr->SectorSize * disk_ptr->AoE.MaxSectorsPerPacket;
 /*        StorageAdapterDescriptor.MaximumTransferLength = SECTORSIZE * POOLSIZE;
  */
-                                               StorageAdapterDescriptor.MaximumPhysicalPages = ( ULONG ) - 1;
-                                               StorageAdapterDescriptor.AlignmentMask = 0;
-                                               StorageAdapterDescriptor.AdapterUsesPio = TRUE;
-                                               StorageAdapterDescriptor.AdapterScansDown = FALSE;
-                                               StorageAdapterDescriptor.CommandQueueing = FALSE;
-                                               StorageAdapterDescriptor.AcceleratedTransfer = FALSE;
-                                               StorageAdapterDescriptor.BusType = BusTypeScsi;
-                                               RtlCopyMemory ( Irp->AssociatedIrp.SystemBuffer,
-                                                                                                               &StorageAdapterDescriptor, CopySize );
-                                               Irp->IoStatus.Information = ( ULONG_PTR ) CopySize;
-                                               Status = STATUS_SUCCESS;
-                                       }
+           StorageAdapterDescriptor.MaximumPhysicalPages = ( ULONG ) - 1;
+           StorageAdapterDescriptor.AlignmentMask = 0;
+           StorageAdapterDescriptor.AdapterUsesPio = TRUE;
+           StorageAdapterDescriptor.AdapterScansDown = FALSE;
+           StorageAdapterDescriptor.CommandQueueing = FALSE;
+           StorageAdapterDescriptor.AcceleratedTransfer = FALSE;
+           StorageAdapterDescriptor.BusType = BusTypeScsi;
+           RtlCopyMemory ( Irp->AssociatedIrp.SystemBuffer,
+                           &StorageAdapterDescriptor, CopySize );
+           Irp->IoStatus.Information = ( ULONG_PTR ) CopySize;
+           Status = STATUS_SUCCESS;
+         }
 
-                               if ( StoragePropertyQuery->PropertyId == StorageDeviceProperty
-                                                && StoragePropertyQuery->QueryType == PropertyStandardQuery )
-                                       {
-                                               CopySize =
-                                                       ( Stack->Parameters.DeviceIoControl.OutputBufferLength <
-                                                               sizeof ( STORAGE_DEVICE_DESCRIPTOR ) ? Stack->Parameters.
-                                                               DeviceIoControl.OutputBufferLength :
-                                                               sizeof ( STORAGE_DEVICE_DESCRIPTOR ) );
-                                               StorageDeviceDescriptor.Version =
-                                                       sizeof ( STORAGE_DEVICE_DESCRIPTOR );
-                                               StorageDeviceDescriptor.Size =
-                                                       sizeof ( STORAGE_DEVICE_DESCRIPTOR );
-                                               StorageDeviceDescriptor.DeviceType = DIRECT_ACCESS_DEVICE;
-                                               StorageDeviceDescriptor.DeviceTypeModifier = 0;
-                                               StorageDeviceDescriptor.RemovableMedia = FALSE;
-                                               StorageDeviceDescriptor.CommandQueueing = FALSE;
-                                               StorageDeviceDescriptor.VendorIdOffset = 0;
-                                               StorageDeviceDescriptor.ProductIdOffset = 0;
-                                               StorageDeviceDescriptor.ProductRevisionOffset = 0;
-                                               StorageDeviceDescriptor.SerialNumberOffset = 0;
-                                               StorageDeviceDescriptor.BusType = BusTypeScsi;
-                                               StorageDeviceDescriptor.RawPropertiesLength = 0;
-                                               RtlCopyMemory ( Irp->AssociatedIrp.SystemBuffer,
-                                                                                                               &StorageDeviceDescriptor, CopySize );
-                                               Irp->IoStatus.Information = ( ULONG_PTR ) CopySize;
-                                               Status = STATUS_SUCCESS;
-                                       }
+       if ( StoragePropertyQuery->PropertyId == StorageDeviceProperty
+            && StoragePropertyQuery->QueryType == PropertyStandardQuery )
+         {
+           CopySize =
+             ( Stack->Parameters.DeviceIoControl.OutputBufferLength <
+               sizeof ( STORAGE_DEVICE_DESCRIPTOR ) ? Stack->
+               Parameters.DeviceIoControl.
+               OutputBufferLength : sizeof ( STORAGE_DEVICE_DESCRIPTOR ) );
+           StorageDeviceDescriptor.Version =
+             sizeof ( STORAGE_DEVICE_DESCRIPTOR );
+           StorageDeviceDescriptor.Size =
+             sizeof ( STORAGE_DEVICE_DESCRIPTOR );
+           StorageDeviceDescriptor.DeviceType = DIRECT_ACCESS_DEVICE;
+           StorageDeviceDescriptor.DeviceTypeModifier = 0;
+           StorageDeviceDescriptor.RemovableMedia = FALSE;
+           StorageDeviceDescriptor.CommandQueueing = FALSE;
+           StorageDeviceDescriptor.VendorIdOffset = 0;
+           StorageDeviceDescriptor.ProductIdOffset = 0;
+           StorageDeviceDescriptor.ProductRevisionOffset = 0;
+           StorageDeviceDescriptor.SerialNumberOffset = 0;
+           StorageDeviceDescriptor.BusType = BusTypeScsi;
+           StorageDeviceDescriptor.RawPropertiesLength = 0;
+           RtlCopyMemory ( Irp->AssociatedIrp.SystemBuffer,
+                           &StorageDeviceDescriptor, CopySize );
+           Irp->IoStatus.Information = ( ULONG_PTR ) CopySize;
+           Status = STATUS_SUCCESS;
+         }
 
-                               if ( Status == STATUS_INVALID_PARAMETER )
-                                       {
-                                               DBG ( "!!Invalid IOCTL_STORAGE_QUERY_PROPERTY "
-                                                                       "(PropertyId: %08x / QueryType: %08x)!!\n",
-                                                                       StoragePropertyQuery->PropertyId,
-                                                                       StoragePropertyQuery->QueryType );
-                                       }
-                               break;
-                       case IOCTL_DISK_GET_DRIVE_GEOMETRY:
-                               CopySize =
-                                       ( Stack->Parameters.DeviceIoControl.OutputBufferLength <
-                                               sizeof ( DISK_GEOMETRY ) ? Stack->Parameters.
-                                               DeviceIoControl.OutputBufferLength : sizeof ( DISK_GEOMETRY ) );
-                               DiskGeometry.MediaType = FixedMedia;
-                               DiskGeometry.Cylinders.QuadPart = disk_ptr->Cylinders;
-                               DiskGeometry.TracksPerCylinder = disk_ptr->Heads;
-                               DiskGeometry.SectorsPerTrack = disk_ptr->Sectors;
-                               DiskGeometry.BytesPerSector = disk_ptr->SectorSize;
-                               RtlCopyMemory ( Irp->AssociatedIrp.SystemBuffer, &DiskGeometry,
-                                                                                               CopySize );
-                               Irp->IoStatus.Information = ( ULONG_PTR ) CopySize;
-                               Status = STATUS_SUCCESS;
-                               break;
-                       case IOCTL_SCSI_GET_ADDRESS:
-                               CopySize =
-                                       ( Stack->Parameters.DeviceIoControl.OutputBufferLength <
-                                               sizeof ( SCSI_ADDRESS ) ? Stack->Parameters.
-                                               DeviceIoControl.OutputBufferLength : sizeof ( SCSI_ADDRESS ) );
-                               ScsiAdress.Length = sizeof ( SCSI_ADDRESS );
-                               ScsiAdress.PortNumber = 0;
-                               ScsiAdress.PathId = 0;
-                               ScsiAdress.TargetId = ( winvblock__uint8 ) disk_ptr->DiskNumber;
-                               ScsiAdress.Lun = 0;
-                               RtlCopyMemory ( Irp->AssociatedIrp.SystemBuffer, &ScsiAdress,
-                                                                                               CopySize );
-                               Irp->IoStatus.Information = ( ULONG_PTR ) CopySize;
-                               Status = STATUS_SUCCESS;
-                               break;
-                       default:
-                               Irp->IoStatus.Information = 0;
-                               Status = STATUS_INVALID_PARAMETER;
-               }
+       if ( Status == STATUS_INVALID_PARAMETER )
+         {
+           DBG ( "!!Invalid IOCTL_STORAGE_QUERY_PROPERTY "
+                 "(PropertyId: %08x / QueryType: %08x)!!\n",
+                 StoragePropertyQuery->PropertyId,
+                 StoragePropertyQuery->QueryType );
+         }
+       break;
+      case IOCTL_DISK_GET_DRIVE_GEOMETRY:
+       CopySize =
+         ( Stack->Parameters.DeviceIoControl.OutputBufferLength <
+           sizeof ( DISK_GEOMETRY ) ? Stack->Parameters.DeviceIoControl.
+           OutputBufferLength : sizeof ( DISK_GEOMETRY ) );
+       DiskGeometry.MediaType = FixedMedia;
+       DiskGeometry.Cylinders.QuadPart = disk_ptr->Cylinders;
+       DiskGeometry.TracksPerCylinder = disk_ptr->Heads;
+       DiskGeometry.SectorsPerTrack = disk_ptr->Sectors;
+       DiskGeometry.BytesPerSector = disk_ptr->SectorSize;
+       RtlCopyMemory ( Irp->AssociatedIrp.SystemBuffer, &DiskGeometry,
+                       CopySize );
+       Irp->IoStatus.Information = ( ULONG_PTR ) CopySize;
+       Status = STATUS_SUCCESS;
+       break;
+      case IOCTL_SCSI_GET_ADDRESS:
+       CopySize =
+         ( Stack->Parameters.DeviceIoControl.OutputBufferLength <
+           sizeof ( SCSI_ADDRESS ) ? Stack->Parameters.DeviceIoControl.
+           OutputBufferLength : sizeof ( SCSI_ADDRESS ) );
+       ScsiAdress.Length = sizeof ( SCSI_ADDRESS );
+       ScsiAdress.PortNumber = 0;
+       ScsiAdress.PathId = 0;
+       ScsiAdress.TargetId = ( winvblock__uint8 ) disk_ptr->DiskNumber;
+       ScsiAdress.Lun = 0;
+       RtlCopyMemory ( Irp->AssociatedIrp.SystemBuffer, &ScsiAdress,
+                       CopySize );
+       Irp->IoStatus.Information = ( ULONG_PTR ) CopySize;
+       Status = STATUS_SUCCESS;
+       break;
+      default:
+       Irp->IoStatus.Information = 0;
+       Status = STATUS_INVALID_PARAMETER;
+    }
 
-       Irp->IoStatus.Status = Status;
-       IoCompleteRequest ( Irp, IO_NO_INCREMENT );
-       return Status;
+  Irp->IoStatus.Status = Status;
+  IoCompleteRequest ( Irp, IO_NO_INCREMENT );
+  return Status;
 }
 
 irp__handler_decl ( Disk_DispatchSystemControl )
 {
-       NTSTATUS Status;
+  NTSTATUS Status;
 
-       Status = Irp->IoStatus.Status;
-       IoCompleteRequest ( Irp, IO_NO_INCREMENT );
-       return Status;
+  Status = Irp->IoStatus.Status;
+  IoCompleteRequest ( Irp, IO_NO_INCREMENT );
+  return Status;
 }
 
 irp__handler_decl ( Disk_Dispatch )
 {
-       NTSTATUS Status;
-       switch ( Stack->MajorFunction )
-               {
-                       case IRP_MJ_POWER:
-                               PoStartNextPowerIrp ( Irp );
-                               Irp->IoStatus.Status = STATUS_NOT_SUPPORTED;
-                               IoCompleteRequest ( Irp, IO_NO_INCREMENT );
-                               Status = STATUS_NOT_SUPPORTED;
-                               break;
-                       case IRP_MJ_PNP:
-                               Status =
-                                       Disk_DispatchPnP ( DeviceObject, Irp, Stack, DeviceExtension );
-                               break;
-                       case IRP_MJ_SYSTEM_CONTROL:
-                               Status =
-                                       Disk_DispatchSystemControl ( DeviceObject, Irp, Stack,
-                                                                                                                                                        DeviceExtension );
-                               break;
-                       case IRP_MJ_DEVICE_CONTROL:
-                               Status =
-                                       Disk_DispatchDeviceControl ( DeviceObject, Irp, Stack,
-                                                                                                                                                        DeviceExtension );
-                               break;
-                       case IRP_MJ_SCSI:
-                               Status =
-                                       Disk_DispatchSCSI ( DeviceObject, Irp, Stack, DeviceExtension );
-                               break;
-                       default:
-                               Status = STATUS_NOT_SUPPORTED;
-                               Irp->IoStatus.Status = Status;
-                               IoCompleteRequest ( Irp, IO_NO_INCREMENT );
-               }
+  NTSTATUS Status;
+  switch ( Stack->MajorFunction )
+    {
+      case IRP_MJ_POWER:
+       PoStartNextPowerIrp ( Irp );
+       Irp->IoStatus.Status = STATUS_NOT_SUPPORTED;
+       IoCompleteRequest ( Irp, IO_NO_INCREMENT );
+       Status = STATUS_NOT_SUPPORTED;
+       break;
+      case IRP_MJ_PNP:
+       Status =
+         Disk_DispatchPnP ( DeviceObject, Irp, Stack, DeviceExtension );
+       break;
+      case IRP_MJ_SYSTEM_CONTROL:
+       Status =
+         Disk_DispatchSystemControl ( DeviceObject, Irp, Stack,
+                                      DeviceExtension );
+       break;
+      case IRP_MJ_DEVICE_CONTROL:
+       Status =
+         Disk_DispatchDeviceControl ( DeviceObject, Irp, Stack,
+                                      DeviceExtension );
+       break;
+      case IRP_MJ_SCSI:
+       Status =
+         Disk_DispatchSCSI ( DeviceObject, Irp, Stack, DeviceExtension );
+       break;
+      default:
+       Status = STATUS_NOT_SUPPORTED;
+       Irp->IoStatus.Status = Status;
+       IoCompleteRequest ( Irp, IO_NO_INCREMENT );
+    }
 }
index 1bfa528..9bcabf5 100644 (file)
 
 typedef struct _AOEDISK_AOEDISK
 {
-       ULONG MTU;
-       winvblock__uint8 ClientMac[6];
-       winvblock__uint8 ServerMac[6];
-       ULONG Major;
-       ULONG Minor;
-       ULONG MaxSectorsPerPacket;
-       ULONG Timeout;
+  ULONG MTU;
+  winvblock__uint8 ClientMac[6];
+  winvblock__uint8 ServerMac[6];
+  ULONG Major;
+  ULONG Minor;
+  ULONG MaxSectorsPerPacket;
+  ULONG Timeout;
 } AOEDISK_AOEDISK,
 *PAOEDISK_AOEDISK;
 
 extern irp__handler_decl (
-       Disk_Dispatch
+  Disk_Dispatch
  );
 
 extern irp__handler_decl (
-       Disk_DispatchPnP
+  Disk_DispatchPnP
  );
 
 extern irp__handler_decl (
-       Disk_DispatchSCSI
+  Disk_DispatchSCSI
  );
 
 extern irp__handler_decl (
-       Disk_DispatchDeviceControl
+  Disk_DispatchDeviceControl
  );
 
 extern irp__handler_decl (
-       Disk_DispatchSystemControl
+  Disk_DispatchSystemControl
  );
 
-#endif                                                                                                 /* _AOEDISK_H */
+#endif                         /* _AOEDISK_H */
index c57aa77..aa95e00 100644 (file)
--- a/src/bus.c
+++ b/src/bus.c
 
 /* in this file */
 static irp__handler_decl (
-       Bus_DispatchNotSupported
+  Bus_DispatchNotSupported
  );
 static irp__handler_decl (
-       Bus_DispatchPower
+  Bus_DispatchPower
  );
 winvblock__bool STDCALL Bus_AddChild (
-       IN PDEVICE_OBJECT BusDeviceObject,
-       IN disk__type Disk,
-       IN winvblock__bool Boot
+  IN PDEVICE_OBJECT BusDeviceObject,
+  IN disk__type Disk,
+  IN winvblock__bool Boot
  );
 static NTSTATUS STDCALL Bus_IoCompletionRoutine (
-       IN PDEVICE_OBJECT DeviceObject,
-       IN PIRP Irp,
-       IN PKEVENT Event
+  IN PDEVICE_OBJECT DeviceObject,
+  IN PIRP Irp,
+  IN PKEVENT Event
  );
 
 typedef struct _BUS_TARGETLIST
 {
-       MOUNT_TARGET Target;
-       struct _BUS_TARGETLIST *Next;
+  MOUNT_TARGET Target;
+  struct _BUS_TARGETLIST *Next;
 } BUS_TARGETLIST,
 *PBUS_TARGETLIST;
 
@@ -73,108 +73,108 @@ PDEVICE_OBJECT bus__fdo = NULL;
 
 NTSTATUS STDCALL
 Bus_Start (
-       void
+  void
  )
 {
-       DBG ( "Entry\n" );
-       KeInitializeSpinLock ( &Bus_Globals_TargetListSpinLock );
-       return STATUS_SUCCESS;
+  DBG ( "Entry\n" );
+  KeInitializeSpinLock ( &Bus_Globals_TargetListSpinLock );
+  return STATUS_SUCCESS;
 }
 
 VOID STDCALL
 Bus_Stop (
-       void
+  void
  )
 {
-       UNICODE_STRING DosDeviceName;
-       PBUS_TARGETLIST Walker,
-        Next;
-       KIRQL Irql;
-
-       DBG ( "Entry\n" );
-       KeAcquireSpinLock ( &Bus_Globals_TargetListSpinLock, &Irql );
-       Walker = Bus_Globals_TargetList;
-       while ( Walker != NULL )
-               {
-                       Next = Walker->Next;
-                       ExFreePool ( Walker );
-                       Walker = Next;
-               }
-       KeReleaseSpinLock ( &Bus_Globals_TargetListSpinLock, Irql );
-       RtlInitUnicodeString ( &DosDeviceName, L"\\DosDevices\\AoE" );
-       IoDeleteSymbolicLink ( &DosDeviceName );
-       bus__fdo = NULL;
+  UNICODE_STRING DosDeviceName;
+  PBUS_TARGETLIST Walker,
+   Next;
+  KIRQL Irql;
+
+  DBG ( "Entry\n" );
+  KeAcquireSpinLock ( &Bus_Globals_TargetListSpinLock, &Irql );
+  Walker = Bus_Globals_TargetList;
+  while ( Walker != NULL )
+    {
+      Next = Walker->Next;
+      ExFreePool ( Walker );
+      Walker = Next;
+    }
+  KeReleaseSpinLock ( &Bus_Globals_TargetListSpinLock, Irql );
+  RtlInitUnicodeString ( &DosDeviceName, L"\\DosDevices\\AoE" );
+  IoDeleteSymbolicLink ( &DosDeviceName );
+  bus__fdo = NULL;
 }
 
 VOID STDCALL
 Bus_AddTarget (
-       IN winvblock__uint8_ptr ClientMac,
-       IN winvblock__uint8_ptr ServerMac,
-       winvblock__uint16 Major,
-       winvblock__uint8 Minor,
-       LONGLONG LBASize
+  IN winvblock__uint8_ptr ClientMac,
+  IN winvblock__uint8_ptr ServerMac,
+  winvblock__uint16 Major,
+  winvblock__uint8 Minor,
+  LONGLONG LBASize
  )
 {
-       PBUS_TARGETLIST Walker,
-        Last;
-       KIRQL Irql;
-
-       KeAcquireSpinLock ( &Bus_Globals_TargetListSpinLock, &Irql );
-       Last = Bus_Globals_TargetList;
-       Walker = Bus_Globals_TargetList;
-       while ( Walker != NULL )
-               {
-                       if ( ( RtlCompareMemory ( &Walker->Target.ClientMac, ClientMac, 6 ) ==
-                                                6 )
-                                        && ( RtlCompareMemory ( &Walker->Target.ServerMac, ServerMac, 6 ) ==
-                                                               6 ) && Walker->Target.Major == Major
-                                        && Walker->Target.Minor == Minor )
-                               {
-                                       if ( Walker->Target.LBASize != LBASize )
-                                               {
-                                                       DBG ( "LBASize changed for e%d.%d " "(%I64u->%I64u)\n", Major,
-                                                                               Minor, Walker->Target.LBASize, LBASize );
-                                                       Walker->Target.LBASize = LBASize;
-                                               }
-                                       KeQuerySystemTime ( &Walker->Target.ProbeTime );
-                                       KeReleaseSpinLock ( &Bus_Globals_TargetListSpinLock, Irql );
-                                       return;
-                               }
-                       Last = Walker;
-                       Walker = Walker->Next;
-               }
-
-       if ( ( Walker =
-                                ( PBUS_TARGETLIST ) ExAllocatePool ( NonPagedPool,
-                                                                                                                                                                                       sizeof ( BUS_TARGETLIST ) ) ) ==
-                        NULL )
-