summaryrefslogtreecommitdiffstats
path: root/sys/kern/tty_snoop.c
diff options
context:
space:
mode:
authorjulian <julian@FreeBSD.org>1995-12-08 11:19:42 +0000
committerjulian <julian@FreeBSD.org>1995-12-08 11:19:42 +0000
commit1900eea896e2aaeae8a9fa8affa5fded2068c9b4 (patch)
tree5150d199464d64c1021f91b2c2f112d48546a8bf /sys/kern/tty_snoop.c
parentaaf9d7f10ecc63adae1dc4f55cfd31a2926c605a (diff)
downloadFreeBSD-src-1900eea896e2aaeae8a9fa8affa5fded2068c9b4.zip
FreeBSD-src-1900eea896e2aaeae8a9fa8affa5fded2068c9b4.tar.gz
Pass 3 of the great devsw changes
most devsw referenced functions are now static, as they are in the same file as their devsw structure. I've also added DEVFS support for nearly every device in the system, however many of the devices have 'incorrect' names under DEVFS because I couldn't quickly work out the correct naming conventions. (but devfs won't be coming on line for a month or so anyhow so that doesn't matter) If you "OWN" a device which would normally have an entry in /dev then search for the devfs_add_devsw() entries and munge to make them right.. check out similar devices to see what I might have done in them in you can't see what's going on.. for a laugh compare conf.c conf.h defore and after... :) I have not doen DEVFS entries for any DISKSLICE devices yet as that will be a much more complicated job.. (pass 5 :) pass 4 will be to make the devsw tables of type (cdevsw * ) rather than (cdevsw) seems to work here.. complaints to the usual places.. :)
Diffstat (limited to 'sys/kern/tty_snoop.c')
-rw-r--r--sys/kern/tty_snoop.c60
1 files changed, 33 insertions, 27 deletions
diff --git a/sys/kern/tty_snoop.c b/sys/kern/tty_snoop.c
index 8e16b2f..27ffe9f 100644
--- a/sys/kern/tty_snoop.c
+++ b/sys/kern/tty_snoop.c
@@ -30,15 +30,25 @@
#include <sys/uio.h>
#include <sys/kernel.h>
#include <sys/malloc.h>
-
-#include <sys/snoop.h>
-
-#ifdef JREMOD
#ifdef DEVFS
#include <sys/devfsext.h>
#endif /*DEVFS*/
+
+#include <sys/snoop.h>
+
+static d_open_t snpopen;
+static d_close_t snpclose;
+static d_read_t snpread;
+static d_write_t snpwrite;
+static d_ioctl_t snpioctl;
+static d_select_t snpselect;
+
#define CDEV_MAJOR 53
-#endif /*JREMOD*/
+struct cdevsw snp_cdevsw =
+ { snpopen, snpclose, snpread, snpwrite, /*53*/
+ snpioctl, nostop, nullreset, nodevtotty,/* snoop */
+ snpselect, nommap, NULL, "snp", NULL, -1 };
+
#ifndef MIN
#define MIN(a,b) (((a)<(b))?(a):(b))
@@ -63,7 +73,7 @@ devtotty (dev)
* length for function keys...
*/
-int
+static int
snpwrite(dev, uio, flag)
dev_t dev;
struct uio *uio;
@@ -104,7 +114,7 @@ tty_input:
}
-int
+static int
snpread(dev, uio, flag)
dev_t dev;
struct uio *uio;
@@ -270,7 +280,7 @@ snpin(snp, buf, n)
return n;
}
-int
+static int
snpopen(dev, flag, mode, p)
dev_t dev;
int flag, mode;
@@ -346,7 +356,7 @@ detach_notty:
return (0);
}
-int
+static int
snpclose(dev, flags, fmt, p)
dev_t dev;
int flags;
@@ -376,7 +386,7 @@ snpdown(snp)
}
-int
+static int
snpioctl(dev, cmd, data, flags, p)
dev_t dev;
int cmd;
@@ -473,7 +483,7 @@ snpioctl(dev, cmd, data, flags, p)
}
-int
+static int
snpselect(dev, rw, p)
dev_t dev;
int rw;
@@ -500,29 +510,26 @@ snpselect(dev, rw, p)
return 0;
}
-#ifdef JREMOD
-struct cdevsw snp_cdevsw =
- { snpopen, snpclose, snpread, snpwrite, /*53*/
- snpioctl, nostop, nullreset, nodevtotty,/* snoop */
- snpselect, nommap, NULL };
-
+static void *snp_devfs_token[NSNP];
static snp_devsw_installed = 0;
-static void snp_drvinit(void *unused)
+static void
+snp_drvinit(void *unused)
{
dev_t dev;
+ char name[32];
+ int i;
if( ! snp_devsw_installed ) {
- dev = makedev(CDEV_MAJOR,0);
- cdevsw_add(&dev,&snp_cdevsw,NULL);
+ dev = makedev(CDEV_MAJOR, 0);
+ cdevsw_add(&dev,&snp_cdevsw, NULL);
snp_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*/
- "/", "snp", major(dev), 0, DV_CHR, 0, 0, 0600);
+ for ( i = 0 ; i < NSNP ; i++) {
+ sprintf(name,"snp%d",i);
+ snp_devfs_token[i] =
+ devfs_add_devsw( "/", name, &snp_cdevsw, i,
+ DV_CHR, 0, 0, 0600);
}
#endif
}
@@ -530,6 +537,5 @@ static void snp_drvinit(void *unused)
SYSINIT(snpdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,snp_drvinit,NULL)
-#endif /* JREMOD */
#endif
OpenPOWER on IntegriCloud