Move _insque()/_remque() to libkern. Once remaining uses would
be converted to <sys/queue.h> macros, _insque()/_remque() would be eliminated altogether.
This commit is contained in:
parent
7c661278ee
commit
c495131fe3
|
@ -1,64 +0,0 @@
|
|||
/* $NetBSD: support.c,v 1.8 2001/01/03 22:15:38 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Author: Chris G. Demetriou
|
||||
*
|
||||
* Permission to use, copy, modify and distribute this software and
|
||||
* its documentation is hereby granted, provided that both the copyright
|
||||
* notice and this permission notice appear in all copies of the
|
||||
* software, derivative works or modified versions, and any portions
|
||||
* thereof, and that both notices appear in supporting documentation.
|
||||
*
|
||||
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
|
||||
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
|
||||
* FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
|
||||
*
|
||||
* Carnegie Mellon requests users of this software to return to
|
||||
*
|
||||
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
|
||||
* School of Computer Science
|
||||
* Carnegie Mellon University
|
||||
* Pittsburgh PA 15213-3890
|
||||
*
|
||||
* any improvements or extensions that they make and grant Carnegie the
|
||||
* rights to redistribute these changes.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
|
||||
|
||||
__KERNEL_RCSID(0, "$NetBSD: support.c,v 1.8 2001/01/03 22:15:38 thorpej Exp $");
|
||||
|
||||
/*
|
||||
* Some C support functions that aren't (yet) in libkern or assembly.
|
||||
*/
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/errno.h>
|
||||
|
||||
struct qelem {
|
||||
struct qelem *q_forw;
|
||||
struct qelem *q_back;
|
||||
};
|
||||
|
||||
void
|
||||
_insque(void *entry, void *pred)
|
||||
{
|
||||
struct qelem *e = (struct qelem *) entry;
|
||||
struct qelem *p = (struct qelem *) pred;
|
||||
|
||||
e->q_forw = p->q_forw;
|
||||
e->q_back = p;
|
||||
p->q_forw->q_back = e;
|
||||
p->q_forw = e;
|
||||
}
|
||||
|
||||
void
|
||||
_remque(void *element)
|
||||
{
|
||||
struct qelem *e = (struct qelem *) element;
|
||||
e->q_forw->q_back = e->q_back;
|
||||
e->q_back->q_forw = e->q_forw;
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: files.alpha,v 1.140 2001/06/18 02:00:48 christos Exp $
|
||||
# $NetBSD: files.alpha,v 1.141 2001/08/12 08:35:32 jdolecek Exp $
|
||||
#
|
||||
# alpha-specific configuration info
|
||||
|
||||
|
@ -492,7 +492,6 @@ file arch/alpha/alpha/pmap.c
|
|||
file arch/alpha/alpha/process_machdep.c
|
||||
file arch/alpha/alpha/procfs_machdep.c procfs
|
||||
file arch/alpha/alpha/prom.c
|
||||
file arch/alpha/alpha/support.c
|
||||
file arch/alpha/alpha/sys_machdep.c
|
||||
file arch/alpha/alpha/syscall.c
|
||||
file arch/alpha/alpha/trap.c
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: stubs.c,v 1.1 2001/07/28 13:28:04 chris Exp $ */
|
||||
/* $NetBSD: stubs.c,v 1.2 2001/08/12 08:35:33 jdolecek Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994-1998 Mark Brinicombe.
|
||||
|
@ -55,49 +55,6 @@
|
|||
extern dev_t dumpdev;
|
||||
extern BootConfig bootconfig;
|
||||
|
||||
/* These queue functions are candiates for arm32/machdep.c */
|
||||
struct queue {
|
||||
struct queue *q_next, *q_prev;
|
||||
};
|
||||
|
||||
/*
|
||||
* insert an element into a queue
|
||||
*/
|
||||
|
||||
void
|
||||
_insque(v1, v2)
|
||||
void *v1;
|
||||
void *v2;
|
||||
{
|
||||
struct queue *elem = v1, *head = v2;
|
||||
struct queue *next;
|
||||
|
||||
next = head->q_next;
|
||||
elem->q_next = next;
|
||||
head->q_next = elem;
|
||||
elem->q_prev = head;
|
||||
next->q_prev = elem;
|
||||
}
|
||||
|
||||
/*
|
||||
* remove an element from a queue
|
||||
*/
|
||||
|
||||
void
|
||||
_remque(v)
|
||||
void *v;
|
||||
{
|
||||
struct queue *elem = v;
|
||||
struct queue *next, *prev;
|
||||
|
||||
next = elem->q_next;
|
||||
prev = elem->q_prev;
|
||||
next->q_prev = prev;
|
||||
prev->q_next = next;
|
||||
elem->q_prev = 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* These variables are needed by /sbin/savecore
|
||||
*/
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: stubs.c,v 1.6 2001/06/29 02:40:28 toshii Exp $ */
|
||||
/* $NetBSD: stubs.c,v 1.7 2001/08/12 08:35:32 jdolecek Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994-1998 Mark Brinicombe.
|
||||
|
@ -55,49 +55,6 @@
|
|||
extern dev_t dumpdev;
|
||||
extern BootConfig bootconfig;
|
||||
|
||||
/* These queue functions are candiates for arm32/machdep.c */
|
||||
struct queue {
|
||||
struct queue *q_next, *q_prev;
|
||||
};
|
||||
|
||||
/*
|
||||
* insert an element into a queue
|
||||
*/
|
||||
|
||||
void
|
||||
_insque(v1, v2)
|
||||
void *v1;
|
||||
void *v2;
|
||||
{
|
||||
struct queue *elem = v1, *head = v2;
|
||||
struct queue *next;
|
||||
|
||||
next = head->q_next;
|
||||
elem->q_next = next;
|
||||
head->q_next = elem;
|
||||
elem->q_prev = head;
|
||||
next->q_prev = elem;
|
||||
}
|
||||
|
||||
/*
|
||||
* remove an element from a queue
|
||||
*/
|
||||
|
||||
void
|
||||
_remque(v)
|
||||
void *v;
|
||||
{
|
||||
struct queue *elem = v;
|
||||
struct queue *next, *prev;
|
||||
|
||||
next = elem->q_next;
|
||||
prev = elem->q_prev;
|
||||
next->q_prev = prev;
|
||||
prev->q_next = next;
|
||||
elem->q_prev = 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* These variables are needed by /sbin/savecore
|
||||
*/
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: machdep.c,v 1.452 2001/08/03 01:24:40 thorpej Exp $ */
|
||||
/* $NetBSD: machdep.c,v 1.453 2001/08/12 08:35:31 jdolecek Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996, 1997, 1998, 2000 The NetBSD Foundation, Inc.
|
||||
|
@ -2833,45 +2833,6 @@ init386(first_avail)
|
|||
identifycpu(curcpu());
|
||||
}
|
||||
|
||||
struct queue {
|
||||
struct queue *q_next, *q_prev;
|
||||
};
|
||||
|
||||
/*
|
||||
* insert an element into a queue
|
||||
*/
|
||||
void
|
||||
_insque(v1, v2)
|
||||
void *v1;
|
||||
void *v2;
|
||||
{
|
||||
struct queue *elem = v1, *head = v2;
|
||||
struct queue *next;
|
||||
|
||||
next = head->q_next;
|
||||
elem->q_next = next;
|
||||
head->q_next = elem;
|
||||
elem->q_prev = head;
|
||||
next->q_prev = elem;
|
||||
}
|
||||
|
||||
/*
|
||||
* remove an element from a queue
|
||||
*/
|
||||
void
|
||||
_remque(v)
|
||||
void *v;
|
||||
{
|
||||
struct queue *elem = v;
|
||||
struct queue *next, *prev;
|
||||
|
||||
next = elem->q_next;
|
||||
prev = elem->q_prev;
|
||||
next->q_prev = prev;
|
||||
prev->q_next = next;
|
||||
elem->q_prev = 0;
|
||||
}
|
||||
|
||||
#ifdef COMPAT_NOMID
|
||||
static int
|
||||
exec_nomid(p, epp)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: machdep.c,v 1.123 2001/06/02 18:09:18 chs Exp $ */
|
||||
/* $NetBSD: machdep.c,v 1.124 2001/08/12 08:35:33 jdolecek Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996 Matthias Pfaller.
|
||||
|
@ -1019,45 +1019,6 @@ init532()
|
|||
panic("main returned to init532\n");
|
||||
}
|
||||
|
||||
struct queue {
|
||||
struct queue *q_next, *q_prev;
|
||||
};
|
||||
|
||||
/*
|
||||
* insert an element into a queue
|
||||
*/
|
||||
void
|
||||
_insque(v1, v2)
|
||||
void *v1;
|
||||
void *v2;
|
||||
{
|
||||
register struct queue *elem = v1, *head = v2;
|
||||
register struct queue *next;
|
||||
|
||||
next = head->q_next;
|
||||
elem->q_next = next;
|
||||
head->q_next = elem;
|
||||
elem->q_prev = head;
|
||||
next->q_prev = elem;
|
||||
}
|
||||
|
||||
/*
|
||||
* remove an element from a queue
|
||||
*/
|
||||
void
|
||||
_remque(v)
|
||||
void *v;
|
||||
{
|
||||
register struct queue *elem = v;
|
||||
register struct queue *next, *prev;
|
||||
|
||||
next = elem->q_next;
|
||||
prev = elem->q_prev;
|
||||
next->q_prev = prev;
|
||||
prev->q_next = next;
|
||||
elem->q_prev = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* cpu_exec_aout_makecmds():
|
||||
* cpu-dependent a.out format hook for execve().
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: sh3_machdep.c,v 1.15 2001/06/02 18:09:20 chs Exp $ */
|
||||
/* $NetBSD: sh3_machdep.c,v 1.16 2001/08/12 08:35:33 jdolecek Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
|
||||
|
@ -428,41 +428,3 @@ setregs(p, pack, stack)
|
|||
#endif
|
||||
}
|
||||
|
||||
struct queue {
|
||||
struct queue *q_next, *q_prev;
|
||||
};
|
||||
|
||||
/*
|
||||
* insert an element into a queue
|
||||
*/
|
||||
void
|
||||
_insque(v1, v2)
|
||||
void *v1;
|
||||
void *v2;
|
||||
{
|
||||
struct queue *elem = v1, *head = v2;
|
||||
struct queue *next;
|
||||
|
||||
next = head->q_next;
|
||||
elem->q_next = next;
|
||||
head->q_next = elem;
|
||||
elem->q_prev = head;
|
||||
next->q_prev = elem;
|
||||
}
|
||||
|
||||
/*
|
||||
* remove an element from a queue
|
||||
*/
|
||||
void
|
||||
_remque(v)
|
||||
void *v;
|
||||
{
|
||||
struct queue *elem = v;
|
||||
struct queue *next, *prev;
|
||||
|
||||
next = elem->q_next;
|
||||
prev = elem->q_prev;
|
||||
next->q_prev = prev;
|
||||
prev->q_next = next;
|
||||
elem->q_prev = 0;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: machdep.c,v 1.1 2001/06/19 00:21:17 fvdl Exp $ */
|
||||
/* $NetBSD: machdep.c,v 1.2 2001/08/12 08:35:33 jdolecek Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996, 1997, 1998, 2000 The NetBSD Foundation, Inc.
|
||||
|
@ -1560,45 +1560,6 @@ init_x86_64(first_avail)
|
|||
enable_intr();
|
||||
}
|
||||
|
||||
struct queue {
|
||||
struct queue *q_next, *q_prev;
|
||||
};
|
||||
|
||||
/*
|
||||
* insert an element into a queue
|
||||
*/
|
||||
void
|
||||
_insque(v1, v2)
|
||||
void *v1;
|
||||
void *v2;
|
||||
{
|
||||
struct queue *elem = v1, *head = v2;
|
||||
struct queue *next;
|
||||
|
||||
next = head->q_next;
|
||||
elem->q_next = next;
|
||||
head->q_next = elem;
|
||||
elem->q_prev = head;
|
||||
next->q_prev = elem;
|
||||
}
|
||||
|
||||
/*
|
||||
* remove an element from a queue
|
||||
*/
|
||||
void
|
||||
_remque(v)
|
||||
void *v;
|
||||
{
|
||||
struct queue *elem = v;
|
||||
struct queue *next, *prev;
|
||||
|
||||
next = elem->q_next;
|
||||
prev = elem->q_prev;
|
||||
next->q_prev = prev;
|
||||
prev->q_next = next;
|
||||
elem->q_prev = 0;
|
||||
}
|
||||
|
||||
void *
|
||||
lookup_bootinfo(type)
|
||||
int type;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: Makefile,v 1.60 2001/02/18 22:38:50 enami Exp $
|
||||
# $NetBSD: Makefile,v 1.61 2001/08/12 08:35:34 jdolecek Exp $
|
||||
|
||||
LIB= kern
|
||||
MKPIC= no
|
||||
|
@ -37,6 +37,7 @@ SRCS+= adddi3.c anddi3.c ashldi3.c ashrdi3.c cmpdi2.c divdi3.c iordi3.c \
|
|||
|
||||
# Other stuff
|
||||
SRCS+= __cmsg_alignbytes.c inet_addr.c intoa.c md4c.c md5c.c sha1.c pmatch.c
|
||||
SRCS+= _que.c
|
||||
|
||||
# Files to clean up
|
||||
CLEANFILES+= lib${LIB}.o lib${LIB}.po
|
||||
|
|
|
@ -0,0 +1,84 @@
|
|||
/* $NetBSD: _que.c,v 1.1 2001/08/12 08:35:34 jdolecek Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the NetBSD
|
||||
* Foundation, Inc. and its contributors.
|
||||
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Use <sys/queue.h> macros for new code, queue functions provided here
|
||||
* are obsolete. Once the remaining code using this would be converted
|
||||
* to use <sys/queue.h>, this would be removed.
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/systm.h>
|
||||
|
||||
struct queue {
|
||||
struct queue *q_next, *q_prev;
|
||||
};
|
||||
|
||||
/*
|
||||
* insert an element into a queue
|
||||
*/
|
||||
|
||||
void
|
||||
_insque(v1, v2)
|
||||
void *v1;
|
||||
void *v2;
|
||||
{
|
||||
struct queue *elem = v1, *head = v2;
|
||||
struct queue *next;
|
||||
|
||||
next = head->q_next;
|
||||
elem->q_next = next;
|
||||
head->q_next = elem;
|
||||
elem->q_prev = head;
|
||||
next->q_prev = elem;
|
||||
}
|
||||
|
||||
/*
|
||||
* remove an element from a queue
|
||||
*/
|
||||
|
||||
void
|
||||
_remque(v)
|
||||
void *v;
|
||||
{
|
||||
struct queue *elem = v;
|
||||
struct queue *next, *prev;
|
||||
|
||||
next = elem->q_next;
|
||||
prev = elem->q_prev;
|
||||
next->q_prev = prev;
|
||||
prev->q_next = next;
|
||||
elem->q_prev = 0;
|
||||
}
|
Loading…
Reference in New Issue