summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorjulian <julian@FreeBSD.org>1995-09-03 05:43:50 +0000
committerjulian <julian@FreeBSD.org>1995-09-03 05:43:50 +0000
commit3b421a628b770ce7d903f166e047d7dc8e672ed7 (patch)
tree48c036cfd246d74ad2a6c99044f9938396941363 /sys
parent6759a9710d59bc29e3766f8fa8c2699111015c60 (diff)
downloadFreeBSD-src-3b421a628b770ce7d903f166e047d7dc8e672ed7.zip
FreeBSD-src-3b421a628b770ce7d903f166e047d7dc8e672ed7.tar.gz
devfs changes..
changes to allow devices that don't probe (e.g. /dev/mem) to create devfs entries this required giving 'configure' its own SYSINIT entry so we could duck in just before it with a DEVFS init and some device inits.. my devfs now looks like: ./misc ./misc/speaker ./misc/mem ./misc/kmem ./misc/null ./misc/zero ./misc/io ./misc/console ./misc/pcaudio ./misc/pcaudioctl ./disks ./disks/rfloppy ./disks/rfloppy/fd0.1440 ./disks/rfloppy/fd1.1200 ./disks/floppy ./disks/floppy/fd0.1440 ./disks/floppy/fd1.1200 also some sligt cleanups.. DEVFS needs a lot of work but I'm getting back to it..
Diffstat (limited to 'sys')
-rw-r--r--sys/amd64/amd64/autoconf.c9
-rw-r--r--sys/amd64/amd64/machdep.c14
-rw-r--r--sys/amd64/amd64/mem.c22
-rw-r--r--sys/amd64/include/md_var.h3
-rw-r--r--sys/dev/fdc/fdc.c11
-rw-r--r--sys/dev/speaker/spkr.c16
-rw-r--r--sys/i386/i386/autoconf.c9
-rw-r--r--sys/i386/i386/cons.c15
-rw-r--r--sys/i386/i386/machdep.c14
-rw-r--r--sys/i386/i386/mem.c22
-rw-r--r--sys/i386/include/md_var.h3
-rw-r--r--sys/i386/isa/fd.c11
-rw-r--r--sys/i386/isa/pcaudio.c17
-rw-r--r--sys/i386/isa/spkr.c16
-rw-r--r--sys/isa/fd.c11
-rw-r--r--sys/kern/init_main.c4
-rw-r--r--sys/kern/tty_cons.c15
-rw-r--r--sys/miscfs/devfs/devfs_back.c145
-rw-r--r--sys/miscfs/devfs/devfs_proto.h6
-rw-r--r--sys/miscfs/devfs/devfs_vfsops.c6
-rw-r--r--sys/miscfs/devfs/reproto.sh6
-rw-r--r--sys/sys/devfsext.h11
-rw-r--r--sys/sys/kernel.h8
23 files changed, 269 insertions, 125 deletions
diff --git a/sys/amd64/amd64/autoconf.c b/sys/amd64/amd64/autoconf.c
index fbeeee7..4eb5684 100644
--- a/sys/amd64/amd64/autoconf.c
+++ b/sys/amd64/amd64/autoconf.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)autoconf.c 7.1 (Berkeley) 5/9/91
- * $Id: autoconf.c,v 1.35 1995/08/28 09:17:44 julian Exp $
+ * $Id: autoconf.c,v 1.36 1995/08/30 01:34:20 bde Exp $
*/
/*
@@ -159,7 +159,7 @@ configure_finish()
* Determine i/o configuration for a machine.
*/
void
-configure()
+configure( caddr_t dummy ) /* arg not used */
{
configure_start();
@@ -239,6 +239,11 @@ configure()
setconf();
cold = 0;
}
+/*
+ * Add a SYSINIT entry so that Configure gets called at the right time.
+ */
+SYSINIT(configure, SI_SUB_CONFIGURE, SI_ORDER_FIRST, configure, NULL)
+
int
setdumpdev(dev)
diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c
index 5618983..fc9ca70 100644
--- a/sys/amd64/amd64/machdep.c
+++ b/sys/amd64/amd64/machdep.c
@@ -35,7 +35,7 @@
* SUCH DAMAGE.
*
* from: @(#)machdep.c 7.4 (Berkeley) 6/3/91
- * $Id: machdep.c,v 1.136 1995/08/20 04:41:02 davidg Exp $
+ * $Id: machdep.c,v 1.137 1995/08/28 09:17:46 julian Exp $
*/
#include "npx.h"
@@ -398,19 +398,19 @@ again:
vm_pager_bufferinit();
/*
- * Configure the system.
+ * if we need it, print out the Bios's idea of geometry
*/
- configure();
if (bootverbose) {
printf("BIOS Geometries:\n");
for (i=0; i < N_BIOS_GEOM; i++) {
int j = bootinfo.bi_bios_geom[i];
if (j == 0x4f010f)
continue;
- printf(" %x:%08x", i, j);
- printf(" %d cyl, %d heads, %d sects\n",
- j >> 16, (j >> 8) & 0xff, j & 0xff);
-
+ printf(" %x:%08x ", i, j);
+ printf("0..%d=%d cyl, 0..%d=%d heads, 1..%d=%d sects\n",
+ (j >> 16),(j >> 16)+1,
+ ((j >> 8) & 0xff),((j >> 8) & 0xff)+1,
+ (j & 0xff), (j & 0xff));
}
printf(" %d accounted for\n", bootinfo.bi_n_bios_used);
}
diff --git a/sys/amd64/amd64/mem.c b/sys/amd64/amd64/mem.c
index 0d95688..c17a64f 100644
--- a/sys/amd64/amd64/mem.c
+++ b/sys/amd64/amd64/mem.c
@@ -38,7 +38,7 @@
*
* from: Utah $Hdr: mem.c 1.13 89/10/08$
* from: @(#)mem.c 7.2 (Berkeley) 5/9/91
- * $Id: mem.c,v 1.8 1994/05/25 08:54:24 rgrimes Exp $
+ * $Id: mem.c,v 1.9 1994/08/06 10:25:34 davidg Exp $
*/
/*
@@ -62,6 +62,26 @@
#include <vm/vm_prot.h>
#include <vm/pmap.h>
+#ifdef DEVFS
+#include <sys/devfsext.h>
+#include "sys/kernel.h"
+int mmopen();
+
+void memdev_init(caddr_t data) /* data not used */
+{
+ void * x;
+/* path name devsw minor type uid gid perm*/
+ x=dev_add("/misc", "mem", mmopen, 0, DV_CHR, 0, 2, 0640);
+ x=dev_add("/misc", "kmem", mmopen, 1, DV_CHR, 0, 2, 0640);
+ x=dev_add("/misc", "null", mmopen, 2, DV_CHR, 0, 0, 0666);
+ x=dev_add("/misc", "zero", mmopen, 12, DV_CHR, 0, 0, 0666);
+ x=dev_add("/misc", "io", mmopen, 14, DV_CHR, 0, 2, 0640);
+}
+SYSINIT(memdev,SI_SUB_DEVFS, SI_ORDER_ANY, memdev_init, NULL)
+#endif /*DEVFS*/
+
+
+
extern char *ptvmmap; /* poor name! */
/*ARGSUSED*/
int
diff --git a/sys/amd64/include/md_var.h b/sys/amd64/include/md_var.h
index 34854b0..2528d73 100644
--- a/sys/amd64/include/md_var.h
+++ b/sys/amd64/include/md_var.h
@@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: md_var.h,v 1.2 1995/03/28 07:55:08 bde Exp $
+ * $Id: md_var.h,v 1.3 1995/05/30 08:00:43 rgrimes Exp $
*/
#ifndef _MACHINE_MD_VAR_H_
@@ -52,7 +52,6 @@ extern int szsigcode;
struct proc;
struct reg;
-void configure __P((void));
void cpu_reset __P((void));
void doreti_iret __P((void)) __asm(__STRING(doreti_iret));
void doreti_iret_fault __P((void)) __asm(__STRING(doreti_iret_fault));
diff --git a/sys/dev/fdc/fdc.c b/sys/dev/fdc/fdc.c
index 3c46823..17bef91 100644
--- a/sys/dev/fdc/fdc.c
+++ b/sys/dev/fdc/fdc.c
@@ -43,7 +43,7 @@
* SUCH DAMAGE.
*
* from: @(#)fd.c 7.4 (Berkeley) 5/25/91
- * $Id: fd.c,v 1.61.2.1 1995/06/08 10:26:23 davidg Exp $
+ * $Id: fd.c,v 1.62 1995/06/11 19:31:19 rgrimes Exp $
*
*/
@@ -82,6 +82,9 @@
#include <sys/ftape.h>
#include <i386/isa/ftreg.h>
#endif
+#ifdef DEVFS
+#include <sys/devfsext.h>
+#endif
static int fd_goaway(struct kern_devconf *, int);
static int fdc_goaway(struct kern_devconf *, int);
@@ -557,7 +560,7 @@ fdattach(struct isa_device *dev)
int ic_type = 0;
#ifdef DEVFS
char name[64];
- caddr_t key;
+ void *key;
#endif /* DEVFS */
fdc->fdcu = fdcu;
@@ -753,9 +756,9 @@ fdattach(struct isa_device *dev)
kdc_fd[fdu].kdc_state = DC_IDLE;
#ifdef DEVFS
key = dev_add("/disks/rfloppy",name,(caddr_t)Fdopen,fdu * 8,
- 0,0,0,0644);
+ DV_CHR,0,0,0644);
key = dev_add("/disks/floppy",name,(caddr_t)Fdopen,fdu * 8,
- 1,0,0,0644);
+ DV_BLK,0,0,0644);
#endif /* DEVFS */
if (dk_ndrive < DK_NDRIVE) {
sprintf(dk_names[dk_ndrive], "fd%d", fdu);
diff --git a/sys/dev/speaker/spkr.c b/sys/dev/speaker/spkr.c
index 4c1f128..9a98251 100644
--- a/sys/dev/speaker/spkr.c
+++ b/sys/dev/speaker/spkr.c
@@ -4,7 +4,7 @@
* v1.4 by Eric S. Raymond (esr@snark.thyrsus.com) Aug 1993
* modified for FreeBSD by Andrew A. Chernov <ache@astral.msk.su>
*
- * $Id: spkr.c,v 1.13 1995/05/05 06:15:11 davidg Exp $
+ * $Id: spkr.c,v 1.14 1995/05/30 08:03:09 rgrimes Exp $
*/
#include "speaker.h"
@@ -23,6 +23,20 @@
#include <machine/clock.h>
#include <machine/speaker.h>
+#ifdef DEVFS
+#include <sys/devfsext.h>
+#include "sys/kernel.h"
+int spkropen();
+
+void spkrdev_init(caddr_t data) /* data not used */
+{
+ void * x;
+/* path name devsw minor type uid gid perm*/
+ x=dev_add("/misc", "speaker", spkropen, 0, DV_CHR, 0, 0, 0600);
+}
+SYSINIT(spkrdev,SI_SUB_DEVFS, SI_ORDER_ANY, spkrdev_init, NULL)
+#endif /*DEVFS*/
+
/**************** MACHINE DEPENDENT PART STARTS HERE *************************
*
* This section defines a function tone() which causes a tone of given
diff --git a/sys/i386/i386/autoconf.c b/sys/i386/i386/autoconf.c
index fbeeee7..4eb5684 100644
--- a/sys/i386/i386/autoconf.c
+++ b/sys/i386/i386/autoconf.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)autoconf.c 7.1 (Berkeley) 5/9/91
- * $Id: autoconf.c,v 1.35 1995/08/28 09:17:44 julian Exp $
+ * $Id: autoconf.c,v 1.36 1995/08/30 01:34:20 bde Exp $
*/
/*
@@ -159,7 +159,7 @@ configure_finish()
* Determine i/o configuration for a machine.
*/
void
-configure()
+configure( caddr_t dummy ) /* arg not used */
{
configure_start();
@@ -239,6 +239,11 @@ configure()
setconf();
cold = 0;
}
+/*
+ * Add a SYSINIT entry so that Configure gets called at the right time.
+ */
+SYSINIT(configure, SI_SUB_CONFIGURE, SI_ORDER_FIRST, configure, NULL)
+
int
setdumpdev(dev)
diff --git a/sys/i386/i386/cons.c b/sys/i386/i386/cons.c
index 9f18dd9..af17d13 100644
--- a/sys/i386/i386/cons.c
+++ b/sys/i386/i386/cons.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* from: @(#)cons.c 7.2 (Berkeley) 5/9/91
- * $Id: cons.c,v 1.29 1995/06/14 04:52:39 bde Exp $
+ * $Id: cons.c,v 1.30 1995/06/26 07:39:49 bde Exp $
*/
#include <sys/param.h>
@@ -76,6 +76,19 @@ static d_open_t *cn_phys_open; /* physical device open function */
static struct consdev *cn_tab; /* physical console device info */
static struct tty *cn_tp; /* physical console tty struct */
+#ifdef DEVFS
+#include <sys/devfsext.h>
+#include "sys/kernel.h"
+
+void cndev_init(caddr_t data) /* data not used */
+{
+ void * x;
+/* path name devsw minor type uid gid perm*/
+ x=dev_add("/misc", "console", cnopen, 0, DV_CHR, 0, 0, 0640);
+}
+SYSINIT(cndev,SI_SUB_DEVFS, SI_ORDER_ANY, cndev_init, NULL)
+#endif /*DEVFS*/
+
void
cninit()
{
diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c
index 5618983..fc9ca70 100644
--- a/sys/i386/i386/machdep.c
+++ b/sys/i386/i386/machdep.c
@@ -35,7 +35,7 @@
* SUCH DAMAGE.
*
* from: @(#)machdep.c 7.4 (Berkeley) 6/3/91
- * $Id: machdep.c,v 1.136 1995/08/20 04:41:02 davidg Exp $
+ * $Id: machdep.c,v 1.137 1995/08/28 09:17:46 julian Exp $
*/
#include "npx.h"
@@ -398,19 +398,19 @@ again:
vm_pager_bufferinit();
/*
- * Configure the system.
+ * if we need it, print out the Bios's idea of geometry
*/
- configure();
if (bootverbose) {
printf("BIOS Geometries:\n");
for (i=0; i < N_BIOS_GEOM; i++) {
int j = bootinfo.bi_bios_geom[i];
if (j == 0x4f010f)
continue;
- printf(" %x:%08x", i, j);
- printf(" %d cyl, %d heads, %d sects\n",
- j >> 16, (j >> 8) & 0xff, j & 0xff);
-
+ printf(" %x:%08x ", i, j);
+ printf("0..%d=%d cyl, 0..%d=%d heads, 1..%d=%d sects\n",
+ (j >> 16),(j >> 16)+1,
+ ((j >> 8) & 0xff),((j >> 8) & 0xff)+1,
+ (j & 0xff), (j & 0xff));
}
printf(" %d accounted for\n", bootinfo.bi_n_bios_used);
}
diff --git a/sys/i386/i386/mem.c b/sys/i386/i386/mem.c
index 0d95688..c17a64f 100644
--- a/sys/i386/i386/mem.c
+++ b/sys/i386/i386/mem.c
@@ -38,7 +38,7 @@
*
* from: Utah $Hdr: mem.c 1.13 89/10/08$
* from: @(#)mem.c 7.2 (Berkeley) 5/9/91
- * $Id: mem.c,v 1.8 1994/05/25 08:54:24 rgrimes Exp $
+ * $Id: mem.c,v 1.9 1994/08/06 10:25:34 davidg Exp $
*/
/*
@@ -62,6 +62,26 @@
#include <vm/vm_prot.h>
#include <vm/pmap.h>
+#ifdef DEVFS
+#include <sys/devfsext.h>
+#include "sys/kernel.h"
+int mmopen();
+
+void memdev_init(caddr_t data) /* data not used */
+{
+ void * x;
+/* path name devsw minor type uid gid perm*/
+ x=dev_add("/misc", "mem", mmopen, 0, DV_CHR, 0, 2, 0640);
+ x=dev_add("/misc", "kmem", mmopen, 1, DV_CHR, 0, 2, 0640);
+ x=dev_add("/misc", "null", mmopen, 2, DV_CHR, 0, 0, 0666);
+ x=dev_add("/misc", "zero", mmopen, 12, DV_CHR, 0, 0, 0666);
+ x=dev_add("/misc", "io", mmopen, 14, DV_CHR, 0, 2, 0640);
+}
+SYSINIT(memdev,SI_SUB_DEVFS, SI_ORDER_ANY, memdev_init, NULL)
+#endif /*DEVFS*/
+
+
+
extern char *ptvmmap; /* poor name! */
/*ARGSUSED*/
int
diff --git a/sys/i386/include/md_var.h b/sys/i386/include/md_var.h
index 34854b0..2528d73 100644
--- a/sys/i386/include/md_var.h
+++ b/sys/i386/include/md_var.h
@@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: md_var.h,v 1.2 1995/03/28 07:55:08 bde Exp $
+ * $Id: md_var.h,v 1.3 1995/05/30 08:00:43 rgrimes Exp $
*/
#ifndef _MACHINE_MD_VAR_H_
@@ -52,7 +52,6 @@ extern int szsigcode;
struct proc;
struct reg;
-void configure __P((void));
void cpu_reset __P((void));
void doreti_iret __P((void)) __asm(__STRING(doreti_iret));
void doreti_iret_fault __P((void)) __asm(__STRING(doreti_iret_fault));
diff --git a/sys/i386/isa/fd.c b/sys/i386/isa/fd.c
index 3c46823..17bef91 100644
--- a/sys/i386/isa/fd.c
+++ b/sys/i386/isa/fd.c
@@ -43,7 +43,7 @@
* SUCH DAMAGE.
*
* from: @(#)fd.c 7.4 (Berkeley) 5/25/91
- * $Id: fd.c,v 1.61.2.1 1995/06/08 10:26:23 davidg Exp $
+ * $Id: fd.c,v 1.62 1995/06/11 19:31:19 rgrimes Exp $
*
*/
@@ -82,6 +82,9 @@
#include <sys/ftape.h>
#include <i386/isa/ftreg.h>
#endif
+#ifdef DEVFS
+#include <sys/devfsext.h>
+#endif
static int fd_goaway(struct kern_devconf *, int);
static int fdc_goaway(struct kern_devconf *, int);
@@ -557,7 +560,7 @@ fdattach(struct isa_device *dev)
int ic_type = 0;
#ifdef DEVFS
char name[64];
- caddr_t key;
+ void *key;
#endif /* DEVFS */
fdc->fdcu = fdcu;
@@ -753,9 +756,9 @@ fdattach(struct isa_device *dev)
kdc_fd[fdu].kdc_state = DC_IDLE;
#ifdef DEVFS
key = dev_add("/disks/rfloppy",name,(caddr_t)Fdopen,fdu * 8,
- 0,0,0,0644);
+ DV_CHR,0,0,0644);
key = dev_add("/disks/floppy",name,(caddr_t)Fdopen,fdu * 8,
- 1,0,0,0644);
+ DV_BLK,0,0,0644);
#endif /* DEVFS */
if (dk_ndrive < DK_NDRIVE) {
sprintf(dk_names[dk_ndrive], "fd%d", fdu);
diff --git a/sys/i386/isa/pcaudio.c b/sys/i386/isa/pcaudio.c
index f53b925..a3e93b1 100644
--- a/sys/i386/isa/pcaudio.c
+++ b/sys/i386/isa/pcaudio.c
@@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: pcaudio.c,v 1.12 1995/03/30 14:33:03 sos Exp $
+ * $Id: pcaudio.c,v 1.13 1995/05/30 08:02:55 rgrimes Exp $
*/
#include "pca.h"
@@ -245,6 +245,18 @@ pca_registerdev(struct isa_device *id)
dev_attach(&kdc_pca[id->id_unit]);
}
+#ifdef DEVFS
+#include <sys/devfsext.h>
+
+void pcadev_init(caddr_t data) /* data not used */
+{
+ void * x;
+/* path name devsw minor type uid gid perm*/
+ x=dev_add("/misc", "pcaudio", pcaopen, 0, DV_CHR, 0, 0, 0666);
+ x=dev_add("/misc", "pcaudioctl", pcaopen, 128, DV_CHR, 0, 0, 0666);
+}
+#endif /*DEVFS*/
+
int
pcaattach(struct isa_device *dvp)
@@ -252,6 +264,9 @@ pcaattach(struct isa_device *dvp)
printf("pca%d: PC speaker audio driver\n", dvp->id_unit);
pca_init();
pca_registerdev(dvp);
+#ifdef DEVFS
+ pcadev_init(NULL);
+#endif /*DEVFS*/
return 1;
}
diff --git a/sys/i386/isa/spkr.c b/sys/i386/isa/spkr.c
index 4c1f128..9a98251 100644
--- a/sys/i386/isa/spkr.c
+++ b/sys/i386/isa/spkr.c
@@ -4,7 +4,7 @@
* v1.4 by Eric S. Raymond (esr@snark.thyrsus.com) Aug 1993
* modified for FreeBSD by Andrew A. Chernov <ache@astral.msk.su>
*
- * $Id: spkr.c,v 1.13 1995/05/05 06:15:11 davidg Exp $
+ * $Id: spkr.c,v 1.14 1995/05/30 08:03:09 rgrimes Exp $
*/
#include "speaker.h"
@@ -23,6 +23,20 @@
#include <machine/clock.h>
#include <machine/speaker.h>
+#ifdef DEVFS
+#include <sys/devfsext.h>
+#include "sys/kernel.h"
+int spkropen();
+
+void spkrdev_init(caddr_t data) /* data not used */
+{
+ void * x;
+/* path name devsw minor type uid gid perm*/
+ x=dev_add("/misc", "speaker", spkropen, 0, DV_CHR, 0, 0, 0600);
+}
+SYSINIT(spkrdev,SI_SUB_DEVFS, SI_ORDER_ANY, spkrdev_init, NULL)
+#endif /*DEVFS*/
+
/**************** MACHINE DEPENDENT PART STARTS HERE *************************
*
* This section defines a function tone() which causes a tone of given
diff --git a/sys/isa/fd.c b/sys/isa/fd.c
index 3c46823..17bef91 100644
--- a/sys/isa/fd.c
+++ b/sys/isa/fd.c
@@ -43,7 +43,7 @@
* SUCH DAMAGE.
*
* from: @(#)fd.c 7.4 (Berkeley) 5/25/91
- * $Id: fd.c,v 1.61.2.1 1995/06/08 10:26:23 davidg Exp $
+ * $Id: fd.c,v 1.62 1995/06/11 19:31:19 rgrimes Exp $
*
*/
@@ -82,6 +82,9 @@
#include <sys/ftape.h>
#include <i386/isa/ftreg.h>
#endif
+#ifdef DEVFS
+#include <sys/devfsext.h>
+#endif
static int fd_goaway(struct kern_devconf *, int);
static int fdc_goaway(struct kern_devconf *, int);
@@ -557,7 +560,7 @@ fdattach(struct isa_device *dev)
int ic_type = 0;
#ifdef DEVFS
char name[64];
- caddr_t key;
+ void *key;
#endif /* DEVFS */
fdc->fdcu = fdcu;
@@ -753,9 +756,9 @@ fdattach(struct isa_device *dev)
kdc_fd[fdu].kdc_state = DC_IDLE;
#ifdef DEVFS
key = dev_add("/disks/rfloppy",name,(caddr_t)Fdopen,fdu * 8,
- 0,0,0,0644);
+ DV_CHR,0,0,0644);
key = dev_add("/disks/floppy",name,(caddr_t)Fdopen,fdu * 8,
- 1,0,0,0644);
+ DV_BLK,0,0,0644);
#endif /* DEVFS */
if (dk_ndrive < DK_NDRIVE) {
sprintf(dk_names[dk_ndrive], "fd%d", fdu);
diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c
index 6f1735b..447483d 100644
--- a/sys/kern/init_main.c
+++ b/sys/kern/init_main.c
@@ -39,7 +39,7 @@
* SUCH DAMAGE.
*
* @(#)init_main.c 8.9 (Berkeley) 1/21/94
- * $Id: init_main.c,v 1.27 1995/08/28 09:18:42 julian Exp $
+ * $Id: init_main.c,v 1.28 1995/08/29 23:59:22 bde Exp $
*/
#include <sys/param.h>
@@ -223,7 +223,7 @@ main(framep)
/* ARGSUSED*/
void
kproc_start( udata)
-caddr_t udata; /* not used*/
+caddr_t udata; /* pointer to a 'kproc_desc' ? */
{
struct kproc_desc *kp = (struct kproc_desc *)udata;
struct proc *p = curproc;
diff --git a/sys/kern/tty_cons.c b/sys/kern/tty_cons.c
index 9f18dd9..af17d13 100644
--- a/sys/kern/tty_cons.c
+++ b/sys/kern/tty_cons.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* from: @(#)cons.c 7.2 (Berkeley) 5/9/91
- * $Id: cons.c,v 1.29 1995/06/14 04:52:39 bde Exp $
+ * $Id: cons.c,v 1.30 1995/06/26 07:39:49 bde Exp $
*/
#include <sys/param.h>
@@ -76,6 +76,19 @@ static d_open_t *cn_phys_open; /* physical device open function */
static struct consdev *cn_tab; /* physical console device info */
static struct tty *cn_tp; /* physical console tty struct */
+#ifdef DEVFS
+#include <sys/devfsext.h>
+#include "sys/kernel.h"
+
+void cndev_init(caddr_t data) /* data not used */
+{
+ void * x;
+/* path name devsw minor type uid gid perm*/
+ x=dev_add("/misc", "console", cnopen, 0, DV_CHR, 0, 0, 0640);
+}
+SYSINIT(cndev,SI_SUB_DEVFS, SI_ORDER_ANY, cndev_init, NULL)
+#endif /*DEVFS*/
+
void
cninit()
{
diff --git a/sys/miscfs/devfs/devfs_back.c b/sys/miscfs/devfs/devfs_back.c
index 5e615cb..0a15e40 100644
--- a/sys/miscfs/devfs/devfs_back.c
+++ b/sys/miscfs/devfs/devfs_back.c
@@ -2,7 +2,7 @@
/*
* Written by Julian Elischer (julian@DIALix.oz.au)
*
- * $Header: /home/ncvs/src/sys/miscfs/devfs/devfs_back.c,v 1.2 1995/04/20 07:34:51 julian Exp $
+ * $Header: /home/ncvs/src/sys/miscfs/devfs/devfs_back.c,v 1.3 1995/05/30 08:06:49 rgrimes Exp $
*/
#include "param.h"
@@ -17,11 +17,12 @@
#include "malloc.h"
#include "dir.h" /* defines dirent structure */
#include "devfsdefs.h"
+#include "sys/devfsext.h"
+SYSINIT(devfs, SI_SUB_DEVFS, SI_ORDER_FIRST, devfs_sinit, NULL)
devnm_p dev_root; /* root of the backing tree */
-int devfs_set_up = 0; /* note tha we HAVE set up the backing tree */
/*
* Set up the root directory node in the backing plane
@@ -30,82 +31,76 @@ int devfs_set_up = 0; /* note tha we HAVE set up the backing tree */
* Notice that the ops are by indirection.. as they haven't
* been set up yet!
*/
-void devfs_back_init() /*proto*/
+void devfs_sinit() /*proto*/
{
devnm_p devbp;
dn_p dnp;
+
+ /*
+ * Allocate and fill out a new backing node
+ */
+ if(!(devbp = (devnm_p)malloc(sizeof(devnm_t),
+ M_DEVFSBACK, M_NOWAIT)))
+ {
+ return ;
+ }
+ bzero(devbp,sizeof(devnm_t));
/*
- * This may be called several times.. only do it if it needs
- * to be done.
+ * And the devnode associated with it
*/
- if(!devfs_set_up)
+ if(!(dnp = (dn_p)malloc(sizeof(devnode_t),
+ M_DEVFSNODE, M_NOWAIT)))
{
- /*
- * Allocate and fill out a new backing node
- */
- if(!(devbp = (devnm_p)malloc(sizeof(devnm_t),
- M_DEVFSBACK, M_NOWAIT)))
- {
- return ;
- }
- bzero(devbp,sizeof(devnm_t));
- /*
- * And the devnode associated with it
- */
- if(!(dnp = (dn_p)malloc(sizeof(devnode_t),
- M_DEVFSNODE, M_NOWAIT)))
- {
- free(devbp,M_DEVFSBACK);
- return ;
- }
- bzero(dnp,sizeof(devnode_t));
- /*
- * Link the two together
- */
- devbp->dnp = dnp;
- dnp->links = 1;
- /*
- * set up the directory node for the root
- * and put in all the usual entries for a directory node
- */
- dnp->type = DEV_DIR;
- dnp->links++; /* for .*/
- /* root loops to self */
- dnp->by.Dir.parent = dnp;
- dnp->links++; /* for ..*/
- /*
- * set up the list of children (none so far)
- */
- dnp->by.Dir.dirlist = (devnm_p)0;
- dnp->by.Dir.dirlast =
- &dnp->by.Dir.dirlist;
- dnp->by.Dir.myname = devbp;
- /*
- * set up a pointer to directory type ops
- */
- dnp->ops = &devfs_vnodeop_p;
- dnp->mode |= 0555; /* default perms */
- /*
- * note creation times etc, as now (boot time)
- */
- TIMEVAL_TO_TIMESPEC(&time,&(dnp->ctime))
- dnp->mtime = dnp->ctime;
- dnp->atime = dnp->ctime;
+ free(devbp,M_DEVFSBACK);
+ return ;
+ }
+ bzero(dnp,sizeof(devnode_t));
+ /*
+ * Link the two together
+ */
+ devbp->dnp = dnp;
+ dnp->links = 1;
+ /*
+ * set up the directory node for the root
+ * and put in all the usual entries for a directory node
+ */
+ dnp->type = DEV_DIR;
+ dnp->links++; /* for .*/
+ /* root loops to self */
+ dnp->by.Dir.parent = dnp;
+ dnp->links++; /* for ..*/
+ /*
+ * set up the list of children (none so far)
+ */
+ dnp->by.Dir.dirlist = (devnm_p)0;
+ dnp->by.Dir.dirlast =
+ &dnp->by.Dir.dirlist;
+ dnp->by.Dir.myname = devbp;
+ /*
+ * set up a pointer to directory type ops
+ */
+ dnp->ops = &devfs_vnodeop_p;
+ dnp->mode |= 0555; /* default perms */
+ /*
+ * note creation times etc, as now (boot time)
+ */
+ TIMEVAL_TO_TIMESPEC(&time,&(dnp->ctime))
+ dnp->mtime = dnp->ctime;
+ dnp->atime = dnp->ctime;
- /*
- * and the list of layers
- */
- devbp->next_front = NULL;
- devbp->prev_frontp = &(devbp->next_front);
+ /*
+ * and the list of layers
+ */
+ devbp->next_front = NULL;
+ devbp->prev_frontp = &(devbp->next_front);
- /*
- * next time, we don't need to do all this
- */
- dev_root = devbp;
- devfs_set_up = 1;
- }
+ /*
+ * next time, we don't need to do all this
+ */
+ dev_root = devbp;
+ printf("DEVFS: ready for devices\n");
}
/***********************************************************************\
@@ -135,7 +130,6 @@ int dev_finddir(char *orig_path, dn_p dirnode, int create, dn_p *dn_pp) /*proto*
DBPRINT(("dev_finddir\n"));
- devfs_back_init(); /* in case we are the first */
if(!dirnode) dirnode = dev_root->dnp;
if(dirnode->type != DEV_DIR) return ENOTDIR;
if(strlen(orig_path) > (DEVMAXPATHSIZE - 1)) return ENAMETOOLONG;
@@ -458,7 +452,14 @@ int get_bdev_major_num(caddr_t addr) /*proto*/
* Add the named device entry into the given directory, and make it *
* The appropriate type... (called (sometimes indirectly) by drivers..) *
\***********************************************************************/
-devnm_p dev_add(char *path,char *name,caddr_t funct,int minor,int chrblk,uid_t uid,gid_t gid, int perms) /*proto*/
+void *dev_add(char *path,
+ char *name,
+ void *funct,
+ int minor,
+ int chrblk,
+ uid_t uid,
+ gid_t gid,
+ int perms)
{
devnm_p new_dev;
dn_p dnp; /* devnode for parent directory */
@@ -471,7 +472,7 @@ devnm_p dev_add(char *path,char *name,caddr_t funct,int minor,int chrblk,uid_t u
if (retval) return 0;
switch(chrblk)
{
- case 0:
+ case DV_CHR:
major = get_cdev_major_num(funct);
by.Cdev.cdevsw = cdevsw + major;
by.Cdev.dev = makedev(major, minor);
@@ -479,7 +480,7 @@ devnm_p dev_add(char *path,char *name,caddr_t funct,int minor,int chrblk,uid_t u
&by,&new_dev))
return 0;
break;
- case 1:
+ case DV_BLK:
major = get_bdev_major_num(funct);
by.Bdev.bdevsw = bdevsw + major;
by.Bdev.dev = makedev(major, minor);
diff --git a/sys/miscfs/devfs/devfs_proto.h b/sys/miscfs/devfs/devfs_proto.h
index a4ac67b..77cd5ac 100644
--- a/sys/miscfs/devfs/devfs_proto.h
+++ b/sys/miscfs/devfs/devfs_proto.h
@@ -1,4 +1,5 @@
-void devfs_back_init() /*proto*/;
+/* THIS FILE PRODUCED AUTOMATICALLY */
+void devfs_sinit() /*proto*/;
int dev_finddir(char *orig_path, dn_p dirnode, int create, dn_p *dn_pp) /*proto*/;
int dev_add_node(char *name, dn_p dirnode, int entrytype, union typeinfo *by, devnm_p *devnm_pp) /*proto*/;
int dev_remove(devnm_p devbp) /*proto*/;
@@ -6,7 +7,6 @@ int dev_touch(devnm_p key) /* update the node for this dev */ /*proto*/;
void devfs_dn_free(dn_p dnp) /*proto*/;
int get_cdev_major_num(caddr_t addr) /*proto*/;
int get_bdev_major_num(caddr_t addr) /*proto*/;
-devnm_p dev_add(char *path,char *name,caddr_t funct,int minor,int chrblk,uid_t uid,gid_t gid, int perms) /*proto*/;
int devfs_add_fronts(devnm_p parent,devnm_p child) /*proto*/;
dn_p dev_findfront(dn_p dir,char *name) /*proto*/;
int dev_mk_front(dn_p parent,devnm_p back,devnm_p *devnm_pp , struct devfsmount *dvm) /*proto*/;
@@ -29,3 +29,5 @@ int devfs_vget(struct mount *mp, ino_t ino,struct vnode **vpp) /*proto*/;
int devfs_fhtovp (struct mount *mp, struct fid *fhp, struct mbuf *nam, struct vnode **vpp, int *exflagsp, struct ucred **credanonp) /*proto*/;
int devfs_vptofh (struct vnode *vp, struct fid *fhp) /*proto*/;
void devfs_dropvnode(dn_p dnp) /*proto*/;
+/* THIS FILE PRODUCED AUTOMATICALLY */
+/* DO NOT EDIT (see reproto.sh) */
diff --git a/sys/miscfs/devfs/devfs_vfsops.c b/sys/miscfs/devfs/devfs_vfsops.c
index 5781df7..7edb6cc 100644
--- a/sys/miscfs/devfs/devfs_vfsops.c
+++ b/sys/miscfs/devfs/devfs_vfsops.c
@@ -1,7 +1,7 @@
/*
* Written by Julian Elischer (julian@DIALix.oz.au)
*
- * $Header: /home/ncvs/src/sys/miscfs/devfs/devfs_vfsops.c,v 1.2 1995/04/20 07:34:53 julian Exp $
+ * $Header: /home/ncvs/src/sys/miscfs/devfs/devfs_vfsops.c,v 1.3 1995/05/30 08:06:52 rgrimes Exp $
*
*
*/
@@ -22,9 +22,7 @@
int devfs_init(void) /*proto*/
{
- printf("devfs initialised\n");
- devfs_back_init();
- /* devfs_front_init();*/ /* nothing to do at the moment */
+ printf("devfs ready to run\n");
return 0; /*XXX*/
}
diff --git a/sys/miscfs/devfs/reproto.sh b/sys/miscfs/devfs/reproto.sh
index dc4b731..277f68a 100644
--- a/sys/miscfs/devfs/reproto.sh
+++ b/sys/miscfs/devfs/reproto.sh
@@ -1,2 +1,6 @@
#!/bin/sh
-grep -h '/\*proto\*/' *.c |awk '{print $0 ";"}' >devfs_proto.h
+echo "/* THIS FILE PRODUCED AUTOMATICALLY */" >devfs_proto.h
+grep -h '/\*proto\*/' *.c |awk '{print $0 ";"}' >>devfs_proto.h
+echo "/* THIS FILE PRODUCED AUTOMATICALLY */" >>devfs_proto.h
+echo "/* DO NOT EDIT (see reproto.sh) */" >>devfs_proto.h
+
diff --git a/sys/sys/devfsext.h b/sys/sys/devfsext.h
new file mode 100644
index 0000000..59200a4
--- /dev/null
+++ b/sys/sys/devfsext.h
@@ -0,0 +1,11 @@
+void *dev_add(char *path,
+ char *name,
+ void *funct,
+ int minor,
+ int chrblk,
+ uid_t uid,
+ gid_t gid,
+ int perms) ;
+#define DV_CHR 0
+#define DV_BLK 1
+#define DV_DEV 2
diff --git a/sys/sys/kernel.h b/sys/sys/kernel.h
index ef323f9..e766410 100644
--- a/sys/sys/kernel.h
+++ b/sys/sys/kernel.h
@@ -39,7 +39,7 @@
* SUCH DAMAGE.
*
* @(#)kernel.h 8.3 (Berkeley) 1/21/94
- * $Id: kernel.h,v 1.10 1995/08/28 09:19:04 julian Exp $
+ * $Id: kernel.h,v 1.11 1995/08/31 06:28:29 bde Exp $
*/
#ifndef _SYS_KERNEL_H_
@@ -118,6 +118,8 @@ enum sysinit_sub_id {
SI_SUB_VM = 0x10000000, /* virtual memory system init*/
SI_SUB_KMEM = 0x18000000, /* kernel memory*/
SI_SUB_CPU = 0x20000000, /* CPU resource(s)*/
+ SI_SUB_DEVFS = 0x22000000, /* get DEVFS ready */
+ SI_SUB_CONFIGURE = 0x24000000, /* Configure devices */
SI_SUB_INTRINSIC = 0x28000000, /* proc 0*/
SI_SUB_RUN_QUEUE = 0x30000000, /* the run queue*/
SI_SUB_VM_CONF = 0x38000000, /* config VM, set limits*/
@@ -197,8 +199,8 @@ struct sysinit {
DATA_SET(sysinit_set,uniquifier ## _sys_init);
/*
- * Call 'fork()' before calling '(*func)(ident)'; kernel 'thread' or
- * builtin process.
+ * Call 'fork()' before calling '(*func)(ident)';
+ * for making a kernel 'thread' (or builtin process.)
*/
#define SYSINIT_KT(uniquifier, subsystem, order, func, ident) \
static struct sysinit uniquifier ## _sys_init = { \
OpenPOWER on IntegriCloud