From: deraadt Date: Wed, 26 Mar 1997 01:53:48 +0000 (+0000) Subject: deal with CD drives that indicate 2352 bytes per block... X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=cd694eb1c1168c93653b51517ec88bbd09cbfa17;p=openbsd deal with CD drives that indicate 2352 bytes per block... --- diff --git a/sys/dev/atapi/acd.c b/sys/dev/atapi/acd.c index b0564c965bd..ce446843837 100644 --- a/sys/dev/atapi/acd.c +++ b/sys/dev/atapi/acd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acd.c,v 1.22 1997/02/23 18:48:13 niklas Exp $ */ +/* $OpenBSD: acd.c,v 1.23 1997/03/26 01:53:49 deraadt Exp $ */ /* * Copyright (c) 1996 Manuel Bouyer. All rights reserved. @@ -984,11 +984,6 @@ acdgetdisklabel(acd) bzero(acd->sc_dk.dk_cpulabel, sizeof(struct cpu_disklabel)); lp->d_secsize = acd->params.blksize; -#if 0 - /* I don't think this is necessary anymore. */ - if (lp->d_secsize > 2048) - lp->d_secsize = 2048; -#endif lp->d_ntracks = 1; lp->d_nsectors = 100; lp->d_ncylinders = (acd->params.disksize / 100) + 1; @@ -1130,6 +1125,8 @@ acd_size(acd, flags) } acd->params.blksize = _4btol((u_int8_t*)&rdcap.blksize); + if (acd->params.blksize < 512 || acd->params.blksize > 2048) + acd->params.blksize = 2048; /* some drives lie ! */ acd->params.disksize = _4btol((u_int8_t*)&rdcap.size); ATAPI_DEBUG_PRINT(("acd_size: %ld %ld\n", acd->params.blksize, diff --git a/sys/scsi/cd.c b/sys/scsi/cd.c index 56991a4fac9..1a96f733782 100644 --- a/sys/scsi/cd.c +++ b/sys/scsi/cd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cd.c,v 1.20 1997/01/04 08:50:20 deraadt Exp $ */ +/* $OpenBSD: cd.c,v 1.21 1997/03/26 01:53:48 deraadt Exp $ */ /* $NetBSD: cd.c,v 1.92 1996/05/05 19:52:50 christos Exp $ */ /* @@ -1056,8 +1056,6 @@ cdgetdisklabel(dev, cd) bzero(cd->sc_dk.dk_cpulabel, sizeof(struct cpu_disklabel)); lp->d_secsize = cd->params.blksize; - if (lp->d_secsize > 2048) - lp->d_secsize = 2048; lp->d_ntracks = 1; lp->d_nsectors = 100; lp->d_ncylinders = (cd->params.disksize / 100) + 1; @@ -1126,7 +1124,7 @@ cd_size(cd, flags) return 0; blksize = _4btol(rdcap.length); - if (blksize < 512) + if (blksize < 512 || blksize > 2048) blksize = 2048; /* some drives lie ! */ cd->params.blksize = blksize;