diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2019-11-28 16:27:36 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2019-11-28 16:27:36 +0000 |
commit | c16d553252f53f7171d8c9e4f6ab46a2e9cf70aa (patch) | |
tree | a810bbd9c6189bb56369a7c9700f8379ba74abea | |
parent | bcfc9657998ba89908b332eecc1605bb484587e8 (diff) |
Always pass a pointer to 'big' to scsi_do_mode_sense().
Sets up some simplifications.
-rw-r--r-- | sys/scsi/cd.c | 8 | ||||
-rw-r--r-- | sys/scsi/ch.c | 8 | ||||
-rw-r--r-- | sys/scsi/scsi_base.c | 9 | ||||
-rw-r--r-- | sys/scsi/sd.c | 8 |
4 files changed, 15 insertions, 18 deletions
diff --git a/sys/scsi/cd.c b/sys/scsi/cd.c index 9ffd9d5e1fa..1419cbddef9 100644 --- a/sys/scsi/cd.c +++ b/sys/scsi/cd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cd.c,v 1.237 2019/11/25 17:48:31 krw Exp $ */ +/* $OpenBSD: cd.c,v 1.238 2019/11/28 16:27:35 krw Exp $ */ /* $NetBSD: cd.c,v 1.100 1997/04/02 02:29:30 mycroft Exp $ */ /* @@ -1199,14 +1199,14 @@ cd_getvol(struct cd_softc *sc, struct ioc_vol *arg, int flags) { union scsi_mode_sense_buf *data; struct cd_audio_page *audio = NULL; - int error; + int big, error; data = dma_alloc(sizeof(*data), PR_NOWAIT); if (data == NULL) return (ENOMEM); error = scsi_do_mode_sense(sc->sc_link, AUDIO_PAGE, data, - (void **)&audio, NULL, NULL, NULL, sizeof(*audio), flags, NULL); + (void **)&audio, NULL, NULL, NULL, sizeof(*audio), flags, &big); if (error == 0 && audio == NULL) error = EIO; @@ -1235,7 +1235,7 @@ cd_setvol(struct cd_softc *sc, const struct ioc_vol *arg, int flags) error = scsi_do_mode_sense(sc->sc_link, AUDIO_PAGE | SMS_PAGE_CTRL_CHANGEABLE, data, (void **)&audio, NULL, - NULL, NULL, sizeof(*audio), flags, NULL); + NULL, NULL, sizeof(*audio), flags, &big); if (error == 0 && audio == NULL) error = EIO; if (error != 0) { diff --git a/sys/scsi/ch.c b/sys/scsi/ch.c index 829bbe835d7..8e8203a76a9 100644 --- a/sys/scsi/ch.c +++ b/sys/scsi/ch.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ch.c,v 1.59 2019/11/23 17:10:13 krw Exp $ */ +/* $OpenBSD: ch.c,v 1.60 2019/11/28 16:27:35 krw Exp $ */ /* $NetBSD: ch.c,v 1.26 1997/02/21 22:06:52 thorpej Exp $ */ /* @@ -662,7 +662,7 @@ ch_get_params(struct ch_softc *sc, int flags) union scsi_mode_sense_buf *data; struct page_element_address_assignment *ea; struct page_device_capabilities *cap; - int error, from; + int big, error, from; u_int8_t *moves, *exchanges; data = dma_alloc(sizeof(*data), PR_NOWAIT); @@ -673,7 +673,7 @@ ch_get_params(struct ch_softc *sc, int flags) * Grab info from the element address assignment page (0x1d). */ error = scsi_do_mode_sense(sc->sc_link, 0x1d, data, - (void **)&ea, NULL, NULL, NULL, sizeof(*ea), flags, NULL); + (void **)&ea, NULL, NULL, NULL, sizeof(*ea), flags, &big); if (error == 0 && ea == NULL) error = EIO; if (error != 0) { @@ -700,7 +700,7 @@ ch_get_params(struct ch_softc *sc, int flags) * Grab info from the capabilities page (0x1f). */ error = scsi_do_mode_sense(sc->sc_link, 0x1f, data, - (void **)&cap, NULL, NULL, NULL, sizeof(*cap), flags, NULL); + (void **)&cap, NULL, NULL, NULL, sizeof(*cap), flags, &big); if (cap == NULL) error = EIO; if (error != 0) { diff --git a/sys/scsi/scsi_base.c b/sys/scsi/scsi_base.c index 6c2cb6921d7..78814ff4c71 100644 --- a/sys/scsi/scsi_base.c +++ b/sys/scsi/scsi_base.c @@ -1,4 +1,4 @@ -/* $OpenBSD: scsi_base.c,v 1.245 2019/11/26 20:48:03 krw Exp $ */ +/* $OpenBSD: scsi_base.c,v 1.246 2019/11/28 16:27:35 krw Exp $ */ /* $NetBSD: scsi_base.c,v 1.43 1997/04/02 02:29:36 mycroft Exp $ */ /* @@ -1168,9 +1168,7 @@ scsi_do_mode_sense(struct scsi_link *link, int page, int error, blk_desc_len, offset; *page_data = NULL; - - if (big != NULL) - *big = 0; + *big = 0; if (!ISSET(link->flags, SDEV_ATAPI) || (link->inqdata.device & SID_TYPE) == T_SEQUENTIAL) { @@ -1221,8 +1219,7 @@ scsi_do_mode_sense(struct scsi_link *link, int page, if (_2btol(buf->hdr_big.data_length) < 6) return (EIO); - if (big != NULL) - *big = 1; + *big = 1; offset = sizeof(struct scsi_mode_header_big); *page_data = scsi_mode_sense_big_page(&buf->hdr_big, page_len); blk_desc_len = _2btol(buf->hdr_big.blk_desc_len); diff --git a/sys/scsi/sd.c b/sys/scsi/sd.c index 0f2736767a2..cf6568ef9cf 100644 --- a/sys/scsi/sd.c +++ b/sys/scsi/sd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sd.c,v 1.301 2019/11/26 20:51:20 krw Exp $ */ +/* $OpenBSD: sd.c,v 1.302 2019/11/28 16:27:35 krw Exp $ */ /* $NetBSD: sd.c,v 1.111 1997/04/02 02:29:41 mycroft Exp $ */ /*- @@ -1725,7 +1725,7 @@ sd_get_parms(struct sd_softc *sc, int flags) /* T_RDIRECT supports only PAGE_REDUCED_GEOMETRY (6). */ err = scsi_do_mode_sense(link, PAGE_REDUCED_GEOMETRY, buf, (void **)&reduced, NULL, NULL, &dp.secsize, - sizeof(*reduced), flags | SCSI_SILENT, NULL); + sizeof(*reduced), flags | SCSI_SILENT, &big); if (!err && reduced && DISK_PGCODE(reduced, PAGE_REDUCED_GEOMETRY)) { if (dp.disksize == 0) @@ -1749,7 +1749,7 @@ sd_get_parms(struct sd_softc *sc, int flags) err = scsi_do_mode_sense(link, PAGE_RIGID_GEOMETRY, buf, (void **)&rigid, NULL, NULL, &dp.secsize, sizeof(*rigid) - 4, - flags | SCSI_SILENT, NULL); + flags | SCSI_SILENT, &big); if (!err && rigid && DISK_PGCODE(rigid, PAGE_RIGID_GEOMETRY)) { dp.heads = rigid->nheads; dp.cyls = _3btol(rigid->ncyl); @@ -1761,7 +1761,7 @@ sd_get_parms(struct sd_softc *sc, int flags) err = scsi_do_mode_sense(link, PAGE_FLEX_GEOMETRY, buf, (void **)&flex, NULL, NULL, &dp.secsize, sizeof(*flex) - 4, - flags | SCSI_SILENT, NULL); + flags | SCSI_SILENT, &big); if (!err && flex && DISK_PGCODE(flex, PAGE_FLEX_GEOMETRY)) { dp.sectors = flex->ph_sec_tr; |