summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1997-03-26 01:53:50 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1997-03-26 01:53:50 +0000
commit764df8940a5a4eefe07f7338715e949212a5f88f (patch)
tree6edd533972dd9a93e3b5a0b93f3cba39a93a55b1
parent04bd909e9232664c67f0b02768825b63cdbdc957 (diff)
deal with CD drives that indicate 2352 bytes per block...
-rw-r--r--sys/dev/atapi/acd.c9
-rw-r--r--sys/scsi/cd.c6
2 files changed, 5 insertions, 10 deletions
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;