git: 80d0d1614cdc - main - cam/cd: The SAW_MEDIA flag duplicates VALID_MEDIA
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 08 Feb 2025 21:43:13 UTC
The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=80d0d1614cdc91acffa9b2e1dc73e47b21e78b8f commit 80d0d1614cdc91acffa9b2e1dc73e47b21e78b8f Author: Warner Losh <imp@FreeBSD.org> AuthorDate: 2025-02-08 21:40:28 +0000 Commit: Warner Losh <imp@FreeBSD.org> CommitDate: 2025-02-08 21:40:28 +0000 cam/cd: The SAW_MEDIA flag duplicates VALID_MEDIA This change mirrors what we do in da. Use only the VALID_MEDIA flag. SAW_MEDIA was just used in one place. Transition to using similar technique to what da uses for valid media. We seem to handle media being ejected while we're doing I/O correctly, both with prevent-allow and without (though the former threw some vendor-specific errors before returning seek errors). I could only test USB attached DVD (over ATAPI over BULK). I couldn't test it with SCSI CD attachment, sata attached CD nor parallel ATA attached CDs because I no longer have any of that hardware. Differential Revision: https://reviews.freebsd.org/D48841 Sponsored by: Netflix --- sys/cam/scsi/scsi_cd.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/sys/cam/scsi/scsi_cd.c b/sys/cam/scsi/scsi_cd.c index ec6e31d49b22..00a417f65052 100644 --- a/sys/cam/scsi/scsi_cd.c +++ b/sys/cam/scsi/scsi_cd.c @@ -103,7 +103,6 @@ typedef enum { CD_FLAG_NEW_DISC = 0x0002, CD_FLAG_DISC_LOCKED = 0x0004, CD_FLAG_DISC_REMOVABLE = 0x0008, - CD_FLAG_SAW_MEDIA = 0x0010, CD_FLAG_ACTIVE = 0x0080, CD_FLAG_SCHED_ON_COMP = 0x0100, CD_FLAG_RETRY_UA = 0x0200, @@ -1490,7 +1489,7 @@ cddone(struct cam_periph *periph, union ccb *done_ccb) softc->disk->d_mediasize = (off_t)softc->params.blksize * softc->params.disksize; - softc->flags |= CD_FLAG_SAW_MEDIA | CD_FLAG_VALID_MEDIA; + softc->flags |= CD_FLAG_VALID_MEDIA; softc->state = CD_STATE_MEDIA_TOC_HDR; } else { softc->flags &= ~(CD_FLAG_VALID_MEDIA | @@ -2886,13 +2885,13 @@ cderror(union ccb *ccb, uint32_t cam_flags, uint32_t sense_flags) /* 28/0: NOT READY TO READY CHANGE, MEDIUM MAY HAVE CHANGED */ disk_media_changed(softc->disk, M_NOWAIT); } else if (sense_key == SSD_KEY_NOT_READY && - asc == 0x3a && (softc->flags & CD_FLAG_SAW_MEDIA)) { + asc == 0x3a && (softc->flags & CD_FLAG_VALID_MEDIA)) { /* 3a/0: MEDIUM NOT PRESENT */ /* 3a/1: MEDIUM NOT PRESENT - TRAY CLOSED */ /* 3a/2: MEDIUM NOT PRESENT - TRAY OPEN */ /* 3a/3: MEDIUM NOT PRESENT - LOADABLE */ /* 3a/4: MEDIUM NOT PRESENT - MEDIUM AUXILIARY MEMORY ACCESSIBLE */ - softc->flags &= ~CD_FLAG_SAW_MEDIA; + softc->flags &= ~CD_FLAG_VALID_MEDIA; disk_media_gone(softc->disk, M_NOWAIT); } }