コード例 #1
0
ファイル: draid.c プロジェクト: JanD1943/ndas4windows
NTSTATUS 
DraidStartListenAddress(
	PDRAID_GLOBALS DraidGlobals,
	PDRAID_LISTEN_CONTEXT ListenContext
) {
	NTSTATUS status;
	KIRQL	oldIrql;

	KDPrintM(DBG_LURN_INFO, ("Starting to listen address %02x:%02x:%02x:%02x:%02x:%02x\n",
		ListenContext->Addr.Node[0], ListenContext->Addr.Node[1], ListenContext->Addr.Node[2],
		ListenContext->Addr.Node[3], ListenContext->Addr.Node[4], ListenContext->Addr.Node[5]
	));

	ACQUIRE_SPIN_LOCK(&DraidGlobals->ListenContextSpinlock, &oldIrql);
	ListenContext->Started = TRUE;
	RELEASE_SPIN_LOCK(&DraidGlobals->ListenContextSpinlock, oldIrql);

	//
	// Start listen.
	//

	// 1. Open address
	status = LpxTdiOpenAddress(
				&ListenContext->AddressFileHandle,
				&ListenContext->AddressFileObject,
				&ListenContext->Addr
			);

	if(!NT_SUCCESS(status)) 
	{
		goto errout;
	}

	
	// 2. Open connection
	status = DraidListenConnection(ListenContext);

	if(!NT_SUCCESS(status)) 
	{
		goto errout;
	}

	return status;
	
errout:

	if (ListenContext->AddressFileHandle && ListenContext->AddressFileObject) {
		LpxTdiCloseAddress(ListenContext->AddressFileHandle, ListenContext->AddressFileObject);
		ListenContext->AddressFileHandle = NULL;
		ListenContext->AddressFileObject = NULL;
	}
	ACQUIRE_SPIN_LOCK(&DraidGlobals->ListenContextSpinlock, &oldIrql);
	ListenContext->Started = FALSE;
	RELEASE_SPIN_LOCK(&DraidGlobals->ListenContextSpinlock, oldIrql);
	return status;
}
コード例 #2
0
ファイル: draid.c プロジェクト: JanD1943/ndas4windows
//
// Used when entering power down mode.
//
VOID
DraidFlushAll(
	VOID
) {
	KIRQL oldIrql;
	PLIST_ENTRY listEntry;
	PDRAID_CLIENT_INFO Client;
	PDRAID_GLOBALS DraidGlobals = g_DraidGlobals;
	if (!g_DraidGlobals)
		return;

	KDPrintM(DBG_LURN_INFO, ("DRAID flush all\n"));
	//
	// Flush request to all client 
	//
	ACQUIRE_SPIN_LOCK(&DraidGlobals->ClientListSpinlock, &oldIrql);
	for (listEntry = DraidGlobals->ClientList.Flink;
		listEntry != &DraidGlobals->ClientList;
		listEntry = listEntry->Flink) 
	{
		Client = CONTAINING_RECORD (listEntry, DRAID_CLIENT_INFO, AllClientList);
		DraidClientFlush(Client, NULL, NULL);
	}
	RELEASE_SPIN_LOCK(&DraidGlobals->ClientListSpinlock, oldIrql);

	// Send flush request to arbiter. (Not needed if multi-write is not used.)

}
コード例 #3
0
ファイル: bus.c プロジェクト: BillTheBest/WinNT4
BOOLEAN
ndisAddGlobalDb(
	IN	NDIS_INTERFACE_TYPE		BusType,
	IN	ULONG					BusId,
	IN	ULONG					BusNumber,
	IN	ULONG					SlotNumber
	)
{
	PBUS_SLOT_DB	pDb;
	KIRQL			OldIrql;
	BOOLEAN			rc = FALSE;

	pDb = ALLOC_FROM_POOL(sizeof(BUS_SLOT_DB), NDIS_TAG_DEFAULT);
	if (pDb != NULL)
	{
		pDb->BusType    = BusType;
		pDb->BusId      = BusId;
		pDb->BusNumber  = BusNumber;
		pDb->SlotNumber = SlotNumber;
		ACQUIRE_SPIN_LOCK(&ndisGlobalDbLock, &OldIrql);

		pDb->Next = ndisGlobalDb;
		ndisGlobalDb = pDb;

		RELEASE_SPIN_LOCK(&ndisGlobalDbLock, OldIrql);

		rc = TRUE;
	}

	return rc;
}
コード例 #4
0
ファイル: bus.c プロジェクト: BillTheBest/WinNT4
BOOLEAN
ndisSearchGlobalDb(
	IN	NDIS_INTERFACE_TYPE		BusType,
	IN	ULONG					BusId,
	IN	ULONG					BusNumber,
	IN	ULONG					SlotNumber
	)
{
	PBUS_SLOT_DB	pScan;
	KIRQL			OldIrql;
	BOOLEAN			rc = FALSE;

	ACQUIRE_SPIN_LOCK(&ndisGlobalDbLock, &OldIrql);

	for (pScan = ndisGlobalDb;
		 pScan != NULL;
		 pScan = pScan->Next)
	{
		if ((pScan->BusType == BusType)		&&
			(pScan->BusId == BusId)			&&
			(pScan->BusNumber == BusNumber)	&&
			(pScan->SlotNumber == SlotNumber))
		{
			rc = TRUE;
			break;
		}
	}

	RELEASE_SPIN_LOCK(&ndisGlobalDbLock, OldIrql);

	return rc;
}
コード例 #5
0
ファイル: bowutils.c プロジェクト: BillTheBest/WinNT4
VOID
BowserFreePool (
    IN PVOID P
    )
{
    PPOOL_HEADER header;
    KIRQL oldIrql;
    PPOOL_STATS stats;
    ULONG size;

    header = (PPOOL_HEADER)P - 1;

    size = header->NumberOfBytes;
    stats = header->Stats;

//    if ( allocationType > POOL_MAXTYPE ) allocationType = POOL_MAXTYPE;
//    DbgPrint( "BOWSER: freed type %d, size %d at %x\n", allocationType, size, header );

    ACQUIRE_SPIN_LOCK( &BowserTimeSpinLock, &oldIrql );

    CurrentAllocationCount--;
    CurrentAllocationSize -= size;
#if 1
    stats->Count--;
    stats->Size -= size;
#endif

    RELEASE_SPIN_LOCK( &BowserTimeSpinLock, oldIrql );

    ExFreePool( header );

    return;
}
コード例 #6
0
VOID
SrvCloseCachedDirectoryEntries(
    IN PCONNECTION Connection
)
/*++
Routine Description:

    This routine closes all the cached directory entries on the connection

Arguments:

    Connection - Pointer to the connection structure having the cache

++*/
{
    KIRQL oldIrql;
    PCACHED_DIRECTORY cd;

    ACQUIRE_SPIN_LOCK( &Connection->SpinLock, &oldIrql );

    while( Connection->CachedDirectoryCount > 0 ) {

        cd = CONTAINING_RECORD( Connection->CachedDirectoryList.Flink, CACHED_DIRECTORY, ListEntry );

        RemoveEntryList( &cd->ListEntry );

        Connection->CachedDirectoryCount--;

        DEALLOCATE_NONPAGED_POOL( cd );
    }

    RELEASE_SPIN_LOCK( &Connection->SpinLock, oldIrql );
}
コード例 #7
0
ファイル: GCUtils.c プロジェクト: ggreif/ghc
void
freeGroup_sync(bdescr *bd)
{
    ACQUIRE_SPIN_LOCK(&gc_alloc_block_sync);
    freeGroup(bd);
    RELEASE_SPIN_LOCK(&gc_alloc_block_sync);
}
コード例 #8
0
ファイル: Scav.c プロジェクト: bogiebro/ghc
static void
scavenge_large (gen_workspace *ws)
{
    bdescr *bd;
    StgPtr p;

    gct->evac_gen_no = ws->gen->no;

    bd = ws->todo_large_objects;
    
    for (; bd != NULL; bd = ws->todo_large_objects) {
	
	// take this object *off* the large objects list and put it on
	// the scavenged large objects list.  This is so that we can
	// treat new_large_objects as a stack and push new objects on
	// the front when evacuating.
	ws->todo_large_objects = bd->link;
	
        ACQUIRE_SPIN_LOCK(&ws->gen->sync);
	dbl_link_onto(bd, &ws->gen->scavenged_large_objects);
	ws->gen->n_scavenged_large_blocks += bd->blocks;
        RELEASE_SPIN_LOCK(&ws->gen->sync);
	
	p = bd->start;
	if (scavenge_one(p)) {
	    if (ws->gen->no > 0) {
		recordMutableGen_GC((StgClosure *)p, ws->gen->no);
	    }
	}

        // stats
        gct->scanned += closure_sizeW((StgClosure*)p);
    }
}
コード例 #9
0
ファイル: GCUtils.c プロジェクト: ggreif/ghc
void
freeChain_sync(bdescr *bd)
{
    ACQUIRE_SPIN_LOCK(&gc_alloc_block_sync);
    freeChain(bd);
    RELEASE_SPIN_LOCK(&gc_alloc_block_sync);
}
コード例 #10
0
ファイル: llcobj.c プロジェクト: BillTheBest/WinNT4
VOID
CompleteObjectDelete(
    IN PLLC_OBJECT pStation
    )

/*++

Routine Description:

    The function completes the delete operation for a llc object.

Arguments:

    pStation - link, sap or direct station handle

Return Value:

    None.

--*/

{
    PADAPTER_CONTEXT pAdapterContext = pStation->Gen.pAdapterContext;

    ACQUIRE_SPIN_LOCK(&pAdapterContext->SendSpinLock);

    if (pStation->Gen.ReferenceCount == 0) {
        CompletePendingLlcCommand(pStation);
        BackgroundProcessAndUnlock(pAdapterContext);
    } else {
        RELEASE_SPIN_LOCK(&pAdapterContext->SendSpinLock);
    }
}
コード例 #11
0
ファイル: draid.c プロジェクト: JanD1943/ndas4windows
VOID
DraidListnerDelAddress(
	PTDI_ADDRESS_LPX Addr
) {
	PDRAID_GLOBALS DraidGlobals;
	PLIST_ENTRY listEntry;
	KIRQL oldIrql;
	PDRAID_LISTEN_CONTEXT ListenContext;
	
	if (!g_DraidGlobals) {
		KDPrintM(DBG_LURN_INFO, ("DRAID is not running\n"));
		return;
	}

	DraidGlobals = g_DraidGlobals;
	
	// Find matching address and just mark active flag false because Wait event may be in use.	
	ACQUIRE_SPIN_LOCK(&DraidGlobals->ListenContextSpinlock, &oldIrql);
	for (listEntry = DraidGlobals->ListenContextList.Flink;
		listEntry != &DraidGlobals->ListenContextList;
		listEntry = listEntry->Flink) 
	{
		ListenContext = CONTAINING_RECORD (listEntry, DRAID_LISTEN_CONTEXT, Link);
		if (RtlCompareMemory(ListenContext->Addr.Node, 
			Addr->Node, 6) == 6) {
			KDPrintM(DBG_LURN_INFO, ("Found matching address\n"));
			ListenContext->Destroy = TRUE;
			KeSetEvent(&DraidGlobals->NetChangedEvent, IO_NO_INCREMENT, FALSE);
			break;
		}
	}
	RELEASE_SPIN_LOCK(&DraidGlobals->ListenContextSpinlock, oldIrql);
}
コード例 #12
0
ファイル: draid.c プロジェクト: JanD1943/ndas4windows
PDRAID_LISTEN_CONTEXT 
DraidCreateListenContext(
	PDRAID_GLOBALS DraidGlobals,
	PLPX_ADDRESS Addr
) {
	KIRQL	oldIrql;
	BOOLEAN AlreadyExist;
	PLIST_ENTRY listEntry;
	PDRAID_LISTEN_CONTEXT ListenContext;
		
	//
	// Check address is already in the listen context list
	//
	ACQUIRE_SPIN_LOCK(&DraidGlobals->ListenContextSpinlock, &oldIrql);
	AlreadyExist = FALSE;
	for (listEntry = DraidGlobals->ListenContextList.Flink;
		listEntry != &DraidGlobals->ListenContextList;
		listEntry = listEntry->Flink) 
	{
		ListenContext = CONTAINING_RECORD (listEntry, DRAID_LISTEN_CONTEXT, Link);
		if (!ListenContext->Destroy && RtlCompareMemory(ListenContext->Addr.Node, 
			Addr->Node, 6) == 6) {
			KDPrintM(DBG_LURN_INFO, ("New LPX address already exist.Ignoring.\n"));
			AlreadyExist = TRUE;
			break;
		}
	}
	RELEASE_SPIN_LOCK(&DraidGlobals->ListenContextSpinlock, oldIrql);
	if (AlreadyExist) {
		return NULL;
	}

	//
	// Alloc listen context
	//
	ListenContext = ExAllocatePoolWithTag(NonPagedPool, sizeof(DRAID_LISTEN_CONTEXT), 
		DRAID_LISTEN_CONTEXT_POOL_TAG);
	if (!ListenContext) {
		KDPrintM(DBG_LURN_INFO, ("Failed to alloc listen context\n"));
		return NULL;
	}
	RtlZeroMemory(ListenContext, sizeof(DRAID_LISTEN_CONTEXT));
	
	KeInitializeEvent(
			&ListenContext->TdiListenContext.CompletionEvent, 
			NotificationEvent, 
			FALSE
			);
	InitializeListHead(&ListenContext->Link);

	RtlCopyMemory(ListenContext->Addr.Node, Addr->Node, 6);
	ListenContext->Addr.Port = HTONS(DRIX_ARBITER_PORT_NUM_BASE);

	ExInterlockedInsertTailList(&DraidGlobals->ListenContextList, 
		&ListenContext->Link, 
		&DraidGlobals->ListenContextSpinlock
	);
	return ListenContext;
}
コード例 #13
0
ファイル: GCUtils.c プロジェクト: ggreif/ghc
bdescr* allocGroupOnNode_sync(uint32_t node, uint32_t n)
{
    bdescr *bd;
    ACQUIRE_SPIN_LOCK(&gc_alloc_block_sync);
    bd = allocGroupOnNode(node,n);
    RELEASE_SPIN_LOCK(&gc_alloc_block_sync);
    return bd;
}
コード例 #14
0
ファイル: GCUtils.c プロジェクト: ggreif/ghc
bdescr* allocGroup_sync(uint32_t n)
{
    bdescr *bd;
    uint32_t node = capNoToNumaNode(gct->thread_index);
    ACQUIRE_SPIN_LOCK(&gc_alloc_block_sync);
    bd = allocGroupOnNode(node,n);
    RELEASE_SPIN_LOCK(&gc_alloc_block_sync);
    return bd;
}
コード例 #15
0
ファイル: GCUtils.c プロジェクト: chansuke/ghc
bdescr *
allocBlock_sync(void)
{
    bdescr *bd;
    ACQUIRE_SPIN_LOCK(&gc_alloc_block_sync);
    bd = allocBlock();
    RELEASE_SPIN_LOCK(&gc_alloc_block_sync);
    return bd;
}
コード例 #16
0
ファイル: GCUtils.c プロジェクト: chansuke/ghc
static bdescr *
allocGroup_sync(nat n)
{
    bdescr *bd;
    ACQUIRE_SPIN_LOCK(&gc_alloc_block_sync);
    bd = allocGroup(n);
    RELEASE_SPIN_LOCK(&gc_alloc_block_sync);
    return bd;
}
コード例 #17
0
ファイル: draid.c プロジェクト: JanD1943/ndas4windows
NTSTATUS
DraidUnregisterArbiter(
	PDRAID_ARBITER_INFO Arbiter
) {
	KIRQL oldIrql;
	ASSERT(g_DraidGlobals);
	ACQUIRE_SPIN_LOCK(&g_DraidGlobals->ArbiterListSpinlock, &oldIrql);
	RemoveEntryList(&Arbiter->AllArbiterList);
	RELEASE_SPIN_LOCK(&g_DraidGlobals->ArbiterListSpinlock, oldIrql);
	return STATUS_SUCCESS;	
}
コード例 #18
0
ファイル: draid.c プロジェクト: JanD1943/ndas4windows
NTSTATUS
DraidUnregisterClient(
	PDRAID_CLIENT_INFO Client
) {
	KIRQL oldIrql;
	ASSERT(g_DraidGlobals);
	ACQUIRE_SPIN_LOCK(&g_DraidGlobals->ClientListSpinlock, &oldIrql);
	RemoveEntryList(&Client->AllClientList);
	RELEASE_SPIN_LOCK(&g_DraidGlobals->ClientListSpinlock, oldIrql);
	return STATUS_SUCCESS;	
}
コード例 #19
0
ファイル: lsutils.c プロジェクト: tigtigtig/ndas4windows
VOID
LsuDecrementTdiClientDevice() {
	KIRQL	oldIrql;

	ACQUIRE_SPIN_LOCK(&TDICLIENT_CONTEXT.TdiPnPSpinLock, &oldIrql);

	TDICLIENT_CONTEXT.ClientDeviceCount--;
	ASSERT(TDICLIENT_CONTEXT.ClientDeviceCount >= 0);

	RELEASE_SPIN_LOCK(&TDICLIENT_CONTEXT.TdiPnPSpinLock, oldIrql);
}
コード例 #20
0
ファイル: lsutils.c プロジェクト: tigtigtig/ndas4windows
VOID
LsuIncrementTdiClientInProgress() {
	KIRQL	oldIrql;

	ACQUIRE_SPIN_LOCK(&TDICLIENT_CONTEXT.TdiPnPSpinLock, &oldIrql);

	ASSERT(TDICLIENT_CONTEXT.ClientInProgressIOCount >= 0);
	TDICLIENT_CONTEXT.ClientInProgressIOCount++;

	RELEASE_SPIN_LOCK(&TDICLIENT_CONTEXT.TdiPnPSpinLock, oldIrql);

}
コード例 #21
0
VOID
LsuIncrementTdiClientInProgress() {
	KIRQL	oldIrql;

	ACQUIRE_SPIN_LOCK(&TdiPnPSpinLock, &oldIrql);

	ASSERT(ClientInProgress >= 0);
	ClientInProgress++;

	RELEASE_SPIN_LOCK(&TdiPnPSpinLock, oldIrql);

}
コード例 #22
0
ファイル: lsutils.c プロジェクト: tigtigtig/ndas4windows
VOID
LsuDecrementTdiClientInProgress() {
	KIRQL	oldIrql;

	ACQUIRE_SPIN_LOCK(&TDICLIENT_CONTEXT.TdiPnPSpinLock, &oldIrql);

	TDICLIENT_CONTEXT.ClientInProgressIOCount--;
	ASSERT(TDICLIENT_CONTEXT.ClientInProgressIOCount >= 0);

	LsuCurrentTime(&TDICLIENT_CONTEXT.LastOperationTime);

	RELEASE_SPIN_LOCK(&TDICLIENT_CONTEXT.TdiPnPSpinLock, oldIrql);
}
コード例 #23
0
VOID
LsuDecrementTdiClientInProgress() {
	KIRQL	oldIrql;

	ACQUIRE_SPIN_LOCK(&TdiPnPSpinLock, &oldIrql);

	ClientInProgress--;
	ASSERT(ClientInProgress >= 0);

	LsuCurrentTime(&LastOperationTime);

	RELEASE_SPIN_LOCK(&TdiPnPSpinLock, oldIrql);
}
コード例 #24
0
ファイル: backpack.c プロジェクト: Gaikokujin/WinNT4
BOOLEAN
RdrBackOff (
    IN PBACK_PACK pBP
    )
/*++

Routine Description:

    This routine is called each time a request is made to find out if a the
    request should be sent to the network or a standard reply should be
    returned to the caller.

Arguments:

    pBP   -  supplies back pack data for this request.

Return Value:

    TRUE when caller should not access the network.


--*/

{
    LARGE_INTEGER CurrentTime;
    KIRQL OldIrql;

    DISCARDABLE_CODE(RdrFileDiscardableSection);

    //  If the previous request worked then we should access the network.

    if ( pBP->CurrentIncrement == 0 ) {
        return FALSE;
    }

    //  If the delay has expired then access the network.

    KeQuerySystemTime(&CurrentTime);

    ACQUIRE_SPIN_LOCK(&BackPackSpinLock, &OldIrql);

    if (CurrentTime.QuadPart < pBP->NextTime.QuadPart) {
        RELEASE_SPIN_LOCK(&BackPackSpinLock, OldIrql);
        return TRUE;        //  Not time to access the network yet.
    } else {
        RELEASE_SPIN_LOCK(&BackPackSpinLock, OldIrql);
        return FALSE;
    }
}
コード例 #25
0
ファイル: afilter.c プロジェクト: BillTheBest/WinNT4
VOID
ArcReferencePackage(VOID)
{
    ACQUIRE_SPIN_LOCK(&ArcReferenceLock);

    ArcReferenceCount++;

    if (ArcReferenceCount == 1) {

        KeResetEvent(
            &ArcPagedInEvent
            );

        RELEASE_SPIN_LOCK(&ArcReferenceLock);

        //
        //  Page in all the functions
        //
        ArcImageHandle = MmLockPagableCodeSection(ArcCreateFilter);

        //
        // Signal to everyone to go
        //
        KeSetEvent(
            &ArcPagedInEvent,
            0L,
            FALSE
            );

    } else {

        RELEASE_SPIN_LOCK(&ArcReferenceLock);

        //
        // Wait for everything to be paged in
        //
        KeWaitForSingleObject(
                        &ArcPagedInEvent,
                        Executive,
                        KernelMode,
                        TRUE,
                        NULL
                        );

    }

}
コード例 #26
0
ファイル: backpack.c プロジェクト: Gaikokujin/WinNT4
VOID
RdrBackPackFailure (
    IN PBACK_PACK pBP
    )
/*++

Routine Description:

    This routine is called each time a request fails.

Arguments:

    pBP   -  supplies back pack data for this request.

Return Value:

    None.

--*/

{
    LARGE_INTEGER CurrentTime;
    KIRQL OldIrql;

    DISCARDABLE_CODE(RdrFileDiscardableSection);

    KeQuerySystemTime(&CurrentTime);

    ACQUIRE_SPIN_LOCK(&BackPackSpinLock, &OldIrql);

    if (pBP->CurrentIncrement < pBP->MaximumDelay ) {

        //
        //  We have reached NextTime but not our maximum delay limit.
        //

        pBP->CurrentIncrement++;
    }

    //  NextTime = CurrentTime + (Interval * CurrentIncrement )

    pBP->NextTime.QuadPart = CurrentTime.QuadPart + (pBP->Increment.QuadPart * pBP->CurrentIncrement);

    RELEASE_SPIN_LOCK(&BackPackSpinLock, OldIrql);

}
コード例 #27
0
ファイル: LpxPacket.c プロジェクト: yzx65/ndas4windows
BOOLEAN
PacketQueueEmpty(
    PLIST_ENTRY	PacketQueue,
    PKSPIN_LOCK	QSpinLock
)
{
    PLIST_ENTRY		packetListEntry;
    KIRQL			oldIrql;

    if(QSpinLock) {
        ACQUIRE_SPIN_LOCK(QSpinLock, &oldIrql);
        packetListEntry = PacketQueue->Flink;
        RELEASE_SPIN_LOCK(QSpinLock, oldIrql);
    } else
        packetListEntry = PacketQueue->Flink;

    return (packetListEntry == PacketQueue);
}
コード例 #28
0
ファイル: GCUtils.c プロジェクト: chansuke/ghc
static void
allocBlocks_sync(nat n, bdescr **hd, bdescr **tl, 
                 nat gen_no, step *stp,
                 StgWord32 flags)
{
    bdescr *bd;
    nat i;
    ACQUIRE_SPIN_LOCK(&gc_alloc_block_sync);
    bd = allocGroup(n);
    for (i = 0; i < n; i++) {
        bd[i].blocks = 1;
        bd[i].gen_no = gen_no;
        bd[i].step = stp;
        bd[i].flags = flags;
        bd[i].link = &bd[i+1];
        bd[i].u.scan = bd[i].free = bd[i].start;
    }
    *hd = bd;
    *tl = &bd[n-1];
    RELEASE_SPIN_LOCK(&gc_alloc_block_sync);
}
コード例 #29
0
ファイル: blkendp.c プロジェクト: Gaikokujin/WinNT4
PCONNECTION
WalkConnectionTable (
    IN PENDPOINT Endpoint,
    IN OUT PCSHORT Index
    )
{
    CSHORT i;
    PTABLE_HEADER tableHeader;
    PCONNECTION connection;
    KIRQL oldIrql;

    ACQUIRE_SPIN_LOCK( &ENDPOINT_SPIN_LOCK(0), &oldIrql );
    for ( i = 1; i < ENDPOINT_LOCK_COUNT ; i++ ) {
        ACQUIRE_DPC_SPIN_LOCK( &ENDPOINT_SPIN_LOCK(i) );
    }

    tableHeader = &Endpoint->ConnectionTable;

    for ( i = *Index + 1; i < tableHeader->TableSize; i++ ) {

        connection = (PCONNECTION)tableHeader->Table[i].Owner;
        if ( (connection != NULL) &&
             (GET_BLOCK_STATE(connection) == BlockStateActive) ) {
            *Index = i;
            SrvReferenceConnectionLocked( connection );
            goto exit;
        }
    }
    connection = NULL;

exit:

    for ( i = ENDPOINT_LOCK_COUNT-1 ; i > 0  ; i-- ) {
        RELEASE_DPC_SPIN_LOCK( &ENDPOINT_SPIN_LOCK(i) );
    }
    RELEASE_SPIN_LOCK( &ENDPOINT_SPIN_LOCK(0), oldIrql );

    return connection;
} // WalkConnectionTable
コード例 #30
0
ファイル: llctrace.c プロジェクト: BillTheBest/WinNT4
VOID
LlcTraceWrite( 
    IN UINT Event, 
    IN UCHAR AdapterNumber,
    IN UINT DataBufferSize,
    IN PVOID pDataBuffer
    )
{

//if ((AdapterNumber & 0x7f) != 0)
//    return;

    if (TraceEnabled)
    {
        ACQUIRE_SPIN_LOCK( &TraceLock );
        if ((ULONG)(&pTraceBufferHead[1]) >= (ULONG)pTraceBufferTop)
        {
            pTraceBufferHead = (PLLC_TRACE_HEADER)pTraceBufferBase;
        }
        pTraceBufferHead->Event = (USHORT)Event;
        pTraceBufferHead->AdapterNumber = AdapterNumber;
        pTraceBufferHead->TimerTick = AbsoluteTime;
        pTraceBufferHead->DataLength = (UCHAR)
#ifdef min 
            min( TRACE_DATA_LENGTH, DataBufferSize );
#else
            __min( TRACE_DATA_LENGTH, DataBufferSize );
#endif
        memcpy( 
            pTraceBufferHead->Buffer,
            pDataBuffer,
            pTraceBufferHead->DataLength
            );
        pTraceBufferHead++;
        pTraceBufferHead->Event = LLC_TRACE_END_OF_DATA;
        RELEASE_SPIN_LOCK( &TraceLock );
    }
}