summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2019-11-23 12:27:33 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2019-11-23 12:27:33 +0000
commit1b00d477b04b935629a718d0bd7cf2efa73363e8 (patch)
tree4bca5b1ef9c54d426f1731b1a3dc2c452754e2ef
parent6a455e2358994a618a893c7a96cbb9e73473f19e (diff)
Consistently use !ISSET() to check for unset flags.
-rw-r--r--sys/scsi/cd.c22
-rw-r--r--sys/scsi/ch.c6
-rw-r--r--sys/scsi/scsi_base.c8
-rw-r--r--sys/scsi/scsi_ioctl.c4
-rw-r--r--sys/scsi/scsiconf.c4
-rw-r--r--sys/scsi/sd.c6
6 files changed, 25 insertions, 25 deletions
diff --git a/sys/scsi/cd.c b/sys/scsi/cd.c
index ebd52e7de81..85d435b631b 100644
--- a/sys/scsi/cd.c
+++ b/sys/scsi/cd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cd.c,v 1.234 2019/11/23 01:16:05 krw Exp $ */
+/* $OpenBSD: cd.c,v 1.235 2019/11/23 12:27:32 krw Exp $ */
/* $NetBSD: cd.c,v 1.100 1997/04/02 02:29:30 mycroft Exp $ */
/*
@@ -216,7 +216,7 @@ cdattach(struct device *parent, struct device *self, void *aux)
/*
* Note if this device is ancient. This is used in cdminphys().
*/
- if (!(link->flags & SDEV_ATAPI) &&
+ if (!ISSET(link->flags, SDEV_ATAPI) &&
SID_ANSII_REV(sa->sa_inqbuf) == SCSI_REV_0)
SET(sc->sc_flags, CDF_ANCIENT);
@@ -310,7 +310,7 @@ cdopen(dev_t dev, int flag, int fmt, struct proc *p)
* If any partition is open, but the disk has been invalidated,
* disallow further opens.
*/
- if ((link->flags & SDEV_MEDIA_LOADED) == 0) {
+ if (!ISSET(link->flags, SDEV_MEDIA_LOADED)) {
if (rawopen)
goto out;
error = EIO;
@@ -460,7 +460,7 @@ cdstrategy(struct buf *bp)
* If the device has been made invalid, error out
* maybe the media changed, or no media loaded
*/
- if ((sc->sc_link->flags & SDEV_MEDIA_LOADED) == 0) {
+ if (!ISSET(sc->sc_link->flags, SDEV_MEDIA_LOADED)) {
bp->b_error = EIO;
goto bad;
}
@@ -532,7 +532,7 @@ cdstart(struct scsi_xfer *xs)
* reads and writes until all files have been closed and
* re-opened
*/
- if ((link->flags & SDEV_MEDIA_LOADED) == 0) {
+ if (!ISSET(link->flags, SDEV_MEDIA_LOADED)) {
bufq_drain(&sc->sc_bufq);
scsi_xs_put(xs);
return;
@@ -561,8 +561,8 @@ cdstart(struct scsi_xfer *xs)
* Fill out the scsi command. If the transfer will
* fit in a "small" cdb, use it.
*/
- if (!(link->flags & SDEV_ATAPI) &&
- !(link->quirks & SDEV_ONLYBIG) &&
+ if (!ISSET(link->flags, SDEV_ATAPI) &&
+ !ISSET(link->quirks, SDEV_ONLYBIG) &&
((secno & 0x1fffff) == secno) &&
((nsecs & 0xff) == nsecs)) {
/*
@@ -736,7 +736,7 @@ cdioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p)
/*
* If the device is not valid.. abandon ship
*/
- if ((sc->sc_link->flags & SDEV_MEDIA_LOADED) == 0) {
+ if (!ISSET(sc->sc_link->flags, SDEV_MEDIA_LOADED)) {
switch (cmd) {
case DIOCLOCK:
case DIOCEJECT:
@@ -766,7 +766,7 @@ cdioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p)
break;
/* FALLTHROUGH */
default:
- if ((sc->sc_link->flags & SDEV_OPEN) == 0)
+ if (!ISSET(sc->sc_link->flags, SDEV_OPEN))
error = ENODEV;
else
error = EIO;
@@ -798,7 +798,7 @@ cdioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p)
case DIOCWDINFO:
case DIOCSDINFO:
- if ((flag & FWRITE) == 0) {
+ if (!ISSET(flag, FWRITE)) {
error = EBADF;
break;
}
@@ -2071,7 +2071,7 @@ cd_interpret_sense(struct scsi_xfer *xs)
u_int8_t skey = sense->flags & SSD_KEY;
u_int8_t serr = sense->error_code & SSD_ERRCODE;
- if (((link->flags & SDEV_OPEN) == 0) ||
+ if (!ISSET(link->flags, SDEV_OPEN) ||
(serr != SSD_ERRCODE_CURRENT && serr != SSD_ERRCODE_DEFERRED))
return (scsi_interpret_sense(xs));
diff --git a/sys/scsi/ch.c b/sys/scsi/ch.c
index 1e8f42d981b..a706c4d2876 100644
--- a/sys/scsi/ch.c
+++ b/sys/scsi/ch.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ch.c,v 1.57 2019/11/23 01:16:05 krw Exp $ */
+/* $OpenBSD: ch.c,v 1.58 2019/11/23 12:27:32 krw Exp $ */
/* $NetBSD: ch.c,v 1.26 1997/02/21 22:06:52 thorpej Exp $ */
/*
@@ -271,7 +271,7 @@ chioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct proc *p)
break;
default:
- if ((flags & FWRITE) == 0)
+ if (!ISSET(flags, FWRITE))
return (EBADF);
}
@@ -756,7 +756,7 @@ ch_interpret_sense(struct scsi_xfer *xs)
u_int8_t serr = sense->error_code & SSD_ERRCODE;
u_int8_t skey = sense->flags & SSD_KEY;
- if (((link->flags & SDEV_OPEN) == 0) ||
+ if (!ISSET(link->flags, SDEV_OPEN) ||
(serr != SSD_ERRCODE_CURRENT && serr != SSD_ERRCODE_DEFERRED))
return (scsi_interpret_sense(xs));
diff --git a/sys/scsi/scsi_base.c b/sys/scsi/scsi_base.c
index 437dedf3745..e816ad56d71 100644
--- a/sys/scsi/scsi_base.c
+++ b/sys/scsi/scsi_base.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: scsi_base.c,v 1.241 2019/11/22 15:34:29 krw Exp $ */
+/* $OpenBSD: scsi_base.c,v 1.242 2019/11/23 12:27:32 krw Exp $ */
/* $NetBSD: scsi_base.c,v 1.43 1997/04/02 02:29:36 mycroft Exp $ */
/*
@@ -1106,7 +1106,7 @@ scsi_do_mode_sense(struct scsi_link *link, int page,
if (big != NULL)
*big = 0;
- if ((link->flags & SDEV_ATAPI) == 0 ||
+ if (!ISSET(link->flags, SDEV_ATAPI) ||
(link->inqdata.device & SID_TYPE) == T_SEQUENTIAL) {
/*
* Try 6 byte mode sense request first. Some devices don't
@@ -1576,7 +1576,7 @@ scsi_interpret_sense(struct scsi_xfer *xs)
CLR(link->flags, SDEV_MEDIA_LOADED);
if (ISSET(xs->flags, SCSI_IGNORE_MEDIA_CHANGE) ||
/* XXX Should reupload any transient state. */
- (link->flags & SDEV_REMOVABLE) == 0) {
+ !ISSET(link->flags, SDEV_REMOVABLE)) {
return (scsi_delay(xs, 1));
}
error = EIO;
@@ -2440,7 +2440,7 @@ scsi_decode_sense(struct scsi_sense_data *sense, int flag)
rqsbuf, sizeof(rqsbuf));
break;
case DECODE_SKSV:
- if (sense->extra_len < 9 || ((spec_1 & SSD_SCS_VALID) == 0))
+ if (sense->extra_len < 9 || !ISSET(spec_1, SSD_SCS_VALID))
break;
switch (skey) {
case SKEY_ILLEGAL_REQUEST:
diff --git a/sys/scsi/scsi_ioctl.c b/sys/scsi/scsi_ioctl.c
index aa4708701f6..ce51ac62180 100644
--- a/sys/scsi/scsi_ioctl.c
+++ b/sys/scsi/scsi_ioctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: scsi_ioctl.c,v 1.60 2019/11/23 01:16:05 krw Exp $ */
+/* $OpenBSD: scsi_ioctl.c,v 1.61 2019/11/23 12:27:32 krw Exp $ */
/* $NetBSD: scsi_ioctl.c,v 1.23 1996/10/12 23:23:17 christos Exp $ */
/*
@@ -316,7 +316,7 @@ scsi_do_ioctl(struct scsi_link *link, u_long cmd, caddr_t addr, int flag)
/* FALLTHROUGH */
case ATAIOCCOMMAND:
case SCIOCDEBUG:
- if ((flag & FWRITE) == 0)
+ if (!ISSET(flag, FWRITE))
return (EPERM);
break;
default:
diff --git a/sys/scsi/scsiconf.c b/sys/scsi/scsiconf.c
index 9cfbe2c369e..4f586e366e5 100644
--- a/sys/scsi/scsiconf.c
+++ b/sys/scsi/scsiconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: scsiconf.c,v 1.219 2019/11/23 01:16:05 krw Exp $ */
+/* $OpenBSD: scsiconf.c,v 1.220 2019/11/23 12:27:32 krw Exp $ */
/* $NetBSD: scsiconf.c,v 1.57 1996/05/02 01:09:01 neil Exp $ */
/*
@@ -503,7 +503,7 @@ scsi_detach_link(struct scsibus_softc *sb, struct scsi_link *link, int flags)
struct scsi_link *alink = sb->adapter_link;
int rv;
- if (((flags & DETACH_FORCE) == 0) && (link->flags & SDEV_OPEN))
+ if (!ISSET(flags, DETACH_FORCE) && (link->flags & SDEV_OPEN))
return (EBUSY);
/* Detaching a device from scsibus is a five step process. */
diff --git a/sys/scsi/sd.c b/sys/scsi/sd.c
index 504b7cd857a..b793999315f 100644
--- a/sys/scsi/sd.c
+++ b/sys/scsi/sd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sd.c,v 1.297 2019/11/09 14:36:30 krw Exp $ */
+/* $OpenBSD: sd.c,v 1.298 2019/11/23 12:27:32 krw Exp $ */
/* $NetBSD: sd.c,v 1.111 1997/04/02 02:29:41 mycroft Exp $ */
/*-
@@ -176,7 +176,7 @@ sdattach(struct device *parent, struct device *self, void *aux)
if (ISSET(link->flags, SDEV_ATAPI) && ISSET(link->flags, SDEV_REMOVABLE))
SET(link->quirks, SDEV_NOSYNCCACHE);
- if (!(link->inqdata.flags & SID_RelAdr))
+ if (!ISSET(link->inqdata.flags, SID_RelAdr))
SET(link->quirks, SDEV_ONLYBIG);
/*
@@ -1325,7 +1325,7 @@ sddump(dev_t dev, daddr_t blkno, caddr_t va, size_t size)
*/
#if 0
/* Make sure it was initialized. */
- if ((sc->sc_link->flags & SDEV_MEDIA_LOADED) != SDEV_MEDIA_LOADED)
+ if (!ISSET(sc->sc_link->flags, SDEV_MEDIA_LOADED))
return ENXIO;
#endif /* 0 */