Subject: port-m68k/3213: db_machdep.h includes too many vm/xxx headers
To: None <gnats-bugs@gnats.netbsd.org>
From: Erik Bertelsen <erik@erik-be.uni-c.dk>
List: netbsd-bugs
Date: 02/11/1997 21:59:58
>Number:         3213
>Category:       port-m68k
>Synopsis:       db_machdep.h includes too many vm/xxx headers
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    gnats-admin (GNATS administrator)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Feb 11 12:05:00 1997
>Last-Modified:
>Originator:     Erik Bertelsen
>Organization:
UNI-C
>Release:        NetBSD-current 7 feb 1997
>Environment:
System: NetBSD erik-be.uni-c.dk 1.2C NetBSD 1.2C (ERIKBE) #4: Fri Feb 7 14:20:40 MET 1997 erik@erik-be.uni-c.dk:/sw/NetBSD/src/sys/arch/i386/compile/ERIKBE i386



>Description:
	When reading through some printouts of some of the m68k headers
	in an attempt to learn a little more about the MD parts of 
	NetBSD/mac68k, I wondered why arch/m68k/include/db_machdep.h
	seemed to include a lot of headers from sys/vm.

	By doing changes and recompiles, I could see that (at least on
	the mac68k), this could be reduced significantly. Doing this
	will make this header a little more understandable, will reduce
	compile time slightly and reduce the number of header file 
	dependencies.

	I also add an extern specifier to the declaration of ddb_regs.
	If there is a good reason not to do this, it may be removed from
	my patch, but I prefer headers to contain just declarations and
	leave the definitions off to an appropriate .c file.
>How-To-Repeat:
	inspect m68k/include/db_machdep.h.

	Note: a similar patch applies to i386/include/db_machdep.h that
	is even worse by including <vm/vm.h> to pull in about 10 other
	mostly superflouous headers.....
>Fix:

Index: db_machdep.h
===================================================================
RCS file: /usr/cvs-base/src/sys/arch/m68k/include/db_machdep.h,v
retrieving revision 1.1.1.3
diff -c -r1.1.1.3 db_machdep.h
*** db_machdep.h	1997/01/30 21:30:09	1.1.1.3
--- db_machdep.h	1997/02/11 18:42:51
***************
*** 32,51 ****
  #ifndef	_M68K_DB_MACHDEP_H_
  #define	_M68K_DB_MACHDEP_H_
  
! #include <vm/vm_prot.h>
! #include <vm/vm_param.h>
! #include <vm/vm_inherit.h>
! #include <vm/lock.h>
  
  #include <machine/frame.h>
- #include <machine/psl.h>
  #include <machine/trap.h>
  
  typedef	vm_offset_t	db_addr_t;	/* address - unsigned */
  typedef	int		db_expr_t;	/* expression - signed */
  typedef struct trapframe db_regs_t;
  
! db_regs_t	ddb_regs;		/* register state */
  #define DDB_REGS	(&ddb_regs)
  
  #define	PC_REGS(regs)	((db_addr_t)(regs)->tf_pc)
--- 32,47 ----
  #ifndef	_M68K_DB_MACHDEP_H_
  #define	_M68K_DB_MACHDEP_H_
  
! #include <sys/types.h>
  
  #include <machine/frame.h>
  #include <machine/trap.h>
  
  typedef	vm_offset_t	db_addr_t;	/* address - unsigned */
  typedef	int		db_expr_t;	/* expression - signed */
  typedef struct trapframe db_regs_t;
  
! extern db_regs_t	ddb_regs;		/* register state */
  #define DDB_REGS	(&ddb_regs)
  
  #define	PC_REGS(regs)	((db_addr_t)(regs)->tf_pc)
>Audit-Trail:
>Unformatted: