summaryrefslogtreecommitdiff
path: root/sys/dev/ata/wd.c
diff options
context:
space:
mode:
authorAaron Campbell <aaron@cvs.openbsd.org>2004-07-06 00:38:39 +0000
committerAaron Campbell <aaron@cvs.openbsd.org>2004-07-06 00:38:39 +0000
commit7b0e8251a38d162852d5177bc875b41ba6c8424e (patch)
tree0204d950ca1d3bc141a8fa0fb54aa4860f986404 /sys/dev/ata/wd.c
parented39ea5730efcc7ed23c2c4f0f8ee51d79533ec0 (diff)
Replace magic number with a more descriptive #define. This magic number was
particularly vile because it looks like a typo (i.e., looks like one "f" is missing), but it's really not. I happened to notice this myself, but the fix is inspired by NetBSD in the interest of keeping the code similar. deraadt@ ok
Diffstat (limited to 'sys/dev/ata/wd.c')
-rw-r--r--sys/dev/ata/wd.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/dev/ata/wd.c b/sys/dev/ata/wd.c
index 0cc70814c7a..97c52e29b0f 100644
--- a/sys/dev/ata/wd.c
+++ b/sys/dev/ata/wd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wd.c,v 1.40 2004/03/03 17:16:03 tedu Exp $ */
+/* $OpenBSD: wd.c,v 1.41 2004/07/06 00:38:38 aaron Exp $ */
/* $NetBSD: wd.c,v 1.193 1999/02/28 17:15:27 explorer Exp $ */
/*
@@ -104,6 +104,8 @@
#include "locators.h"
#endif
+#define LBA48_THRESHOLD (0xfffffff) /* 128GB / DEV_BSIZE */
+
#define WDIORETRIES_SINGLE 4 /* number of retries before single-sector */
#define WDIORETRIES 5 /* number of retries before giving up */
#define RECOVERYTIME hz/2 /* time to wait before retrying a cmd */
@@ -561,7 +563,8 @@ __wdstart(struct wd_softc *wd, struct buf *bp)
nblks = bp->b_bcount / wd->sc_dk.dk_label->d_secsize;
if ((wd->sc_flags & WDF_LBA48) &&
/* use LBA48 only if really need */
- ((wd->sc_wdc_bio.blkno + nblks - 1 > 0xfffffff) || (nblks > 0xff)))
+ ((wd->sc_wdc_bio.blkno + nblks - 1 > LBA48_THRESHOLD) ||
+ (nblks > 0xff)))
wd->sc_wdc_bio.flags |= ATA_LBA48;
if (wd->sc_flags & WDF_LBA)
wd->sc_wdc_bio.flags |= ATA_LBA;