]>
git.saurik.com Git - apple/xnu.git/blob - bsd/netat/adsp_misc.c
75c735bccf1a6cd5ddb334bc2e34829625b22dbd
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_OSREFERENCE_HEADER_START@
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the
10 * License may not be used to create, or enable the creation or
11 * redistribution of, unlawful or unlicensed copies of an Apple operating
12 * system, or to circumvent, violate, or enable the circumvention or
13 * violation of, any terms of an Apple operating system software license
16 * Please obtain a copy of the License at
17 * http://www.opensource.apple.com/apsl/ and read it before using this
20 * The Original Code and all software distributed under the License are
21 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
22 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
23 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
24 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
25 * Please see the License for the specific language governing rights and
26 * limitations under the License.
28 * @APPLE_LICENSE_OSREFERENCE_HEADER_END@
30 #include <sys/errno.h>
31 #include <sys/types.h>
32 #include <sys/param.h>
33 #include <machine/spl.h>
34 #include <sys/systm.h>
35 #include <sys/kernel.h>
37 #include <sys/filedesc.h>
38 #include <sys/fcntl.h>
40 #include <sys/socket.h>
42 #include <netat/sysglue.h>
43 #include <netat/appletalk.h>
44 #include <netat/at_pcb.h>
45 #include <netat/debug.h>
46 #include <netat/adsp.h>
47 #include <netat/adsp_internal.h>
50 * These function replace the Mk68 assembly routines found in qAddToEnd.s and
52 * Modified for MP, 1996 by Tuyen Nguyen
53 * Modified, April 9, 1997 by Tuyen Nguyen for MacOSX.
61 /* ----------------------------------------------------------------------
62 * void qAddToEnd(void *qhead, void *qelem)
65 * Ptr to ptr to 1st item in queue
66 * Ptr to item to add to end of queue
70 * Assumptions: The link field is the FIRST field of the qelem structure.
71 * ----------------------------------------------------------------------
73 int qAddToEnd(qhead
, qelem
)
77 /* define our own type to access the next field. NOTE THAT THE "NEXT"
78 * FIELD IS ASSUMED TO BE THE FIRST FIELD OF THE STRUCTURE
81 register struct qlink
*q
;
83 /* Scan the linked list to the end and update the previous
84 * element next field. (do that protocted).
90 /* are we about to link to ourself */
100 qelem
->qlinkp
= (struct qlink
*) 0;
103 DPRINTF("%s: qhead=%x added elem=%x\n","qAddToEnd", qhead
, qelem
);
110 /* ----------------------------------------------------------------------
112 * void* qfind_m(void *qhead, void NPTR match, ProcPtr compare_fnx)
114 * Hunt down a linked list of queue elements calling the compare
115 * function on each item. When the compare function returns true,
116 * return ptr to the queue element.
120 * qhead Address of ptr to first item in queue
124 * D0 & A0 Ptr to queue element or NIL
127 * ----------------------------------------------------------------------
129 void* qfind_m(qhead
, match
, compare_fnx
)
134 CCBPtr queue_item
= qhead
;
137 if ((*compare_fnx
)(queue_item
,match
))
140 queue_item
= queue_item
->ccbLink
;