Subject: kern/2931: Move boolean_t from vm/vm_param.h to sys/types.h
To: None <gnats-bugs@gnats.netbsd.org>
From: Erik Bertelsen <erik@aarhus1.uni-c.dk>
List: netbsd-bugs
Date: 11/11/1996 08:44:31
>Number:         2931
>Category:       kern
>Synopsis:       Move boolean_t from vm/vm_param.h to sys/types.h
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people (Kernel Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Nov 10 23:20:01 1996
>Last-Modified:
>Originator:     Erik Bertelsen
>Organization:
	
>Release:        NetBSD-current 10 November 1996
>Environment:
	
System: NetBSD aarhus1.uni-c.dk 1.2B NetBSD 1.2B (AARHUS1) #12: Mon Oct 28 08:30:06 MET 1996 erik@aarhus1.uni-c.dk:/usr/src/sys/arch/pmax/compile/AARHUS1 pmax


>Description:
	The typedef'ed type boolean_t is in several parts of the kernel, incl.
	/sys/vm and /sys/ddb, miscfs/procfs, arch/{i386, m68k, mac68k, pmax}.
	It may also be used in other ports, but the list above covers those
	ports for which I have the sources.

	Boolean_t is defined in <vm/vm_param.h> with a remark that it is there
	instead of in sys/types (where it really belongs) to avoid breaking
	many programs.

	The consequence of this is that many modules have to include 
	<vm/vm_param.h> just to declare boolean_t -- some just pull in
	<vm/vm.h> to do this. This is also true for modules that really
	have nothing with vm to do.

	Furthermore /sys/dev/ic/pdq* even defines its own type pdq_boolean_t
	with the same functionality.

	To clean up this mess, I suggest to move the declaration of
	boolean_t to types.h, but if it should not be exposed to user
	land programs, it can be guarded by _KERNEL as shown in the patch
	below.

	After applying the patch below, several other source files in
	the kernel may have their includes cleaned up, often by omitting
	includes from <vm/> that become non-needed.

	best regards
	Erik Bertelsen

>How-To-Repeat:
>Fix:
*** vm_param.h.orig	Mon Nov 11 08:29:31 1996
--- vm_param.h	Mon Nov 11 08:32:06 1996
***************
*** 74,86 ****
  #include <machine/vmparam.h>
  
  /*
-  * This belongs in types.h, but breaks too many existing programs.
-  */
- typedef int	boolean_t;
- #define	TRUE	1
- #define	FALSE	0
- 
- /*
   *	The machine independent pages are refered to as PAGES.  A page
   *	is some number of hardware pages, depending on the target machine.
   */
--- 74,79 ----
*** types.h.orig	Mon Nov 11 08:29:26 1996
--- types.h	Mon Nov 11 08:32:01 1996
***************
*** 64,69 ****
--- 64,77 ----
  typedef	u_int64_t	u_quad_t;	/* quads */
  typedef	int64_t		quad_t;
  typedef	quad_t *	qaddr_t;
+ #ifdef _KERNEL
+ /*
+  * This is restricted to the kernel to avoid breaking too many existing programs.
+  */
+ typedef int	boolean_t;
+ #define	TRUE	1
+ #define	FALSE	0
+ #endif
  
  typedef	char *		caddr_t;	/* core address */
  typedef	int32_t		daddr_t;	/* disk address */
>Audit-Trail:
>Unformatted: