* GPL HEADER END
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved
+ * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*/
/*
{
ULONG i;
for (i=0; i < length; i++) {
- if (((i+1) % 31) == 0)
+ if (((i+1) % 31) == 0)
printk("\n");
printk("%2.2x ", (UCHAR)buffer[i]);
}
{
PKS_TSDU KsTsdu = NULL;
- spin_lock(&(ks_data.ksnd_tsdu_lock));
+ cfs_spin_lock(&(ks_data.ksnd_tsdu_lock));
- if (!list_empty (&(ks_data.ksnd_freetsdus))) {
+ if (!cfs_list_empty (&(ks_data.ksnd_freetsdus))) {
LASSERT(ks_data.ksnd_nfreetsdus > 0);
- KsTsdu = list_entry(ks_data.ksnd_freetsdus.next, KS_TSDU, Link);
- list_del(&(KsTsdu->Link));
+ KsTsdu = cfs_list_entry(ks_data.ksnd_freetsdus.next, KS_TSDU, Link);
+ cfs_list_del(&(KsTsdu->Link));
ks_data.ksnd_nfreetsdus--;
} else {
ks_data.ksnd_tsdu_slab, 0);
}
- spin_unlock(&(ks_data.ksnd_tsdu_lock));
+ cfs_spin_unlock(&(ks_data.ksnd_tsdu_lock));
if (NULL != KsTsdu) {
RtlZeroMemory(KsTsdu, ks_data.ksnd_tsdu_size);
PKS_TSDU KsTsdu
)
{
- spin_lock(&(ks_data.ksnd_tsdu_lock));
+ cfs_spin_lock(&(ks_data.ksnd_tsdu_lock));
if (ks_data.ksnd_nfreetsdus > 128) {
KsFreeKsTsdu(KsTsdu);
} else {
- list_add_tail( &(KsTsdu->Link), &(ks_data.ksnd_freetsdus));
+ cfs_list_add_tail( &(KsTsdu->Link), &(ks_data.ksnd_freetsdus));
ks_data.ksnd_nfreetsdus++;
}
- spin_unlock(&(ks_data.ksnd_tsdu_lock));
+ cfs_spin_unlock(&(ks_data.ksnd_tsdu_lock));
}
/* with tconn lock acquired */
LASSERT(TsduMgr->TotalBytes >= length);
- while (!list_empty(&TsduMgr->TsduList)) {
+ while (!cfs_list_empty(&TsduMgr->TsduList)) {
ULONG start = 0;
- KsTsdu = list_entry(TsduMgr->TsduList.next, KS_TSDU, Link);
+ KsTsdu = cfs_list_entry(TsduMgr->TsduList.next, KS_TSDU, Link);
LASSERT(KsTsdu->Magic == KS_TSDU_MAGIC);
start = KsTsdu->StartOffset;
if (KsTsdu->StartOffset >= KsTsdu->LastOffset) {
/* remove KsTsdu from list */
- list_del(&KsTsdu->Link);
+ cfs_list_del(&KsTsdu->Link);
TsduMgr->NumOfTsdu--;
KsPutKsTsdu(KsTsdu);
}
/* retrieve the latest Tsdu buffer form TsduMgr
list if the list is not empty. */
- if (list_empty(&(TsduMgr->TsduList))) {
+ if (cfs_list_empty(&(TsduMgr->TsduList))) {
LASSERT(TsduMgr->NumOfTsdu == 0);
KsTsdu = NULL;
} else {
LASSERT(TsduMgr->NumOfTsdu > 0);
- KsTsdu = list_entry(TsduMgr->TsduList.prev, KS_TSDU, Link);
+ KsTsdu = cfs_list_entry(TsduMgr->TsduList.prev, KS_TSDU, Link);
/* if this Tsdu does not contain enough space, we need
allocate a new Tsdu queue. */
if (NULL == KsTsdu) {
KsTsdu = KsAllocateKsTsdu();
if (NULL != KsTsdu) {
- list_add_tail(&(KsTsdu->Link), &(TsduMgr->TsduList));
+ cfs_list_add_tail(&(KsTsdu->Link), &(TsduMgr->TsduList));
TsduMgr->NumOfTsdu++;
}
}
} else {
- KsTsdu = list_entry(TsduMgr->TsduList.next, KS_TSDU, Link);
+ KsTsdu = cfs_list_entry(TsduMgr->TsduList.next, KS_TSDU, Link);
LASSERT(KsTsdu->Magic == KS_TSDU_MAGIC);
/* remove the KsTsdu from TsduMgr list to release the lock */
- list_del(&(KsTsdu->Link));
+ cfs_list_del(&(KsTsdu->Link));
TsduMgr->NumOfTsdu--;
while (length > BytesRecved) {
KsTsdu = NULL;
} else {
TsduMgr->NumOfTsdu++;
- list_add(&(KsTsdu->Link), &(TsduMgr->TsduList));
+ cfs_list_add(&(KsTsdu->Link), &(TsduMgr->TsduList));
}
}
TsduMgr->NumOfTsdu = 0;
TsduMgr->TotalBytes = 0;
- spin_lock_init(&TsduMgr->Lock);
+ cfs_spin_lock_init(&TsduMgr->Lock);
}
KsRemoveTdiEngine(TsduMgr);
KeSetEvent(&(TsduMgr->Event), 0, FALSE);
- while (!list_empty(&TsduMgr->TsduList)) {
+ while (!cfs_list_empty(&TsduMgr->TsduList)) {
- KsTsdu = list_entry(TsduMgr->TsduList.next, KS_TSDU, Link);
+ KsTsdu = cfs_list_entry(TsduMgr->TsduList.next, KS_TSDU, Link);
LASSERT(KsTsdu->Magic == KS_TSDU_MAGIC);
if (KsTsdu->StartOffset == KsTsdu->LastOffset) {
// KsTsdu is empty now, we need free it ...
//
- list_del(&(KsTsdu->Link));
+ cfs_list_del(&(KsTsdu->Link));
TsduMgr->NumOfTsdu--;
KsFreeKsTsdu(KsTsdu);
LASSERT(child->kstc_type == kstt_child);
- spin_lock(&(child->kstc_lock));
+ cfs_spin_lock(&(child->kstc_lock));
LASSERT(parent->kstc_state == ksts_listening);
LASSERT(child->kstc_state == ksts_connecting);
FALSE
);
- spin_unlock(&(child->kstc_lock));
+ cfs_spin_unlock(&(child->kstc_lock));
KsPrint((2, "KsAcceptCompletionRoutine: singal parent: %p (child: %p)\n",
parent, child));
child->child.kstc_busy = FALSE;
child->kstc_state = ksts_associated;
- spin_unlock(&(child->kstc_lock));
+ cfs_spin_unlock(&(child->kstc_lock));
}
/* now free the Irp */
ks_addr_slot_t * slot = NULL;
PLIST_ENTRY list = NULL;
- spin_lock(&ks_data.ksnd_addrs_lock);
+ cfs_spin_lock(&ks_data.ksnd_addrs_lock);
list = ks_data.ksnd_addrs_list.Flink;
while (list != &ks_data.ksnd_addrs_list) {
slot = NULL;
}
- spin_unlock(&ks_data.ksnd_addrs_lock);
+ cfs_spin_unlock(&ks_data.ksnd_addrs_lock);
return slot;
}
void
KsCleanupIpAddresses()
{
- spin_lock(&ks_data.ksnd_addrs_lock);
+ cfs_spin_lock(&ks_data.ksnd_addrs_lock);
while (!IsListEmpty(&ks_data.ksnd_addrs_list)) {
}
cfs_assert(ks_data.ksnd_naddrs == 0);
- spin_unlock(&ks_data.ksnd_addrs_lock);
+ cfs_spin_unlock(&ks_data.ksnd_addrs_lock);
}
VOID
slot = cfs_alloc(sizeof(ks_addr_slot_t) + DeviceName->Length, CFS_ALLOC_ZERO);
if (slot != NULL) {
- spin_lock(&ks_data.ksnd_addrs_lock);
+ cfs_spin_lock(&ks_data.ksnd_addrs_lock);
InsertTailList(&ks_data.ksnd_addrs_list, &slot->link);
sprintf(slot->iface, "eth%d", ks_data.ksnd_naddrs++);
slot->ip_addr = ntohl(IpAddress->in_addr);
slot->devname.Length = DeviceName->Length;
slot->devname.MaximumLength = DeviceName->Length + sizeof(WCHAR);
slot->devname.Buffer = slot->buffer;
- spin_unlock(&ks_data.ksnd_addrs_lock);
+ cfs_spin_unlock(&ks_data.ksnd_addrs_lock);
KsPrint((0, "KsAddAddressHandle: %s added: ip=%xh(%d.%d.%d.%d)\n",
slot->iface, IpAddress->in_addr,
/* initialize the global ks_data members */
RtlInitUnicodeString(&ks_data.ksnd_client_name, TDILND_MODULE_NAME);
- spin_lock_init(&ks_data.ksnd_addrs_lock);
+ cfs_spin_lock_init(&ks_data.ksnd_addrs_lock);
InitializeListHead(&ks_data.ksnd_addrs_list);
/* register the pnp handlers */
LASSERT(parent->kstc_type == kstt_listener);
LASSERT(parent->kstc_state == ksts_listening);
- if (list_empty(&(parent->listener.kstc_listening.list))) {
+ if (cfs_list_empty(&(parent->listener.kstc_listening.list))) {
child = NULL;
} else {
- struct list_head * tmp;
+ cfs_list_t * tmp;
/* check the listening queue and try to get a free connecton */
- list_for_each(tmp, &(parent->listener.kstc_listening.list)) {
- child = list_entry (tmp, ks_tconn_t, child.kstc_link);
- spin_lock(&(child->kstc_lock));
+ cfs_list_for_each(tmp, &(parent->listener.kstc_listening.list)) {
+ child = cfs_list_entry (tmp, ks_tconn_t, child.kstc_link);
+ cfs_spin_lock(&(child->kstc_lock));
if (!child->child.kstc_busy) {
LASSERT(child->kstc_state == ksts_associated);
child->child.kstc_busy = TRUE;
- spin_unlock(&(child->kstc_lock));
+ cfs_spin_unlock(&(child->kstc_lock));
break;
} else {
- spin_unlock(&(child->kstc_lock));
+ cfs_spin_unlock(&(child->kstc_lock));
child = NULL;
}
}
LASSERT(parent->kstc_type == kstt_listener);
- spin_lock(&(parent->kstc_lock));
+ cfs_spin_lock(&(parent->kstc_lock));
if (parent->kstc_state == ksts_listening) {
if (child) {
- spin_lock(&(child->kstc_lock));
+ cfs_spin_lock(&(child->kstc_lock));
child->child.kstc_info.ConnectionInfo = ConnectionInfo;
child->child.kstc_info.Remote = ConnectionInfo->RemoteAddress;
child->kstc_state = ksts_connecting;
- spin_unlock(&(child->kstc_lock));
+ cfs_spin_unlock(&(child->kstc_lock));
} else {
goto errorout;
}
- spin_unlock(&(parent->kstc_lock));
+ cfs_spin_unlock(&(parent->kstc_lock));
return Status;
errorout:
- spin_unlock(&(parent->kstc_lock));
+ cfs_spin_unlock(&(parent->kstc_lock));
*AcceptIrp = NULL;
*ConnectionContext = NULL;
KeSetEvent(&(WorkItem->Event), 0, FALSE);
- spin_lock(&(tconn->kstc_lock));
+ cfs_spin_lock(&(tconn->kstc_lock));
cfs_clear_flag(tconn->kstc_flags, KS_TCONN_DISCONNECT_BUSY);
- spin_unlock(&(tconn->kstc_lock));
+ cfs_spin_unlock(&(tconn->kstc_lock));
ks_put_tconn(tconn);
}
tconn, DisconnectFlags));
ks_get_tconn(tconn);
- spin_lock(&(tconn->kstc_lock));
+ cfs_spin_lock(&(tconn->kstc_lock));
WorkItem = &(tconn->kstc_disconnect);
}
}
- spin_unlock(&(tconn->kstc_lock));
+ cfs_spin_unlock(&(tconn->kstc_lock));
ks_put_tconn(tconn);
return (Status);
tconn
);
- spin_lock_init(&(tconn->kstc_lock));
+ cfs_spin_lock_init(&(tconn->kstc_lock));
ks_get_tconn(tconn);
- spin_lock(&(ks_data.ksnd_tconn_lock));
+ cfs_spin_lock(&(ks_data.ksnd_tconn_lock));
/* attach it into global list in ks_data */
- list_add(&(tconn->kstc_list), &(ks_data.ksnd_tconns));
+ cfs_list_add(&(tconn->kstc_list), &(ks_data.ksnd_tconns));
ks_data.ksnd_ntconns++;
- spin_unlock(&(ks_data.ksnd_tconn_lock));
+ cfs_spin_unlock(&(ks_data.ksnd_tconn_lock));
tconn->kstc_rcv_wnd = tconn->kstc_snd_wnd = 0x10000;
}
void
ks_free_tconn(ks_tconn_t * tconn)
{
- LASSERT(atomic_read(&(tconn->kstc_refcount)) == 0);
+ LASSERT(cfs_atomic_read(&(tconn->kstc_refcount)) == 0);
- spin_lock(&(ks_data.ksnd_tconn_lock));
+ cfs_spin_lock(&(ks_data.ksnd_tconn_lock));
/* remove it from the global list */
- list_del(&tconn->kstc_list);
+ cfs_list_del(&tconn->kstc_list);
ks_data.ksnd_ntconns--;
/* if this is the last tconn, it would be safe for
if (ks_data.ksnd_ntconns == 0) {
cfs_wake_event(&ks_data.ksnd_tconn_exit);
}
- spin_unlock(&(ks_data.ksnd_tconn_lock));
+ cfs_spin_unlock(&(ks_data.ksnd_tconn_lock));
/* free the structure memory */
cfs_mem_cache_free(ks_data.ksnd_tconn_slab, tconn);
ks_tconn_t * tconn
)
{
- atomic_inc(&(tconn->kstc_refcount));
+ cfs_atomic_inc(&(tconn->kstc_refcount));
}
/*
ks_tconn_t *tconn
)
{
- if (atomic_dec_and_test(&(tconn->kstc_refcount))) {
+ if (cfs_atomic_dec_and_test(&(tconn->kstc_refcount))) {
- spin_lock(&(tconn->kstc_lock));
+ cfs_spin_lock(&(tconn->kstc_lock));
if ( ( tconn->kstc_type == kstt_child ||
tconn->kstc_type == kstt_sender ) &&
( tconn->kstc_state == ksts_connected ) ) {
- spin_unlock(&(tconn->kstc_lock));
+ cfs_spin_unlock(&(tconn->kstc_lock));
ks_abort_tconn(tconn);
cfs_set_flag(tconn->kstc_flags, KS_TCONN_DESTROY_BUSY);
}
- spin_unlock(&(tconn->kstc_lock));
+ cfs_spin_unlock(&(tconn->kstc_lock));
}
}
}
tconn->kstc_addr.FileObject
);
- spin_lock(&tconn->child.kstc_parent->kstc_lock);
- spin_lock(&tconn->kstc_lock);
+ cfs_spin_lock(&tconn->child.kstc_parent->kstc_lock);
+ cfs_spin_lock(&tconn->kstc_lock);
tconn->kstc_state = ksts_inited;
if (tconn->child.kstc_queued) {
- list_del(&(tconn->child.kstc_link));
+ cfs_list_del(&(tconn->child.kstc_link));
if (tconn->child.kstc_queueno) {
tconn->child.kstc_queued = FALSE;
}
- spin_unlock(&tconn->kstc_lock);
- spin_unlock(&tconn->child.kstc_parent->kstc_lock);
+ cfs_spin_unlock(&tconn->kstc_lock);
+ cfs_spin_unlock(&tconn->child.kstc_parent->kstc_lock);
/* drop the reference of the parent tconn */
ks_put_tconn(tconn->child.kstc_parent);
NULL
);
- spin_lock(&(tconn->kstc_lock));
+ cfs_spin_lock(&(tconn->kstc_lock));
if (NT_SUCCESS(status)) {
tconn->sender.kstc_info.ConnectionInfo = ConnectionInfo;
tconn->sender.kstc_info.Remote = ConnectionInfo->RemoteAddress;
- spin_unlock(&(tconn->kstc_lock));
+ cfs_spin_unlock(&(tconn->kstc_lock));
} else {
rc = cfs_error_code(status);
tconn->kstc_state = ksts_associated;
- spin_unlock(&(tconn->kstc_lock));
+ cfs_spin_unlock(&(tconn->kstc_lock));
/* disassocidate the connection and the address object,
after cleanup, it's safe to set the state to abort ... */
cfs_enter_debugger();
}
- spin_lock(&(tconn->kstc_lock));
+ cfs_spin_lock(&(tconn->kstc_lock));
/* cleanup the tsdumgr Lists */
KsCleanupTsdu (tconn);
info->ConnectionInfo = NULL;
info->Remote = NULL;
- spin_unlock(&(tconn->kstc_lock));
+ cfs_spin_unlock(&(tconn->kstc_lock));
}
status = STATUS_SUCCESS;
WorkItem = &(tconn->kstc_disconnect);
ks_get_tconn(tconn);
- spin_lock(&(tconn->kstc_lock));
+ cfs_spin_lock(&(tconn->kstc_lock));
if (tconn->kstc_state != ksts_connected) {
ks_put_tconn(tconn);
}
}
- spin_unlock(&(tconn->kstc_lock));
+ cfs_spin_unlock(&(tconn->kstc_lock));
}
engs = &TsduMgr->Slot;
if (!engs->queued) {
- spin_lock(&engm->lock);
+ cfs_spin_lock(&engm->lock);
if (!engs->queued) {
- list_add_tail(&engs->link, &engm->list);
+ cfs_list_add_tail(&engs->link, &engm->list);
engs->queued = TRUE;
engs->tconn = tconn;
engs->emgr = engm;
engs->tsdumgr = TsduMgr;
KeSetEvent(&(engm->start),0, FALSE);
}
- spin_unlock(&engm->lock);
+ cfs_spin_unlock(&engm->lock);
KsPrint((4, "KsQueueTdiEngine: TsduMgr=%p is queued to engine %p\n",
TsduMgr, engm));
}
if (engs->queued) {
engm = engs->emgr;
LASSERT(engm != NULL);
- spin_lock(&engm->lock);
+ cfs_spin_lock(&engm->lock);
if (engs->queued) {
- list_del(&engs->link);
+ cfs_list_del(&engs->link);
engs->queued = FALSE;
engs->tconn = NULL;
engs->emgr = NULL;
engs->tsdumgr = NULL;
}
- spin_unlock(&engm->lock);
+ cfs_spin_unlock(&engm->lock);
KsPrint((4, "KsQueueTdiEngine: TsduMgr %p is removed from engine %p\n",
TsduMgr, engm));
}
tflags = TDI_SEND_NON_BLOCKING;
}
- if (list_empty(&TsduMgr->TsduList)) {
+ if (cfs_list_empty(&TsduMgr->TsduList)) {
LASSERT(TsduMgr->TotalBytes == 0);
ks_unlock_tsdumgr(TsduMgr);
goto errorout;
{
ks_engine_mgr_t * engm = context;
ks_engine_slot_t * engs;
- struct list_head * list;
+ cfs_list_t * list;
ks_tconn_t * tconn;
cfs_set_thread_priority(31);
cfs_wait_event_internal(&engm->start, 0);
- spin_lock(&engm->lock);
- if (list_empty(&engm->list)) {
- spin_unlock(&engm->lock);
+ cfs_spin_lock(&engm->lock);
+ if (cfs_list_empty(&engm->list)) {
+ cfs_spin_unlock(&engm->lock);
continue;
}
list = engm->list.next;
- list_del(list);
- engs = list_entry(list, ks_engine_slot_t, link);
+ cfs_list_del(list);
+ engs = cfs_list_entry(list, ks_engine_slot_t, link);
LASSERT(engs->emgr == engm);
LASSERT(engs->queued);
engs->emgr = NULL;
engs->queued = FALSE;
- spin_unlock(&engm->lock);
+ cfs_spin_unlock(&engm->lock);
tconn = engs->tconn;
LASSERT(tconn->kstc_magic == KS_TCONN_MAGIC);
/* initialize tconn related globals */
RtlZeroMemory(&ks_data, sizeof(ks_tdi_data_t));
- spin_lock_init(&ks_data.ksnd_tconn_lock);
+ cfs_spin_lock_init(&ks_data.ksnd_tconn_lock);
CFS_INIT_LIST_HEAD(&ks_data.ksnd_tconns);
cfs_init_event(&ks_data.ksnd_tconn_exit, TRUE, FALSE);
}
/* initialize tsdu related globals */
- spin_lock_init(&ks_data.ksnd_tsdu_lock);
+ cfs_spin_lock_init(&ks_data.ksnd_tsdu_lock);
CFS_INIT_LIST_HEAD(&ks_data.ksnd_freetsdus);
ks_data.ksnd_tsdu_size = TDINAL_TSDU_DEFAULT_SIZE; /* 64k */
ks_data.ksnd_tsdu_slab = cfs_mem_cache_create(
}
/* initialize engine threads list */
- ks_data.ksnd_engine_nums = num_online_cpus();
+ ks_data.ksnd_engine_nums = cfs_num_online_cpus();
if (ks_data.ksnd_engine_nums < 4) {
ks_data.ksnd_engine_nums = 4;
}
goto errorout;
}
for (i = 0; i < ks_data.ksnd_engine_nums; i++) {
- spin_lock_init(&ks_data.ksnd_engine_mgr[i].lock);
+ cfs_spin_lock_init(&ks_data.ksnd_engine_mgr[i].lock);
cfs_init_event(&ks_data.ksnd_engine_mgr[i].start, TRUE, FALSE);
cfs_init_event(&ks_data.ksnd_engine_mgr[i].exit, TRUE, FALSE);
CFS_INIT_LIST_HEAD(&ks_data.ksnd_engine_mgr[i].list);
- cfs_kernel_thread(KsDeliveryEngineThread, &ks_data.ksnd_engine_mgr[i], 0);
+ cfs_create_thread(KsDeliveryEngineThread, &ks_data.ksnd_engine_mgr[i], 0);
}
/* register pnp handlers to watch network condition */
ks_fini_tdi_data()
{
PKS_TSDU KsTsdu = NULL;
- struct list_head * list = NULL;
+ cfs_list_t * list = NULL;
int i;
/* clean up the pnp handler and address slots */
}
/* we need wait until all the tconn are freed */
- spin_lock(&(ks_data.ksnd_tconn_lock));
+ cfs_spin_lock(&(ks_data.ksnd_tconn_lock));
- if (list_empty(&(ks_data.ksnd_tconns))) {
+ if (cfs_list_empty(&(ks_data.ksnd_tconns))) {
cfs_wake_event(&ks_data.ksnd_tconn_exit);
}
- spin_unlock(&(ks_data.ksnd_tconn_lock));
+ cfs_spin_unlock(&(ks_data.ksnd_tconn_lock));
/* now wait on the tconn exit event */
cfs_wait_event_internal(&ks_data.ksnd_tconn_exit, 0);
ks_data.ksnd_tconn_slab = NULL;
/* clean up all the tsud buffers in the free list */
- spin_lock(&(ks_data.ksnd_tsdu_lock));
- list_for_each (list, &ks_data.ksnd_freetsdus) {
- KsTsdu = list_entry (list, KS_TSDU, Link);
+ cfs_spin_lock(&(ks_data.ksnd_tsdu_lock));
+ cfs_list_for_each (list, &ks_data.ksnd_freetsdus) {
+ KsTsdu = cfs_list_entry (list, KS_TSDU, Link);
cfs_mem_cache_free(
ks_data.ksnd_tsdu_slab,
KsTsdu );
}
- spin_unlock(&(ks_data.ksnd_tsdu_lock));
+ cfs_spin_unlock(&(ks_data.ksnd_tsdu_lock));
/* it's safe to delete the tsdu slab ... */
cfs_mem_cache_destroy(ks_data.ksnd_tsdu_slab);
/* create the backlog child tconn */
backlog = ks_create_child_tconn(parent);
- spin_lock(&(parent->kstc_lock));
+ cfs_spin_lock(&(parent->kstc_lock));
if (backlog) {
- spin_lock(&backlog->kstc_lock);
+ cfs_spin_lock(&backlog->kstc_lock);
/* attch it into the listing list of daemon */
- list_add( &backlog->child.kstc_link,
+ cfs_list_add( &backlog->child.kstc_link,
&parent->listener.kstc_listening.list );
parent->listener.kstc_listening.num++;
backlog->child.kstc_queued = TRUE;
- spin_unlock(&backlog->kstc_lock);
+ cfs_spin_unlock(&backlog->kstc_lock);
} else {
cfs_enter_debugger();
}
- spin_unlock(&(parent->kstc_lock));
+ cfs_spin_unlock(&(parent->kstc_lock));
}
}
return rc;
}
- spin_lock(&(tconn->kstc_lock));
+ cfs_spin_lock(&(tconn->kstc_lock));
tconn->listener.nbacklog = nbacklog;
tconn->kstc_state = ksts_listening;
cfs_set_flag(tconn->kstc_flags, KS_TCONN_DAEMON_STARTED);
- spin_unlock(&(tconn->kstc_lock));
+ cfs_spin_unlock(&(tconn->kstc_lock));
return rc;
}
void
ks_stop_listen(ks_tconn_t *tconn)
{
- struct list_head * list;
+ cfs_list_t * list;
ks_tconn_t * backlog;
/* reset all tdi event callbacks to NULL */
KsResetHandlers (tconn);
- spin_lock(&tconn->kstc_lock);
+ cfs_spin_lock(&tconn->kstc_lock);
cfs_clear_flag(tconn->kstc_flags, KS_TCONN_DAEMON_STARTED);
/* cleanup all the listening backlog child connections */
- list_for_each (list, &(tconn->listener.kstc_listening.list)) {
- backlog = list_entry(list, ks_tconn_t, child.kstc_link);
+ cfs_list_for_each (list, &(tconn->listener.kstc_listening.list)) {
+ backlog = cfs_list_entry(list, ks_tconn_t, child.kstc_link);
/* destory and free it */
ks_put_tconn(backlog);
}
- spin_unlock(&tconn->kstc_lock);
+ cfs_spin_unlock(&tconn->kstc_lock);
/* wake up it from the waiting on new incoming connections */
KeSetEvent(&tconn->listener.kstc_accept_event, 0, FALSE);
ks_tconn_t ** child
)
{
- struct list_head * tmp;
+ cfs_list_t * tmp;
ks_tconn_t * backlog = NULL;
ks_replenish_backlogs(parent, parent->listener.nbacklog);
- spin_lock(&(parent->kstc_lock));
+ cfs_spin_lock(&(parent->kstc_lock));
if (parent->listener.kstc_listening.num <= 0) {
- spin_unlock(&(parent->kstc_lock));
+ cfs_spin_unlock(&(parent->kstc_lock));
return -1;
}
/* check the listening queue and try to search the accepted connecton */
- list_for_each(tmp, &(parent->listener.kstc_listening.list)) {
- backlog = list_entry (tmp, ks_tconn_t, child.kstc_link);
+ cfs_list_for_each(tmp, &(parent->listener.kstc_listening.list)) {
+ backlog = cfs_list_entry (tmp, ks_tconn_t, child.kstc_link);
- spin_lock(&(backlog->kstc_lock));
+ cfs_spin_lock(&(backlog->kstc_lock));
if (backlog->child.kstc_accepted) {
LASSERT(backlog->kstc_state == ksts_connected);
LASSERT(backlog->child.kstc_busy);
- list_del(&(backlog->child.kstc_link));
- list_add(&(backlog->child.kstc_link),
- &(parent->listener.kstc_accepted.list));
+ cfs_list_del(&(backlog->child.kstc_link));
+ cfs_list_add(&(backlog->child.kstc_link),
+ &(parent->listener.kstc_accepted.list));
parent->listener.kstc_accepted.num++;
parent->listener.kstc_listening.num--;
backlog->child.kstc_queueno = 1;
- spin_unlock(&(backlog->kstc_lock));
+ cfs_spin_unlock(&(backlog->kstc_lock));
break;
} else {
- spin_unlock(&(backlog->kstc_lock));
+ cfs_spin_unlock(&(backlog->kstc_lock));
backlog = NULL;
}
}
- spin_unlock(&(parent->kstc_lock));
+ cfs_spin_unlock(&(parent->kstc_lock));
/* we need wait until new incoming connections are requested
or the case of shuting down the listenig daemon thread */
NULL
);
- spin_lock(&(parent->kstc_lock));
+ cfs_spin_lock(&(parent->kstc_lock));
/* check whether it's exptected to exit ? */
if (!cfs_is_flag_set(parent->kstc_flags, KS_TCONN_DAEMON_STARTED)) {
- spin_unlock(&(parent->kstc_lock));
+ cfs_spin_unlock(&(parent->kstc_lock));
} else {
goto again;
}
ks_addr_slot_t * slot = NULL;
PLIST_ENTRY list = NULL;
- spin_lock(&ks_data.ksnd_addrs_lock);
+ cfs_spin_lock(&ks_data.ksnd_addrs_lock);
list = ks_data.ksnd_addrs_list.Flink;
while (list != &ks_data.ksnd_addrs_list) {
slot = NULL;
}
- spin_unlock(&ks_data.ksnd_addrs_lock);
+ cfs_spin_unlock(&ks_data.ksnd_addrs_lock);
return (int)(slot == NULL);
}
PLIST_ENTRY list = NULL;
int nips = 0;
- spin_lock(&ks_data.ksnd_addrs_lock);
+ cfs_spin_lock(&ks_data.ksnd_addrs_lock);
*names = cfs_alloc(sizeof(char *) * ks_data.ksnd_naddrs, CFS_ALLOC_ZERO);
if (*names == NULL) {
errorout:
- spin_unlock(&ks_data.ksnd_addrs_lock);
+ cfs_spin_unlock(&ks_data.ksnd_addrs_lock);
return nips;
}
{
LASSERT(sock->kstc_type == kstt_listener);
- spin_lock(&(sock->kstc_lock));
+ cfs_spin_lock(&(sock->kstc_lock));
/* clear the daemon flag */
cfs_clear_flag(sock->kstc_flags, KS_TCONN_DAEMON_STARTED);
/* wake up it from the waiting on new incoming connections */
KeSetEvent(&sock->listener.kstc_accept_event, 0, FALSE);
- spin_unlock(&(sock->kstc_lock));
+ cfs_spin_unlock(&(sock->kstc_lock));
}
/*
{
PTRANSPORT_ADDRESS taddr = NULL;
- spin_lock(&socket->kstc_lock);
+ cfs_spin_lock(&socket->kstc_lock);
if (remote) {
if (socket->kstc_type == kstt_sender) {
taddr = socket->sender.kstc_info.Remote;
if (port != NULL)
*port = ntohs (addr->sin_port);
} else {
- spin_unlock(&socket->kstc_lock);
+ cfs_spin_unlock(&socket->kstc_lock);
return -ENOTCONN;
}
- spin_unlock(&socket->kstc_lock);
+ cfs_spin_unlock(&socket->kstc_lock);
return 0;
}