Author: fireball
Date: Tue Jun 9 20:17:34 2009
New Revision: 41358
URL:
http://svn.reactos.org/svn/reactos?rev=41358&view=rev
Log:
- Implement a helper for updating IO transfer counters. Based on a patch by Dmitry
Chapyshev.
Modified:
trunk/reactos/ntoskrnl/include/internal/io_x.h
Modified: trunk/reactos/ntoskrnl/include/internal/io_x.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/io_x.h [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/include/internal/io_x.h [iso-8859-1] Tue Jun 9 20:17:34 2009
@@ -91,6 +91,44 @@
static
__inline
+VOID
+IopUpdateTransferCount(IN IOP_TRANSFER_TYPE Type, IN ULONG TransferCount)
+{
+ PLARGE_INTEGER CountToChange;
+ PLARGE_INTEGER TransferToChange;
+
+ /* Make sure I/O operations are being counted */
+ if (IoCountOperations)
+ {
+ if (Type == IopReadTransfer)
+ {
+ /* Increase read count */
+ CountToChange = &PsGetCurrentProcess()->ReadTransferCount;
+ TransferToChange = &IoReadTransferCount;
+ }
+ else if (Type == IopWriteTransfer)
+ {
+ /* Increase write count */
+ CountToChange = &PsGetCurrentProcess()->WriteTransferCount;
+ TransferToChange = &IoWriteTransferCount;
+ }
+ else
+ {
+ /* Increase other count */
+ CountToChange = &PsGetCurrentProcess()->OtherTransferCount;
+ TransferToChange = &IoOtherTransferCount;
+ }
+
+ /* Increase the process-wide count */
+ ExInterlockedAddLargeStatistic(CountToChange, TransferCount);
+
+ /* Increase global count */
+ ExInterlockedAddLargeStatistic(TransferToChange, TransferCount);
+ }
+}
+
+static
+__inline
BOOLEAN
IopValidateOpenPacket(IN POPEN_PACKET OpenPacket)
{