Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 05 Apr 2011 14:26:04 +0300
From:      Andriy Gapon <avg@FreeBSD.org>
To:        freebsd-scsi@FreeBSD.org
Subject:   silence CDIOREADTOCHEADER
Message-ID:  <4D9AFC4C.9070702@FreeBSD.org>

next in thread | raw e-mail | index | archive | help

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4D9AFC4C.9070702>