summaryrefslogtreecommitdiffstats
path: root/sys/net/if_tun.c
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2000-08-20 21:34:39 +0000
committerphk <phk@FreeBSD.org>2000-08-20 21:34:39 +0000
commitb648921accec69a7e5c83e915ded3037cbca7f3d (patch)
treefa2e43c05e3c1d31732408f806d72db091c03d14 /sys/net/if_tun.c
parent1c624ac57c791b6df4b51eb86e04dc404052c700 (diff)
downloadFreeBSD-src-b648921accec69a7e5c83e915ded3037cbca7f3d.zip
FreeBSD-src-b648921accec69a7e5c83e915ded3037cbca7f3d.tar.gz
Remove all traces of Julians DEVFS (incl from kern/subr_diskslice.c)
Remove old DEVFS support fields from dev_t. Make uid, gid & mode members of dev_t and set them in make_dev(). Use correct uid, gid & mode in make_dev in disk minilayer. Add support for registering alias names for a dev_t using the new function make_dev_alias(). These will show up as symlinks in DEVFS. Use makedev() rather than make_dev() for MFSs magic devices to prevent DEVFS from noticing this abuse. Add a field for DEVFS inode number in dev_t. Add new DEVFS in fs/devfs. Add devfs cloning to: disk minilayer (ie: ad(4), sd(4), cd(4) etc etc) md(4), tun(4), bpf(4), fd(4) If DEVFS add -d flag to /sbin/inits args to make it mount devfs. Add commented out DEVFS to GENERIC
Diffstat (limited to 'sys/net/if_tun.c')
-rw-r--r--sys/net/if_tun.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/sys/net/if_tun.c b/sys/net/if_tun.c
index b544f75..da865f0 100644
--- a/sys/net/if_tun.c
+++ b/sys/net/if_tun.c
@@ -17,6 +17,7 @@
*/
#include "opt_inet.h"
+#include "opt_devfs.h"
#include <sys/param.h>
#include <sys/proc.h>
@@ -50,6 +51,11 @@
#include <net/if_tunvar.h>
#include <net/if_tun.h>
+#ifdef DEVFS
+#include <sys/eventhandler.h>
+#include <fs/devfs/devfs.h>
+#endif
+
static MALLOC_DEFINE(M_TUN, "tun", "Tunnel Interface");
static void tunattach __P((void *));
@@ -91,12 +97,40 @@ static struct cdevsw tun_cdevsw = {
/* bmaj */ -1
};
+#ifdef DEVFS
+static void tun_clone __P((void *arg, char *name, int namelen, dev_t *dev));
+
+static void
+tun_clone(arg, name, namelen, dev)
+ void *arg;
+ char *name;
+ int namelen;
+ dev_t *dev;
+{
+ int u;
+
+ if (*dev != NODEV)
+ return;
+ if (devfs_stdclone(name, NULL, "tun", &u) != 1)
+ return;
+ /* XXX: minor encoding if u > 255 */
+ *dev = make_dev(&tun_cdevsw, u,
+ UID_UUCP, GID_DIALER, 0600, "tun%d", u);
+
+}
+#endif
+
+
static void
tunattach(dummy)
void *dummy;
{
+#ifdef DEVFS
+ EVENTHANDLER_REGISTER(devfs_clone, tun_clone, 0, 1000);
+#else
cdevsw_add(&tun_cdevsw);
+#endif
}
static void
OpenPOWER on IntegriCloud