diff options
-rw-r--r-- | sys/dev/ata/atapi-cd.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/dev/ata/atapi-cd.c b/sys/dev/ata/atapi-cd.c index 38369b9..50da005 100644 --- a/sys/dev/ata/atapi-cd.c +++ b/sys/dev/ata/atapi-cd.c @@ -1186,13 +1186,15 @@ acd_read_toc(struct acd_softc *cdp) int8_t ccb[16]; struct g_provider *pp; - bzero(&cdp->toc, sizeof(cdp->toc)); - bzero(ccb, sizeof(ccb)); + if (acd_test_ready(cdp->device)) + return; - if (acd_test_ready(cdp->device) != 0) + if (!(cdp->device->flags & ATA_D_MEDIA_CHANGED)) return; cdp->device->flags &= ~ATA_D_MEDIA_CHANGED; + bzero(&cdp->toc, sizeof(cdp->toc)); + bzero(ccb, sizeof(ccb)); cdp->disk_size = -1; /* hack for GEOM SOS */ len = sizeof(struct ioc_toc_header) + sizeof(struct cd_toc_entry); |