diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2005-09-19 04:25:01 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2005-09-19 04:25:01 +0000 |
commit | 337ebf3effea77896139ca0823b71f597438e8fe (patch) | |
tree | 894aea1e65df3462423c242a9c37644f33acff9d /sys/scsi/sd.c | |
parent | 31f93a076ba883138b4081a293a18720b0b65b5b (diff) |
Use variable to eliminate repeated calculation. More readable. No
functional change.
ok dlg@
Diffstat (limited to 'sys/scsi/sd.c')
-rw-r--r-- | sys/scsi/sd.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/sys/scsi/sd.c b/sys/scsi/sd.c index bda748be3f0..d89a250a3e9 100644 --- a/sys/scsi/sd.c +++ b/sys/scsi/sd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sd.c,v 1.93 2005/09/11 17:34:27 krw Exp $ */ +/* $OpenBSD: sd.c,v 1.94 2005/09/19 04:25:00 krw Exp $ */ /* $NetBSD: sd.c,v 1.111 1997/04/02 02:29:41 mycroft Exp $ */ /*- @@ -344,12 +344,13 @@ sdopen(dev, flag, fmt, p) { struct scsi_link *sc_link; struct sd_softc *sd; - int unit, part; - int error = 0; + int error = 0, part, rawopen, unit; unit = SDUNIT(dev); part = SDPART(dev); + rawopen = (part == RAW_PART) && (fmt == S_IFCHR); + sd = sdlookup(unit); if (sd == NULL) return (ENXIO); @@ -370,7 +371,7 @@ sdopen(dev, flag, fmt, p) * disallow further opens of non-raw partition. */ if ((sc_link->flags & SDEV_MEDIA_LOADED) == 0) { - if (part == RAW_PART && fmt == S_IFCHR) + if (rawopen) goto out; error = EIO; goto bad; @@ -381,17 +382,16 @@ sdopen(dev, flag, fmt, p) /* Check that it is still responding and ok. */ error = scsi_test_unit_ready(sc_link, - TEST_READY_RETRIES_DEFAULT, - ((part == RAW_PART && fmt == S_IFCHR) ? SCSI_SILENT : 0) | + TEST_READY_RETRIES_DEFAULT, (rawopen ? SCSI_SILENT : 0) | SCSI_IGNORE_ILLEGAL_REQUEST | SCSI_IGNORE_MEDIA_CHANGE); /* Spin up the unit, ready or not. */ error = scsi_start(sc_link, SSS_START, - ((part == RAW_PART && fmt == S_IFCHR) ? SCSI_SILENT : 0) | - SCSI_IGNORE_ILLEGAL_REQUEST | SCSI_IGNORE_MEDIA_CHANGE); + (rawopen ? SCSI_SILENT : 0) | SCSI_IGNORE_ILLEGAL_REQUEST | + SCSI_IGNORE_MEDIA_CHANGE); if (error) { - if (part == RAW_PART && fmt == S_IFCHR) { + if (rawopen) { error = 0; goto out; } else |