summaryrefslogtreecommitdiffstats
path: root/sys/net/if_tun.c
diff options
context:
space:
mode:
authorjulian <julian@FreeBSD.org>1995-11-29 10:49:16 +0000
committerjulian <julian@FreeBSD.org>1995-11-29 10:49:16 +0000
commitf2f63c6ece7d25485976323df6d684743fe14bb6 (patch)
tree5ed2d747156a38098db0e540f833114bc9dd1b51 /sys/net/if_tun.c
parentbe48321f04abe146ffbc5091fe940b107f46c175 (diff)
downloadFreeBSD-src-f2f63c6ece7d25485976323df6d684743fe14bb6.zip
FreeBSD-src-f2f63c6ece7d25485976323df6d684743fe14bb6.tar.gz
OK, that's it..
That's EVERY SINGLE driver that has an entry in conf.c.. my next trick will be to define cdevsw[] and bdevsw[] as empty arrays and remove all those DAMNED defines as well.. Each of these drivers has a SYSINIT linker set entry that comes in very early.. and asks teh driver to add it's own entry to the two devsw[] tables. some slight reworking of the commits from yesterday (added the SYSINIT stuff and some usually wrong but token DEVFS entries to all these devices. BTW does anyone know where the 'ata' entries in conf.c actually reside? seems we don't actually have a 'ataopen() etc... If you want to add a new device in conf.c please make sure I know so I can keep it up to date too.. as before, this is all dependent on #if defined(JREMOD) (and #ifdef DEVFS in parts)
Diffstat (limited to 'sys/net/if_tun.c')
-rw-r--r--sys/net/if_tun.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/sys/net/if_tun.c b/sys/net/if_tun.c
index 91ffbe2..ded3d95 100644
--- a/sys/net/if_tun.c
+++ b/sys/net/if_tun.c
@@ -67,6 +67,13 @@ static void tunattach __P((void *));
PSEUDO_SET(tunattach, if_tun);
#endif
+#ifdef JREMOD
+#ifdef DEVFS
+#include <sys/devfsext.h>
+#endif /*DEVFS*/
+#define CDEV_MAJOR 52
+#endif /*JREMOD*/
+
#define TUNDEBUG if (tundebug) printf
int tundebug = 0;
@@ -598,4 +605,36 @@ tunselect(dev_t dev, int rw, struct proc *p)
return 0;
}
+#ifdef JREMOD
+struct cdevsw tun_cdevsw =
+ { tunopen, tunclose, tunread, tunwrite, /*52*/
+ tunioctl, nostop, nullreset, nodevtotty,/* tunnel */
+ tunselect, nommap, NULL };
+
+static tun_devsw_installed = 0;
+
+static void tun_drvinit(void *unused)
+{
+ dev_t dev;
+
+ if( ! tun_devsw_installed ) {
+ dev = makedev(CDEV_MAJOR,0);
+ cdevsw_add(&dev,&tun_cdevsw,NULL);
+ tun_devsw_installed = 1;
+#ifdef DEVFS
+ {
+ int x;
+/* default for a simple device with no probe routine (usually delete this) */
+ x=devfs_add_devsw(
+/* path name devsw minor type uid gid perm*/
+ "/", "tun", major(dev), 0, DV_CHR, 0, 0, 0600);
+ }
+ }
+#endif
+}
+
+SYSINIT(tundev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,tun_drvinit,NULL)
+
+#endif /* JREMOD */
+
#endif /* NTUN */
OpenPOWER on IntegriCloud