Moved inline functions for insque() and remque() to <sys/queue.h>.

Protected them with `#ifdef KERNEL' so that <sys/queue.h> is valid C++.
Added the necessary #includes of <sys/queue.h>.

These functions are bogus and should be replaced by the queue macros.
This commit is contained in:
bde 1995-12-03 13:45:34 +00:00
parent 754df9d25d
commit 35ee958319
9 changed files with 62 additions and 75 deletions

View File

@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: cpufunc.h,v 1.40 1995/08/26 20:45:59 bde Exp $
* $Id: cpufunc.h,v 1.41 1995/10/05 10:32:47 phk Exp $
*/
/*
@ -296,35 +296,6 @@ write_eflags(u_long ef)
__asm __volatile("pushl %0; popfl" : : "r" (ef));
}
/*
* XXX queue stuff belongs elsewhere.
*/
struct quehead {
struct quehead *qh_link;
struct quehead *qh_rlink;
};
static __inline void
insque(void *a, void *b)
{
struct quehead *element = a, *head = b;
element->qh_link = head->qh_link;
element->qh_rlink = head;
head->qh_link = element;
element->qh_link->qh_rlink = element;
}
static __inline void
remque(void *a)
{
struct quehead *element = a;
element->qh_link->qh_rlink = element->qh_rlink;
element->qh_rlink->qh_link = element->qh_link;
element->qh_rlink = 0;
}
#else /* !__GNUC__ */
int bdb __P((void));
@ -348,9 +319,6 @@ u_long read_eflags __P((void));
u_long rcr2 __P((void));
void write_eflags __P((u_long ef));
void insque __P((void *a, void *b));
void remque __P((void *a));
#endif /* __GNUC__ */
/*

View File

@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: cpufunc.h,v 1.40 1995/08/26 20:45:59 bde Exp $
* $Id: cpufunc.h,v 1.41 1995/10/05 10:32:47 phk Exp $
*/
/*
@ -296,35 +296,6 @@ write_eflags(u_long ef)
__asm __volatile("pushl %0; popfl" : : "r" (ef));
}
/*
* XXX queue stuff belongs elsewhere.
*/
struct quehead {
struct quehead *qh_link;
struct quehead *qh_rlink;
};
static __inline void
insque(void *a, void *b)
{
struct quehead *element = a, *head = b;
element->qh_link = head->qh_link;
element->qh_rlink = head;
head->qh_link = element;
element->qh_link->qh_rlink = element;
}
static __inline void
remque(void *a)
{
struct quehead *element = a;
element->qh_link->qh_rlink = element->qh_rlink;
element->qh_rlink->qh_link = element->qh_link;
element->qh_rlink = 0;
}
#else /* !__GNUC__ */
int bdb __P((void));
@ -348,9 +319,6 @@ u_long read_eflags __P((void));
u_long rcr2 __P((void));
void write_eflags __P((u_long ef));
void insque __P((void *a, void *b));
void remque __P((void *a));
#endif /* __GNUC__ */
/*

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)raw_cb.c 8.1 (Berkeley) 6/10/93
* $Id: raw_cb.c,v 1.4 1995/05/30 08:08:21 rgrimes Exp $
* $Id: raw_cb.c,v 1.5 1995/07/29 11:40:59 bde Exp $
*/
#include <sys/param.h>
@ -41,6 +41,7 @@
#include <sys/socketvar.h>
#include <sys/domain.h>
#include <sys/protosw.h>
#include <sys/queue.h>
#include <sys/errno.h>
#include <net/if.h>

View File

@ -37,7 +37,7 @@
* SUCH DAMAGE.
*
* @(#)llc_subr.c 8.1 (Berkeley) 6/10/93
* $Id: llc_subr.c,v 1.5 1995/05/30 08:08:52 rgrimes Exp $
* $Id: llc_subr.c,v 1.6 1995/07/29 11:41:22 bde Exp $
*/
#include <sys/param.h>
@ -46,6 +46,7 @@
#include <sys/domain.h>
#include <sys/socket.h>
#include <sys/protosw.h>
#include <sys/queue.h>
#include <sys/socketvar.h>
#include <sys/errno.h>
#include <sys/time.h>

View File

@ -39,7 +39,7 @@
* SUCH DAMAGE.
*
* @(#)pk_input.c 8.1 (Berkeley) 6/10/93
* $Id: pk_input.c,v 1.5 1995/05/30 08:08:59 rgrimes Exp $
* $Id: pk_input.c,v 1.6 1995/07/29 11:41:26 bde Exp $
*/
#include <sys/param.h>
@ -47,6 +47,7 @@
#include <sys/mbuf.h>
#include <sys/socket.h>
#include <sys/protosw.h>
#include <sys/queue.h>
#include <sys/socketvar.h>
#include <sys/errno.h>

View File

@ -39,7 +39,7 @@
* SUCH DAMAGE.
*
* @(#)pk_subr.c 8.1 (Berkeley) 6/10/93
* $Id: pk_subr.c,v 1.4 1995/05/30 08:09:07 rgrimes Exp $
* $Id: pk_subr.c,v 1.5 1995/07/29 11:41:26 bde Exp $
*/
#include <sys/param.h>
@ -47,6 +47,7 @@
#include <sys/mbuf.h>
#include <sys/socket.h>
#include <sys/protosw.h>
#include <sys/queue.h>
#include <sys/socketvar.h>
#include <sys/errno.h>
#include <sys/time.h>

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)ns_pcb.c 8.1 (Berkeley) 6/10/93
* $Id: ns_pcb.c,v 1.2 1994/08/02 07:51:52 davidg Exp $
* $Id: ns_pcb.c,v 1.3 1995/05/30 08:12:28 rgrimes Exp $
*/
#include <sys/param.h>
@ -41,6 +41,7 @@
#include <sys/socket.h>
#include <sys/socketvar.h>
#include <sys/protosw.h>
#include <sys/queue.h>
#include <net/if.h>
#include <net/route.h>

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)spp_usrreq.c 8.1 (Berkeley) 6/10/93
* $Id: spp_usrreq.c,v 1.4 1995/05/30 08:12:31 rgrimes Exp $
* $Id: spp_usrreq.c,v 1.5 1995/07/29 11:41:59 bde Exp $
*/
#include <sys/param.h>
@ -39,6 +39,7 @@
#include <sys/malloc.h>
#include <sys/mbuf.h>
#include <sys/protosw.h>
#include <sys/queue.h>
#include <sys/socket.h>
#include <sys/socketvar.h>
#include <sys/errno.h>

View File

@ -31,10 +31,10 @@
* SUCH DAMAGE.
*
* @(#)queue.h 8.4 (Berkeley) 1/4/94
* $Id: queue.h,v 1.2 1994/08/02 07:53:25 davidg Exp $
* $Id: queue.h,v 1.3 1995/05/30 08:14:30 rgrimes Exp $
*/
#ifndef _SYS_QUEUE_H_
#ifndef _SYS_QUEUE_H_
#define _SYS_QUEUE_H_
/*
@ -243,4 +243,49 @@ struct { \
(elm)->field.cqe_prev->field.cqe_next = \
(elm)->field.cqe_next; \
}
#endif /* !_SYS_QUEUE_H_ */
#ifdef KERNEL
/*
* XXX insque() and remque() are an old way of handling certain queues.
* They bogusly assumes that all queue heads look alike.
*/
struct quehead {
struct quehead *qh_link;
struct quehead *qh_rlink;
};
#ifdef __GNUC__
static __inline void
insque(void *a, void *b)
{
struct quehead *element = a, *head = b;
element->qh_link = head->qh_link;
element->qh_rlink = head;
head->qh_link = element;
element->qh_link->qh_rlink = element;
}
static __inline void
remque(void *a)
{
struct quehead *element = a;
element->qh_link->qh_rlink = element->qh_rlink;
element->qh_rlink->qh_link = element->qh_link;
element->qh_rlink = 0;
}
#else /* !__GNUC__ */
void insque __P((void *a, void *b));
void remque __P((void *a));
#endif /* __GNUC__ */
#endif /* KERNEL */
#endif /* !_SYS_QUEUE_H_ */