mirror of
https://github.com/reactos/reactos.git
synced 2025-01-06 06:20:13 +00:00
Convert NdisQueryPacket to an inline function (The DDK also defines it as an inline function). Should fix some warnings with GCC4.2
svn path=/trunk/; revision=25563
This commit is contained in:
parent
603823ffb8
commit
a8897783d7
2 changed files with 47 additions and 43 deletions
|
@ -155,7 +155,7 @@ typedef struct _NIC_ADAPTER
|
|||
UINT TXFree; /* Number of free transmit buffers */
|
||||
UINT TXNext; /* Next buffer to use */
|
||||
/* Length of packet. 0 means buffer is unused */
|
||||
INT TXSize[DRIVER_DEFAULT_TX_BUFFER_COUNT];
|
||||
UINT TXSize[DRIVER_DEFAULT_TX_BUFFER_COUNT];
|
||||
INT TXCurrent; /* Current buffer beeing transmitted. -1 means none */
|
||||
|
||||
/* Head of transmit queue */
|
||||
|
|
|
@ -2022,48 +2022,52 @@ NdisQueryBufferOffset(
|
|||
* OUT PNDIS_BUFFER *FirstBuffer OPTIONAL,
|
||||
* OUT PUINT TotalPacketLength OPTIONAL);
|
||||
*/
|
||||
#define NdisQueryPacket(Packet, \
|
||||
PhysicalBufferCount, \
|
||||
BufferCount, \
|
||||
FirstBuffer, \
|
||||
TotalPacketLength) \
|
||||
{ \
|
||||
if (FirstBuffer) \
|
||||
*((PNDIS_BUFFER*)FirstBuffer) = (Packet)->Private.Head; \
|
||||
if ((TotalPacketLength) || (BufferCount) || (PhysicalBufferCount)) \
|
||||
{ \
|
||||
if (!(Packet)->Private.ValidCounts) { \
|
||||
UINT _Offset; \
|
||||
UINT _PacketLength; \
|
||||
PNDIS_BUFFER _NdisBuffer; \
|
||||
UINT _PhysicalBufferCount = 0; \
|
||||
UINT _TotalPacketLength = 0; \
|
||||
UINT _Count = 0; \
|
||||
\
|
||||
for (_NdisBuffer = (Packet)->Private.Head; \
|
||||
_NdisBuffer != (PNDIS_BUFFER)NULL; \
|
||||
_NdisBuffer = _NdisBuffer->Next) \
|
||||
{ \
|
||||
_PhysicalBufferCount += NDIS_BUFFER_TO_SPAN_PAGES(_NdisBuffer); \
|
||||
NdisQueryBufferOffset(_NdisBuffer, &_Offset, &_PacketLength); \
|
||||
_TotalPacketLength += _PacketLength; \
|
||||
_Count++; \
|
||||
} \
|
||||
(Packet)->Private.PhysicalCount = _PhysicalBufferCount; \
|
||||
(Packet)->Private.TotalLength = _TotalPacketLength; \
|
||||
(Packet)->Private.Count = _Count; \
|
||||
(Packet)->Private.ValidCounts = TRUE; \
|
||||
} \
|
||||
\
|
||||
if (PhysicalBufferCount) \
|
||||
*((PUINT)PhysicalBufferCount) = (Packet)->Private.PhysicalCount; \
|
||||
\
|
||||
if (BufferCount) \
|
||||
*((PUINT)BufferCount) = (Packet)->Private.Count; \
|
||||
\
|
||||
if (TotalPacketLength) \
|
||||
*((PUINT)TotalPacketLength) = (Packet)->Private.TotalLength; \
|
||||
} \
|
||||
static __inline
|
||||
VOID
|
||||
NdisQueryPacket(
|
||||
IN PNDIS_PACKET Packet,
|
||||
OUT PUINT PhysicalBufferCount OPTIONAL,
|
||||
OUT PUINT BufferCount OPTIONAL,
|
||||
OUT PNDIS_BUFFER *FirstBuffer OPTIONAL,
|
||||
OUT PUINT TotalPacketLength OPTIONAL)
|
||||
{
|
||||
if (FirstBuffer)
|
||||
*((PNDIS_BUFFER*)FirstBuffer) = Packet->Private.Head;
|
||||
if (TotalPacketLength || BufferCount || PhysicalBufferCount)
|
||||
{
|
||||
if (!Packet->Private.ValidCounts)
|
||||
{
|
||||
UINT Offset;
|
||||
UINT PacketLength;
|
||||
PNDIS_BUFFER NdisBuffer;
|
||||
UINT PhysicalBufferCount = 0;
|
||||
UINT TotalPacketLength = 0;
|
||||
UINT Count = 0;
|
||||
|
||||
for (NdisBuffer = Packet->Private.Head;
|
||||
NdisBuffer != (PNDIS_BUFFER)NULL;
|
||||
NdisBuffer = NdisBuffer->Next)
|
||||
{
|
||||
PhysicalBufferCount += NDIS_BUFFER_TO_SPAN_PAGES(NdisBuffer);
|
||||
NdisQueryBufferOffset(NdisBuffer, &Offset, &PacketLength);
|
||||
TotalPacketLength += PacketLength;
|
||||
Count++;
|
||||
}
|
||||
Packet->Private.PhysicalCount = PhysicalBufferCount;
|
||||
Packet->Private.TotalLength = TotalPacketLength;
|
||||
Packet->Private.Count = Count;
|
||||
Packet->Private.ValidCounts = TRUE;
|
||||
}
|
||||
|
||||
if (PhysicalBufferCount)
|
||||
*((PUINT)PhysicalBufferCount) = Packet->Private.PhysicalCount;
|
||||
|
||||
if (BufferCount)
|
||||
*((PUINT)BufferCount) = Packet->Private.Count;
|
||||
|
||||
if (TotalPacketLength)
|
||||
*((PUINT)TotalPacketLength) = Packet->Private.TotalLength;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in a new issue