Get the MEDIA_CHANGED status right.
This commit is contained in:
parent
1edde29e97
commit
78e0324341
@ -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);
|
||||
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user