]>
git.saurik.com Git - apple/xnu.git/blob - bsd/netat/adsp_misc.c
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
20 * @APPLE_LICENSE_HEADER_END@
22 #include <sys/errno.h>
23 #include <sys/types.h>
24 #include <sys/param.h>
25 #include <machine/spl.h>
26 #include <sys/systm.h>
27 #include <sys/kernel.h>
29 #include <sys/filedesc.h>
30 #include <sys/fcntl.h>
32 #include <sys/socket.h>
34 #include <netat/sysglue.h>
35 #include <netat/appletalk.h>
36 #include <netat/at_pcb.h>
37 #include <netat/debug.h>
38 #include <netat/adsp.h>
39 #include <netat/adsp_internal.h>
42 * These function replace the Mk68 assembly routines found in qAddToEnd.s and
44 * Modified for MP, 1996 by Tuyen Nguyen
45 * Modified, April 9, 1997 by Tuyen Nguyen for MacOSX.
53 /* ----------------------------------------------------------------------
54 * void qAddToEnd(void *qhead, void *qelem)
57 * Ptr to ptr to 1st item in queue
58 * Ptr to item to add to end of queue
62 * Assumptions: The link field is the FIRST field of the qelem structure.
63 * ----------------------------------------------------------------------
65 int qAddToEnd(qhead
, qelem
)
69 /* define our own type to access the next field. NOTE THAT THE "NEXT"
70 * FIELD IS ASSUMED TO BE THE FIRST FIELD OF THE STRUCTURE
73 register struct qlink
*q
;
75 /* Scan the linked list to the end and update the previous
76 * element next field. (do that protocted).
82 /* are we about to link to ourself */
92 qelem
->qlinkp
= (struct qlink
*) 0;
95 DPRINTF("%s: qhead=%x added elem=%x\n","qAddToEnd", qhead
, qelem
);
102 /* ----------------------------------------------------------------------
104 * void* qfind_m(void *qhead, void NPTR match, ProcPtr compare_fnx)
106 * Hunt down a linked list of queue elements calling the compare
107 * function on each item. When the compare function returns true,
108 * return ptr to the queue element.
112 * qhead Address of ptr to first item in queue
116 * D0 & A0 Ptr to queue element or NIL
119 * ----------------------------------------------------------------------
121 void* qfind_m(qhead
, match
, compare_fnx
)
126 CCBPtr queue_item
= qhead
;
129 if ((*compare_fnx
)(queue_item
,match
))
132 queue_item
= queue_item
->ccbLink
;