summaryrefslogtreecommitdiffstats
path: root/sys/dev
diff options
context:
space:
mode:
authorsos <sos@FreeBSD.org>2000-01-28 21:03:25 +0000
committersos <sos@FreeBSD.org>2000-01-28 21:03:25 +0000
commitfcb7935df13747eb6b7eb29b464a2bfc6529307f (patch)
treeab40b1cafe11ebc64e394c563aa619c04c5aea5a /sys/dev
parent1232f6e99e1f4342957e573f1efcc970982d46a7 (diff)
downloadFreeBSD-src-fcb7935df13747eb6b7eb29b464a2bfc6529307f.zip
FreeBSD-src-fcb7935df13747eb6b7eb29b464a2bfc6529307f.tar.gz
Get the MEDIA_CHANGED status right.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/ata/atapi-cd.c4
-rw-r--r--sys/dev/ata/atapi-fd.c3
2 files changed, 5 insertions, 2 deletions
diff --git a/sys/dev/ata/atapi-cd.c b/sys/dev/ata/atapi-cd.c
index 5e5f4c2..30b7e31 100644
--- a/sys/dev/ata/atapi-cd.c
+++ b/sys/dev/ata/atapi-cd.c
@@ -463,6 +463,8 @@ acdopen(dev_t dev, int32_t flags, int32_t fmt, struct proc *p)
cdp->flags |= F_LOCKED;
if (!(flags & O_NONBLOCK) && !(flags & FWRITE))
acd_read_toc(cdp);
+ else
+ atapi_test_ready(cdp->atp);
}
cdp->refcnt++;
return 0;
@@ -1149,9 +1151,9 @@ acd_read_toc(struct acd_softc *cdp)
bzero(&cdp->info, sizeof(cdp->info));
bzero(ccb, sizeof(ccb));
+ atapi_test_ready(cdp->atp);
acd_select_slot(cdp);
- atapi_test_ready(cdp->atp);
if (cdp->atp->flags & ATAPI_F_MEDIA_CHANGED)
cdp->flags &= ~(F_WRITTEN | F_DISK_OPEN | F_TRACK_OPEN);
diff --git a/sys/dev/ata/atapi-fd.c b/sys/dev/ata/atapi-fd.c
index bb2b24e..5dbe8f3 100644
--- a/sys/dev/ata/atapi-fd.c
+++ b/sys/dev/ata/atapi-fd.c
@@ -213,11 +213,12 @@ afdopen(dev_t dev, int32_t flags, int32_t fmt, struct proc *p)
struct afd_softc *fdp = dev->si_drv1;
struct disklabel *label;
- fdp->atp->flags &= ~ATAPI_F_MEDIA_CHANGED;
+ atapi_wait_ready(fdp->atp, 10);
afd_prevent_allow(fdp, 1);
if (afd_sense(fdp))
printf("afd%d: sense media type failed\n", fdp->lun);
+ fdp->atp->flags &= ~ATAPI_F_MEDIA_CHANGED;
label = &fdp->disk.d_label;
bzero(label, sizeof *label);
label->d_secsize = fdp->cap.sector_size;
OpenPOWER on IntegriCloud