Commit in reactos/drivers/net/afd/afd on MAIN
connect.c+9-61.5 -> 1.6
read.c+4-21.12 -> 1.13
write.c+3-11.12 -> 1.13
tdi.c+2-51.21 -> 1.22
main.c+38-371.13 -> 1.14
+56-51
5 modified files
connect: Allow async connections, and assume that concurrent operations 
(like write) can happen.
main: Allow empty EaInfo in open, re: async select and the special control
socket.
read + write: assertions
tdi: don't wait for connect to return, remove event.

reactos/drivers/net/afd/afd
connect.c 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- connect.c	21 Nov 2004 20:54:52 -0000	1.5
+++ connect.c	30 Nov 2004 04:49:50 -0000	1.6
@@ -1,4 +1,4 @@
-/* $Id: connect.c,v 1.5 2004/11/21 20:54:52 arty Exp $
+/* $Id: connect.c,v 1.6 2004/11/30 04:49:50 arty Exp $
  * COPYRIGHT:        See COPYING in the top level directory
  * PROJECT:          ReactOS kernel
  * FILE:             drivers/net/afd/afd/connect.c
@@ -53,10 +53,9 @@
     AFD_DbgPrint(MID_TRACE,("Called: FCB %x, FO %x\n", 
 			    Context, FCB->FileObject));
 
-    /* Check the result of the connect operation */
-    /* Since the previous does not return until we come through here, we do
-     * not need to relock. */
-    /* if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp ); */
+    /* I was wrong about this before as we can have pending writes to a not
+     * yet connected socket */
+    if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp, FALSE );
 
     AFD_DbgPrint(MID_TRACE,("Irp->IoStatus.Status = %x\n", 
 			    Irp->IoStatus.Status));
@@ -118,7 +117,7 @@
 	    Status = STATUS_SUCCESS;
     }
 
-    /* SocketStateUnlock( FCB ); */
+    SocketStateUnlock( FCB );
 
     AFD_DbgPrint(MID_TRACE,("Returning %x\n", Status));
     
@@ -202,6 +201,10 @@
 				 FCB );
 
 	    ExFreePool( TargetAddress );
+
+	    AFD_DbgPrint(MID_TRACE,("Queueing IRP %x\n", Irp));
+
+	    return LeaveIrpUntilLater( FCB, Irp, FUNCTION_CONNECT );
 	} else Status = STATUS_NO_MEMORY;
 	break;
 

reactos/drivers/net/afd/afd
read.c 1.12 -> 1.13
diff -u -r1.12 -r1.13
--- read.c	21 Nov 2004 20:54:52 -0000	1.12
+++ read.c	30 Nov 2004 04:49:50 -0000	1.13
@@ -1,4 +1,4 @@
-/* $Id: read.c,v 1.12 2004/11/21 20:54:52 arty Exp $
+/* $Id: read.c,v 1.13 2004/11/30 04:49:50 arty Exp $
  * COPYRIGHT:        See COPYING in the top level directory
  * PROJECT:          ReactOS kernel
  * FILE:             drivers/net/afd/afd/read.c
@@ -78,7 +78,9 @@
     UINT TotalBytesCopied = 0;
 
     AFD_DbgPrint(MID_TRACE,("Called\n"));
-    
+
+    ASSERT_IRQL(APC_LEVEL);
+
     if( !SocketAcquireStateLock( FCB ) ) return Status;
 
     FCB->ReceiveIrp.InFlightRequest = NULL;

reactos/drivers/net/afd/afd
write.c 1.12 -> 1.13
diff -u -r1.12 -r1.13
--- write.c	21 Nov 2004 20:54:52 -0000	1.12
+++ write.c	30 Nov 2004 04:49:50 -0000	1.13
@@ -1,4 +1,4 @@
-/* $Id: write.c,v 1.12 2004/11/21 20:54:52 arty Exp $
+/* $Id: write.c,v 1.13 2004/11/30 04:49:50 arty Exp $
  * COPYRIGHT:        See COPYING in the top level directory
  * PROJECT:          ReactOS kernel
  * FILE:             drivers/net/afd/afd/write.c
@@ -30,6 +30,8 @@
 			    Irp->IoStatus.Status,
 			    Irp->IoStatus.Information));
 
+    ASSERT_IRQL(APC_LEVEL);
+
     if( !SocketAcquireStateLock( FCB ) ) return Status;
 
     FCB->SendIrp.InFlightRequest = NULL; 

reactos/drivers/net/afd/afd
tdi.c 1.21 -> 1.22
diff -u -r1.21 -r1.22
--- tdi.c	3 Oct 2004 21:16:27 -0000	1.21
+++ tdi.c	30 Nov 2004 04:49:50 -0000	1.22
@@ -286,7 +286,6 @@
   PDEVICE_OBJECT DeviceObject;
   IO_STATUS_BLOCK Iosb;
   NTSTATUS Status;
-  KEVENT Event;
 
   AFD_DbgPrint(MAX_TRACE, ("Called\n"));
 
@@ -294,12 +293,10 @@
 
   DeviceObject = IoGetRelatedDeviceObject(ConnectionObject);
 
-  KeInitializeEvent(&Event, NotificationEvent, FALSE);
-
   *Irp = TdiBuildInternalDeviceControlIrp(TDI_CONNECT,             /* Sub function */
 					  DeviceObject,            /* Device object */
 					  ConnectionObject,        /* File object */
-					  &Event,                  /* Event */
+					  NULL,                    /* Event */
 					  &Iosb);                  /* Status */
   if (!*Irp) {
     return STATUS_INSUFFICIENT_RESOURCES;
@@ -314,7 +311,7 @@
                   RemoteAddress,          /* Request connection information */
                   RemoteAddress);         /* Return connection information */
 
-  Status = TdiCall(*Irp, DeviceObject, &Event, &Iosb);
+  Status = TdiCall(*Irp, DeviceObject, NULL, &Iosb);
 
   return Status;
 }

reactos/drivers/net/afd/afd
main.c 1.13 -> 1.14
diff -u -r1.13 -r1.14
--- main.c	21 Nov 2004 20:54:52 -0000	1.13
+++ main.c	30 Nov 2004 04:49:50 -0000	1.14
@@ -1,4 +1,4 @@
-/* $Id: main.c,v 1.13 2004/11/21 20:54:52 arty Exp $
+/* $Id: main.c,v 1.14 2004/11/30 04:49:50 arty Exp $
  * COPYRIGHT:        See COPYING in the top level directory
  * PROJECT:          ReactOS kernel
  * FILE:             drivers/net/afd/afd/main.c
@@ -47,9 +47,9 @@
     PFILE_OBJECT FileObject;
     PAFD_DEVICE_EXTENSION DeviceExt;
     PFILE_FULL_EA_INFORMATION EaInfo;
-    PAFD_CREATE_PACKET ConnectInfo;
+    PAFD_CREATE_PACKET ConnectInfo = NULL;
     ULONG EaLength;
-    PWCHAR EaInfoValue;
+    PWCHAR EaInfoValue = NULL;
     UINT Disposition, i;
 
     AFD_DbgPrint(MID_TRACE,
@@ -62,22 +62,18 @@
     Irp->IoStatus.Information = 0;
     
     EaInfo = Irp->AssociatedIrp.SystemBuffer;
-    ConnectInfo = (PAFD_CREATE_PACKET)(EaInfo->EaName + EaInfo->EaNameLength + 1);
-    EaInfoValue = (PWCHAR)(((PCHAR)ConnectInfo) + sizeof(AFD_CREATE_PACKET));
-
-    if(!EaInfo) {
-	AFD_DbgPrint(MIN_TRACE, ("No EA Info in IRP.\n"));
-	Irp->IoStatus.Status = STATUS_INVALID_PARAMETER;
-	IoCompleteRequest( Irp, IO_NO_INCREMENT );
-	return STATUS_INVALID_PARAMETER;
-    }
-
-    EaLength = sizeof(FILE_FULL_EA_INFORMATION) +
-	EaInfo->EaNameLength +
-	EaInfo->EaValueLength;
-
-    AFD_DbgPrint(MID_TRACE,("EaInfo: %x, EaInfoValue: %x\n", 
-			    EaInfo, EaInfoValue));
+    
+    if( EaInfo ) {
+	ConnectInfo = (PAFD_CREATE_PACKET)(EaInfo->EaName + EaInfo->EaNameLength + 1);
+	EaInfoValue = (PWCHAR)(((PCHAR)ConnectInfo) + sizeof(AFD_CREATE_PACKET));
+	
+	EaLength = sizeof(FILE_FULL_EA_INFORMATION) +
+	    EaInfo->EaNameLength +
+	    EaInfo->EaValueLength;
+	
+	AFD_DbgPrint(MID_TRACE,("EaInfo: %x, EaInfoValue: %x\n", 
+				EaInfo, EaInfoValue));
+    }
 
     AFD_DbgPrint(MID_TRACE,("About to allocate the new FCB\n"));
 
@@ -88,11 +84,11 @@
 	return STATUS_NO_MEMORY;
     }
 
-    AFD_DbgPrint(MID_TRACE,("Initializing the new FCB @ %x (FileObject %x Flags %x)\n", FCB, FileObject, ConnectInfo->EndpointFlags));
+    AFD_DbgPrint(MID_TRACE,("Initializing the new FCB @ %x (FileObject %x Flags %x)\n", FCB, FileObject, ConnectInfo ? ConnectInfo->EndpointFlags : 0));
 
     RtlZeroMemory( FCB, sizeof( *FCB ) );
 
-    FCB->Flags = ConnectInfo->EndpointFlags;
+    FCB->Flags = ConnectInfo ? ConnectInfo->EndpointFlags : 0;
     FCB->State = SOCKET_STATE_CREATED;
     FCB->FileObject = FileObject;
     FCB->DeviceExt = DeviceExt;
@@ -111,24 +107,29 @@
 
     AFD_DbgPrint(MID_TRACE,("%x: Checking command channel\n", FCB));
 
-    FCB->TdiDeviceName.Length = ConnectInfo->SizeOfTransportName;
-    FCB->TdiDeviceName.MaximumLength = FCB->TdiDeviceName.Length;
-    FCB->TdiDeviceName.Buffer = 
-      ExAllocatePool( NonPagedPool, FCB->TdiDeviceName.Length );
-    RtlCopyMemory( FCB->TdiDeviceName.Buffer,
-		   ConnectInfo->TransportName,
-		   FCB->TdiDeviceName.Length );
-
-    if( !FCB->TdiDeviceName.Buffer ) {
-      ExFreePool(FCB);
-      AFD_DbgPrint(MID_TRACE,("Could not copy target string\n"));
-      Irp->IoStatus.Status = STATUS_NO_MEMORY;
-      IoCompleteRequest( Irp, IO_NETWORK_INCREMENT );
-      return STATUS_NO_MEMORY;
+    if( ConnectInfo ) {
+	FCB->TdiDeviceName.Length = ConnectInfo->SizeOfTransportName;
+	FCB->TdiDeviceName.MaximumLength = FCB->TdiDeviceName.Length;
+	FCB->TdiDeviceName.Buffer = 
+	    ExAllocatePool( NonPagedPool, FCB->TdiDeviceName.Length );
+	RtlCopyMemory( FCB->TdiDeviceName.Buffer,
+		       ConnectInfo->TransportName,
+		       FCB->TdiDeviceName.Length );
+
+	if( !FCB->TdiDeviceName.Buffer ) {
+	    ExFreePool(FCB);
+	    AFD_DbgPrint(MID_TRACE,("Could not copy target string\n"));
+	    Irp->IoStatus.Status = STATUS_NO_MEMORY;
+	    IoCompleteRequest( Irp, IO_NETWORK_INCREMENT );
+	    return STATUS_NO_MEMORY;
+	}
+
+	AFD_DbgPrint(MID_TRACE,("Success: %s %wZ\n", 
+				EaInfo->EaName, &FCB->TdiDeviceName));
+    } else {
+	AFD_DbgPrint(MID_TRACE,("Success: Control connection\n"));
     }
 
-    AFD_DbgPrint(MID_TRACE,("Success: %s %wZ\n", 
-			    EaInfo->EaName, &FCB->TdiDeviceName));
     FileObject->FsContext = FCB;
     Irp->IoStatus.Status = STATUS_SUCCESS;
     IoCompleteRequest( Irp, IO_NETWORK_INCREMENT );
CVSspam 0.2.8