From 70ab233e8ea36a5247134fe44b69a8dfdf402407 Mon Sep 17 00:00:00 2001 From: Kenneth R Westerback Date: Tue, 22 Sep 2020 19:32:54 +0000 Subject: Since dlg@'s 2009 scsi midlayer refactoring the 'struct scsi_generic *cmd' member of 'struct scsi_xfer' has always been pointed at the 'struct scsi_generic cmdstore' member of the same instance. So nuke 'cmdstore' and remove the '*' from cmd. Take the address of cmd as required by the various casts. No intentional functional change. luna88k test by aoyama@, sparc64 test by jmatthew@ Identification of 2009's last *cmd use and ok jmatthew@ --- sys/dev/pv/hvs.c | 6 +++--- sys/dev/pv/vioblk.c | 16 ++++++++-------- sys/dev/pv/vioscsi.c | 4 ++-- sys/dev/pv/xbf.c | 20 ++++++++++---------- 4 files changed, 23 insertions(+), 23 deletions(-) (limited to 'sys/dev/pv') diff --git a/sys/dev/pv/hvs.c b/sys/dev/pv/hvs.c index 0d5e6523561..84b43e5edd4 100644 --- a/sys/dev/pv/hvs.c +++ b/sys/dev/pv/hvs.c @@ -361,7 +361,7 @@ hvs_scsi_cmd(struct scsi_xfer *xs) srb->srb_lun = link->lun; srb->srb_cdblen = xs->cmdlen; - memcpy(srb->srb_data, xs->cmd, xs->cmdlen); + memcpy(srb->srb_data, &xs->cmd, xs->cmdlen); switch (xs->flags & (SCSI_DATA_IN | SCSI_DATA_OUT)) { case SCSI_DATA_IN: @@ -424,7 +424,7 @@ hvs_scsi_cmd(struct scsi_xfer *xs) #ifdef HVS_DEBUG_IO DPRINTF("%s: %u.%u: rid %llu opcode %#x flags %#x datalen %d\n", sc->sc_dev.dv_xname, link->target, link->lun, ccb->ccb_rid, - xs->cmd->opcode, xs->flags, xs->datalen); + xs->cmd.opcode, xs->flags, xs->datalen); #endif if (xs->flags & SCSI_POLL) @@ -664,7 +664,7 @@ hvs_scsi_cmd_done(struct hvs_ccb *ccb) } if (error == XS_NOERROR) { - if (xs->cmd->opcode == INQUIRY) + if (xs->cmd.opcode == INQUIRY) fixup_inquiry(xs, srb); else if (srb->srb_direction != SRB_DATA_NONE) xs->resid = xs->datalen - srb->srb_datalen; diff --git a/sys/dev/pv/vioblk.c b/sys/dev/pv/vioblk.c index c5a62c0feb4..1788717ba12 100644 --- a/sys/dev/pv/vioblk.c +++ b/sys/dev/pv/vioblk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vioblk.c,v 1.30 2020/09/05 13:05:07 krw Exp $ */ +/* $OpenBSD: vioblk.c,v 1.31 2020/09/22 19:32:53 krw Exp $ */ /* * Copyright (c) 2012 Stefan Fritsch. @@ -406,7 +406,7 @@ vioblk_scsi_cmd(struct scsi_xfer *xs) u_int32_t sector_count = 0; uint8_t operation; - switch (xs->cmd->opcode) { + switch (xs->cmd.opcode) { case READ_COMMAND: case READ_10: case READ_12: @@ -447,7 +447,7 @@ vioblk_scsi_cmd(struct scsi_xfer *xs) return; default: - printf("%s cmd 0x%02x\n", __func__, xs->cmd->opcode); + printf("%s cmd 0x%02x\n", __func__, xs->cmd.opcode); case MODE_SENSE: case MODE_SENSE_BIG: case REPORT_LUNS: @@ -460,19 +460,19 @@ vioblk_scsi_cmd(struct scsi_xfer *xs) * layout as 10-byte READ/WRITE commands. */ if (xs->cmdlen == 6) { - rw = (struct scsi_rw *)xs->cmd; + rw = (struct scsi_rw *)&xs->cmd; lba = _3btol(rw->addr) & (SRW_TOPADDR << 16 | 0xffff); sector_count = rw->length ? rw->length : 0x100; } else if (xs->cmdlen == 10) { - rw10 = (struct scsi_rw_10 *)xs->cmd; + rw10 = (struct scsi_rw_10 *)&xs->cmd; lba = _4btol(rw10->addr); sector_count = _2btol(rw10->length); } else if (xs->cmdlen == 12) { - rw12 = (struct scsi_rw_12 *)xs->cmd; + rw12 = (struct scsi_rw_12 *)&xs->cmd; lba = _4btol(rw12->addr); sector_count = _4btol(rw12->length); } else if (xs->cmdlen == 16) { - rw16 = (struct scsi_rw_16 *)xs->cmd; + rw16 = (struct scsi_rw_16 *)&xs->cmd; lba = _8btol(rw16->addr); sector_count = _4btol(rw16->length); } @@ -562,7 +562,7 @@ out_done: void vioblk_scsi_inq(struct scsi_xfer *xs) { - struct scsi_inquiry *inq = (struct scsi_inquiry *)xs->cmd; + struct scsi_inquiry *inq = (struct scsi_inquiry *)&xs->cmd; struct scsi_inquiry_data inqd; if (ISSET(inq->flags, SI_EVPD)) { diff --git a/sys/dev/pv/vioscsi.c b/sys/dev/pv/vioscsi.c index 85a3f996ffc..aa2a1ccd8f2 100644 --- a/sys/dev/pv/vioscsi.c +++ b/sys/dev/pv/vioscsi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vioscsi.c,v 1.25 2020/07/22 13:16:05 krw Exp $ */ +/* $OpenBSD: vioscsi.c,v 1.26 2020/09/22 19:32:53 krw Exp $ */ /* * Copyright (c) 2013 Google Inc. * @@ -212,7 +212,7 @@ vioscsi_scsi_cmd(struct scsi_xfer *xs) if ((size_t)xs->cmdlen > sizeof(req->cdb)) goto stuffup; memset(req->cdb, 0, sizeof(req->cdb)); - memcpy(req->cdb, xs->cmd, xs->cmdlen); + memcpy(req->cdb, &xs->cmd, xs->cmdlen); int isread = !!(xs->flags & SCSI_DATA_IN); diff --git a/sys/dev/pv/xbf.c b/sys/dev/pv/xbf.c index 9ad437687d4..d635214664e 100644 --- a/sys/dev/pv/xbf.c +++ b/sys/dev/pv/xbf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: xbf.c,v 1.48 2020/09/05 13:05:07 krw Exp $ */ +/* $OpenBSD: xbf.c,v 1.49 2020/09/22 19:32:53 krw Exp $ */ /* * Copyright (c) 2016, 2017 Mike Belopuhov @@ -385,7 +385,7 @@ xbf_scsi_cmd(struct scsi_xfer *xs) { struct xbf_softc *sc = xs->sc_link->bus->sb_adapter_softc; - switch (xs->cmd->opcode) { + switch (xs->cmd.opcode) { case READ_COMMAND: case READ_10: case READ_12: @@ -420,7 +420,7 @@ xbf_scsi_cmd(struct scsi_xfer *xs) xbf_scsi_done(xs, XS_NOERROR); return; default: - printf("%s cmd 0x%02x\n", __func__, xs->cmd->opcode); + printf("%s cmd 0x%02x\n", __func__, xs->cmd.opcode); case MODE_SENSE: case MODE_SENSE_BIG: case REPORT_LUNS: @@ -436,7 +436,7 @@ xbf_scsi_cmd(struct scsi_xfer *xs) if (ISSET(xs->flags, SCSI_POLL) && xbf_poll_cmd(xs)) { printf("%s: op %#x timed out\n", sc->sc_dev.dv_xname, - xs->cmd->opcode); + xs->cmd.opcode); if (sc->sc_state == XBF_CONNECTED) { xbf_reclaim_cmd(xs); xbf_scsi_done(xs, XS_TIMEOUT); @@ -617,7 +617,7 @@ xbf_submit_cmd(struct scsi_xfer *xs) unsigned int ndesc = 0; int desc, error; - switch (xs->cmd->opcode) { + switch (xs->cmd.opcode) { case READ_COMMAND: case READ_10: case READ_12: @@ -645,19 +645,19 @@ xbf_submit_cmd(struct scsi_xfer *xs) * has the same layout as 10-byte READ/WRITE commands. */ if (xs->cmdlen == 6) { - rw = (struct scsi_rw *)xs->cmd; + rw = (struct scsi_rw *)&xs->cmd; lba = _3btol(rw->addr) & (SRW_TOPADDR << 16 | 0xffff); nblk = rw->length ? rw->length : 0x100; } else if (xs->cmdlen == 10) { - rw10 = (struct scsi_rw_10 *)xs->cmd; + rw10 = (struct scsi_rw_10 *)&xs->cmd; lba = _4btol(rw10->addr); nblk = _2btol(rw10->length); } else if (xs->cmdlen == 12) { - rw12 = (struct scsi_rw_12 *)xs->cmd; + rw12 = (struct scsi_rw_12 *)&xs->cmd; lba = _4btol(rw12->addr); nblk = _4btol(rw12->length); } else if (xs->cmdlen == 16) { - rw16 = (struct scsi_rw_16 *)xs->cmd; + rw16 = (struct scsi_rw_16 *)&xs->cmd; lba = _8btol(rw16->addr); nblk = _4btol(rw16->length); } @@ -809,7 +809,7 @@ xbf_complete_cmd(struct xbf_softc *sc, struct xbf_ccb_queue *cq, int desc) void xbf_scsi_inq(struct scsi_xfer *xs) { - struct scsi_inquiry *inq = (struct scsi_inquiry *)xs->cmd; + struct scsi_inquiry *inq = (struct scsi_inquiry *)&xs->cmd; if (ISSET(inq->flags, SI_EVPD)) xbf_scsi_done(xs, XS_DRIVER_STUFFUP); -- cgit v1.2.3