silence CDIOREADTOCHEADER
Andriy Gapon
avg at FreeBSD.org
Tue Apr 5 11:26:07 UTC 2011
Please consider the following patch:
diff --git a/sys/cam/scsi/scsi_cd.c b/sys/cam/scsi/scsi_cd.c
index 4c49e2d3..3e86eb8 100644
--- a/sys/cam/scsi/scsi_cd.c
+++ b/sys/cam/scsi/scsi_cd.c
@@ -2135,7 +2135,7 @@ cdioctl(struct disk *dp, u_long cmd, void *addr, int flag,
struct thread *td)
("trying to do CDIOREADTOCHEADER\n"));
error = cdreadtoc(periph, 0, 0, (u_int8_t *)th,
- sizeof (*th), /*sense_flags*/0);
+ sizeof (*th), /*sense_flags*/SF_NO_PRINT);
if (error) {
free(th, M_SCSICD);
cam_periph_unlock(periph);
The idea is the READ_TOC command is bound to fail with "Invalid field in CDB" if
a disc in CD drive doesn't have any tracks, e.g. it is a blank disk.
This is a quite normal condition that doesn't require verbose logging.
Elsewhere in scsi_cd code we already call cdreadtoc with SF_NO_PRINT when we try
find out disk information for internal cd(4) use. That is done for the same
reason according to the comments.
Main reason to want this change is that some userland applications, most
prominently hald, have a habit of calling CDIOREADTOCHEADER while "tasting" a
new disk in a drive.
--
Andriy Gapon
More information about the freebsd-scsi
mailing list