diff options
author | sos <sos@FreeBSD.org> | 2003-11-02 22:24:47 +0000 |
---|---|---|
committer | sos <sos@FreeBSD.org> | 2003-11-02 22:24:47 +0000 |
commit | 7908dcfbce1e0c381cc7a08c905b3acbf4ecd481 (patch) | |
tree | acbe34586972bea5627cea3659066503c4d33d3f /sys/dev/ata | |
parent | 624344bf53e3481625602856c5d8f343875bb7e8 (diff) | |
download | FreeBSD-src-7908dcfbce1e0c381cc7a08c905b3acbf4ecd481.zip FreeBSD-src-7908dcfbce1e0c381cc7a08c905b3acbf4ecd481.tar.gz |
Fix burning of CD's that got broken by the GEOM'ification.
GEOM was not designed to handle media that does not have
a size. Blank CD's are of that type, so cheat and set the
media size to -1. This allows burning to work, but makes
GEOM issue outofrange reads that makes the ATAPI subsystem
spew out a few warnings. GEOM should be tought about this.
GEOM was not designed to handle changing the sectorsize
between opens. Writing multitack CD's with both audio and
data tracks needs to change sector size on the fly. We
cheat here and stuff the current sectorsize into GEOM
private internals. GEOM should grow some clean way for this.
Diffstat (limited to 'sys/dev/ata')
-rw-r--r-- | sys/dev/ata/atapi-cd.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/sys/dev/ata/atapi-cd.c b/sys/dev/ata/atapi-cd.c index 88ea1cc..e5dcc9f 100644 --- a/sys/dev/ata/atapi-cd.c +++ b/sys/dev/ata/atapi-cd.c @@ -233,6 +233,7 @@ acd_init_lun(struct ata_device *atadev) cdp->device = atadev; cdp->lun = ata_get_lun(&acd_lun_map); cdp->block_size = 2048; + cdp->disk_size = -1; /* hack for GEOM SOS */ cdp->slot = -1; cdp->changer_info = NULL; return cdp; @@ -518,16 +519,11 @@ acd_geom_access(struct g_provider *pp, int dr, int dw, int de) acd_prevent_allow(cdp, 0); cdp->flags &= ~F_LOCKED; } - pp->mediasize = (off_t)cdp->disk_size * (off_t)cdp->block_size; - pp->sectorsize = cdp->block_size; - track = pp->index; - - if (track) { + if ((track = pp->index)) { pp->sectorsize = (cdp->toc.tab[track - 1].control & 4) ? 2048 : 2352; - pp->mediasize = - ntohl(cdp->toc.tab[track].addr.lba) - - ntohl(cdp->toc.tab[track - 1].addr.lba); + pp->mediasize = ntohl(cdp->toc.tab[track].addr.lba) - + ntohl(cdp->toc.tab[track - 1].addr.lba); } else { pp->sectorsize = cdp->block_size; @@ -950,6 +946,7 @@ acd_geom_ioctl(struct g_provider *pp, u_long cmd, void *addr, struct thread *td) case CDRIOCSETBLOCKSIZE: cdp->block_size = *(int *)addr; + pp->sectorsize = cdp->block_size; /* hack for GEOM SOS */ acd_set_ioparm(cdp); break; @@ -1013,7 +1010,6 @@ acd_geom_start(struct bio *bp) /* GEOM classes must do their own request limiting */ if (bp->bio_length <= cdp->iomax) { - mtx_lock(&cdp->queue_mtx); bp->bio_pblkno = bp->bio_offset / bp->bio_to->sectorsize; bioq_disksort(&cdp->queue, bp); |