Author: hbelusca
Date: Mon Sep 2 22:19:41 2013
New Revision: 59967
URL:
http://svn.reactos.org/svn/reactos?rev=59967&view=rev
Log:
[NTOS:LPC]: Rename a flag I've introduced sooner, and remove an unneeded variable +
code formatting.
Modified:
trunk/reactos/ntoskrnl/include/internal/lpc.h
trunk/reactos/ntoskrnl/lpc/close.c
trunk/reactos/ntoskrnl/lpc/reply.c
trunk/reactos/ntoskrnl/lpc/send.c
Modified: trunk/reactos/ntoskrnl/include/internal/lpc.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/lpc.h [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/include/internal/lpc.h [iso-8859-1] Mon Sep 2 22:19:41 2013
@@ -60,7 +60,7 @@
//
// LPC Locking Flags
//
-#define LPCP_LOCK_OWNED 1
+#define LPCP_LOCK_HELD 1
#define LPCP_LOCK_RELEASE 2
//
Modified: trunk/reactos/ntoskrnl/lpc/close.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/lpc/close.c?rev=5…
==============================================================================
--- trunk/reactos/ntoskrnl/lpc/close.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/lpc/close.c [iso-8859-1] Mon Sep 2 22:19:41 2013
@@ -55,7 +55,7 @@
PLPCP_CONNECTION_MESSAGE ConnectMessage;
PLPCP_PORT_OBJECT ClientPort = NULL;
PETHREAD Thread = NULL;
- BOOLEAN LockHeld = (LockFlags & LPCP_LOCK_OWNED);
+ BOOLEAN LockHeld = (LockFlags & LPCP_LOCK_HELD);
BOOLEAN ReleaseLock = (LockFlags & LPCP_LOCK_RELEASE);
PAGED_CODE();
@@ -186,7 +186,7 @@
Thread->LpcReplyMessage = NULL;
/* And remove the message from the port zone */
- LpcpFreeToPortZone(Message, LPCP_LOCK_OWNED);
+ LpcpFreeToPortZone(Message, LPCP_LOCK_HELD);
NextEntry = Port->LpcReplyChainHead.Flink;
}
@@ -213,7 +213,7 @@
InitializeListHead(&Message->Entry);
/* Remove it from the port zone */
- LpcpFreeToPortZone(Message, LPCP_LOCK_OWNED);
+ LpcpFreeToPortZone(Message, LPCP_LOCK_HELD);
}
/* Release the lock */
@@ -407,7 +407,7 @@
/* Free queued messages */
RemoveEntryList(&Message->Entry);
InitializeListHead(&Message->Entry);
- LpcpFreeToPortZone(Message, LPCP_LOCK_OWNED);
+ LpcpFreeToPortZone(Message, LPCP_LOCK_HELD);
/* Restart at the head */
NextEntry = ListHead->Flink;
@@ -420,7 +420,7 @@
/* Remove it */
RemoveEntryList(&Message->Entry);
InitializeListHead(&Message->Entry);
- LpcpFreeToPortZone(Message, LPCP_LOCK_OWNED);
+ LpcpFreeToPortZone(Message, LPCP_LOCK_HELD);
/* Restart at the head */
NextEntry = ListHead->Flink;
Modified: trunk/reactos/ntoskrnl/lpc/reply.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/lpc/reply.c?rev=5…
==============================================================================
--- trunk/reactos/ntoskrnl/lpc/reply.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/lpc/reply.c [iso-8859-1] Mon Sep 2 22:19:41 2013
@@ -48,7 +48,7 @@
/* Unlink and free it */
RemoveEntryList(&Message->Entry);
InitializeListHead(&Message->Entry);
- LpcpFreeToPortZone(Message, LPCP_LOCK_OWNED);
+ LpcpFreeToPortZone(Message, LPCP_LOCK_HELD);
break;
}
@@ -63,7 +63,7 @@
IN PLPCP_MESSAGE Message,
IN ULONG LockFlags)
{
- BOOLEAN LockHeld = (LockFlags & LPCP_LOCK_OWNED);
+ BOOLEAN LockHeld = (LockFlags & LPCP_LOCK_HELD);
PAGED_CODE();
@@ -238,7 +238,7 @@
Request) != LPC_REQUEST)))
{
/* It isn't, fail */
- LpcpFreeToPortZone(Message, LPCP_LOCK_OWNED | LPCP_LOCK_RELEASE);
+ LpcpFreeToPortZone(Message, LPCP_LOCK_HELD | LPCP_LOCK_RELEASE);
if (ConnectionPort) ObDereferenceObject(ConnectionPort);
ObDereferenceObject(WakeupThread);
ObDereferenceObject(Port);
@@ -257,7 +257,7 @@
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
/* Fail */
- LpcpFreeToPortZone(Message, LPCP_LOCK_OWNED | LPCP_LOCK_RELEASE);
+ LpcpFreeToPortZone(Message, LPCP_LOCK_HELD | LPCP_LOCK_RELEASE);
ObDereferenceObject(WakeupThread);
ObDereferenceObject(Port);
_SEH2_YIELD(return _SEH2_GetExceptionCode());
@@ -482,7 +482,7 @@
Request) != LPC_REQUEST)))
{
/* It isn't, fail */
- LpcpFreeToPortZone(Message, LPCP_LOCK_OWNED | LPCP_LOCK_RELEASE);
+ LpcpFreeToPortZone(Message, LPCP_LOCK_HELD | LPCP_LOCK_RELEASE);
if (ConnectionPort) ObDereferenceObject(ConnectionPort);
ObDereferenceObject(WakeupThread);
ObDereferenceObject(Port);
@@ -639,7 +639,7 @@
if (Message->Request.u2.s2.DataInfoOffset)
{
/* It does, save it, and don't free the message below */
- LpcpSaveDataInfoMessage(Port, Message, LPCP_LOCK_OWNED);
+ LpcpSaveDataInfoMessage(Port, Message, LPCP_LOCK_HELD);
Message = NULL;
}
}
@@ -661,7 +661,7 @@
if (Message)
{
/* Free it and release the lock */
- LpcpFreeToPortZone(Message, LPCP_LOCK_OWNED | LPCP_LOCK_RELEASE);
+ LpcpFreeToPortZone(Message, LPCP_LOCK_HELD | LPCP_LOCK_RELEASE);
}
else
{
Modified: trunk/reactos/ntoskrnl/lpc/send.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/lpc/send.c?rev=59…
==============================================================================
--- trunk/reactos/ntoskrnl/lpc/send.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/lpc/send.c [iso-8859-1] Mon Sep 2 22:19:41 2013
@@ -104,7 +104,7 @@
if (!ConnectionPort)
{
/* Fail */
- LpcpFreeToPortZone(Message, LPCP_LOCK_OWNED | LPCP_LOCK_RELEASE);
+ LpcpFreeToPortZone(Message, LPCP_LOCK_HELD | LPCP_LOCK_RELEASE);
return STATUS_PORT_DISCONNECTED;
}
}
@@ -115,7 +115,7 @@
if (!ConnectionPort)
{
/* Fail */
- LpcpFreeToPortZone(Message, LPCP_LOCK_OWNED | LPCP_LOCK_RELEASE);
+ LpcpFreeToPortZone(Message, LPCP_LOCK_HELD | LPCP_LOCK_RELEASE);
return STATUS_PORT_DISCONNECTED;
}
}
@@ -134,7 +134,7 @@
if (QueuePort)
{
/* Generate the Message ID and set it */
- Message->Request.MessageId = LpcpNextMessageId++;
+ Message->Request.MessageId = LpcpNextMessageId++;
if (!LpcpNextMessageId) LpcpNextMessageId = 1;
Message->Request.CallbackId = 0;
@@ -144,7 +144,7 @@
/* Insert the message in our chain */
InsertTailList(&QueuePort->MsgQueue.ReceiveHead, &Message->Entry);
- /* Release the lock and release the semaphore */
+ /* Release the lock and the semaphore */
KeEnterCriticalRegion();
KeReleaseGuardedMutex(&LpcpLock);
LpcpCompleteWait(QueuePort->MsgQueue.Semaphore);
@@ -156,15 +156,16 @@
KeSetEvent(&QueuePort->WaitEvent, IO_NO_INCREMENT, FALSE);
}
+ KeLeaveCriticalRegion();
+
/* We're done */
- KeLeaveCriticalRegion();
if (ConnectionPort) ObDereferenceObject(ConnectionPort);
LPCTRACE(LPC_SEND_DEBUG, "Port: %p. Message: %p\n", QueuePort,
Message);
return STATUS_SUCCESS;
}
/* If we got here, then free the message and fail */
- LpcpFreeToPortZone(Message, LPCP_LOCK_OWNED | LPCP_LOCK_RELEASE);
+ LpcpFreeToPortZone(Message, LPCP_LOCK_HELD | LPCP_LOCK_RELEASE);
if (ConnectionPort) ObDereferenceObject(ConnectionPort);
return STATUS_PORT_DISCONNECTED;
}
@@ -284,7 +285,7 @@
if (!QueuePort)
{
/* We have no connected port, fail */
- LpcpFreeToPortZone(Message, LPCP_LOCK_OWNED | LPCP_LOCK_RELEASE);
+ LpcpFreeToPortZone(Message, LPCP_LOCK_HELD | LPCP_LOCK_RELEASE);
return STATUS_PORT_DISCONNECTED;
}
@@ -300,7 +301,7 @@
if (!ConnectionPort)
{
/* Fail */
- LpcpFreeToPortZone(Message, LPCP_LOCK_OWNED | LPCP_LOCK_RELEASE);
+ LpcpFreeToPortZone(Message, LPCP_LOCK_HELD | LPCP_LOCK_RELEASE);
return STATUS_PORT_DISCONNECTED;
}
}
@@ -312,7 +313,7 @@
if (!ConnectionPort)
{
/* Fail */
- LpcpFreeToPortZone(Message, LPCP_LOCK_OWNED | LPCP_LOCK_RELEASE);
+ LpcpFreeToPortZone(Message, LPCP_LOCK_HELD | LPCP_LOCK_RELEASE);
return STATUS_PORT_DISCONNECTED;
}
}
@@ -331,7 +332,7 @@
Message->SenderPort = Port;
/* Generate the Message ID and set it */
- Message->Request.MessageId = LpcpNextMessageId++;
+ Message->Request.MessageId = LpcpNextMessageId++;
if (!LpcpNextMessageId) LpcpNextMessageId = 1;
Message->Request.CallbackId = 0;
@@ -413,7 +414,7 @@
}
/* Free the message */
- LpcpFreeToPortZone(Message, LPCP_LOCK_OWNED | LPCP_LOCK_RELEASE);
+ LpcpFreeToPortZone(Message, LPCP_LOCK_HELD | LPCP_LOCK_RELEASE);
}
else
{
@@ -452,7 +453,6 @@
PLPCP_MESSAGE Message;
KPROCESSOR_MODE PreviousMode = KeGetPreviousMode();
PETHREAD Thread = PsGetCurrentThread();
- PKSEMAPHORE Semaphore;
PAGED_CODE();
@@ -536,7 +536,7 @@
if (!QueuePort)
{
/* We have no connected port, fail */
- LpcpFreeToPortZone(Message, LPCP_LOCK_OWNED | LPCP_LOCK_RELEASE);
+ LpcpFreeToPortZone(Message, LPCP_LOCK_HELD | LPCP_LOCK_RELEASE);
ObDereferenceObject(Port);
return STATUS_PORT_DISCONNECTED;
}
@@ -550,7 +550,7 @@
if (!ConnectionPort)
{
/* Fail */
- LpcpFreeToPortZone(Message, LPCP_LOCK_OWNED | LPCP_LOCK_RELEASE);
+ LpcpFreeToPortZone(Message, LPCP_LOCK_HELD | LPCP_LOCK_RELEASE);
ObDereferenceObject(Port);
return STATUS_PORT_DISCONNECTED;
}
@@ -563,7 +563,7 @@
if (!ConnectionPort)
{
/* Fail */
- LpcpFreeToPortZone(Message, LPCP_LOCK_OWNED | LPCP_LOCK_RELEASE);
+ LpcpFreeToPortZone(Message, LPCP_LOCK_HELD | LPCP_LOCK_RELEASE);
ObDereferenceObject(Port);
return STATUS_PORT_DISCONNECTED;
}
@@ -585,7 +585,7 @@
Message->SenderPort = Port;
/* Generate the Message ID and set it */
- Message->Request.MessageId = LpcpNextMessageId++;
+ Message->Request.MessageId = LpcpNextMessageId++;
if (!LpcpNextMessageId) LpcpNextMessageId = 1;
Message->Request.CallbackId = 0;
@@ -595,13 +595,10 @@
/* Insert the message in our chain */
InsertTailList(&QueuePort->MsgQueue.ReceiveHead, &Message->Entry);
- /* Release the lock and get the semaphore we'll use later */
+ /* Release the lock and the semaphore */
KeEnterCriticalRegion();
KeReleaseGuardedMutex(&LpcpLock);
-
- /* Now release the semaphore */
- Semaphore = QueuePort->MsgQueue.Semaphore;
- LpcpCompleteWait(Semaphore);
+ LpcpCompleteWait(QueuePort->MsgQueue.Semaphore);
/* If this is a waitable port, wake it up */
if (QueuePort->Flags & LPCP_WAITABLE_PORT)
@@ -629,7 +626,7 @@
Status);
/* The wait failed, free the message */
- if (Message) LpcpFreeToPortZone(Message, LPCP_LOCK_OWNED | LPCP_LOCK_RELEASE);
+ if (Message) LpcpFreeToPortZone(Message, LPCP_LOCK_HELD | LPCP_LOCK_RELEASE);
ObDereferenceObject(Port);
if (ConnectionPort) ObDereferenceObject(ConnectionPort);
@@ -762,7 +759,7 @@
if (!QueuePort)
{
/* We have no connected port, fail */
- LpcpFreeToPortZone(Message, LPCP_LOCK_OWNED | LPCP_LOCK_RELEASE);
+ LpcpFreeToPortZone(Message, LPCP_LOCK_HELD | LPCP_LOCK_RELEASE);
ObDereferenceObject(Port);
return STATUS_PORT_DISCONNECTED;
}
@@ -779,7 +776,7 @@
if (!ConnectionPort)
{
/* Fail */
- LpcpFreeToPortZone(Message, LPCP_LOCK_OWNED | LPCP_LOCK_RELEASE);
+ LpcpFreeToPortZone(Message, LPCP_LOCK_HELD | LPCP_LOCK_RELEASE);
ObDereferenceObject(Port);
return STATUS_PORT_DISCONNECTED;
}
@@ -792,7 +789,7 @@
if (!ConnectionPort)
{
/* Fail */
- LpcpFreeToPortZone(Message, LPCP_LOCK_OWNED | LPCP_LOCK_RELEASE);
+ LpcpFreeToPortZone(Message, LPCP_LOCK_HELD | LPCP_LOCK_RELEASE);
ObDereferenceObject(Port);
return STATUS_PORT_DISCONNECTED;
}
@@ -812,7 +809,7 @@
Message->SenderPort = Port;
/* Generate the Message ID and set it */
- Message->Request.MessageId = LpcpNextMessageId++;
+ Message->Request.MessageId = LpcpNextMessageId++;
if (!LpcpNextMessageId) LpcpNextMessageId = 1;
Message->Request.CallbackId = 0;