Fix dev_t/minor problems

This commit is contained in:
Peter Wemm 1999-05-12 19:01:30 +00:00
parent 83ae4407f5
commit c7b52b866e
9 changed files with 91 additions and 63 deletions

View File

@ -323,13 +323,14 @@ mss_attach(struct isa_device *dev)
} }
int int
mss_open(dev_t dev, int flags, int mode, struct proc * p) mss_open(dev_t i_dev, int flags, int mode, struct proc * p)
{ {
int unit; int unit;
int dev;
snddev_info *d; snddev_info *d;
u_long s; u_long s;
dev = minor(dev); dev = minor(i_dev);
unit = dev >> 4 ; unit = dev >> 4 ;
dev &= 0xf ; dev &= 0xf ;
d = &pcm_info[unit] ; d = &pcm_info[unit] ;
@ -395,13 +396,14 @@ mss_open(dev_t dev, int flags, int mode, struct proc * p)
} }
static int static int
mss_close(dev_t dev, int flags, int mode, struct proc * p) mss_close(dev_t i_dev, int flags, int mode, struct proc * p)
{ {
int unit; int unit;
int dev;
snddev_info *d; snddev_info *d;
u_long s; u_long s;
dev = minor(dev); dev = minor(i_dev);
unit = dev >> 4 ; unit = dev >> 4 ;
dev &= 0xf; dev &= 0xf;
d = &pcm_info[unit] ; d = &pcm_info[unit] ;
@ -437,12 +439,13 @@ mss_close(dev_t dev, int flags, int mode, struct proc * p)
} }
static int static int
mss_ioctl(dev_t dev, u_long cmd, caddr_t arg, int mode, struct proc * p) mss_ioctl(dev_t i_dev, u_long cmd, caddr_t arg, int mode, struct proc * p)
{ {
snddev_info *d; snddev_info *d;
int unit; int unit;
int dev;
dev = minor(dev); dev = minor(i_dev);
unit = dev >> 4 ; unit = dev >> 4 ;
d = &pcm_info[unit] ; d = &pcm_info[unit] ;
/* /*
@ -1897,12 +1900,13 @@ gus_mem_cfg(snddev_info *d)
#endif /* gus mem cfg... */ #endif /* gus mem cfg... */
static int static int
ad1816_ioctl(dev_t dev, u_long cmd, caddr_t arg, int mode, struct proc * p) ad1816_ioctl(dev_t i_dev, u_long cmd, caddr_t arg, int mode, struct proc * p)
{ {
snddev_info *d; snddev_info *d;
int unit; int unit;
int dev;
dev = minor(dev); dev = minor(i_dev);
unit = dev >> 4; unit = dev >> 4;
d = &pcm_info[unit]; d = &pcm_info[unit];

View File

@ -160,12 +160,13 @@ sb_attach(struct isa_device *dev)
* *
*/ */
static int static int
sb_dsp_open(dev_t dev, int flags, int mode, struct proc * p) sb_dsp_open(dev_t i_dev, int flags, int mode, struct proc * p)
{ {
snddev_info *d; snddev_info *d;
int unit ; int unit ;
int dev;
dev = minor(dev); dev = minor(i_dev);
unit = dev >> 4 ; unit = dev >> 4 ;
d = &pcm_info[unit] ; d = &pcm_info[unit] ;
@ -235,13 +236,14 @@ sb_dsp_open(dev_t dev, int flags, int mode, struct proc * p)
} }
static int static int
sb_dsp_close(dev_t dev, int flags, int mode, struct proc * p) sb_dsp_close(dev_t i_dev, int flags, int mode, struct proc * p)
{ {
int unit; int unit;
int dev;
snddev_info *d; snddev_info *d;
u_long s; u_long s;
dev = minor(dev); dev = minor(i_dev);
unit = dev >> 4 ; unit = dev >> 4 ;
d = &pcm_info[unit] ; d = &pcm_info[unit] ;
@ -257,12 +259,13 @@ sb_dsp_close(dev_t dev, int flags, int mode, struct proc * p)
} }
static int static int
sb_dsp_ioctl(dev_t dev, u_long cmd, caddr_t arg, int mode, struct proc * p) sb_dsp_ioctl(dev_t i_dev, u_long cmd, caddr_t arg, int mode, struct proc * p)
{ {
int unit; int unit;
int dev;
snddev_info *d; snddev_info *d;
dev = minor(dev); dev = minor(i_dev);
unit = dev >> 4 ; unit = dev >> 4 ;
d = &pcm_info[unit] ; d = &pcm_info[unit] ;

View File

@ -323,13 +323,14 @@ mss_attach(struct isa_device *dev)
} }
int int
mss_open(dev_t dev, int flags, int mode, struct proc * p) mss_open(dev_t i_dev, int flags, int mode, struct proc * p)
{ {
int unit; int unit;
int dev;
snddev_info *d; snddev_info *d;
u_long s; u_long s;
dev = minor(dev); dev = minor(i_dev);
unit = dev >> 4 ; unit = dev >> 4 ;
dev &= 0xf ; dev &= 0xf ;
d = &pcm_info[unit] ; d = &pcm_info[unit] ;
@ -395,13 +396,14 @@ mss_open(dev_t dev, int flags, int mode, struct proc * p)
} }
static int static int
mss_close(dev_t dev, int flags, int mode, struct proc * p) mss_close(dev_t i_dev, int flags, int mode, struct proc * p)
{ {
int unit; int unit;
int dev;
snddev_info *d; snddev_info *d;
u_long s; u_long s;
dev = minor(dev); dev = minor(i_dev);
unit = dev >> 4 ; unit = dev >> 4 ;
dev &= 0xf; dev &= 0xf;
d = &pcm_info[unit] ; d = &pcm_info[unit] ;
@ -437,12 +439,13 @@ mss_close(dev_t dev, int flags, int mode, struct proc * p)
} }
static int static int
mss_ioctl(dev_t dev, u_long cmd, caddr_t arg, int mode, struct proc * p) mss_ioctl(dev_t i_dev, u_long cmd, caddr_t arg, int mode, struct proc * p)
{ {
snddev_info *d; snddev_info *d;
int unit; int unit;
int dev;
dev = minor(dev); dev = minor(i_dev);
unit = dev >> 4 ; unit = dev >> 4 ;
d = &pcm_info[unit] ; d = &pcm_info[unit] ;
/* /*
@ -1897,12 +1900,13 @@ gus_mem_cfg(snddev_info *d)
#endif /* gus mem cfg... */ #endif /* gus mem cfg... */
static int static int
ad1816_ioctl(dev_t dev, u_long cmd, caddr_t arg, int mode, struct proc * p) ad1816_ioctl(dev_t i_dev, u_long cmd, caddr_t arg, int mode, struct proc * p)
{ {
snddev_info *d; snddev_info *d;
int unit; int unit;
int dev;
dev = minor(dev); dev = minor(i_dev);
unit = dev >> 4; unit = dev >> 4;
d = &pcm_info[unit]; d = &pcm_info[unit];

View File

@ -160,12 +160,13 @@ sb_attach(struct isa_device *dev)
* *
*/ */
static int static int
sb_dsp_open(dev_t dev, int flags, int mode, struct proc * p) sb_dsp_open(dev_t i_dev, int flags, int mode, struct proc * p)
{ {
snddev_info *d; snddev_info *d;
int unit ; int unit ;
int dev;
dev = minor(dev); dev = minor(i_dev);
unit = dev >> 4 ; unit = dev >> 4 ;
d = &pcm_info[unit] ; d = &pcm_info[unit] ;
@ -235,13 +236,14 @@ sb_dsp_open(dev_t dev, int flags, int mode, struct proc * p)
} }
static int static int
sb_dsp_close(dev_t dev, int flags, int mode, struct proc * p) sb_dsp_close(dev_t i_dev, int flags, int mode, struct proc * p)
{ {
int unit; int unit;
int dev;
snddev_info *d; snddev_info *d;
u_long s; u_long s;
dev = minor(dev); dev = minor(i_dev);
unit = dev >> 4 ; unit = dev >> 4 ;
d = &pcm_info[unit] ; d = &pcm_info[unit] ;
@ -257,12 +259,13 @@ sb_dsp_close(dev_t dev, int flags, int mode, struct proc * p)
} }
static int static int
sb_dsp_ioctl(dev_t dev, u_long cmd, caddr_t arg, int mode, struct proc * p) sb_dsp_ioctl(dev_t i_dev, u_long cmd, caddr_t arg, int mode, struct proc * p)
{ {
int unit; int unit;
int dev;
snddev_info *d; snddev_info *d;
dev = minor(dev); dev = minor(i_dev);
unit = dev >> 4 ; unit = dev >> 4 ;
d = &pcm_info[unit] ; d = &pcm_info[unit] ;

View File

@ -160,12 +160,13 @@ sb_attach(struct isa_device *dev)
* *
*/ */
static int static int
sb_dsp_open(dev_t dev, int flags, int mode, struct proc * p) sb_dsp_open(dev_t i_dev, int flags, int mode, struct proc * p)
{ {
snddev_info *d; snddev_info *d;
int unit ; int unit ;
int dev;
dev = minor(dev); dev = minor(i_dev);
unit = dev >> 4 ; unit = dev >> 4 ;
d = &pcm_info[unit] ; d = &pcm_info[unit] ;
@ -235,13 +236,14 @@ sb_dsp_open(dev_t dev, int flags, int mode, struct proc * p)
} }
static int static int
sb_dsp_close(dev_t dev, int flags, int mode, struct proc * p) sb_dsp_close(dev_t i_dev, int flags, int mode, struct proc * p)
{ {
int unit; int unit;
int dev;
snddev_info *d; snddev_info *d;
u_long s; u_long s;
dev = minor(dev); dev = minor(i_dev);
unit = dev >> 4 ; unit = dev >> 4 ;
d = &pcm_info[unit] ; d = &pcm_info[unit] ;
@ -257,12 +259,13 @@ sb_dsp_close(dev_t dev, int flags, int mode, struct proc * p)
} }
static int static int
sb_dsp_ioctl(dev_t dev, u_long cmd, caddr_t arg, int mode, struct proc * p) sb_dsp_ioctl(dev_t i_dev, u_long cmd, caddr_t arg, int mode, struct proc * p)
{ {
int unit; int unit;
int dev;
snddev_info *d; snddev_info *d;
dev = minor(dev); dev = minor(i_dev);
unit = dev >> 4 ; unit = dev >> 4 ;
d = &pcm_info[unit] ; d = &pcm_info[unit] ;

View File

@ -160,12 +160,13 @@ sb_attach(struct isa_device *dev)
* *
*/ */
static int static int
sb_dsp_open(dev_t dev, int flags, int mode, struct proc * p) sb_dsp_open(dev_t i_dev, int flags, int mode, struct proc * p)
{ {
snddev_info *d; snddev_info *d;
int unit ; int unit ;
int dev;
dev = minor(dev); dev = minor(i_dev);
unit = dev >> 4 ; unit = dev >> 4 ;
d = &pcm_info[unit] ; d = &pcm_info[unit] ;
@ -235,13 +236,14 @@ sb_dsp_open(dev_t dev, int flags, int mode, struct proc * p)
} }
static int static int
sb_dsp_close(dev_t dev, int flags, int mode, struct proc * p) sb_dsp_close(dev_t i_dev, int flags, int mode, struct proc * p)
{ {
int unit; int unit;
int dev;
snddev_info *d; snddev_info *d;
u_long s; u_long s;
dev = minor(dev); dev = minor(i_dev);
unit = dev >> 4 ; unit = dev >> 4 ;
d = &pcm_info[unit] ; d = &pcm_info[unit] ;
@ -257,12 +259,13 @@ sb_dsp_close(dev_t dev, int flags, int mode, struct proc * p)
} }
static int static int
sb_dsp_ioctl(dev_t dev, u_long cmd, caddr_t arg, int mode, struct proc * p) sb_dsp_ioctl(dev_t i_dev, u_long cmd, caddr_t arg, int mode, struct proc * p)
{ {
int unit; int unit;
int dev;
snddev_info *d; snddev_info *d;
dev = minor(dev); dev = minor(i_dev);
unit = dev >> 4 ; unit = dev >> 4 ;
d = &pcm_info[unit] ; d = &pcm_info[unit] ;

View File

@ -323,13 +323,14 @@ mss_attach(struct isa_device *dev)
} }
int int
mss_open(dev_t dev, int flags, int mode, struct proc * p) mss_open(dev_t i_dev, int flags, int mode, struct proc * p)
{ {
int unit; int unit;
int dev;
snddev_info *d; snddev_info *d;
u_long s; u_long s;
dev = minor(dev); dev = minor(i_dev);
unit = dev >> 4 ; unit = dev >> 4 ;
dev &= 0xf ; dev &= 0xf ;
d = &pcm_info[unit] ; d = &pcm_info[unit] ;
@ -395,13 +396,14 @@ mss_open(dev_t dev, int flags, int mode, struct proc * p)
} }
static int static int
mss_close(dev_t dev, int flags, int mode, struct proc * p) mss_close(dev_t i_dev, int flags, int mode, struct proc * p)
{ {
int unit; int unit;
int dev;
snddev_info *d; snddev_info *d;
u_long s; u_long s;
dev = minor(dev); dev = minor(i_dev);
unit = dev >> 4 ; unit = dev >> 4 ;
dev &= 0xf; dev &= 0xf;
d = &pcm_info[unit] ; d = &pcm_info[unit] ;
@ -437,12 +439,13 @@ mss_close(dev_t dev, int flags, int mode, struct proc * p)
} }
static int static int
mss_ioctl(dev_t dev, u_long cmd, caddr_t arg, int mode, struct proc * p) mss_ioctl(dev_t i_dev, u_long cmd, caddr_t arg, int mode, struct proc * p)
{ {
snddev_info *d; snddev_info *d;
int unit; int unit;
int dev;
dev = minor(dev); dev = minor(i_dev);
unit = dev >> 4 ; unit = dev >> 4 ;
d = &pcm_info[unit] ; d = &pcm_info[unit] ;
/* /*
@ -1897,12 +1900,13 @@ gus_mem_cfg(snddev_info *d)
#endif /* gus mem cfg... */ #endif /* gus mem cfg... */
static int static int
ad1816_ioctl(dev_t dev, u_long cmd, caddr_t arg, int mode, struct proc * p) ad1816_ioctl(dev_t i_dev, u_long cmd, caddr_t arg, int mode, struct proc * p)
{ {
snddev_info *d; snddev_info *d;
int unit; int unit;
int dev;
dev = minor(dev); dev = minor(i_dev);
unit = dev >> 4; unit = dev >> 4;
d = &pcm_info[unit]; d = &pcm_info[unit];

View File

@ -160,12 +160,13 @@ sb_attach(struct isa_device *dev)
* *
*/ */
static int static int
sb_dsp_open(dev_t dev, int flags, int mode, struct proc * p) sb_dsp_open(dev_t i_dev, int flags, int mode, struct proc * p)
{ {
snddev_info *d; snddev_info *d;
int unit ; int unit ;
int dev;
dev = minor(dev); dev = minor(i_dev);
unit = dev >> 4 ; unit = dev >> 4 ;
d = &pcm_info[unit] ; d = &pcm_info[unit] ;
@ -235,13 +236,14 @@ sb_dsp_open(dev_t dev, int flags, int mode, struct proc * p)
} }
static int static int
sb_dsp_close(dev_t dev, int flags, int mode, struct proc * p) sb_dsp_close(dev_t i_dev, int flags, int mode, struct proc * p)
{ {
int unit; int unit;
int dev;
snddev_info *d; snddev_info *d;
u_long s; u_long s;
dev = minor(dev); dev = minor(i_dev);
unit = dev >> 4 ; unit = dev >> 4 ;
d = &pcm_info[unit] ; d = &pcm_info[unit] ;
@ -257,12 +259,13 @@ sb_dsp_close(dev_t dev, int flags, int mode, struct proc * p)
} }
static int static int
sb_dsp_ioctl(dev_t dev, u_long cmd, caddr_t arg, int mode, struct proc * p) sb_dsp_ioctl(dev_t i_dev, u_long cmd, caddr_t arg, int mode, struct proc * p)
{ {
int unit; int unit;
int dev;
snddev_info *d; snddev_info *d;
dev = minor(dev); dev = minor(i_dev);
unit = dev >> 4 ; unit = dev >> 4 ;
d = &pcm_info[unit] ; d = &pcm_info[unit] ;

View File

@ -445,12 +445,13 @@ generic_snd_probe(struct isa_device * dev, snddev_info **p[], char *s)
* number. * number.
*/ */
static snddev_info * static snddev_info *
get_snddev_info(dev_t dev, int *unit) get_snddev_info(dev_t i_dev, int *unit)
{ {
int u; int u;
snddev_info *d = NULL ; snddev_info *d = NULL ;
int dev;
dev = minor(dev); dev = minor(i_dev);
u = dev >> 4 ; u = dev >> 4 ;
if (unit) if (unit)
*unit = u ; *unit = u ;
@ -502,7 +503,7 @@ sndopen(dev_t i_dev, int flags, int mode, struct proc * p)
snddev_info *d; snddev_info *d;
dev = minor(i_dev); dev = minor(i_dev);
d = get_snddev_info(dev, &unit); d = get_snddev_info(i_dev, &unit);
DEB(printf("open snd%d subdev %d flags 0x%08x mode 0x%08x\n", DEB(printf("open snd%d subdev %d flags 0x%08x mode 0x%08x\n",
unit, dev & 0xf, flags, mode)); unit, dev & 0xf, flags, mode));
@ -545,7 +546,7 @@ sndclose(dev_t i_dev, int flags, int mode, struct proc * p)
snddev_info *d; snddev_info *d;
dev = minor(i_dev); dev = minor(i_dev);
d = get_snddev_info(dev, &unit); d = get_snddev_info(i_dev, &unit);
DEB(printf("close snd%d subdev %d\n", unit, dev & 0xf)); DEB(printf("close snd%d subdev %d\n", unit, dev & 0xf));
@ -579,7 +580,7 @@ sndread(dev_t i_dev, struct uio * buf, int flag)
dev = minor(i_dev); dev = minor(i_dev);
d = get_snddev_info(dev, &unit); d = get_snddev_info(i_dev, &unit);
DEB(printf("read snd%d subdev %d flag 0x%08x\n", unit, dev & 0xf, flag)); DEB(printf("read snd%d subdev %d flag 0x%08x\n", unit, dev & 0xf, flag));
if (d == NULL) if (d == NULL)
@ -666,7 +667,7 @@ sndwrite(dev_t i_dev, struct uio * buf, int flag)
u_long s; u_long s;
dev = minor(i_dev); dev = minor(i_dev);
d = get_snddev_info(dev, &unit); d = get_snddev_info(i_dev, &unit);
DEB(printf("write snd%d subdev %d flag 0x%08x\n", unit, dev & 0xf, flag)); DEB(printf("write snd%d subdev %d flag 0x%08x\n", unit, dev & 0xf, flag));
@ -752,7 +753,7 @@ sndioctl(dev_t i_dev, u_long cmd, caddr_t arg, int mode, struct proc * p)
u_long s; u_long s;
dev = minor(i_dev); dev = minor(i_dev);
d = get_snddev_info(dev, &unit); d = get_snddev_info(i_dev, &unit);
if (d == NULL) if (d == NULL)
return (ENXIO) ; return (ENXIO) ;
@ -767,7 +768,7 @@ sndioctl(dev_t i_dev, u_long cmd, caddr_t arg, int mode, struct proc * p)
return ENXIO ; return ENXIO ;
} }
if (d->ioctl) if (d->ioctl)
ret = d->ioctl(dev, cmd, arg, mode, p); ret = d->ioctl(i_dev, cmd, arg, mode, p);
if (ret != ENOSYS) if (ret != ENOSYS)
return ret ; return ret ;
@ -1189,7 +1190,7 @@ sndselect(dev_t i_dev, int rw, struct proc * p)
u_long flags; u_long flags;
dev = minor(i_dev); dev = minor(i_dev);
d = get_snddev_info(dev, &unit); d = get_snddev_info(i_dev, &unit);
DEB(printf("sndselect dev 0x%04x rw 0x%08x\n",i_dev, rw)); DEB(printf("sndselect dev 0x%04x rw 0x%08x\n",i_dev, rw));
if (d == NULL ) /* should not happen! */ if (d == NULL ) /* should not happen! */
return (ENXIO) ; return (ENXIO) ;