Subject: Re: Undeclared BUFQ_INSERT_HEAD in pmax and amiga kernels
To: NetBSD Mailing list <netbsd@mrynet.com>
From: Simon Burge <simonb@netbsd.org>
List: current-users
Date: 01/24/2000 10:35:00
Simon Burge wrote:

> NetBSD Mailing list wrote:
> 
> > The following occurs in the pmax port when building the GENERIC kernel:
> > 
> > /usr/src/sys/arch/pmax/dev/tz.c
> > 	cc1: warnings being treated as errors
> > 	/usr/src/sys/arch/pmax/dev/tz.c: In function `tzprobe':
> > 	/usr/src/sys/arch/pmax/dev/tz.c:231: warning: implicit declaration of function `BUFQ_INSERT_HEAD'
> > 	*** Error code 1
> > 
> >  [[ ... ]]
> > 
> > The lack of a declaration anywhere suggests that the amiga port would be 
> > exhibiting the same failure with fd.c.
> 
> Ahh, the wrath of the uncompiled commit!  BUFQ_INSERT_HEAD is defined
> in <sys/queue.h>.  rz.c works because it includes <sys/disk.h> which
> includes <sys/queue.h>.  I'll fix this in the next few minutes (when
> my cvs update finishes) by adding <sys/queue.h> to includes for both,
> although I can only test for pmax.

Ick, this wasn't as simple as I first thought (quick pre-coffee
comments!).  I saw the *_INSERT_HEAD and thought it was as simple
as adding <sys/queue.h>.  The problem is that <sys/buf.h> has a
few BUFQ_INSERT_* macros but no BUFQ_INSERT_HEAD.  The following
at least allows me to compile tz.c - I haven't finished building
a complete kernel to see if it works yet.

Jason - does this look right?

Simon.
--
Index: buf.h
===================================================================
RCS file: /cvsroot/syssrc/sys/sys/buf.h,v
retrieving revision 1.36
diff -p -u -r1.36 buf.h
--- buf.h	2000/01/21 23:20:51	1.36
+++ buf.h	2000/01/23 23:31:56
@@ -107,6 +107,13 @@ do {									\
 	(bufq)->bq_barrier = NULL;					\
 } while (/*CONSTCOND*/0)
 
+#define	BUFQ_INSERT_HEAD(bufq, bp)					\
+do {									\
+	TAILQ_INSERT_HEAD(&(bufq)->bq_head, (bp), b_actq);		\
+	if (((bp)->b_flags & B_ORDERED) != 0)				\
+		(bufq)->bq_barrier = (bp);				\
+} while (/*CONSTCOND*/0)
+
 #define	BUFQ_INSERT_TAIL(bufq, bp)					\
 do {									\
 	TAILQ_INSERT_TAIL(&(bufq)->bq_head, (bp), b_actq);		\