What does sys/proc.h have to do with dev/pci?  The answer should probably 
be not much, but in reality is closer to quite a bit.

As part of the ongoing rthreads work, I'm making some changes to internal 
fields of struct proc.  These fields are only accessed by files under 
kern.  Why then, I wondered, did minor changes require the entire kernel 
to be recompiled.  Because everything includes sys/proc.h!

Some code is after tsleep and wakeup.  Other code is after one of proc.h's 
tagalong includes, like timeout.h.  But no reason to drag all of proc.h in 
for such things.

Following diff moves tsleep and wakeup into param.h (not sure of a better 
place to put them, but it seems reasonable), and converts a sample few pci 
drivers to a proc.h free existence.

This has two benefits.  First, all kernel compiles get faster, as they 
have less text to process for many files.  Second, it makes development 
faster by reducing the set of dependencies for a recompile.

Index: dev/pci/ips.c
===================================================================
RCS file: /home/tedu/cvs/src/sys/dev/pci/ips.c,v
retrieving revision 1.95
diff -u -r1.95 ips.c
--- dev/pci/ips.c       23 Mar 2010 01:57:20 -0000      1.95
+++ dev/pci/ips.c       2 Apr 2010 03:31:18 -0000
@@ -29,7 +29,6 @@
 #include <sys/ioctl.h>
 #include <sys/kernel.h>
 #include <sys/malloc.h>
-#include <sys/proc.h>
 #include <sys/sensors.h>
 #include <sys/timeout.h>
 #include <sys/queue.h>
Index: dev/pci/mpii.c
===================================================================
RCS file: /home/tedu/cvs/src/sys/dev/pci/mpii.c,v
retrieving revision 1.12
diff -u -r1.12 mpii.c
--- dev/pci/mpii.c      23 Mar 2010 01:57:20 -0000      1.12
+++ dev/pci/mpii.c      2 Apr 2010 03:32:35 -0000
@@ -25,7 +25,6 @@
 #include <sys/buf.h>
 #include <sys/device.h>
 #include <sys/ioctl.h>
-#include <sys/proc.h>
 #include <sys/malloc.h>
 #include <sys/kernel.h>
 #include <sys/rwlock.h>
Index: dev/pci/nofn.c
===================================================================
RCS file: /home/tedu/cvs/src/sys/dev/pci/nofn.c,v
retrieving revision 1.16
diff -u -r1.16 nofn.c
--- dev/pci/nofn.c      22 May 2008 19:23:04 -0000      1.16
+++ dev/pci/nofn.c      2 Apr 2010 03:34:33 -0000
@@ -37,13 +37,13 @@
 
 #include <sys/param.h>
 #include <sys/systm.h>
-#include <sys/proc.h>
 #include <sys/errno.h>
 #include <sys/malloc.h>
 #include <sys/kernel.h>
 #include <sys/mbuf.h>
 #include <sys/device.h>
 #include <sys/queue.h>
+#include <sys/timeout.h>
 
 #include <crypto/cryptodev.h>
 #include <crypto/cryptosoft.h>
Index: dev/pci/ppb.c
===================================================================
RCS file: /home/tedu/cvs/src/sys/dev/pci/ppb.c,v
retrieving revision 1.40
diff -u -r1.40 ppb.c
--- dev/pci/ppb.c       27 Dec 2009 20:03:52 -0000      1.40
+++ dev/pci/ppb.c       2 Apr 2010 03:34:44 -0000
@@ -35,7 +35,7 @@
 #include <sys/systm.h>
 #include <sys/kernel.h>
 #include <sys/device.h>
-#include <sys/proc.h>
+#include <sys/timeout.h>
 #include <sys/workq.h>
 
 #include <dev/pci/pcireg.h>
Index: dev/pci/safe.c
===================================================================
RCS file: /home/tedu/cvs/src/sys/dev/pci/safe.c,v
retrieving revision 1.27
diff -u -r1.27 safe.c
--- dev/pci/safe.c      10 Jan 2010 12:43:07 -0000      1.27
+++ dev/pci/safe.c      2 Apr 2010 03:33:43 -0000
@@ -36,7 +36,6 @@
  */
 #include <sys/param.h>
 #include <sys/systm.h>
-#include <sys/proc.h>
 #include <sys/errno.h>
 #include <sys/malloc.h>
 #include <sys/kernel.h>
Index: dev/pci/yds.c
===================================================================
RCS file: /home/tedu/cvs/src/sys/dev/pci/yds.c,v
retrieving revision 1.32
diff -u -r1.32 yds.c
--- dev/pci/yds.c       29 Mar 2009 21:53:53 -0000      1.32
+++ dev/pci/yds.c       2 Apr 2010 03:31:32 -0000
@@ -45,7 +45,6 @@
 #include <sys/fcntl.h>
 #include <sys/malloc.h>
 #include <sys/device.h>
-#include <sys/proc.h>
 #include <sys/queue.h>
 #include <sys/fcntl.h>
 
Index: sys/param.h
===================================================================
RCS file: /home/tedu/cvs/src/sys/sys/param.h,v
retrieving revision 1.86
diff -u -r1.86 param.h
--- sys/param.h 17 Feb 2010 21:46:43 -0000      1.86
+++ sys/param.h 2 Apr 2010 03:31:07 -0000
@@ -85,6 +85,23 @@
 #include <sys/resource.h>
 #include <sys/ucred.h>
 #include <sys/uio.h>
+struct sleep_state;
+struct mutex;
+void   sleep_setup(struct sleep_state *, const volatile void *, int,
+           const char *);
+void   sleep_setup_timeout(struct sleep_state *, int);
+void   sleep_setup_signal(struct sleep_state *, int);
+void   sleep_finish(struct sleep_state *, int);
+int    sleep_finish_timeout(struct sleep_state *);
+int    sleep_finish_signal(struct sleep_state *);
+void   sleep_queue_init(void);
+
+void    wakeup_n(const volatile void *, int);
+void    wakeup(const volatile void *);
+#define wakeup_one(c) wakeup_n((c), 1)
+int    tsleep(const volatile void *, int, const char *, int);
+int    msleep(const volatile void *, struct mutex *, int,  const char*, int);
+
 #endif
 
 /* Signals. */
Index: sys/proc.h
===================================================================
RCS file: /home/tedu/cvs/src/sys/sys/proc.h,v
retrieving revision 1.124
diff -u -r1.124 proc.h
--- sys/proc.h  24 Mar 2010 23:18:17 -0000      1.124
+++ sys/proc.h  2 Apr 2010 03:30:20 -0000
@@ -429,9 +429,6 @@
 void   resetpriority(struct proc *);
 void   setrunnable(struct proc *);
 void   unsleep(struct proc *);
-void    wakeup_n(const volatile void *, int);
-void    wakeup(const volatile void *);
-#define wakeup_one(c) wakeup_n((c), 1)
 void   reaper(void);
 void   exit1(struct proc *, int, int);
 void   exit2(struct proc *);
@@ -452,18 +449,6 @@
        int sls_do_sleep;
        int sls_sig;
 };
-
-void   sleep_setup(struct sleep_state *, const volatile void *, int,
-           const char *);
-void   sleep_setup_timeout(struct sleep_state *, int);
-void   sleep_setup_signal(struct sleep_state *, int);
-void   sleep_finish(struct sleep_state *, int);
-int    sleep_finish_timeout(struct sleep_state *);
-int    sleep_finish_signal(struct sleep_state *);
-void   sleep_queue_init(void);
-
-int    tsleep(const volatile void *, int, const char *, int);
-int    msleep(const volatile void *, struct mutex *, int,  const char*, int);
 
 #if defined(MULTIPROCESSOR)
 void   proc_trampoline_mp(void);       /* XXX */

Reply via email to