diff options
author | phk <phk@FreeBSD.org> | 1999-05-08 07:02:41 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 1999-05-08 07:02:41 +0000 |
commit | bac74fbd5437e3b09bdcbbe1a58698e0fc6aab8b (patch) | |
tree | 64550e00285b8b98137f77e0130d6b4285790397 /sys | |
parent | 31167e1a820f19bcb6a06bf97cbead60ae7105d6 (diff) | |
download | FreeBSD-src-bac74fbd5437e3b09bdcbbe1a58698e0fc6aab8b.zip FreeBSD-src-bac74fbd5437e3b09bdcbbe1a58698e0fc6aab8b.tar.gz |
Fix some of the places where too much inside knowledge about major/minor
layout and dev_t structure is being (ab)used.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/dgb/dgb.c | 7 | ||||
-rw-r--r-- | sys/dev/dgb/dgm.c | 7 | ||||
-rw-r--r-- | sys/dev/mcd/mcd.c | 4 | ||||
-rw-r--r-- | sys/dev/si/si.c | 6 | ||||
-rw-r--r-- | sys/dev/usb/ugen.c | 4 | ||||
-rw-r--r-- | sys/gnu/i386/isa/dgb.c | 7 | ||||
-rw-r--r-- | sys/gnu/i386/isa/dgm.c | 7 | ||||
-rw-r--r-- | sys/i386/isa/cx.c | 2 | ||||
-rw-r--r-- | sys/i386/isa/istallion.c | 33 | ||||
-rw-r--r-- | sys/i386/isa/mcd.c | 4 | ||||
-rw-r--r-- | sys/i386/isa/si.c | 6 | ||||
-rw-r--r-- | sys/i386/isa/sound/soundcard.c | 49 | ||||
-rw-r--r-- | sys/i386/isa/stallion.c | 29 | ||||
-rw-r--r-- | sys/kern/vfs_export.c | 6 | ||||
-rw-r--r-- | sys/kern/vfs_subr.c | 6 | ||||
-rw-r--r-- | sys/sys/disklabel.h | 23 | ||||
-rw-r--r-- | sys/sys/diskmbr.h | 23 | ||||
-rw-r--r-- | sys/sys/diskpc98.h | 23 |
18 files changed, 142 insertions, 104 deletions
diff --git a/sys/dev/dgb/dgb.c b/sys/dev/dgb/dgb.c index 127dfe9..e9a044b 100644 --- a/sys/dev/dgb/dgb.c +++ b/sys/dev/dgb/dgb.c @@ -1,5 +1,5 @@ /*- - * dgb.c $Id: dgb.c,v 1.46 1999/04/28 10:51:55 dt Exp $ + * dgb.c $Id: dgb.c,v 1.47 1999/05/02 21:39:52 peter Exp $ * * Digiboard driver. * @@ -1953,9 +1953,8 @@ dgbparam(tp, t) struct tty *tp; struct termios *t; { - int dev=tp->t_dev; - int unit=MINOR_TO_UNIT(dev); - int pnum=MINOR_TO_PORT(dev); + int unit=MINOR_TO_UNIT(minor(tp->t_dev)); + int pnum=MINOR_TO_PORT(minor(tp->t_dev)); struct dgb_softc *sc=&dgb_softc[unit]; struct dgb_p *port=&sc->ports[pnum]; volatile struct board_chan *bc=port->brdchan; diff --git a/sys/dev/dgb/dgm.c b/sys/dev/dgb/dgm.c index e274ea7..291e520 100644 --- a/sys/dev/dgb/dgm.c +++ b/sys/dev/dgb/dgm.c @@ -1,5 +1,5 @@ /*- - * $Id: dgm.c,v 1.11 1999/05/02 21:39:52 peter Exp $ + * $Id: dgm.c,v 1.12 1999/05/03 09:32:31 brian Exp $ * * This driver and the associated header files support the ISA PC/Xem * Digiboards. Its evolutionary roots are described below. @@ -1757,9 +1757,8 @@ dgmparam(tp, t) struct tty *tp; struct termios *t; { - int dev=tp->t_dev; - int unit=MINOR_TO_UNIT(dev); - int pnum=MINOR_TO_PORT(dev); + int unit=MINOR_TO_UNIT(minor(tp->t_dev)); + int pnum=MINOR_TO_PORT(minor(tp->t_dev)); struct dgm_softc *sc=&dgm_softc[unit]; struct dgm_p *port=&sc->ports[pnum]; volatile struct board_chan *bc=port->brdchan; diff --git a/sys/dev/mcd/mcd.c b/sys/dev/mcd/mcd.c index b53883e..8af4105 100644 --- a/sys/dev/mcd/mcd.c +++ b/sys/dev/mcd/mcd.c @@ -40,7 +40,7 @@ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: mcd.c,v 1.104 1999/05/06 18:54:17 peter Exp $ + * $Id: mcd.c,v 1.105 1999/05/07 07:03:27 phk Exp $ */ static const char COPYRIGHT[] = "mcd-driver (C)1993 by H.Veit & B.Moore"; @@ -225,7 +225,7 @@ static struct cdevsw mcd_cdevsw = { mcdioctl, nostop, nullreset, nodevtotty, seltrue, nommap, mcdstrategy, "mcd", NULL, -1, nodump, nopsize, - D_DISK, 0, NODEV }; + D_DISK}; #define mcd_put(port,byte) outb(port,byte) diff --git a/sys/dev/si/si.c b/sys/dev/si/si.c index 52f672b..8cdef5c 100644 --- a/sys/dev/si/si.c +++ b/sys/dev/si/si.c @@ -30,7 +30,7 @@ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN * NO EVENT SHALL THE AUTHORS BE LIABLE. * - * $Id: si.c,v 1.82 1999/04/28 10:52:52 dt Exp $ + * $Id: si.c,v 1.83 1999/05/02 20:35:44 peter Exp $ */ #ifndef lint @@ -2751,8 +2751,8 @@ si_dprintf(pp, flags, fmt, va_alist) (pp != NULL && ((pp->sp_debug&flags) || (si_debug&flags)))) { if (pp != NULL) printf("%ci%d(%d): ", 's', - (int)SI_CARD(pp->sp_tty->t_dev), - (int)SI_PORT(pp->sp_tty->t_dev)); + (int)SI_CARD(minor(pp->sp_tty->t_dev)), + (int)SI_PORT(minor(pp->sp_tty->t_dev))); va_start(ap, fmt); vprintf(fmt, ap); va_end(ap); diff --git a/sys/dev/usb/ugen.c b/sys/dev/usb/ugen.c index bebd853..d073769 100644 --- a/sys/dev/usb/ugen.c +++ b/sys/dev/usb/ugen.c @@ -141,8 +141,8 @@ usb_config_descriptor_t *ugen_get_cdesc __P((struct ugen_softc *sc, int index, usbd_status ugen_set_interface __P((struct ugen_softc *, int, int)); int ugen_get_alt_index __P((struct ugen_softc *sc, int ifaceidx)); -#define UGENUNIT(n) (((n) >> 4) & 0xf) -#define UGENENDPOINT(n) ((n) & 0xf) +#define UGENUNIT(n) ((minor(n) >> 4) & 0xf) +#define UGENENDPOINT(n) (minor(n) & 0xf) USB_DECLARE_DRIVER(ugen); diff --git a/sys/gnu/i386/isa/dgb.c b/sys/gnu/i386/isa/dgb.c index 127dfe9..e9a044b 100644 --- a/sys/gnu/i386/isa/dgb.c +++ b/sys/gnu/i386/isa/dgb.c @@ -1,5 +1,5 @@ /*- - * dgb.c $Id: dgb.c,v 1.46 1999/04/28 10:51:55 dt Exp $ + * dgb.c $Id: dgb.c,v 1.47 1999/05/02 21:39:52 peter Exp $ * * Digiboard driver. * @@ -1953,9 +1953,8 @@ dgbparam(tp, t) struct tty *tp; struct termios *t; { - int dev=tp->t_dev; - int unit=MINOR_TO_UNIT(dev); - int pnum=MINOR_TO_PORT(dev); + int unit=MINOR_TO_UNIT(minor(tp->t_dev)); + int pnum=MINOR_TO_PORT(minor(tp->t_dev)); struct dgb_softc *sc=&dgb_softc[unit]; struct dgb_p *port=&sc->ports[pnum]; volatile struct board_chan *bc=port->brdchan; diff --git a/sys/gnu/i386/isa/dgm.c b/sys/gnu/i386/isa/dgm.c index e274ea7..291e520 100644 --- a/sys/gnu/i386/isa/dgm.c +++ b/sys/gnu/i386/isa/dgm.c @@ -1,5 +1,5 @@ /*- - * $Id: dgm.c,v 1.11 1999/05/02 21:39:52 peter Exp $ + * $Id: dgm.c,v 1.12 1999/05/03 09:32:31 brian Exp $ * * This driver and the associated header files support the ISA PC/Xem * Digiboards. Its evolutionary roots are described below. @@ -1757,9 +1757,8 @@ dgmparam(tp, t) struct tty *tp; struct termios *t; { - int dev=tp->t_dev; - int unit=MINOR_TO_UNIT(dev); - int pnum=MINOR_TO_PORT(dev); + int unit=MINOR_TO_UNIT(minor(tp->t_dev)); + int pnum=MINOR_TO_PORT(minor(tp->t_dev)); struct dgm_softc *sc=&dgm_softc[unit]; struct dgm_p *port=&sc->ports[pnum]; volatile struct board_chan *bc=port->brdchan; diff --git a/sys/i386/isa/cx.c b/sys/i386/isa/cx.c index 7e2f800..4234000 100644 --- a/sys/i386/isa/cx.c +++ b/sys/i386/isa/cx.c @@ -72,7 +72,7 @@ timeout_t cxtimeout; #define DMABUFSZ (6*256) /* buffer size */ #define BYTE *(unsigned char*)& -#define UNIT(u) ((u) & 077) +#define UNIT(u) (minor(u) & 077) #define UNIT_CTL 077 extern cx_board_t cxboard [NCX]; /* adapter state structures */ diff --git a/sys/i386/isa/istallion.c b/sys/i386/isa/istallion.c index 5816c51..84b4277 100644 --- a/sys/i386/isa/istallion.c +++ b/sys/i386/isa/istallion.c @@ -33,7 +33,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: istallion.c,v 1.25 1999/04/27 11:15:05 phk Exp $ + * $Id: istallion.c,v 1.26 1999/04/28 10:52:35 dt Exp $ */ /*****************************************************************************/ @@ -504,8 +504,8 @@ static char *stli_brdnames[] = { * the device number. This gives us plenty of minor numbers to play * with... */ -#define MKDEV2BRD(m) (((m) & 0x00700000) >> 20) -#define MKDEV2PORT(m) (((m) & 0x1f) | (((m) & 0x00010000) >> 11)) +#define MKDEV2BRD(m) ((minor(m) & 0x00700000) >> 20) +#define MKDEV2PORT(m) ((minor(m) & 0x1f) | ((minor(m) & 0x00010000) >> 11)) /* * Define some handy local macros... @@ -941,7 +941,7 @@ STATIC int stliopen(dev_t dev, int flag, int mode, struct proc *p) /* * Firstly check if the supplied device number is a valid device. */ - if (dev & STL_MEMDEV) + if (minor(dev) & STL_MEMDEV) return(0); portp = stli_dev2port(dev); @@ -1065,7 +1065,7 @@ STATIC int stliclose(dev_t dev, int flag, int mode, struct proc *p) (unsigned long) dev, flag, mode, (void *) p); #endif - if (dev & STL_MEMDEV) + if (minor(dev) & STL_MEMDEV) return(0); portp = stli_dev2port(dev); @@ -1093,7 +1093,7 @@ STATIC int stliread(dev_t dev, struct uio *uiop, int flag) (void *) uiop, flag); #endif - if (dev & STL_MEMDEV) + if (minor(dev) & STL_MEMDEV) return(stli_memrw(dev, uiop, flag)); portp = stli_dev2port(dev); @@ -1150,7 +1150,7 @@ STATIC int stliwrite(dev_t dev, struct uio *uiop, int flag) (void *) uiop, flag); #endif - if (dev & STL_MEMDEV) + if (minor(dev) & STL_MEMDEV) return(stli_memrw(dev, uiop, flag)); portp = stli_dev2port(dev); @@ -1176,8 +1176,7 @@ STATIC int stliioctl(dev_t dev, unsigned long cmd, caddr_t data, int flag, (unsigned long) dev, cmd, (void *) data, flag, (void *) p); #endif - dev = minor(dev); - if (dev & STL_MEMDEV) + if (minor(dev) & STL_MEMDEV) return(stli_memioctl(dev, cmd, data, flag, p)); portp = stli_dev2port(dev); @@ -1191,12 +1190,12 @@ STATIC int stliioctl(dev_t dev, unsigned long cmd, caddr_t data, int flag, /* * First up handle ioctls on the control devices. */ - if (dev & STL_CTRLDEV) { - if ((dev & STL_CTRLDEV) == STL_CTRLINIT) - localtios = (dev & STL_CALLOUTDEV) ? + if (minor(dev) & STL_CTRLDEV) { + if ((minor(dev) & STL_CTRLDEV) == STL_CTRLINIT) + localtios = (minor(dev) & STL_CALLOUTDEV) ? &portp->initouttios : &portp->initintios; - else if ((dev & STL_CTRLDEV) == STL_CTRLLOCK) - localtios = (dev & STL_CALLOUTDEV) ? + else if ((minor(dev) & STL_CTRLDEV) == STL_CTRLLOCK) + localtios = (minor(dev) & STL_CALLOUTDEV) ? &portp->lockouttios : &portp->lockintios; else return(ENODEV); @@ -1245,7 +1244,7 @@ STATIC int stliioctl(dev_t dev, unsigned long cmd, caddr_t data, int flag, */ if ((cmd == TIOCSETA) || (cmd == TIOCSETAW) || (cmd == TIOCSETAF)) { newtios = (struct termios *) data; - localtios = (dev & STL_CALLOUTDEV) ? &portp->lockouttios : + localtios = (minor(dev) & STL_CALLOUTDEV) ? &portp->lockouttios : &portp->lockintios; newtios->c_iflag = (tp->t_iflag & localtios->c_iflag) | @@ -3783,7 +3782,7 @@ STATIC int stli_memrw(dev_t dev, struct uio *uiop, int flag) (int) uiop, flag); #endif - brdnr = dev & 0x7; + brdnr = minor(dev) & 0x7; brdp = stli_brds[brdnr]; if (brdp == (stlibrd_t *) NULL) return(ENODEV); @@ -3831,7 +3830,7 @@ static int stli_memioctl(dev_t dev, unsigned long cmd, caddr_t data, int flag, (unsigned long) dev, cmd, (void *) data, flag); #endif - brdnr = dev & 0x7; + brdnr = minor(dev) & 0x7; brdp = stli_brds[brdnr]; if (brdp == (stlibrd_t *) NULL) return(ENODEV); diff --git a/sys/i386/isa/mcd.c b/sys/i386/isa/mcd.c index b53883e..8af4105 100644 --- a/sys/i386/isa/mcd.c +++ b/sys/i386/isa/mcd.c @@ -40,7 +40,7 @@ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: mcd.c,v 1.104 1999/05/06 18:54:17 peter Exp $ + * $Id: mcd.c,v 1.105 1999/05/07 07:03:27 phk Exp $ */ static const char COPYRIGHT[] = "mcd-driver (C)1993 by H.Veit & B.Moore"; @@ -225,7 +225,7 @@ static struct cdevsw mcd_cdevsw = { mcdioctl, nostop, nullreset, nodevtotty, seltrue, nommap, mcdstrategy, "mcd", NULL, -1, nodump, nopsize, - D_DISK, 0, NODEV }; + D_DISK}; #define mcd_put(port,byte) outb(port,byte) diff --git a/sys/i386/isa/si.c b/sys/i386/isa/si.c index 52f672b..8cdef5c 100644 --- a/sys/i386/isa/si.c +++ b/sys/i386/isa/si.c @@ -30,7 +30,7 @@ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN * NO EVENT SHALL THE AUTHORS BE LIABLE. * - * $Id: si.c,v 1.82 1999/04/28 10:52:52 dt Exp $ + * $Id: si.c,v 1.83 1999/05/02 20:35:44 peter Exp $ */ #ifndef lint @@ -2751,8 +2751,8 @@ si_dprintf(pp, flags, fmt, va_alist) (pp != NULL && ((pp->sp_debug&flags) || (si_debug&flags)))) { if (pp != NULL) printf("%ci%d(%d): ", 's', - (int)SI_CARD(pp->sp_tty->t_dev), - (int)SI_PORT(pp->sp_tty->t_dev)); + (int)SI_CARD(minor(pp->sp_tty->t_dev)), + (int)SI_PORT(minor(pp->sp_tty->t_dev))); va_start(ap, fmt); vprintf(fmt, ap); va_end(ap); diff --git a/sys/i386/isa/sound/soundcard.c b/sys/i386/isa/sound/soundcard.c index 57320ba..e00e462 100644 --- a/sys/i386/isa/sound/soundcard.c +++ b/sys/i386/isa/sound/soundcard.c @@ -150,11 +150,11 @@ static int sndmmap( dev_t dev, int offset, int nprot ) { struct dma_buffparms * dmap; + u_int min = minor(dev) >> 4; - dev = minor(dev) >> 4; - if (dev > 0 ) return (-1); + if (min > 0 ) return (-1); - dmap = audio_devs[dev]->dmap_out; + dmap = audio_devs[min]->dmap_out; if (nprot & PROT_EXEC) return( -1 ); @@ -167,9 +167,9 @@ static int sndread(dev_t dev, struct uio * buf, int flag) { int count = buf->uio_resid; + u_int min = minor(dev); - dev = minor(dev); - FIX_RETURN(sound_read_sw(dev, &files[dev], buf, count)); + FIX_RETURN(sound_read_sw(min, &files[min], buf, count)); } @@ -177,9 +177,9 @@ static int sndwrite(dev_t dev, struct uio * buf, int flag) { int count = buf->uio_resid; + u_int min = minor(dev); - dev = minor(dev); - FIX_RETURN(sound_write_sw(dev, &files[dev], buf, count)); + FIX_RETURN(sound_write_sw(min, &files[min], buf, count)); } static int @@ -187,9 +187,9 @@ sndopen(dev_t dev, int flags, int mode, struct proc * p) { int retval; struct fileinfo tmp_file; + u_int min = minor(dev); - dev = minor(dev); - if (!soundcard_configured && dev) { + if (!soundcard_configured && min) { printf("SoundCard Error: soundcard system has not been configured\n"); return ENODEV ; } @@ -202,12 +202,12 @@ sndopen(dev_t dev, int flags, int mode, struct proc * p) else if (flags & FWRITE) tmp_file.mode = OPEN_WRITE; - selinfo[dev >> 4].si_pid = 0; - selinfo[dev >> 4].si_flags = 0; - if ((retval = sound_open_sw(dev, &tmp_file)) < 0) + selinfo[min >> 4].si_pid = 0; + selinfo[min >> 4].si_flags = 0; + if ((retval = sound_open_sw(min, &tmp_file)) < 0) FIX_RETURN(retval); - bcopy((char *) &tmp_file, (char *) &files[dev], sizeof(tmp_file)); + bcopy((char *) &tmp_file, (char *) &files[min], sizeof(tmp_file)); FIX_RETURN(retval); } @@ -216,38 +216,37 @@ sndopen(dev_t dev, int flags, int mode, struct proc * p) static int sndclose(dev_t dev, int flags, int mode, struct proc * p) { - dev = minor(dev); - sound_release_sw(dev, &files[dev]); + u_int min = minor(dev); + sound_release_sw(min, &files[min]); return 0 ; } static int sndioctl(dev_t dev, u_long cmd, caddr_t arg, int mode, struct proc * p) { - dev = minor(dev); - FIX_RETURN(sound_ioctl_sw(dev, &files[dev], cmd, arg)); + u_int min = minor(dev); + FIX_RETURN(sound_ioctl_sw(min, &files[min], cmd, arg)); } int sndpoll(dev_t dev, int events, struct proc * p) { - dev = minor(dev); - dev = minor(dev); + u_int min = minor(dev); - /* printf ("snd_select(dev=%d, rw=%d, pid=%d)\n", dev, rw, p->p_pid); */ + /* printf ("snd_select(dev=%d, rw=%d, pid=%d)\n", min, rw, p->p_pid); */ #ifdef ALLOW_POLL - switch (dev & 0x0f) { + switch (min & 0x0f) { #ifdef CONFIG_SEQUENCER case SND_DEV_SEQ: case SND_DEV_SEQ2: - return sequencer_poll(dev, &files[dev], events, p); + return sequencer_poll(min, &files[min], events, p); break; #endif #ifdef CONFIG_MIDI case SND_DEV_MIDIN: - return MIDIbuf_poll(dev, &files[dev], events, p); + return MIDIbuf_poll(min, &files[min], events, p); break; #endif @@ -256,7 +255,7 @@ sndpoll(dev_t dev, int events, struct proc * p) case SND_DEV_DSP16: case SND_DEV_AUDIO: - return audio_poll(dev, &files[dev], events, p); + return audio_poll(min, &files[min], events, p); break; #endif @@ -265,7 +264,7 @@ sndpoll(dev_t dev, int events, struct proc * p) } #endif /* ALLOW_POLL */ - DEB(printf("sound_ioctl(dev=%d, cmd=0x%x, arg=0x%x)\n", dev, cmd, arg)); + DEB(printf("sound_ioctl(min=%d, cmd=0x%x, arg=0x%x)\n", min, cmd, arg)); return 0 ; } diff --git a/sys/i386/isa/stallion.c b/sys/i386/isa/stallion.c index 97b564d..2dd3c1f 100644 --- a/sys/i386/isa/stallion.c +++ b/sys/i386/isa/stallion.c @@ -33,7 +33,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: stallion.c,v 1.28 1999/04/28 10:52:57 dt Exp $ + * $Id: stallion.c,v 1.29 1999/05/06 18:44:05 peter Exp $ */ /*****************************************************************************/ @@ -416,8 +416,8 @@ static int stl_cd1400clkdivs[] = { * the device number. This gives us plenty of minor numbers to play * with... */ -#define MKDEV2BRD(m) (((m) & 0x00700000) >> 20) -#define MKDEV2PORT(m) (((m) & 0x1f) | (((m) & 0x00010000) >> 11)) +#define MKDEV2BRD(m) ((minor(m) & 0x00700000) >> 20) +#define MKDEV2PORT(m) ((minor(m) & 0x1f) | ((minor(m) & 0x00010000) >> 11)) /* * Define some handy local macros... @@ -773,7 +773,7 @@ STATIC int stlopen(dev_t dev, int flag, int mode, struct proc *p) /* * Firstly check if the supplied device number is a valid device. */ - if (dev & STL_MEMDEV) + if (minor(dev) & STL_MEMDEV) return(0); portp = stl_dev2port(dev); @@ -885,7 +885,7 @@ STATIC int stlclose(dev_t dev, int flag, int mode, struct proc *p) flag, mode, (void *) p); #endif - if (dev & STL_MEMDEV) + if (minor(dev) & STL_MEMDEV) return(0); portp = stl_dev2port(dev); @@ -988,8 +988,7 @@ STATIC int stlioctl(dev_t dev, unsigned long cmd, caddr_t data, int flag, (unsigned long) dev, cmd, (void *) data, flag, (void *) p); #endif - dev = minor(dev); - if (dev & STL_MEMDEV) + if (minor(dev) & STL_MEMDEV) return(stl_memioctl(dev, cmd, data, flag, p)); portp = stl_dev2port(dev); @@ -1001,12 +1000,12 @@ STATIC int stlioctl(dev_t dev, unsigned long cmd, caddr_t data, int flag, /* * First up handle ioctls on the control devices. */ - if (dev & STL_CTRLDEV) { - if ((dev & STL_CTRLDEV) == STL_CTRLINIT) - localtios = (dev & STL_CALLOUTDEV) ? + if (minor(dev) & STL_CTRLDEV) { + if ((minor(dev) & STL_CTRLDEV) == STL_CTRLINIT) + localtios = (minor(dev) & STL_CALLOUTDEV) ? &portp->initouttios : &portp->initintios; - else if ((dev & STL_CTRLDEV) == STL_CTRLLOCK) - localtios = (dev & STL_CALLOUTDEV) ? + else if ((minor(dev) & STL_CTRLDEV) == STL_CTRLLOCK) + localtios = (minor(dev) & STL_CALLOUTDEV) ? &portp->lockouttios : &portp->lockintios; else return(ENODEV); @@ -1055,8 +1054,8 @@ STATIC int stlioctl(dev_t dev, unsigned long cmd, caddr_t data, int flag, */ if ((cmd == TIOCSETA) || (cmd == TIOCSETAW) || (cmd == TIOCSETAF)) { newtios = (struct termios *) data; - localtios = (dev & STL_CALLOUTDEV) ? &portp->lockouttios : - &portp->lockintios; + localtios = (minor(dev) & STL_CALLOUTDEV) ? + &portp->lockouttios : &portp->lockintios; newtios->c_iflag = (tp->t_iflag & localtios->c_iflag) | (newtios->c_iflag & ~localtios->c_iflag); @@ -3103,7 +3102,7 @@ static int stl_memioctl(dev_t dev, unsigned long cmd, caddr_t data, int flag, (unsigned long) dev, cmd, (void *) data, flag); #endif - brdnr = dev & 0x7; + brdnr = minor(dev) & 0x7; brdp = stl_brds[brdnr]; if (brdp == (stlbrd_t *) NULL) return(ENODEV); diff --git a/sys/kern/vfs_export.c b/sys/kern/vfs_export.c index c33406e..ff42b06 100644 --- a/sys/kern/vfs_export.c +++ b/sys/kern/vfs_export.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)vfs_subr.c 8.31 (Berkeley) 5/26/95 - * $Id: vfs_subr.c,v 1.191 1999/05/07 10:10:58 phk Exp $ + * $Id: vfs_subr.c,v 1.192 1999/05/08 06:39:48 phk Exp $ */ /* @@ -324,11 +324,11 @@ vfs_getnewfsid(mp) simple_lock(&mntid_slock); mtype = mp->mnt_vfc->vfc_typenum; - mp->mnt_stat.f_fsid.val[0] = makedev(nblkdev + mtype, 0); + mp->mnt_stat.f_fsid.val[0] = (nblkdev + mtype) * 256; mp->mnt_stat.f_fsid.val[1] = mtype; if (xxxfs_mntid == 0) ++xxxfs_mntid; - tfsid.val[0] = makedev(nblkdev + mtype, xxxfs_mntid); + tfsid.val[0] = (nblkdev + mtype) * 256 | xxxfs_mntid; tfsid.val[1] = mtype; if (mountlist.cqh_first != (void *)&mountlist) { while (vfs_getvfs(&tfsid)) { diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index c33406e..ff42b06 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)vfs_subr.c 8.31 (Berkeley) 5/26/95 - * $Id: vfs_subr.c,v 1.191 1999/05/07 10:10:58 phk Exp $ + * $Id: vfs_subr.c,v 1.192 1999/05/08 06:39:48 phk Exp $ */ /* @@ -324,11 +324,11 @@ vfs_getnewfsid(mp) simple_lock(&mntid_slock); mtype = mp->mnt_vfc->vfc_typenum; - mp->mnt_stat.f_fsid.val[0] = makedev(nblkdev + mtype, 0); + mp->mnt_stat.f_fsid.val[0] = (nblkdev + mtype) * 256; mp->mnt_stat.f_fsid.val[1] = mtype; if (xxxfs_mntid == 0) ++xxxfs_mntid; - tfsid.val[0] = makedev(nblkdev + mtype, xxxfs_mntid); + tfsid.val[0] = (nblkdev + mtype) * 256 | xxxfs_mntid; tfsid.val[1] = mtype; if (mountlist.cqh_first != (void *)&mountlist) { while (vfs_getvfs(&tfsid)) { diff --git a/sys/sys/disklabel.h b/sys/sys/disklabel.h index b011091..6d603ff 100644 --- a/sys/sys/disklabel.h +++ b/sys/sys/disklabel.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)disklabel.h 8.2 (Berkeley) 7/10/94 - * $Id: disklabel.h,v 1.37 1999/03/23 04:08:42 grog Exp $ + * $Id: disklabel.h,v 1.38 1999/04/03 07:21:14 bde Exp $ */ #ifndef _SYS_DISKLABEL_H_ @@ -419,12 +419,27 @@ struct dos_partition { #define dkmakeminor(unit, slice, part) \ (((slice) << 16) | (((unit) & 0x1e0) << 16) | \ (((unit) & 0x1f) << 3) | (part)) -#define dkmodpart(dev, part) (((dev) & ~(dev_t)7) | (part)) -#define dkmodslice(dev, slice) (((dev) & ~(dev_t)0x1f0000) | ((slice) << 16)) +static __inline dev_t +dkmodpart(dev_t dev, int part) +{ + return (makedev(major(dev), (minor(dev) & ~7) | part)); +} + +static __inline dev_t +dkmodslice(dev_t dev, int slice) +{ + return (makedev(major(dev), (minor(dev) & ~0x1f0000) | (slice << 16))); +} + #define dkpart(dev) (minor(dev) & 7) #define dkslice(dev) ((minor(dev) >> 16) & 0x1f) #define dktype(dev) ((minor(dev) >> 25) & 0x7f) -#define dkunit(dev) ((((dev) >> 16) & 0x1e0) | (((dev) >> 3) & 0x1f)) + +static __inline u_int +dkunit(dev_t dev) +{ + return (((minor(dev) >> 16) & 0x1e0) | ((minor(dev) >> 3) & 0x1f)); +} #ifdef KERNEL diff --git a/sys/sys/diskmbr.h b/sys/sys/diskmbr.h index b011091..6d603ff 100644 --- a/sys/sys/diskmbr.h +++ b/sys/sys/diskmbr.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)disklabel.h 8.2 (Berkeley) 7/10/94 - * $Id: disklabel.h,v 1.37 1999/03/23 04:08:42 grog Exp $ + * $Id: disklabel.h,v 1.38 1999/04/03 07:21:14 bde Exp $ */ #ifndef _SYS_DISKLABEL_H_ @@ -419,12 +419,27 @@ struct dos_partition { #define dkmakeminor(unit, slice, part) \ (((slice) << 16) | (((unit) & 0x1e0) << 16) | \ (((unit) & 0x1f) << 3) | (part)) -#define dkmodpart(dev, part) (((dev) & ~(dev_t)7) | (part)) -#define dkmodslice(dev, slice) (((dev) & ~(dev_t)0x1f0000) | ((slice) << 16)) +static __inline dev_t +dkmodpart(dev_t dev, int part) +{ + return (makedev(major(dev), (minor(dev) & ~7) | part)); +} + +static __inline dev_t +dkmodslice(dev_t dev, int slice) +{ + return (makedev(major(dev), (minor(dev) & ~0x1f0000) | (slice << 16))); +} + #define dkpart(dev) (minor(dev) & 7) #define dkslice(dev) ((minor(dev) >> 16) & 0x1f) #define dktype(dev) ((minor(dev) >> 25) & 0x7f) -#define dkunit(dev) ((((dev) >> 16) & 0x1e0) | (((dev) >> 3) & 0x1f)) + +static __inline u_int +dkunit(dev_t dev) +{ + return (((minor(dev) >> 16) & 0x1e0) | ((minor(dev) >> 3) & 0x1f)); +} #ifdef KERNEL diff --git a/sys/sys/diskpc98.h b/sys/sys/diskpc98.h index b011091..6d603ff 100644 --- a/sys/sys/diskpc98.h +++ b/sys/sys/diskpc98.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)disklabel.h 8.2 (Berkeley) 7/10/94 - * $Id: disklabel.h,v 1.37 1999/03/23 04:08:42 grog Exp $ + * $Id: disklabel.h,v 1.38 1999/04/03 07:21:14 bde Exp $ */ #ifndef _SYS_DISKLABEL_H_ @@ -419,12 +419,27 @@ struct dos_partition { #define dkmakeminor(unit, slice, part) \ (((slice) << 16) | (((unit) & 0x1e0) << 16) | \ (((unit) & 0x1f) << 3) | (part)) -#define dkmodpart(dev, part) (((dev) & ~(dev_t)7) | (part)) -#define dkmodslice(dev, slice) (((dev) & ~(dev_t)0x1f0000) | ((slice) << 16)) +static __inline dev_t +dkmodpart(dev_t dev, int part) +{ + return (makedev(major(dev), (minor(dev) & ~7) | part)); +} + +static __inline dev_t +dkmodslice(dev_t dev, int slice) +{ + return (makedev(major(dev), (minor(dev) & ~0x1f0000) | (slice << 16))); +} + #define dkpart(dev) (minor(dev) & 7) #define dkslice(dev) ((minor(dev) >> 16) & 0x1f) #define dktype(dev) ((minor(dev) >> 25) & 0x7f) -#define dkunit(dev) ((((dev) >> 16) & 0x1e0) | (((dev) >> 3) & 0x1f)) + +static __inline u_int +dkunit(dev_t dev) +{ + return (((minor(dev) >> 16) & 0x1e0) | ((minor(dev) >> 3) & 0x1f)); +} #ifdef KERNEL |