/*
* Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
*
- * @APPLE_LICENSE_OSREFERENCE_HEADER_START@
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. The rights granted to you under the
- * License may not be used to create, or enable the creation or
- * redistribution of, unlawful or unlicensed copies of an Apple operating
- * system, or to circumvent, violate, or enable the circumvention or
- * violation of, any terms of an Apple operating system software license
- * agreement.
- *
- * Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
- *
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ *
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
* limitations under the License.
- *
- * @APPLE_LICENSE_OSREFERENCE_HEADER_END@
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* Copyright (c) 1990, 1995-1998 Apple Computer, Inc.
#include <netat/adsp.h>
#include <netat/adsp_internal.h>
+extern atlock_t adspall_lock;
static void qRemove(CCBPtr, CCBPtr);
register gref_t *gref;
register int total = 0;
CCBPtr sp = 0;
+ int s;
n = *qhead; /* Get first item */
*qhead = 0; /* Zero out the queue */
if (gref->info) {
sp = (CCBPtr)gbuf_rptr(((gbuf_t *)gref->info));
atalk_flush(sp->gref);
+ ATDISABLE(s, sp->lock);
}
}
} else
gbuf_freem(p->mp);
} /* while */
+ if (sp)
+ ATENABLE(s, sp->lock);
return(total);
}
register CCBPtr sp;
register struct adspcmd *pb;
{
+ int s;
register gbuf_t *mp;
/* Must execute nearly all of this with ints off because user could
* is still pending.
*/
if (pb->csCode == (short)dspClose) {
+ ATDISABLE(s, sp->lock);
if ((sp->state == (short)sPassive) || (sp->state == (short)sOpening)) {
sp->state = sClosed;
+ ATENABLE(s, sp->lock);
DoClose(sp, errAborted, 0);
pb->ioResult = 0;
adspioc_ack(0, pb->ioc, pb->gref);
}
if (sp->state == (word)sClosed) { /* Ok to close a closed connection */
+ ATENABLE(s, sp->lock);
pb->ioResult = 0;
adspioc_ack(0, pb->ioc, pb->gref);
return 0;
}
if ((sp->state != (word)sOpen) && (sp->state != (word)sClosing)) {
+ ATENABLE(s, sp->lock);
pb->ioResult = errState;
return EINVAL;
}
sp->state = sClosing; /* No matter what, we're closing */
+ ATENABLE(s, sp->lock);
} /* dspClose */
else { /* dspRemove */
+ ATDISABLE(s, sp->lock);
sp->removing = 1; /* Prevent allowing another dspClose. */
/* Tells completion routine of close */
/* packet to remove us. */
if (sp->state == sPassive || sp->state == sClosed ||
sp->state == sOpening) {
sp->state = sClosed;
+ ATENABLE(s, sp->lock);
DoClose(sp, errAborted, 0); /* Will remove CCB! */
return 0;
- } else /* sClosing & sOpen */
+ } else { /* sClosing & sOpen */
sp->state = sClosing;
+ ATENABLE(s, sp->lock);
+ }
} /* dspRemove */
pb = (struct adspcmd *)gbuf_rptr(mp); /* get new parameter block */
pb->ioc = 0;
pb->mp = mp;
+ ATDISABLE(s, sp->lock);
qAddToEnd(&sp->opb, pb); /* and save it */
+ ATENABLE(s, sp->lock);
} else {
pb->ioResult = 0;
adspioc_ack(0, pb->ioc, pb->gref); /* release user, and keep no copy
register CCBPtr qptr;
register CCBPtr elem;
{
+ int s;
+ ATDISABLE(s, adspall_lock);
while(qptr->ccbLink) {
if ((DSPPBPtr)(qptr->ccbLink) == (DSPPBPtr)elem) {
qptr->ccbLink = elem->ccbLink;
elem->ccbLink = 0;
+ ATENABLE(s, adspall_lock);
return;
}
qptr = qptr->ccbLink;
}
+ ATENABLE(s, adspall_lock);
}
int RxClose(sp)
{
register gbuf_t *mp;
register struct adspcmd *pb;
+ int s, l;
- if ((sp->state == sClosing) || (sp->state == sClosed))
+ ATDISABLE(l, sp->lockClose);
+ ATDISABLE(s, sp->lock);
+ if ((sp->state == sClosing) || (sp->state == sClosed)) {
+ ATENABLE(s, sp->lock);
+ ATENABLE(l, sp->lockClose);
return 0;
-
+ }
sp->state = sClosed;
+ ATENABLE(s, sp->lock);
CheckReadQueue(sp); /* try to deliver all remaining data */
if ( (mp = gbuf_alloc(sizeof(struct adspcmd), PRI_HI)) ) {
if ((sp->userFlags & eClosed) == 0)
DoClose(sp, errAborted, -1); /* abort send requests and timers */
+ ATENABLE(l, sp->lockClose);
return 0;
}