Get the MEDIA_CHANGED status right.

This commit is contained in:
Søren Schmidt 2000-01-28 21:03:25 +00:00
parent 1edde29e97
commit 78e0324341
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=56768
2 changed files with 5 additions and 2 deletions

View File

@ -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);

View File

@ -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;