summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2019-11-23 17:10:14 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2019-11-23 17:10:14 +0000
commit9fadecf60bd7f802122c82e0248c7b864b60894f (patch)
treeb469c9dbb48d4e529c6313df873b801ac1dc2e7d /sys
parenta6babe8ae9995ae1fdfa6ecfd8d503477d048e17 (diff)
Consistently use ISSET() to check for set flags.
Diffstat (limited to 'sys')
-rw-r--r--sys/scsi/cd.c32
-rw-r--r--sys/scsi/ch.c16
-rw-r--r--sys/scsi/scsi_base.c28
-rw-r--r--sys/scsi/scsi_ioctl.c16
-rw-r--r--sys/scsi/scsiconf.c16
-rw-r--r--sys/scsi/sd.c4
-rw-r--r--sys/scsi/st.c6
-rw-r--r--sys/scsi/uk.c4
8 files changed, 61 insertions, 61 deletions
diff --git a/sys/scsi/cd.c b/sys/scsi/cd.c
index 85d435b631b..857b2793a07 100644
--- a/sys/scsi/cd.c
+++ b/sys/scsi/cd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cd.c,v 1.235 2019/11/23 12:27:32 krw Exp $ */
+/* $OpenBSD: cd.c,v 1.236 2019/11/23 17:10:13 krw Exp $ */
/* $NetBSD: cd.c,v 1.100 1997/04/02 02:29:30 mycroft Exp $ */
/*
@@ -290,7 +290,7 @@ cdopen(dev_t dev, int flag, int fmt, struct proc *p)
sc = cdlookup(unit);
if (sc == NULL)
return (ENXIO);
- if (sc->sc_flags & CDF_DYING) {
+ if (ISSET(sc->sc_flags, CDF_DYING)) {
device_unref(&sc->sc_dev);
return (ENXIO);
}
@@ -400,7 +400,7 @@ cdclose(dev_t dev, int flag, int fmt, struct proc *p)
sc = cdlookup(DISKUNIT(dev));
if (sc == NULL)
return ENXIO;
- if (sc->sc_flags & CDF_DYING) {
+ if (ISSET(sc->sc_flags, CDF_DYING)) {
device_unref(&sc->sc_dev);
return (ENXIO);
}
@@ -417,7 +417,7 @@ cdclose(dev_t dev, int flag, int fmt, struct proc *p)
SCSI_SILENT);
CLR(sc->sc_link->flags, SDEV_OPEN | SDEV_MEDIA_LOADED);
- if (sc->sc_link->flags & SDEV_EJECTING) {
+ if (ISSET(sc->sc_link->flags, SDEV_EJECTING)) {
scsi_start(sc->sc_link, SSS_STOP|SSS_LOEJ, 0);
CLR(sc->sc_link->flags, SDEV_EJECTING);
@@ -449,7 +449,7 @@ cdstrategy(struct buf *bp)
bp->b_error = ENXIO;
goto bad;
}
- if (sc->sc_flags & CDF_DYING) {
+ if (ISSET(sc->sc_flags, CDF_DYING)) {
bp->b_error = ENXIO;
goto bad;
}
@@ -522,7 +522,7 @@ cdstart(struct scsi_xfer *xs)
SC_DEBUG(link, SDEV_DB2, ("cdstart\n"));
- if (sc->sc_flags & CDF_DYING) {
+ if (ISSET(sc->sc_flags, CDF_DYING)) {
scsi_xs_put(xs);
return;
}
@@ -685,7 +685,7 @@ cdminphys(struct buf *bp)
* ancient device gets confused by length == 0. A length of 0
* in a 10-byte read/write actually means 0 blocks.
*/
- if (sc->sc_flags & CDF_ANCIENT) {
+ if (ISSET(sc->sc_flags, CDF_ANCIENT)) {
max = sc->sc_dk.dk_label->d_secsize * 0xff;
if (bp->b_bcount > max)
@@ -726,7 +726,7 @@ cdioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p)
sc = cdlookup(DISKUNIT(dev));
if (sc == NULL)
return ENXIO;
- if (sc->sc_flags & CDF_DYING) {
+ if (ISSET(sc->sc_flags, CDF_DYING)) {
device_unref(&sc->sc_dev);
return (ENXIO);
}
@@ -872,7 +872,7 @@ cdioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p)
dma_free(th, sizeof(*th));
break;
}
- if (sc->sc_link->quirks & ADEV_LITTLETOC)
+ if (ISSET(sc->sc_link->quirks, ADEV_LITTLETOC))
th->len = letoh16(th->len);
else
th->len = betoh16(th->len);
@@ -914,7 +914,7 @@ cdioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p)
ntracks >= 0; ntracks--) {
cte = &toc->entries[ntracks];
cte->addr_type = CD_LBA_FORMAT;
- if (sc->sc_link->quirks & ADEV_LITTLETOC) {
+ if (ISSET(sc->sc_link->quirks, ADEV_LITTLETOC)) {
#if BYTE_ORDER == BIG_ENDIAN
swap16_multi((u_int16_t *)&cte->addr,
sizeof(cte->addr) / 2);
@@ -922,7 +922,7 @@ cdioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p)
} else
cte->addr.lba = betoh32(cte->addr.lba);
}
- if (sc->sc_link->quirks & ADEV_LITTLETOC) {
+ if (ISSET(sc->sc_link->quirks, ADEV_LITTLETOC)) {
th->len = letoh16(th->len);
} else
th->len = betoh16(th->len);
@@ -955,14 +955,14 @@ cdioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p)
}
cte = &toc->entries[0];
- if (sc->sc_link->quirks & ADEV_LITTLETOC) {
+ if (ISSET(sc->sc_link->quirks, ADEV_LITTLETOC)) {
#if BYTE_ORDER == BIG_ENDIAN
swap16_multi((u_int16_t *)&cte->addr,
sizeof(cte->addr) / 2);
#endif /* BYTE_ORDER == BIG_ENDIAN */
} else
cte->addr.lba = betoh32(cte->addr.lba);
- if (sc->sc_link->quirks & ADEV_LITTLETOC)
+ if (ISSET(sc->sc_link->quirks, ADEV_LITTLETOC))
toc->header.len = letoh16(toc->header.len);
else
toc->header.len = betoh16(toc->header.len);
@@ -1120,7 +1120,7 @@ cdgetdisklabel(dev_t dev, struct cd_softc *sc, struct disklabel *lp,
lp->d_secpercyl = 100;
lp->d_ncylinders = (sc->params.disksize / 100) + 1;
- if (sc->sc_link->flags & SDEV_ATAPI) {
+ if (ISSET(sc->sc_link->flags, SDEV_ATAPI)) {
strncpy(lp->d_typename, "ATAPI CD-ROM", sizeof(lp->d_typename));
lp->d_type = DTYPE_ATAPI;
} else {
@@ -1304,7 +1304,7 @@ cd_set_pa_immed(struct cd_softc *sc, int flags)
struct cd_audio_page *audio = NULL;
int error, oflags, big;
- if (sc->sc_link->flags & SDEV_ATAPI)
+ if (ISSET(sc->sc_link->flags, SDEV_ATAPI))
/* XXX Noop? */
return (0);
@@ -1602,7 +1602,7 @@ cd_get_parms(struct cd_softc *sc, int flags)
sc->params.secsize = 2048;
sc->params.disksize = 400000;
- if (sc->sc_link->quirks & ADEV_NOCAPACITY)
+ if (ISSET(sc->sc_link->quirks, ADEV_NOCAPACITY))
return (0);
sc->params.disksize = cd_size(sc->sc_link, flags, &sc->params.secsize);
diff --git a/sys/scsi/ch.c b/sys/scsi/ch.c
index a706c4d2876..829bbe835d7 100644
--- a/sys/scsi/ch.c
+++ b/sys/scsi/ch.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ch.c,v 1.58 2019/11/23 12:27:32 krw Exp $ */
+/* $OpenBSD: ch.c,v 1.59 2019/11/23 17:10:13 krw Exp $ */
/* $NetBSD: ch.c,v 1.26 1997/02/21 22:06:52 thorpej Exp $ */
/*
@@ -182,7 +182,7 @@ chopen(dev_t dev, int flags, int fmt, struct proc *p)
/*
* Only allow one open at a time.
*/
- if (sc->sc_link->flags & SDEV_OPEN)
+ if (ISSET(sc->sc_link->flags, SDEV_OPEN))
return (EBUSY);
SET(sc->sc_link->flags, SDEV_OPEN);
@@ -371,7 +371,7 @@ ch_move(struct ch_softc *sc, struct changer_move *cm)
_lto2b(sc->sc_picker, cmd->tea);
_lto2b(fromelem, cmd->src);
_lto2b(toelem, cmd->dst);
- if (cm->cm_flags & CM_INVERT)
+ if (ISSET(cm->cm_flags, CM_INVERT))
SET(cmd->flags, MOVE_MEDIUM_INVERT);
error = scsi_xs_sync(xs);
@@ -431,9 +431,9 @@ ch_exchange(struct ch_softc *sc, struct changer_exchange *ce)
_lto2b(src, cmd->src);
_lto2b(dst1, cmd->fdst);
_lto2b(dst2, cmd->sdst);
- if (ce->ce_flags & CE_INVERT1)
+ if (ISSET(ce->ce_flags, CE_INVERT1))
SET(cmd->flags, EXCHANGE_MEDIUM_INV1);
- if (ce->ce_flags & CE_INVERT2)
+ if (ISSET(ce->ce_flags, CE_INVERT2))
SET(cmd->flags, EXCHANGE_MEDIUM_INV2);
error = scsi_xs_sync(xs);
@@ -477,7 +477,7 @@ ch_position(struct ch_softc *sc, struct changer_position *cp)
cmd->opcode = POSITION_TO_ELEMENT;
_lto2b(sc->sc_picker, cmd->tea);
_lto2b(dst, cmd->dst);
- if (cp->cp_flags & CP_INVERT)
+ if (ISSET(cp->cp_flags, CP_INVERT))
SET(cmd->flags, POSITION_TO_ELEMENT_INVERT);
error = scsi_xs_sync(xs);
@@ -519,9 +519,9 @@ copy_element_status(int flags, struct read_element_status_descriptor *desc,
{
ces->ces_flags = desc->flags1;
- if (flags & READ_ELEMENT_STATUS_PVOLTAG)
+ if (ISSET(flags, READ_ELEMENT_STATUS_PVOLTAG))
copy_voltag(&ces->ces_pvoltag, &desc->pvoltag);
- if (flags & READ_ELEMENT_STATUS_AVOLTAG)
+ if (ISSET(flags, READ_ELEMENT_STATUS_AVOLTAG))
copy_voltag(&ces->ces_avoltag, &desc->avoltag);
}
diff --git a/sys/scsi/scsi_base.c b/sys/scsi/scsi_base.c
index e816ad56d71..0e628f67026 100644
--- a/sys/scsi/scsi_base.c
+++ b/sys/scsi/scsi_base.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: scsi_base.c,v 1.242 2019/11/23 12:27:32 krw Exp $ */
+/* $OpenBSD: scsi_base.c,v 1.243 2019/11/23 17:10:13 krw Exp $ */
/* $NetBSD: scsi_base.c,v 1.43 1997/04/02 02:29:36 mycroft Exp $ */
/*
@@ -889,7 +889,7 @@ scsi_inquire_vpd(struct scsi_link *link, void *buf, u_int buflen,
u_int32_t bytes;
#endif /* SCSIDEBUG */
- if (link->flags & SDEV_UMASS)
+ if (ISSET(link->flags, SDEV_UMASS))
return (EJUSTRETURN);
xs = scsi_xs_get(link, flags | SCSI_DATA_IN | SCSI_SILENT);
@@ -928,7 +928,7 @@ scsi_prevent(struct scsi_link *link, int type, int flags)
struct scsi_xfer *xs;
int error;
- if (link->quirks & ADEV_NODOORLOCK)
+ if (ISSET(link->quirks, ADEV_NODOORLOCK))
return (0);
xs = scsi_xs_get(link, flags);
@@ -1322,7 +1322,7 @@ void
scsi_done(struct scsi_xfer *xs)
{
#ifdef SCSIDEBUG
- if (xs->sc_link->flags & SDEV_DB1) {
+ if (ISSET(xs->sc_link->flags, SDEV_DB1)) {
if (xs->datalen && ISSET(xs->flags, SCSI_DATA_IN))
scsi_show_mem(xs->data, min(64, xs->datalen));
}
@@ -1572,7 +1572,7 @@ scsi_interpret_sense(struct scsi_xfer *xs)
default:
break;
}
- if ((link->flags & SDEV_REMOVABLE) != 0)
+ if (ISSET(link->flags, SDEV_REMOVABLE))
CLR(link->flags, SDEV_MEDIA_LOADED);
if (ISSET(xs->flags, SCSI_IGNORE_MEDIA_CHANGE) ||
/* XXX Should reupload any transient state. */
@@ -2363,7 +2363,7 @@ scsi_print_sense(struct scsi_xfer *xs)
xs->cmd->opcode);
if (serr != SSD_ERRCODE_CURRENT && serr != SSD_ERRCODE_DEFERRED) {
- if ((sense->error_code & SSD_ERRCODE_VALID) != 0) {
+ if (ISSET(sense->error_code, SSD_ERRCODE_VALID)) {
struct scsi_sense_data_unextended *usense =
(struct scsi_sense_data_unextended *)sense;
printf(" AT BLOCK #: %d (decimal)",
@@ -2379,15 +2379,15 @@ scsi_print_sense(struct scsi_xfer *xs)
char pad = ' ';
printf(" ");
- if (sense->flags & SSD_FILEMARK) {
+ if (ISSET(sense->flags, SSD_FILEMARK)) {
printf("%c Filemark Detected", pad);
pad = ',';
}
- if (sense->flags & SSD_EOM) {
+ if (ISSET(sense->flags, SSD_EOM)) {
printf("%c EOM Detected", pad);
pad = ',';
}
- if (sense->flags & SSD_ILI)
+ if (ISSET(sense->flags, SSD_ILI))
printf("%c Incorrect Length Indicator Set", pad);
printf("\n");
}
@@ -2399,7 +2399,7 @@ scsi_print_sense(struct scsi_xfer *xs)
info = _4btol(&sense->info[0]);
if (info)
printf(" INFO: 0x%x (VALID flag %s)\n", info,
- sense->error_code & SSD_ERRCODE_VALID ? "on" : "off");
+ ISSET(sense->error_code, SSD_ERRCODE_VALID) ? "on" : "off");
if (sense->extra_len < 4)
return;
@@ -2446,10 +2446,10 @@ scsi_decode_sense(struct scsi_sense_data *sense, int flag)
case SKEY_ILLEGAL_REQUEST:
len = snprintf(rqsbuf, sizeof rqsbuf,
"Error in %s, Offset %d",
- (spec_1 & SSD_SCS_CDB_ERROR) ? "CDB" : "Parameters",
- count);
+ ISSET(spec_1, SSD_SCS_CDB_ERROR) ? "CDB" :
+ "Parameters", count);
if ((len != -1 && len < sizeof rqsbuf) &&
- (spec_1 & SSD_SCS_VALID_BIT_INDEX))
+ ISSET(spec_1, SSD_SCS_VALID_BIT_INDEX))
snprintf(rqsbuf+len, sizeof rqsbuf - len,
", bit %d", spec_1 & SSD_SCS_BIT_INDEX);
break;
@@ -2610,7 +2610,7 @@ scsi_show_sense(struct scsi_xfer *xs)
sense->flags & SSD_FILEMARK ? 1 : 0,
sense->extra_len));
- if (xs->sc_link->flags & SDEV_DB1)
+ if (ISSET(xs->sc_link->flags, SDEV_DB1))
scsi_show_mem((u_char *)&xs->sense, sizeof(xs->sense));
scsi_print_sense(xs);
diff --git a/sys/scsi/scsi_ioctl.c b/sys/scsi/scsi_ioctl.c
index ce51ac62180..28fade5edfc 100644
--- a/sys/scsi/scsi_ioctl.c
+++ b/sys/scsi/scsi_ioctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: scsi_ioctl.c,v 1.61 2019/11/23 12:27:32 krw Exp $ */
+/* $OpenBSD: scsi_ioctl.c,v 1.62 2019/11/23 17:10:13 krw Exp $ */
/* $NetBSD: scsi_ioctl.c,v 1.23 1996/10/12 23:23:17 christos Exp $ */
/*
@@ -121,9 +121,9 @@ scsi_ioc_cmd(struct scsi_link *link, scsireq_t *screq)
xs->datalen = screq->datalen;
}
- if (screq->flags & SCCMD_READ)
+ if (ISSET(screq->flags, SCCMD_READ))
SET(xs->flags, SCSI_DATA_IN);
- if (screq->flags & SCCMD_WRITE) {
+ if (ISSET(screq->flags, SCCMD_WRITE)) {
if (screq->datalen > 0) {
err = copyin(screq->databuf, xs->data, screq->datalen);
if (err != 0)
@@ -176,7 +176,7 @@ scsi_ioc_cmd(struct scsi_link *link, scsireq_t *screq)
break;
}
- if (screq->datalen > 0 && screq->flags & SCCMD_READ) {
+ if (screq->datalen > 0 && ISSET(screq->flags, SCCMD_READ)) {
err = copyout(xs->data, screq->databuf, screq->datalen);
if (err != 0)
goto err;
@@ -208,7 +208,7 @@ scsi_ioc_ata_cmd(struct scsi_link *link, atareq_t *atareq)
cdb->opcode = ATA_PASSTHRU_12;
if (atareq->datalen > 0) {
- if (atareq->flags & ATACMD_READ) {
+ if (ISSET(atareq->flags, ATACMD_READ)) {
cdb->count_proto = ATA_PASSTHRU_PROTO_PIO_DATAIN;
cdb->flags = ATA_PASSTHRU_T_DIR_READ;
} else {
@@ -239,9 +239,9 @@ scsi_ioc_ata_cmd(struct scsi_link *link, atareq_t *atareq)
xs->datalen = atareq->datalen;
}
- if (atareq->flags & ATACMD_READ)
+ if (ISSET(atareq->flags, ATACMD_READ))
SET(xs->flags, SCSI_DATA_IN);
- if (atareq->flags & ATACMD_WRITE) {
+ if (ISSET(atareq->flags, ATACMD_WRITE)) {
if (atareq->datalen > 0) {
err = copyin(atareq->databuf, xs->data,
atareq->datalen);
@@ -271,7 +271,7 @@ scsi_ioc_ata_cmd(struct scsi_link *link, atareq_t *atareq)
break;
}
- if (atareq->datalen > 0 && atareq->flags & ATACMD_READ) {
+ if (atareq->datalen > 0 && ISSET(atareq->flags, ATACMD_READ)) {
err = copyout(xs->data, atareq->databuf, atareq->datalen);
if (err != 0)
goto err;
diff --git a/sys/scsi/scsiconf.c b/sys/scsi/scsiconf.c
index 4f586e366e5..0d4a5b75544 100644
--- a/sys/scsi/scsiconf.c
+++ b/sys/scsi/scsiconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: scsiconf.c,v 1.220 2019/11/23 12:27:32 krw Exp $ */
+/* $OpenBSD: scsiconf.c,v 1.221 2019/11/23 17:10:13 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 (!ISSET(flags, DETACH_FORCE) && (link->flags & SDEV_OPEN))
+ if (!ISSET(flags, DETACH_FORCE) && ISSET(link->flags, SDEV_OPEN))
return (EBUSY);
/* Detaching a device from scsibus is a five step process. */
@@ -712,7 +712,7 @@ scsibus_printlink(struct scsi_link *link)
printf("%s>", visbuf);
#ifdef SCSIDEBUG
- if (link->flags & SDEV_ATAPI)
+ if (ISSET(link->flags, SDEV_ATAPI))
printf(" ATAPI");
else if (SID_ANSII_REV(inqbuf) < SCSI_REV_SPC)
printf(" SCSI/%d", SID_ANSII_REV(inqbuf));
@@ -722,7 +722,7 @@ scsibus_printlink(struct scsi_link *link)
printf(" SCSI/SPC-%d", SID_ANSII_REV(inqbuf) - 2);
#endif /* SCSIDEBUG */
- if ((link->flags & SDEV_REMOVABLE) != 0)
+ if (ISSET(link->flags, SDEV_REMOVABLE))
printf(" removable");
if (link->id != NULL && link->id->d_type != DEVID_NONE) {
@@ -949,7 +949,7 @@ scsi_probedev(struct scsibus_softc *sb, int target, int lun, int dumbscan)
link0 = scsi_get_link(sb, target, 0);
if (lun == 0 || link0 == NULL)
;
- else if (link->flags & SDEV_UMASS)
+ else if (ISSET(link->flags, SDEV_UMASS))
;
else if (link->id != NULL && !DEVID_CMP(link0->id, link->id))
;
@@ -1006,7 +1006,7 @@ scsi_probedev(struct scsibus_softc *sb, int target, int lun, int dumbscan)
/*
* note what BASIC type of device it is
*/
- if ((inqbuf->dev_qual2 & SID_REMOVABLE) != 0)
+ if (ISSET(inqbuf->dev_qual2, SID_REMOVABLE))
SET(link->flags, SDEV_REMOVABLE);
sa.sa_sc_link = link;
@@ -1025,7 +1025,7 @@ scsi_probedev(struct scsibus_softc *sb, int target, int lun, int dumbscan)
* different LUN used in a command. So do an INQUIRY on LUN 1 at this
* point to prevent such helpfulness before it causes confusion.
*/
- if (lun == 0 && (link->flags & SDEV_UMASS) &&
+ if (lun == 0 && ISSET(link->flags, SDEV_UMASS) &&
scsi_get_link(sb, target, 1) == NULL && link->luns > 1 &&
(usbinqbuf = dma_alloc(sizeof(*usbinqbuf), M_NOWAIT)) != NULL) {
@@ -1082,7 +1082,7 @@ scsi_inqmatch(struct scsi_inquiry_data *inqbuf, const void *_base,
int removable;
/* Include the qualifier to catch vendor-unique types. */
- removable = inqbuf->dev_qual2 & SID_REMOVABLE ? T_REMOV : T_FIXED;
+ removable = ISSET(inqbuf->dev_qual2, SID_REMOVABLE) ? T_REMOV : T_FIXED;
for (*bestpriority = 0, bestmatch = 0; nmatches--; base += matchsize) {
struct scsi_inquiry_pattern *match = (void *)base;
diff --git a/sys/scsi/sd.c b/sys/scsi/sd.c
index b793999315f..e9cd6600c26 100644
--- a/sys/scsi/sd.c
+++ b/sys/scsi/sd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sd.c,v 1.298 2019/11/23 12:27:32 krw Exp $ */
+/* $OpenBSD: sd.c,v 1.299 2019/11/23 17:10:13 krw Exp $ */
/* $NetBSD: sd.c,v 1.111 1997/04/02 02:29:41 mycroft Exp $ */
/*-
@@ -494,7 +494,7 @@ sdclose(dev_t dev, int flag, int fmt, struct proc *p)
disk_closepart(&sc->sc_dk, part, fmt);
- if (((flag & FWRITE) != 0 || sc->sc_dk.dk_openmask == 0) &&
+ if ((ISSET(flag, FWRITE) || sc->sc_dk.dk_openmask == 0) &&
ISSET(sc->flags, SDF_DIRTY))
sd_flush(sc, 0);
diff --git a/sys/scsi/st.c b/sys/scsi/st.c
index f39b44cb75d..8a3d7f99c39 100644
--- a/sys/scsi/st.c
+++ b/sys/scsi/st.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: st.c,v 1.169 2019/09/29 17:57:36 krw Exp $ */
+/* $OpenBSD: st.c,v 1.170 2019/11/23 17:10:13 krw Exp $ */
/* $NetBSD: st.c,v 1.71 1997/02/21 23:03:49 thorpej Exp $ */
/*
@@ -1357,7 +1357,7 @@ st_mode_sense(struct st_softc *st, int flags)
else
dev_spec = data->hdr.dev_spec;
- if (dev_spec & SMH_DSP_WRITE_PROT)
+ if (ISSET(dev_spec, SMH_DSP_WRITE_PROT))
SET(link->flags, SDEV_READONLY);
else
CLR(link->flags, SDEV_READONLY);
@@ -1913,7 +1913,7 @@ st_interpret_sense(struct scsi_xfer *xs)
* to store datalen in the same units as resid and to adjust
* xs->resid to be in bytes.
*/
- if (sense->error_code & SSD_ERRCODE_VALID) {
+ if (ISSET(sense->error_code, SSD_ERRCODE_VALID)) {
if (ISSET(st->flags, ST_FIXEDBLOCKS))
resid = info * st->blksize; /* XXXX overflow? */
else
diff --git a/sys/scsi/uk.c b/sys/scsi/uk.c
index 16958eab05f..bd208c61158 100644
--- a/sys/scsi/uk.c
+++ b/sys/scsi/uk.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uk.c,v 1.21 2019/11/23 01:16:06 krw Exp $ */
+/* $OpenBSD: uk.c,v 1.22 2019/11/23 17:10:13 krw Exp $ */
/* $NetBSD: uk.c,v 1.15 1996/03/17 00:59:57 thorpej Exp $ */
/*
@@ -132,7 +132,7 @@ ukopen(dev_t dev, int flag, int fmt, struct proc *p)
dev, unit, uk_cd.cd_ndevs));
/* Only allow one at a time */
- if (link->flags & SDEV_OPEN) {
+ if (ISSET(link->flags, SDEV_OPEN)) {
device_unref(&sc->sc_dev);
return (EBUSY);
}