diff options
author | sos <sos@FreeBSD.org> | 2001-02-06 12:41:53 +0000 |
---|---|---|
committer | sos <sos@FreeBSD.org> | 2001-02-06 12:41:53 +0000 |
commit | 00a84250a000ef2221bf5856d2c61e77d2b7e50a (patch) | |
tree | 7a9842031ccfc5305b9c19589bcb4d011a5711ba /sys | |
parent | 7d76aced28ec9c258bd533a4e33516f71f44b6de (diff) | |
download | FreeBSD-src-00a84250a000ef2221bf5856d2c61e77d2b7e50a.zip FreeBSD-src-00a84250a000ef2221bf5856d2c61e77d2b7e50a.tar.gz |
Fix the clone functionality in atapi-cd, it didn't work for
devs other than the first, and allowed to clone a nonexistent
device..
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/ata/ata-all.c | 6 | ||||
-rw-r--r-- | sys/dev/ata/ata-all.h | 1 | ||||
-rw-r--r-- | sys/dev/ata/atapi-cd.c | 16 |
3 files changed, 17 insertions, 6 deletions
diff --git a/sys/dev/ata/ata-all.c b/sys/dev/ata/ata-all.c index 45bb170..baddc76 100644 --- a/sys/dev/ata/ata-all.c +++ b/sys/dev/ata/ata-all.c @@ -1542,6 +1542,12 @@ ata_get_lun(u_int32_t *map) return lun; } +int +ata_test_lun(u_int32_t *map, int lun) +{ + return (*map & ~(1 << lun)); +} + void ata_free_lun(u_int32_t *map, int lun) { diff --git a/sys/dev/ata/ata-all.h b/sys/dev/ata/ata-all.h index afe1d54..2de871a 100644 --- a/sys/dev/ata/ata-all.h +++ b/sys/dev/ata/ata-all.h @@ -345,6 +345,7 @@ int ata_wait(struct ata_softc *, int, u_int8_t); int ata_command(struct ata_softc *, int, u_int8_t, u_int16_t, u_int8_t, u_int8_t, u_int8_t, u_int8_t, int); int ata_printf(struct ata_softc *, int, const char *, ...) __printflike(3, 4); int ata_get_lun(u_int32_t *); +int ata_test_lun(u_int32_t *, int); void ata_free_lun(u_int32_t *, int); char *ata_mode2str(int); int ata_pio2mode(int); diff --git a/sys/dev/ata/atapi-cd.c b/sys/dev/ata/atapi-cd.c index 263f18f..bc87760 100644 --- a/sys/dev/ata/atapi-cd.c +++ b/sys/dev/ata/atapi-cd.c @@ -279,7 +279,8 @@ acd_clone(void *arg, char *name, int namelen, dev_t *dev) int unit, track = 0; if (*dev != NODEV || - !dev_stdclone(name, &namep, "acd", &unit) || *namep++ != 't') + !dev_stdclone(name, &namep, "acd", &unit) || *namep++ != 't' || + !ata_test_lun(&acd_lun_map, unit)) return; while (isdigit(*namep)) { track *= 10; @@ -287,7 +288,7 @@ acd_clone(void *arg, char *name, int namelen, dev_t *dev) } if (*namep) return; - *dev = make_dev(&acd_cdevsw, unit | (track << 16), 0, 0, 0644, name, NULL); + *dev = make_dev(&acd_cdevsw, (unit<<3)|(track<<16), 0, 0, 0644, name, NULL); } static void @@ -373,8 +374,11 @@ acd_describe(struct acd_softc *cdp) if (cdp->cap.write_dvdram) { printf("%s DVD-RAM", comma ? "," : ""); comma = 1; } - if (cdp->cap.test_write) - printf("%s test write", comma ? "," : ""); + if (cdp->cap.test_write) { + printf("%s test write", comma ? "," : ""); comma = 1; + } + if (cdp->cap.burnproof) + printf("%s burnproof", comma ? "," : ""); } if (cdp->cap.audio_play) { printf("\nacd%d: Audio: ", cdp->lun); @@ -505,10 +509,10 @@ static int acdopen(dev_t dev, int flags, int fmt, struct proc *p) { struct acd_softc *cdp; - int track = (dev->si_udev & 0x00ff0000) >> 16; + int track = (dev->si_udev & 0x001f0000) >> 16; if (track) { - dev_t dev1 = makedev(major(dev), (dev->si_udev & 0xff0000ff)); + dev_t dev1 = makedev(major(dev), (dev->si_udev & 0xffe000ff)); if (track <= ((struct acd_softc*)(dev1->si_drv1))->toc.hdr.ending_track) dev->si_drv1 = dev1->si_drv1; |