From c5bc11017e96c2b75ea7dd85e3d980145e3b319e Mon Sep 17 00:00:00 2001 From: Kenneth R Westerback Date: Mon, 26 Sep 2005 22:52:51 +0000 Subject: Use SCSI_IGNORE_ILLEGAL_REQUEST when reading a cd's table of contents. ILLEGAL REQUEST is correctly reported for blank media, as an informative FreeBSD comment pointed out. Ensure the returned table of contents is always initialized to zero. Call readdisklabel with spoofonly = 1 when no data tracks are found. Don't try to read the DOS label from the device if spoofonly is 1. Only done for amd64 here. More archs to follow. Eliminates scsi error messages when attempting to open a cd containing blank media, as pointed out by Michael Coulter. ok deraadt@ --- sys/arch/amd64/amd64/disksubr.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'sys/arch/amd64') diff --git a/sys/arch/amd64/amd64/disksubr.c b/sys/arch/amd64/amd64/disksubr.c index 246a4c6ec0f..c01e4dc5443 100644 --- a/sys/arch/amd64/amd64/disksubr.c +++ b/sys/arch/amd64/amd64/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.3 2005/03/30 07:52:31 deraadt Exp $ */ +/* $OpenBSD: disksubr.c,v 1.4 2005/09/26 22:52:50 krw Exp $ */ /* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */ /* @@ -126,6 +126,11 @@ readdisklabel(dev, strat, lp, osdep, spoofonly) if (part_blkno < extoff) part_blkno = extoff; + if (spoofonly) { + bzero(dp, NDOSPART * sizeof(*dp)); + goto donot; + } + /* read boot record */ bp->b_blkno = part_blkno; bp->b_bcount = lp->d_secsize; -- cgit v1.2.3