devsw tables are now arrays of POINTERS to struct [cb]devsw

seems to work hre just fine though  I can't check every file
that changed due to limmited h/w, however I've checked enught to be petty
happy withe hte code..

WARNING... struct lkm[mumble] has changed
so it might be an idea to recompile any lkm related programs
This commit is contained in:
Julian Elischer 1995-12-13 15:13:57 +00:00
parent 8300a61f5a
commit 6ba9ebce28
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=12813
23 changed files with 126 additions and 232 deletions

View file

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)autoconf.c 7.1 (Berkeley) 5/9/91
* $Id: autoconf.c,v 1.47 1995/12/10 13:36:24 phk Exp $
* $Id: autoconf.c,v 1.48 1995/12/12 08:50:15 gibbs Exp $
*/
/*
@ -281,9 +281,9 @@ setdumpdev(dev)
maj = major(dev);
if (maj >= nblkdev)
return (ENXIO);
if (bdevsw[maj].d_psize == NULL)
if (bdevsw[maj]->d_psize == NULL)
return (ENXIO); /* XXX should sometimes be ENODEV */
psize = bdevsw[maj].d_psize(dev);
psize = bdevsw[maj]->d_psize(dev);
if (psize == -1)
return (ENXIO); /* XXX should sometimes be ENODEV */
newdumplo = psize - Maxmem * NBPG / DEV_BSIZE;

View file

@ -35,7 +35,7 @@
* SUCH DAMAGE.
*
* from: @(#)machdep.c 7.4 (Berkeley) 6/3/91
* $Id: machdep.c,v 1.156 1995/12/09 20:39:47 phk Exp $
* $Id: machdep.c,v 1.157 1995/12/10 13:36:26 phk Exp $
*/
#include "npx.h"
@ -973,7 +973,7 @@ dumpsys()
dumpsize = Maxmem;
printf("\ndumping to dev %lx, offset %ld\n", dumpdev, dumplo);
printf("dump ");
switch ((*bdevsw[major(dumpdev)].d_dump)(dumpdev)) {
switch ((*bdevsw[major(dumpdev)]->d_dump)(dumpdev)) {
case ENXIO:
printf("device bad\n");

View file

@ -65,7 +65,7 @@ devtotty (dev)
if (major(dev) > nchrdev)
return (NULL); /* no such device available */
return (*cdevsw[major(dev)].d_devtotty)(dev);
return (*cdevsw[major(dev)]->d_devtotty)(dev);
}
#define SNP_INPUT_BUF 5 /* This is even too much,the maximal

View file

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)spec_vnops.c 8.6 (Berkeley) 4/9/94
* $Id: spec_vnops.c,v 1.23 1995/12/11 04:56:41 dyson Exp $
* $Id: spec_vnops.c,v 1.24 1995/12/11 09:24:50 phk Exp $
*/
#include <sys/param.h>
@ -159,7 +159,7 @@ spec_open(ap)
case VCHR:
if ((u_int)maj >= nchrdev)
return (ENXIO);
if ( cdevsw[maj].d_open == NULL)
if ( (cdevsw[maj] == NULL) || (cdevsw[maj]->d_open == NULL))
return ENXIO;
if (ap->a_cred != FSCRED && (ap->a_mode & FWRITE)) {
/*
@ -185,14 +185,14 @@ spec_open(ap)
}
}
VOP_UNLOCK(vp);
error = (*cdevsw[maj].d_open)(dev, ap->a_mode, S_IFCHR, ap->a_p);
error = (*cdevsw[maj]->d_open)(dev, ap->a_mode, S_IFCHR, ap->a_p);
VOP_LOCK(vp);
return (error);
case VBLK:
if ((u_int)maj >= nblkdev)
return (ENXIO);
if ( bdevsw[maj].d_open == NULL)
if ( (bdevsw[maj] == NULL) || (bdevsw[maj]->d_open == NULL))
return ENXIO;
/*
* When running in very secure mode, do not allow
@ -208,7 +208,7 @@ spec_open(ap)
error = vfs_mountedon(vp);
if (error)
return (error);
return ((*bdevsw[maj].d_open)(dev, ap->a_mode, S_IFBLK, ap->a_p));
return ((*bdevsw[maj]->d_open)(dev, ap->a_mode, S_IFBLK, ap->a_p));
default:
break;
}
@ -253,7 +253,7 @@ spec_read(ap)
case VCHR:
VOP_UNLOCK(vp);
error = (*cdevsw[major(vp->v_rdev)].d_read)
error = (*cdevsw[major(vp->v_rdev)]->d_read)
(vp->v_rdev, uio, ap->a_ioflag);
VOP_LOCK(vp);
return (error);
@ -264,7 +264,7 @@ spec_read(ap)
bsize = BLKDEV_IOSIZE;
dev = vp->v_rdev;
if ((majordev = major(dev)) < nblkdev &&
(ioctl = bdevsw[majordev].d_ioctl) != NULL &&
(ioctl = bdevsw[majordev]->d_ioctl) != NULL &&
(*ioctl)(dev, DIOCGPART, (caddr_t)&dpart, FREAD, p) == 0 &&
dpart.part->p_fstype == FS_BSDFFS &&
dpart.part->p_frag != 0 && dpart.part->p_fsize != 0)
@ -331,7 +331,7 @@ spec_write(ap)
case VCHR:
VOP_UNLOCK(vp);
error = (*cdevsw[major(vp->v_rdev)].d_write)
error = (*cdevsw[major(vp->v_rdev)]->d_write)
(vp->v_rdev, uio, ap->a_ioflag);
VOP_LOCK(vp);
return (error);
@ -342,7 +342,7 @@ spec_write(ap)
if (uio->uio_offset < 0)
return (EINVAL);
bsize = BLKDEV_IOSIZE;
if ((*bdevsw[major(vp->v_rdev)].d_ioctl)(vp->v_rdev, DIOCGPART,
if ((*bdevsw[major(vp->v_rdev)]->d_ioctl)(vp->v_rdev, DIOCGPART,
(caddr_t)&dpart, FREAD, p) == 0) {
if (dpart.part->p_fstype == FS_BSDFFS &&
dpart.part->p_frag != 0 && dpart.part->p_fsize != 0)
@ -398,16 +398,16 @@ spec_ioctl(ap)
switch (ap->a_vp->v_type) {
case VCHR:
return ((*cdevsw[major(dev)].d_ioctl)(dev, ap->a_command, ap->a_data,
return ((*cdevsw[major(dev)]->d_ioctl)(dev, ap->a_command, ap->a_data,
ap->a_fflag, ap->a_p));
case VBLK:
if (ap->a_command == 0 && (int)ap->a_data == B_TAPE)
if (bdevsw[major(dev)].d_flags & B_TAPE)
if (bdevsw[major(dev)]->d_flags & B_TAPE)
return (0);
else
return (1);
return ((*bdevsw[major(dev)].d_ioctl)(dev, ap->a_command, ap->a_data,
return ((*bdevsw[major(dev)]->d_ioctl)(dev, ap->a_command, ap->a_data,
ap->a_fflag, ap->a_p));
default:
@ -436,7 +436,7 @@ spec_select(ap)
case VCHR:
dev = ap->a_vp->v_rdev;
return (*cdevsw[major(dev)].d_select)(dev, ap->a_which, ap->a_p);
return (*cdevsw[major(dev)]->d_select)(dev, ap->a_which, ap->a_p);
}
}
/*
@ -503,7 +503,7 @@ spec_strategy(ap)
} */ *ap;
{
(*bdevsw[major(ap->a_bp->b_dev)].d_strategy)(ap->a_bp);
(*bdevsw[major(ap->a_bp->b_dev)]->d_strategy)(ap->a_bp);
return (0);
}
@ -600,7 +600,7 @@ spec_close(ap)
*/
if (vcount(vp) > 1 && (vp->v_flag & VXLOCK) == 0)
return (0);
devclose = cdevsw[major(dev)].d_close;
devclose = cdevsw[major(dev)]->d_close;
mode = S_IFCHR;
break;
@ -624,7 +624,7 @@ spec_close(ap)
*/
if (vcount(vp) > 1 && (vp->v_flag & VXLOCK) == 0)
return (0);
devclose = bdevsw[major(dev)].d_close;
devclose = bdevsw[major(dev)]->d_close;
mode = S_IFBLK;
break;
@ -862,7 +862,7 @@ spec_getattr(ap)
else if (vp->v_type == VCHR)
vap->va_blocksize = MAXBSIZE;
if ((*bdevsw[major(vp->v_rdev)].d_ioctl)(vp->v_rdev, DIOCGPART,
if ((*bdevsw[major(vp->v_rdev)]->d_ioctl)(vp->v_rdev, DIOCGPART,
(caddr_t)&dpart, FREAD, ap->a_p) == 0) {
vap->va_bytes = (u_quad_t) dpart.disklab->d_partitions[minor(vp->v_rdev)].p_size * DEV_BSIZE;
vap->va_size = vap->va_bytes;

View file

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)autoconf.c 7.1 (Berkeley) 5/9/91
* $Id: autoconf.c,v 1.47 1995/12/10 13:36:24 phk Exp $
* $Id: autoconf.c,v 1.48 1995/12/12 08:50:15 gibbs Exp $
*/
/*
@ -281,9 +281,9 @@ setdumpdev(dev)
maj = major(dev);
if (maj >= nblkdev)
return (ENXIO);
if (bdevsw[maj].d_psize == NULL)
if (bdevsw[maj]->d_psize == NULL)
return (ENXIO); /* XXX should sometimes be ENODEV */
psize = bdevsw[maj].d_psize(dev);
psize = bdevsw[maj]->d_psize(dev);
if (psize == -1)
return (ENXIO); /* XXX should sometimes be ENODEV */
newdumplo = psize - Maxmem * NBPG / DEV_BSIZE;

View file

@ -42,7 +42,7 @@
* SUCH DAMAGE.
*
* from: @(#)conf.c 5.8 (Berkeley) 5/12/91
* $Id: conf.c,v 1.112 1995/12/07 12:45:27 davidg Exp $
* $Id: conf.c,v 1.113 1995/12/08 11:13:18 julian Exp $
*/
#include <sys/param.h>
@ -62,16 +62,15 @@
#define NUMCDEV 96
#define NUMBDEV 32
struct bdevsw bdevsw[NUMBDEV];
struct bdevsw *bdevsw[NUMBDEV];
int nblkdev = NUMBDEV;
struct cdevsw cdevsw[NUMCDEV];
struct cdevsw *cdevsw[NUMCDEV];
int nchrdev = NUMCDEV;
/*
* The routines below are total "BULLSHIT" and will be trashed
* When I have 'proved' the JREMOD changes above..
*/
#ifndef NEW_STUFF_JRE
/*
* Swapdev is a fake device implemented
@ -155,6 +154,8 @@ isdisk(dev, type)
/* NOTREACHED */
}
#ifndef NEW_STUFF_JRE
/*
* Routine to convert from character to block device number.
*
@ -198,10 +199,8 @@ getmajorbyname(name)
}
static struct cdevsw *getcdevbyname __P((const char *name));
static struct cdevsw *
getcdevbyname(name)
const char *name;
static struct cdevsw **
getcdevbyname(char *name)
{
int maj;
@ -209,112 +208,8 @@ getcdevbyname(name)
return (maj < 0 ? NULL : &cdevsw[maj]);
}
int
register_cdev(name, cdp)
const char *name;
const struct cdevsw *cdp;
{
struct cdevsw *dst_cdp;
dst_cdp = getcdevbyname(name);
if (dst_cdp == NULL)
return (ENXIO);
if ((dst_cdp->d_open != nxopen) && (dst_cdp->d_open != NULL))
return (EBUSY);
*dst_cdp = *cdp;
return (0);
}
static struct cdevsw nxcdevsw = {
nxopen, nxclose, nxread, nxwrite,
nxioctl, nxstop, nxreset, nxdevtotty,
nxselect, nxmmap, NULL,
};
int
unregister_cdev(name, cdp)
const char *name;
const struct cdevsw *cdp;
{
struct cdevsw *dst_cdp;
dst_cdp = getcdevbyname(name);
if (dst_cdp == NULL)
return (ENXIO);
if (dst_cdp->d_open != cdp->d_open)
return (EBUSY);
*dst_cdp = nxcdevsw;
return (0);
}
#else /* NEW_STUFF_JRE *//*===============================================*/
dev_t swapdev = makedev(1, 0);
/*
* Routine that identifies /dev/mem and /dev/kmem.
*
* A minimal stub routine can always return 0.
*/
int
iskmemdev(dev)
dev_t dev;
{
return (major(dev) == 2 && (minor(dev) == 0 || minor(dev) == 1));
}
int
iszerodev(dev)
dev_t dev;
{
return (major(dev) == 2 && minor(dev) == 12);
}
/*
* Routine to determine if a device is a disk.
*
* A minimal stub routine can always return 0.
* XXX will look in the FLAGS (eventually)
*/
int
isdisk(dev, type)
dev_t dev;
int type;
{
switch (major(dev)) {
case 15: /* VBLK: vn, VCHR: cd */
return (1);
case 0: /* wd */
case 2: /* fd */
case 4: /* sd */
case 6: /* cd */
case 7: /* mcd */
case 16: /* scd */
case 17: /* matcd */
case 18: /* ata */
case 19: /* wcd */
case 20: /* od */
if (type == VBLK)
return (1);
return (0);
case 3: /* wd */
case 9: /* fd */
case 13: /* sd */
case 29: /* mcd */
case 43: /* vn */
case 45: /* scd */
case 46: /* matcd */
case 69: /* wcd */
case 70: /* od */
if (type == VCHR)
return (1);
/* fall through */
default:
return (0);
}
/* NOTREACHED */
}
/*
* Routine to convert from character to block device number.
@ -322,13 +217,12 @@ isdisk(dev, type)
* A minimal stub routine can always return NODEV.
*/
dev_t
chrtoblk(dev)
dev_t dev;
chrtoblk(dev_t dev)
{
int blkmaj;
struct bdevsw *bd;
bd = cdevsw[major(dev)].d_bdev;
bd = cdevsw[major(dev)]->d_bdev;
if ( bd )
return(makedev(bd->d_maj,minor(dev)));
else
@ -337,15 +231,14 @@ chrtoblk(dev)
/* Only checks cdevs */
int
getmajorbyname(name)
const char *name;
getmajorbyname(const char *name)
{
struct cdevsw *cd;
int maj;
char *dname;
for( maj = 0; maj <nchrdev ; maj++) {
if ( dname = cdevsw[maj].d_name) {
if ( dname = cdevsw[maj]->d_name) {
if ( strcmp(name, dname) == 0 ) {
return maj;
}
@ -356,38 +249,40 @@ getmajorbyname(name)
/* utterly pointless with devfs */
static struct cdevsw *
getcdevbyname(name)
const char *name;
static struct cdevsw **
getcdevbyname(const char *name)
{
struct cdevsw *cd;
int maj;
char *dname;
for( maj = 0; maj <nchrdev ; maj++) {
if ( dname = cdevsw[maj].d_name) {
if ( dname = cdevsw[maj]->d_name) {
if ( strcmp(name, dname) == 0 ) {
return &(cdevsw[maj]);
return &cdevsw[maj];
}
}
}
return NULL;
}
#endif /* NEW_STUFF_JRE */
/* Zap these as soon as we find out who calls them */
/* Zap these as soon as we find out who calls them , and "why?"*/
int
register_cdev(name, cdp)
const char *name;
const struct cdevsw *cdp;
{
struct cdevsw *dst_cdp;
struct cdevsw **dst_cdp;
dst_cdp = getcdevbyname(name);
if (dst_cdp == NULL)
return (ENXIO);
if ((dst_cdp->d_open != nxopen) && (dst_cdp->d_open != NULL))
if ((*dst_cdp != NULL)
&& ((*dst_cdp)->d_open != nxopen)
&& ((*dst_cdp)->d_open != NULL))
return (EBUSY);
*dst_cdp = *cdp;
*dst_cdp = cdp;
return (0);
}
@ -402,14 +297,13 @@ unregister_cdev(name, cdp)
const char *name;
const struct cdevsw *cdp;
{
struct cdevsw *dst_cdp;
struct cdevsw **dst_cdp;
dst_cdp = getcdevbyname(name);
if (dst_cdp == NULL)
return (ENXIO);
if (dst_cdp->d_open != cdp->d_open)
if ((*dst_cdp)->d_open != cdp->d_open)
return (EBUSY);
*dst_cdp = nxcdevsw;
*dst_cdp = &nxcdevsw;
return (0);
}
#endif /* NEW_STIFF_JRE */

View file

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* from: @(#)cons.c 7.2 (Berkeley) 5/9/91
* $Id: cons.c,v 1.38 1995/12/08 23:20:00 phk Exp $
* $Id: cons.c,v 1.39 1995/12/09 20:39:45 phk Exp $
*/
#include <sys/param.h>
@ -150,7 +150,7 @@ cninit_finish()
/*
* Hook the open and close functions.
*/
cdp = &cdevsw[major(cn_tab->cn_dev)];
cdp = cdevsw[major(cn_tab->cn_dev)];
cn_phys_close = cdp->d_close;
cdp->d_close = cnclose;
cn_phys_open = cdp->d_open;
@ -224,7 +224,7 @@ cnread(dev, uio, flag)
if (cn_tab == NULL)
return (0);
dev = cn_tab->cn_dev;
return ((*cdevsw[major(dev)].d_read)(dev, uio, flag));
return ((*cdevsw[major(dev)]->d_read)(dev, uio, flag));
}
static int
@ -239,7 +239,7 @@ cnwrite(dev, uio, flag)
dev = constty->t_dev;
else
dev = cn_tab->cn_dev;
return ((*cdevsw[major(dev)].d_write)(dev, uio, flag));
return ((*cdevsw[major(dev)]->d_write)(dev, uio, flag));
}
static int
@ -266,7 +266,7 @@ cnioctl(dev, cmd, data, flag, p)
return (0);
}
dev = cn_tab->cn_dev;
return ((*cdevsw[major(dev)].d_ioctl)(dev, cmd, data, flag, p));
return ((*cdevsw[major(dev)]->d_ioctl)(dev, cmd, data, flag, p));
}
static int
@ -280,7 +280,7 @@ cnselect(dev, rw, p)
dev = cn_tab->cn_dev;
return ((*cdevsw[major(dev)].d_select)(dev, rw, p));
return ((*cdevsw[major(dev)]->d_select)(dev, rw, p));
}
int

View file

@ -35,7 +35,7 @@
* SUCH DAMAGE.
*
* from: @(#)machdep.c 7.4 (Berkeley) 6/3/91
* $Id: machdep.c,v 1.156 1995/12/09 20:39:47 phk Exp $
* $Id: machdep.c,v 1.157 1995/12/10 13:36:26 phk Exp $
*/
#include "npx.h"
@ -973,7 +973,7 @@ dumpsys()
dumpsize = Maxmem;
printf("\ndumping to dev %lx, offset %ld\n", dumpdev, dumplo);
printf("dump ");
switch ((*bdevsw[major(dumpdev)].d_dump)(dumpdev)) {
switch ((*bdevsw[major(dumpdev)]->d_dump)(dumpdev)) {
case ENXIO:
printf("device bad\n");

View file

@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: kern_conf.c,v 1.5 1995/11/30 05:59:09 julian Exp $
* $Id: kern_conf.c,v 1.6 1995/12/08 11:16:55 julian Exp $
*/
#include <sys/param.h>
@ -45,7 +45,7 @@
#define ADDENTRY(TTYPE,NXXXDEV) \
int TTYPE##_add(dev_t *descrip, \
struct TTYPE *newentry, \
struct TTYPE *oldentry) \
struct TTYPE **oldentry) \
{ \
int i ; \
if ( (int)*descrip == -1) { /* auto (0 is valid) */ \
@ -53,7 +53,7 @@ int TTYPE##_add(dev_t *descrip, \
* Search the table looking for a slot... \
*/ \
for (i = 0; i < NXXXDEV; i++) \
if (TTYPE[i].d_open == NULL) \
if (TTYPE[i] == NULL) \
break; /* found one! */ \
/* out of allocable slots? */ \
if (i == NXXXDEV) { \
@ -68,13 +68,13 @@ int TTYPE##_add(dev_t *descrip, \
\
/* maybe save old */ \
if (oldentry) { \
bcopy(&TTYPE[i], oldentry, sizeof(struct TTYPE)); \
*oldentry = TTYPE[i]; \
} \
newentry->d_maj = i; \
/* replace with new */ \
bcopy(newentry, &TTYPE[i], sizeof(struct TTYPE)); \
TTYPE[i] = newentry; \
\
/* done! */ \
/* done! let them know where we put it */ \
*descrip = makedev(i,0); \
return 0; \
} \

View file

@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: kern_lkm.c,v 1.24 1995/12/08 11:17:03 julian Exp $
* $Id: kern_lkm.c,v 1.25 1995/12/08 23:21:32 phk Exp $
*/
#include <sys/param.h>
@ -736,12 +736,12 @@ _lkm_dev(lkmtp, cmd)
case LM_DT_BLOCK:
/* replace current slot contents with old contents */
descrip = makedev(i,0);
bdevsw_add(&descrip, &(args->lkm_olddev.bdev),NULL);
bdevsw_add(&descrip, args->lkm_olddev.bdev,NULL);
break;
case LM_DT_CHAR:
/* replace current slot contents with old contents */
cdevsw_add(&descrip, &(args->lkm_olddev.cdev),NULL);
cdevsw_add(&descrip, args->lkm_olddev.cdev,NULL);
break;
default:

View file

@ -16,7 +16,7 @@
* 4. Modifications may be freely made to this file if the above conditions
* are met.
*
* $Id: kern_physio.c,v 1.14 1995/12/02 18:58:48 bde Exp $
* $Id: kern_physio.c,v 1.15 1995/12/07 12:46:46 davidg Exp $
*/
#include <sys/param.h>
@ -174,14 +174,14 @@ minphys(struct buf *bp)
int
rawread(dev_t dev, struct uio *uio, int ioflag)
{
return (physio(cdevsw[major(dev)].d_strategy, (struct buf *)NULL,
return (physio(cdevsw[major(dev)]->d_strategy, (struct buf *)NULL,
dev, 1, minphys, uio));
}
int
rawwrite(dev_t dev, struct uio *uio, int ioflag)
{
return (physio(cdevsw[major(dev)].d_strategy, (struct buf *)NULL,
return (physio(cdevsw[major(dev)]->d_strategy, (struct buf *)NULL,
dev, 0, minphys, uio));
}

View file

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)tty.c 8.8 (Berkeley) 1/21/94
* $Id: tty.c,v 1.71 1995/10/31 19:27:50 bde Exp $
* $Id: tty.c,v 1.72 1995/12/07 12:46:57 davidg Exp $
*/
/*-
@ -426,7 +426,7 @@ ttyinput(c, tp)
#ifdef sun4c /* XXX */
(*tp->t_stop)(tp, 0);
#else
(*cdevsw[major(tp->t_dev)].d_stop)(tp,
(*cdevsw[major(tp->t_dev)]->d_stop)(tp,
0);
#endif
return (0);
@ -965,7 +965,7 @@ ttioctl(tp, cmd, data, flag)
#ifdef sun4c /* XXX */
(*tp->t_stop)(tp, 0);
#else
(*cdevsw[major(tp->t_dev)].d_stop)(tp, 0);
(*cdevsw[major(tp->t_dev)]->d_stop)(tp, 0);
#endif
}
splx(s);
@ -1066,7 +1066,7 @@ ttselect(dev, rw, p)
int rw;
struct proc *p;
{
return ttyselect((*cdevsw[major(dev)].d_devtotty)(dev), rw, p);
return ttyselect((*cdevsw[major(dev)]->d_devtotty)(dev), rw, p);
}
/*
@ -1154,7 +1154,7 @@ ttyflush(tp, rw)
#ifdef sun4c /* XXX */
(*tp->t_stop)(tp, rw);
#else
(*cdevsw[major(tp->t_dev)].d_stop)(tp, rw);
(*cdevsw[major(tp->t_dev)]->d_stop)(tp, rw);
#endif
if (rw & FREAD) {
FLUSHQ(&tp->t_canq);
@ -1321,7 +1321,7 @@ ttymodem(tp, flag)
#ifdef sun4c /* XXX */
(*tp->t_stop)(tp, 0);
#else
(*cdevsw[major(tp->t_dev)].d_stop)(tp, 0);
(*cdevsw[major(tp->t_dev)]->d_stop)(tp, 0);
#endif
}
} else if (flag == 0) {

View file

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* from: @(#)cons.c 7.2 (Berkeley) 5/9/91
* $Id: cons.c,v 1.38 1995/12/08 23:20:00 phk Exp $
* $Id: cons.c,v 1.39 1995/12/09 20:39:45 phk Exp $
*/
#include <sys/param.h>
@ -150,7 +150,7 @@ cninit_finish()
/*
* Hook the open and close functions.
*/
cdp = &cdevsw[major(cn_tab->cn_dev)];
cdp = cdevsw[major(cn_tab->cn_dev)];
cn_phys_close = cdp->d_close;
cdp->d_close = cnclose;
cn_phys_open = cdp->d_open;
@ -224,7 +224,7 @@ cnread(dev, uio, flag)
if (cn_tab == NULL)
return (0);
dev = cn_tab->cn_dev;
return ((*cdevsw[major(dev)].d_read)(dev, uio, flag));
return ((*cdevsw[major(dev)]->d_read)(dev, uio, flag));
}
static int
@ -239,7 +239,7 @@ cnwrite(dev, uio, flag)
dev = constty->t_dev;
else
dev = cn_tab->cn_dev;
return ((*cdevsw[major(dev)].d_write)(dev, uio, flag));
return ((*cdevsw[major(dev)]->d_write)(dev, uio, flag));
}
static int
@ -266,7 +266,7 @@ cnioctl(dev, cmd, data, flag, p)
return (0);
}
dev = cn_tab->cn_dev;
return ((*cdevsw[major(dev)].d_ioctl)(dev, cmd, data, flag, p));
return ((*cdevsw[major(dev)]->d_ioctl)(dev, cmd, data, flag, p));
}
static int
@ -280,7 +280,7 @@ cnselect(dev, rw, p)
dev = cn_tab->cn_dev;
return ((*cdevsw[major(dev)].d_select)(dev, rw, p));
return ((*cdevsw[major(dev)]->d_select)(dev, rw, p));
}
int

View file

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)tty_pty.c 8.2 (Berkeley) 9/23/93
* $Id: tty_pty.c,v 1.30 1995/12/08 23:21:34 phk Exp $
* $Id: tty_pty.c,v 1.31 1995/12/10 15:55:17 bde Exp $
*/
/*
@ -647,7 +647,7 @@ ptyioctl(dev, cmd, data, flag, p)
}
return(0);
} else
if (cdevsw[major(dev)].d_open == ptcopen)
if (cdevsw[major(dev)]->d_open == ptcopen)
switch (cmd) {
case TIOCGPGRP:

View file

@ -65,7 +65,7 @@ devtotty (dev)
if (major(dev) > nchrdev)
return (NULL); /* no such device available */
return (*cdevsw[major(dev)].d_devtotty)(dev);
return (*cdevsw[major(dev)]->d_devtotty)(dev);
}
#define SNP_INPUT_BUF 5 /* This is even too much,the maximal

View file

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)kernfs_vfsops.c 8.4 (Berkeley) 1/21/94
* $Id: kernfs_vfsops.c,v 1.10 1995/11/16 11:16:13 bde Exp $
* $Id: kernfs_vfsops.c,v 1.11 1995/12/11 09:24:32 phk Exp $
*/
/*
@ -120,7 +120,7 @@ kernfs_init()
#endif
for (cmaj = 0; cmaj < nchrdev; cmaj++) {
if (cdevsw[cmaj].d_open == bdevsw[bmaj].d_open) {
if (cdevsw[cmaj]->d_open == bdevsw[bmaj]->d_open) {
dev_t cdev = makedev(cmaj, minor(rootdev));
error = cdevvp(cdev, &rrootvp);
if (error == 0)

View file

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)spec_vnops.c 8.6 (Berkeley) 4/9/94
* $Id: spec_vnops.c,v 1.23 1995/12/11 04:56:41 dyson Exp $
* $Id: spec_vnops.c,v 1.24 1995/12/11 09:24:50 phk Exp $
*/
#include <sys/param.h>
@ -159,7 +159,7 @@ spec_open(ap)
case VCHR:
if ((u_int)maj >= nchrdev)
return (ENXIO);
if ( cdevsw[maj].d_open == NULL)
if ( (cdevsw[maj] == NULL) || (cdevsw[maj]->d_open == NULL))
return ENXIO;
if (ap->a_cred != FSCRED && (ap->a_mode & FWRITE)) {
/*
@ -185,14 +185,14 @@ spec_open(ap)
}
}
VOP_UNLOCK(vp);
error = (*cdevsw[maj].d_open)(dev, ap->a_mode, S_IFCHR, ap->a_p);
error = (*cdevsw[maj]->d_open)(dev, ap->a_mode, S_IFCHR, ap->a_p);
VOP_LOCK(vp);
return (error);
case VBLK:
if ((u_int)maj >= nblkdev)
return (ENXIO);
if ( bdevsw[maj].d_open == NULL)
if ( (bdevsw[maj] == NULL) || (bdevsw[maj]->d_open == NULL))
return ENXIO;
/*
* When running in very secure mode, do not allow
@ -208,7 +208,7 @@ spec_open(ap)
error = vfs_mountedon(vp);
if (error)
return (error);
return ((*bdevsw[maj].d_open)(dev, ap->a_mode, S_IFBLK, ap->a_p));
return ((*bdevsw[maj]->d_open)(dev, ap->a_mode, S_IFBLK, ap->a_p));
default:
break;
}
@ -253,7 +253,7 @@ spec_read(ap)
case VCHR:
VOP_UNLOCK(vp);
error = (*cdevsw[major(vp->v_rdev)].d_read)
error = (*cdevsw[major(vp->v_rdev)]->d_read)
(vp->v_rdev, uio, ap->a_ioflag);
VOP_LOCK(vp);
return (error);
@ -264,7 +264,7 @@ spec_read(ap)
bsize = BLKDEV_IOSIZE;
dev = vp->v_rdev;
if ((majordev = major(dev)) < nblkdev &&
(ioctl = bdevsw[majordev].d_ioctl) != NULL &&
(ioctl = bdevsw[majordev]->d_ioctl) != NULL &&
(*ioctl)(dev, DIOCGPART, (caddr_t)&dpart, FREAD, p) == 0 &&
dpart.part->p_fstype == FS_BSDFFS &&
dpart.part->p_frag != 0 && dpart.part->p_fsize != 0)
@ -331,7 +331,7 @@ spec_write(ap)
case VCHR:
VOP_UNLOCK(vp);
error = (*cdevsw[major(vp->v_rdev)].d_write)
error = (*cdevsw[major(vp->v_rdev)]->d_write)
(vp->v_rdev, uio, ap->a_ioflag);
VOP_LOCK(vp);
return (error);
@ -342,7 +342,7 @@ spec_write(ap)
if (uio->uio_offset < 0)
return (EINVAL);
bsize = BLKDEV_IOSIZE;
if ((*bdevsw[major(vp->v_rdev)].d_ioctl)(vp->v_rdev, DIOCGPART,
if ((*bdevsw[major(vp->v_rdev)]->d_ioctl)(vp->v_rdev, DIOCGPART,
(caddr_t)&dpart, FREAD, p) == 0) {
if (dpart.part->p_fstype == FS_BSDFFS &&
dpart.part->p_frag != 0 && dpart.part->p_fsize != 0)
@ -398,16 +398,16 @@ spec_ioctl(ap)
switch (ap->a_vp->v_type) {
case VCHR:
return ((*cdevsw[major(dev)].d_ioctl)(dev, ap->a_command, ap->a_data,
return ((*cdevsw[major(dev)]->d_ioctl)(dev, ap->a_command, ap->a_data,
ap->a_fflag, ap->a_p));
case VBLK:
if (ap->a_command == 0 && (int)ap->a_data == B_TAPE)
if (bdevsw[major(dev)].d_flags & B_TAPE)
if (bdevsw[major(dev)]->d_flags & B_TAPE)
return (0);
else
return (1);
return ((*bdevsw[major(dev)].d_ioctl)(dev, ap->a_command, ap->a_data,
return ((*bdevsw[major(dev)]->d_ioctl)(dev, ap->a_command, ap->a_data,
ap->a_fflag, ap->a_p));
default:
@ -436,7 +436,7 @@ spec_select(ap)
case VCHR:
dev = ap->a_vp->v_rdev;
return (*cdevsw[major(dev)].d_select)(dev, ap->a_which, ap->a_p);
return (*cdevsw[major(dev)]->d_select)(dev, ap->a_which, ap->a_p);
}
}
/*
@ -503,7 +503,7 @@ spec_strategy(ap)
} */ *ap;
{
(*bdevsw[major(ap->a_bp->b_dev)].d_strategy)(ap->a_bp);
(*bdevsw[major(ap->a_bp->b_dev)]->d_strategy)(ap->a_bp);
return (0);
}
@ -600,7 +600,7 @@ spec_close(ap)
*/
if (vcount(vp) > 1 && (vp->v_flag & VXLOCK) == 0)
return (0);
devclose = cdevsw[major(dev)].d_close;
devclose = cdevsw[major(dev)]->d_close;
mode = S_IFCHR;
break;
@ -624,7 +624,7 @@ spec_close(ap)
*/
if (vcount(vp) > 1 && (vp->v_flag & VXLOCK) == 0)
return (0);
devclose = bdevsw[major(dev)].d_close;
devclose = bdevsw[major(dev)]->d_close;
mode = S_IFBLK;
break;
@ -862,7 +862,7 @@ spec_getattr(ap)
else if (vp->v_type == VCHR)
vap->va_blocksize = MAXBSIZE;
if ((*bdevsw[major(vp->v_rdev)].d_ioctl)(vp->v_rdev, DIOCGPART,
if ((*bdevsw[major(vp->v_rdev)]->d_ioctl)(vp->v_rdev, DIOCGPART,
(caddr_t)&dpart, FREAD, ap->a_p) == 0) {
vap->va_bytes = (u_quad_t) dpart.disklab->d_partitions[minor(vp->v_rdev)].p_size * DEV_BSIZE;
vap->va_size = vap->va_bytes;

View file

@ -16,7 +16,7 @@
*
* New configuration setup: dufault@hda.com
*
* $Id: scsiconf.c,v 1.38 1995/11/21 15:14:28 bde Exp $
* $Id: scsiconf.c,v 1.39 1995/12/10 10:58:25 julian Exp $
*/
#include <sys/types.h>
@ -1198,7 +1198,7 @@ scsi_dev_lookup(d_open)
dev_t d = NODEV;
for (i = 0; i < nchrdev; i++)
if (cdevsw[i].d_open == d_open)
if (cdevsw[i]->d_open == d_open)
{
d = makedev(i, 0);
break;

View file

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)conf.h 8.3 (Berkeley) 1/21/94
* $Id: conf.h,v 1.26 1995/12/10 13:45:30 phk Exp $
* $Id: conf.h,v 1.27 1995/12/10 15:55:34 bde Exp $
*/
#ifndef _SYS_CONF_H_
@ -91,7 +91,7 @@ struct bdevsw {
};
#ifdef KERNEL
extern struct bdevsw bdevsw[];
extern struct bdevsw *bdevsw[];
#endif
struct cdevsw {
@ -112,7 +112,7 @@ struct cdevsw {
};
#ifdef KERNEL
extern struct cdevsw cdevsw[];
extern struct cdevsw *cdevsw[];
#endif
struct linesw {
@ -199,8 +199,8 @@ d_write_t rawwrite;
l_read_t l_noread;
l_write_t l_nowrite;
int bdevsw_add __P((dev_t *descrip,struct bdevsw *new,struct bdevsw *old));
int cdevsw_add __P((dev_t *descrip,struct cdevsw *new,struct cdevsw *old));
int bdevsw_add __P((dev_t *descrip,struct bdevsw *new,struct bdevsw **old));
int cdevsw_add __P((dev_t *descrip,struct cdevsw *new,struct cdevsw **old));
dev_t chrtoblk __P((dev_t dev));
int getmajorbyname __P((const char *name));
int isdisk __P((dev_t dev, int type));

View file

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)conf.h 8.3 (Berkeley) 1/21/94
* $Id: conf.h,v 1.26 1995/12/10 13:45:30 phk Exp $
* $Id: conf.h,v 1.27 1995/12/10 15:55:34 bde Exp $
*/
#ifndef _SYS_CONF_H_
@ -91,7 +91,7 @@ struct bdevsw {
};
#ifdef KERNEL
extern struct bdevsw bdevsw[];
extern struct bdevsw *bdevsw[];
#endif
struct cdevsw {
@ -112,7 +112,7 @@ struct cdevsw {
};
#ifdef KERNEL
extern struct cdevsw cdevsw[];
extern struct cdevsw *cdevsw[];
#endif
struct linesw {
@ -199,8 +199,8 @@ d_write_t rawwrite;
l_read_t l_noread;
l_write_t l_nowrite;
int bdevsw_add __P((dev_t *descrip,struct bdevsw *new,struct bdevsw *old));
int cdevsw_add __P((dev_t *descrip,struct cdevsw *new,struct cdevsw *old));
int bdevsw_add __P((dev_t *descrip,struct bdevsw *new,struct bdevsw **old));
int cdevsw_add __P((dev_t *descrip,struct cdevsw *new,struct cdevsw **old));
dev_t chrtoblk __P((dev_t dev));
int getmajorbyname __P((const char *name));
int isdisk __P((dev_t dev, int type));

View file

@ -34,7 +34,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: lkm.h,v 1.9 1995/11/14 07:35:57 bde Exp $
* $Id: lkm.h,v 1.10 1995/11/21 12:55:11 bde Exp $
*/
#ifndef _SYS_LKM_H_
@ -108,8 +108,8 @@ struct lkm_dev {
struct cdevsw *cdev;
} lkm_dev;
union {
struct bdevsw bdev;
struct cdevsw cdev;
struct bdevsw *bdev;
struct cdevsw *cdev;
} lkm_olddev;
};

View file

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)device_pager.c 8.1 (Berkeley) 6/11/93
* $Id: device_pager.c,v 1.16 1995/12/07 12:48:01 davidg Exp $
* $Id: device_pager.c,v 1.17 1995/12/11 04:57:59 dyson Exp $
*/
#include <sys/param.h>
@ -97,7 +97,7 @@ dev_pager_alloc(handle, size, prot, foff)
* Make sure this device can be mapped.
*/
dev = (dev_t) (u_long) handle;
mapfunc = cdevsw[major(dev)].d_mmap;
mapfunc = cdevsw[major(dev)]->d_mmap;
if (mapfunc == NULL || mapfunc == (d_mmap_t *)nullop) {
printf("obsolete map function %p\n", (void *)mapfunc);
return (NULL);
@ -193,7 +193,7 @@ dev_pager_getpages(object, m, count, reqpage)
dev = (dev_t) (u_long) object->handle;
offset = m[reqpage]->pindex + OFF_TO_IDX(object->paging_offset);
prot = PROT_READ; /* XXX should pass in? */
mapfunc = cdevsw[major(dev)].d_mmap;
mapfunc = cdevsw[major(dev)]->d_mmap;
if (mapfunc == NULL || mapfunc == (d_mmap_t *)nullop)
panic("dev_pager_getpage: no map function");

View file

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)vm_swap.c 8.5 (Berkeley) 2/17/94
* $Id: vm_swap.c,v 1.30 1995/12/08 23:23:00 phk Exp $
* $Id: vm_swap.c,v 1.31 1995/12/10 19:53:42 bde Exp $
*/
#include <sys/param.h>
@ -239,8 +239,8 @@ swaponvp(p, vp, dev, nblks)
if (error)
return (error);
if (nblks == 0 && (bdevsw[major(dev)].d_psize == 0 ||
(nblks = (*bdevsw[major(dev)].d_psize) (dev)) == -1)) {
if (nblks == 0 && (bdevsw[major(dev)]->d_psize == 0 ||
(nblks = (*bdevsw[major(dev)]->d_psize) (dev)) == -1)) {
(void) VOP_CLOSE(vp, FREAD | FWRITE, p->p_ucred, p);
return (ENXIO);
}