summaryrefslogtreecommitdiffstats
path: root/sys/miscfs
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/miscfs
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/miscfs')
-rw-r--r--sys/miscfs/devfs/devfs_tree.c17
-rw-r--r--sys/miscfs/fdesc/fdesc_vnops.c17
-rw-r--r--sys/miscfs/specfs/spec_vnops.c6
3 files changed, 24 insertions, 16 deletions
diff --git a/sys/miscfs/devfs/devfs_tree.c b/sys/miscfs/devfs/devfs_tree.c
index 0110f8b..6f32322 100644
--- a/sys/miscfs/devfs/devfs_tree.c
+++ b/sys/miscfs/devfs/devfs_tree.c
@@ -2,7 +2,7 @@
/*
* Written by Julian Elischer (julian@DIALix.oz.au)
*
- * $Header: /home/ncvs/src/sys/miscfs/devfs/devfs_tree.c,v 1.8 1995/10/10 07:12:25 julian Exp $
+ * $Header: /home/ncvs/src/sys/miscfs/devfs/devfs_tree.c,v 1.9 1995/11/29 10:48:36 julian Exp $
*/
#include "param.h"
@@ -908,15 +908,18 @@ int dev_add_entry(char *name, dn_p parent, int type, union typeinfo *by, devnm_p
\***********************************************************************/
void *devfs_add_devsw(char *path,
char *name,
- int major,
+ void *devsw,
int minor,
int chrblk,
uid_t uid,
gid_t gid,
int perms)
{
+ int major;
devnm_p new_dev;
dn_p dnp; /* devnode for parent directory */
+ struct cdevsw *cd;
+ struct bdevsw *bd;
int retval;
union typeinfo by;
@@ -926,13 +929,19 @@ void *devfs_add_devsw(char *path,
switch(chrblk)
{
case DV_CHR:
- by.Cdev.cdevsw = cdevsw + major;
+ cd = devsw;
+ major = cd->d_maj;
+ if ( major == -1 ) return NULL;
+ by.Cdev.cdevsw = cd;
by.Cdev.dev = makedev(major, minor);
if( dev_add_entry(name, dnp, DEV_CDEV, &by,&new_dev))
return NULL;
break;
case DV_BLK:
- by.Bdev.bdevsw = bdevsw + major;
+ bd = devsw;
+ major = bd->d_maj;
+ if ( major == -1 ) return NULL;
+ by.Bdev.bdevsw = bd;
by.Bdev.dev = makedev(major, minor);
if( dev_add_entry(name, dnp, DEV_BDEV, &by, &new_dev))
return NULL;
diff --git a/sys/miscfs/fdesc/fdesc_vnops.c b/sys/miscfs/fdesc/fdesc_vnops.c
index e4eaafc..bec6bc7 100644
--- a/sys/miscfs/fdesc/fdesc_vnops.c
+++ b/sys/miscfs/fdesc/fdesc_vnops.c
@@ -35,7 +35,7 @@
*
* @(#)fdesc_vnops.c 8.9 (Berkeley) 1/21/94
*
- * $Id: fdesc_vnops.c,v 1.13 1995/12/03 14:54:10 bde Exp $
+ * $Id: fdesc_vnops.c,v 1.14 1995/12/05 19:12:05 bde Exp $
*/
/*
@@ -58,8 +58,11 @@
#include <sys/dirent.h>
#include <sys/socketvar.h>
#include <sys/tty.h>
+#include <sys/conf.h>
#include <miscfs/fdesc/fdesc.h>
+extern struct cdevsw ctty_cdevsw;
+
#define cttyvp(p) ((p)->p_flag & P_CONTROLT ? (p)->p_session->s_ttyvp : NULL)
#define FDL_WANT 0x01
@@ -363,7 +366,7 @@ fdesc_open(ap)
break;
case Fctty:
- error = cttyopen(devctty, ap->a_mode, 0, ap->a_p);
+ error = (*ctty_cdevsw.d_open)(devctty, ap->a_mode, 0, ap->a_p);
break;
}
@@ -710,7 +713,7 @@ fdesc_read(ap)
switch (VTOFDESC(ap->a_vp)->fd_type) {
case Fctty:
- error = cttyread(devctty, ap->a_uio, ap->a_ioflag);
+ error = (*ctty_cdevsw.d_read)(devctty, ap->a_uio, ap->a_ioflag);
break;
default:
@@ -734,7 +737,7 @@ fdesc_write(ap)
switch (VTOFDESC(ap->a_vp)->fd_type) {
case Fctty:
- error = cttywrite(devctty, ap->a_uio, ap->a_ioflag);
+ error = (*ctty_cdevsw.d_write)(devctty, ap->a_uio, ap->a_ioflag);
break;
default:
@@ -760,8 +763,8 @@ fdesc_ioctl(ap)
switch (VTOFDESC(ap->a_vp)->fd_type) {
case Fctty:
- error = cttyioctl(devctty, ap->a_command, ap->a_data,
- ap->a_fflag, ap->a_p);
+ error = (*ctty_cdevsw.d_ioctl)(devctty, ap->a_command,
+ ap->a_data, ap->a_fflag, ap->a_p);
break;
default:
@@ -786,7 +789,7 @@ fdesc_select(ap)
switch (VTOFDESC(ap->a_vp)->fd_type) {
case Fctty:
- error = cttyselect(devctty, ap->a_fflags, ap->a_p);
+ error = (*ctty_cdevsw.d_select)(devctty, ap->a_fflags, ap->a_p);
break;
default:
diff --git a/sys/miscfs/specfs/spec_vnops.c b/sys/miscfs/specfs/spec_vnops.c
index 38e694e..3a04353 100644
--- a/sys/miscfs/specfs/spec_vnops.c
+++ b/sys/miscfs/specfs/spec_vnops.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)spec_vnops.c 8.6 (Berkeley) 4/9/94
- * $Id: spec_vnops.c,v 1.20 1995/12/05 21:51:45 bde Exp $
+ * $Id: spec_vnops.c,v 1.21 1995/12/07 12:47:17 davidg Exp $
*/
#include <sys/param.h>
@@ -159,10 +159,8 @@ spec_open(ap)
case VCHR:
if ((u_int)maj >= nchrdev)
return (ENXIO);
-#ifdef JREMOD
if ( cdevsw[maj].d_open == NULL)
return ENXIO;
-#endif /*JREMOD*/
if (ap->a_cred != FSCRED && (ap->a_mode & FWRITE)) {
/*
* When running in very secure mode, do not allow
@@ -194,10 +192,8 @@ spec_open(ap)
case VBLK:
if ((u_int)maj >= nblkdev)
return (ENXIO);
-#ifdef JREMOD
if ( bdevsw[maj].d_open == NULL)
return ENXIO;
-#endif /*JREMOD*/
/*
* When running in very secure mode, do not allow
* opens for writing of any disk block devices.
OpenPOWER on IntegriCloud