diff options
author | 2020-10-15 00:01:24 +0000 | |
---|---|---|
committer | 2020-10-15 00:01:24 +0000 | |
commit | 8296a4000c2d362a6a2776cd0c235913c0b10257 (patch) | |
tree | 5172efe74f1457f95003dcdfd14236530f992525 | |
parent | regen (diff) | |
download | wireguard-openbsd-8296a4000c2d362a6a2776cd0c235913c0b10257.tar.xz wireguard-openbsd-8296a4000c2d362a6a2776cd0c235913c0b10257.zip |
Replace local *_copy_internal_data() with scsi_copy_internal_data().
-rw-r--r-- | sys/dev/ic/aac.c | 27 | ||||
-rw-r--r-- | sys/dev/ic/ami.c | 25 | ||||
-rw-r--r-- | sys/dev/ic/cac.c | 25 | ||||
-rw-r--r-- | sys/dev/ic/gdt_common.c | 24 | ||||
-rw-r--r-- | sys/dev/ic/twe.c | 27 |
5 files changed, 20 insertions, 108 deletions
diff --git a/sys/dev/ic/aac.c b/sys/dev/ic/aac.c index 2289c5f69ce..a8ba7c5f38b 100644 --- a/sys/dev/ic/aac.c +++ b/sys/dev/ic/aac.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aac.c,v 1.90 2020/09/22 19:32:52 krw Exp $ */ +/* $OpenBSD: aac.c,v 1.91 2020/10/15 00:01:24 krw Exp $ */ /*- * Copyright (c) 2000 Michael Smith @@ -80,7 +80,6 @@ struct scsi_xfer; -void aac_copy_internal_data(struct scsi_xfer *, u_int8_t *, size_t); char *aac_describe_code(struct aac_code_lookup *, u_int32_t); void aac_describe_controller(struct aac_softc *); int aac_enqueue_fib(struct aac_softc *, int, struct aac_command *); @@ -2097,24 +2096,6 @@ aac_eval_mapping(size, cyls, heads, secs) } } -void -aac_copy_internal_data(struct scsi_xfer *xs, u_int8_t *data, size_t size) -{ - struct aac_softc *sc = xs->sc_link->bus->sb_adapter_softc; - size_t copy_cnt; - - AAC_DPRINTF(AAC_D_MISC, ("%s: aac_copy_internal_data\n", - sc->aac_dev.dv_xname)); - - if (!xs->datalen) - printf("%s: uio move not yet supported\n", - sc->aac_dev.dv_xname); - else { - copy_cnt = MIN(size, xs->datalen); - bcopy(data, xs->data, copy_cnt); - } -} - /* Emulated SCSI operation on cache device */ void aac_internal_cache_cmd(struct scsi_xfer *xs) @@ -2147,7 +2128,7 @@ aac_internal_cache_cmd(struct scsi_xfer *xs) sd.flags = SKEY_NO_SENSE; aac_enc32(sd.info, 0); sd.extra_len = 0; - aac_copy_internal_data(xs, (u_int8_t *)&sd, sizeof sd); + scsi_copy_internal_data(xs, &sd, sizeof(sd)); break; case INQUIRY: @@ -2165,7 +2146,7 @@ aac_internal_cache_cmd(struct scsi_xfer *xs) snprintf(inq.product, sizeof inq.product, "Container #%02d", target); strlcpy(inq.revision, " ", sizeof inq.revision); - aac_copy_internal_data(xs, (u_int8_t *)&inq, sizeof inq); + scsi_copy_internal_data(xs, &inq, sizeof(inq)); break; case READ_CAPACITY: @@ -2173,7 +2154,7 @@ aac_internal_cache_cmd(struct scsi_xfer *xs) bzero(&rcd, sizeof rcd); _lto4b(sc->aac_hdr[target].hd_size - 1, rcd.addr); _lto4b(AAC_BLOCK_SIZE, rcd.length); - aac_copy_internal_data(xs, (u_int8_t *)&rcd, sizeof rcd); + scsi_copy_internal_data(xs, (u_int8_t *)&rcd, sizeof rcd); break; default: diff --git a/sys/dev/ic/ami.c b/sys/dev/ic/ami.c index a7937f1af74..f1661bf2d91 100644 --- a/sys/dev/ic/ami.c +++ b/sys/dev/ic/ami.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ami.c,v 1.259 2020/09/22 19:32:52 krw Exp $ */ +/* $OpenBSD: ami.c,v 1.260 2020/10/15 00:01:24 krw Exp $ */ /* * Copyright (c) 2001 Michael Shalayeff @@ -135,8 +135,6 @@ void ami_done_dummy(struct ami_softc *, struct ami_ccb *); void ami_done_ioctl(struct ami_softc *, struct ami_ccb *); void ami_done_init(struct ami_softc *, struct ami_ccb *); -void ami_copy_internal_data(struct scsi_xfer *, void *, size_t); - int ami_load_ptmem(struct ami_softc*, struct ami_ccb *, void *, size_t, int, int); @@ -1191,21 +1189,6 @@ ami_done_init(struct ami_softc *sc, struct ami_ccb *ccb) } void -ami_copy_internal_data(struct scsi_xfer *xs, void *v, size_t size) -{ - size_t copy_cnt; - - AMI_DPRINTF(AMI_D_MISC, ("ami_copy_internal_data ")); - - if (!xs->datalen) - printf("uio move not yet supported\n"); - else { - copy_cnt = MIN(size, xs->datalen); - bcopy(v, xs->data, copy_cnt); - } -} - -void ami_scsi_raw_cmd(struct scsi_xfer *xs) { struct scsi_link *link = xs->sc_link; @@ -1384,7 +1367,7 @@ ami_scsi_cmd(struct scsi_xfer *xs) sd.flags = SKEY_NO_SENSE; *(u_int32_t*)sd.info = htole32(0); sd.extra_len = 0; - ami_copy_internal_data(xs, &sd, sizeof(sd)); + scsi_copy_internal_data(xs, &sd, sizeof(sd)); xs->error = XS_NOERROR; scsi_done(xs); @@ -1409,7 +1392,7 @@ ami_scsi_cmd(struct scsi_xfer *xs) snprintf(inq.product, sizeof(inq.product), "Host drive #%02d", target); strlcpy(inq.revision, " ", sizeof(inq.revision)); - ami_copy_internal_data(xs, &inq, sizeof(inq)); + scsi_copy_internal_data(xs, &inq, sizeof(inq)); xs->error = XS_NOERROR; scsi_done(xs); @@ -1420,7 +1403,7 @@ ami_scsi_cmd(struct scsi_xfer *xs) bzero(&rcd, sizeof(rcd)); _lto4b(sc->sc_hdr[target].hd_size - 1, rcd.addr); _lto4b(AMI_SECTOR_SIZE, rcd.length); - ami_copy_internal_data(xs, &rcd, sizeof(rcd)); + scsi_copy_internal_data(xs, &rcd, sizeof(rcd)); xs->error = XS_NOERROR; scsi_done(xs); diff --git a/sys/dev/ic/cac.c b/sys/dev/ic/cac.c index f5680b4af44..7441be92ae9 100644 --- a/sys/dev/ic/cac.c +++ b/sys/dev/ic/cac.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cac.c,v 1.72 2020/09/22 19:32:52 krw Exp $ */ +/* $OpenBSD: cac.c,v 1.73 2020/10/15 00:01:24 krw Exp $ */ /* $NetBSD: cac.c,v 1.15 2000/11/08 19:20:35 ad Exp $ */ /* @@ -109,7 +109,6 @@ int cac_ccb_start(struct cac_softc *, struct cac_ccb *); int cac_cmd(struct cac_softc *sc, int command, void *data, int datasize, int drive, int blkno, int flags, struct scsi_xfer *xs); int cac_get_dinfo(struct cac_softc *sc, int target); -void cac_copy_internal_data(struct scsi_xfer *xs, void *v, size_t size); struct cac_ccb *cac_l0_completed(struct cac_softc *); int cac_l0_fifo_full(struct cac_softc *); @@ -562,22 +561,6 @@ cac_get_dinfo(sc, target) } void -cac_copy_internal_data(xs, v, size) - struct scsi_xfer *xs; - void *v; - size_t size; -{ - size_t copy_cnt; - - if (!xs->datalen) - printf("uio move is not yet supported\n"); - else { - copy_cnt = MIN(size, xs->datalen); - memcpy(xs->data, v, copy_cnt); - } -} - -void cac_scsi_cmd(xs) struct scsi_xfer *xs; { @@ -619,7 +602,7 @@ cac_scsi_cmd(xs) sd.flags = SKEY_NO_SENSE; *(u_int32_t*)sd.info = htole32(0); sd.extra_len = 0; - cac_copy_internal_data(xs, &sd, sizeof sd); + scsi_copy_internal_data(xs, &sd, sizeof(sd)); break; case INQUIRY: @@ -645,7 +628,7 @@ cac_scsi_cmd(xs) snprintf(inq.product, sizeof inq.product, "%s vol #%02d", p, target); strlcpy(inq.revision, " ", sizeof inq.revision); - cac_copy_internal_data(xs, &inq, sizeof inq); + scsi_copy_internal_data(xs, &inq, sizeof(inq)); break; case READ_CAPACITY: @@ -657,7 +640,7 @@ cac_scsi_cmd(xs) _lto4b( CAC_GET2(dinfo->ncylinders) * CAC_GET1(dinfo->nheads) * CAC_GET1(dinfo->nsectors) - 1, rcd.addr); _lto4b(CAC_SECTOR_SIZE, rcd.length); - cac_copy_internal_data(xs, &rcd, sizeof rcd); + scsi_copy_internal_data(xs, &rcd, sizeof(rcd)); break; case PREVENT_ALLOW: diff --git a/sys/dev/ic/gdt_common.c b/sys/dev/ic/gdt_common.c index 770063ea56e..8a1648b0f94 100644 --- a/sys/dev/ic/gdt_common.c +++ b/sys/dev/ic/gdt_common.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gdt_common.c,v 1.82 2020/09/22 19:32:52 krw Exp $ */ +/* $OpenBSD: gdt_common.c,v 1.83 2020/10/15 00:01:24 krw Exp $ */ /* * Copyright (c) 1999, 2000, 2003 Niklas Hallqvist. All rights reserved. @@ -61,7 +61,6 @@ int gdt_maxcmds = GDT_MAXCMDS; int gdt_async_event(struct gdt_softc *, int); void gdt_chain(struct gdt_softc *); void gdt_clear_events(struct gdt_softc *); -void gdt_copy_internal_data(struct scsi_xfer *, u_int8_t *, size_t); struct scsi_xfer *gdt_dequeue(struct gdt_softc *); void gdt_enqueue(struct gdt_softc *, struct scsi_xfer *, int); void gdt_enqueue_ccb(struct gdt_softc *, struct gdt_ccb *); @@ -855,21 +854,6 @@ gdt_exec_ccb(struct gdt_ccb *ccb) return (1); } -void -gdt_copy_internal_data(struct scsi_xfer *xs, u_int8_t *data, size_t size) -{ - size_t copy_cnt; - - GDT_DPRINTF(GDT_D_MISC, ("gdt_copy_internal_data ")); - - if (!xs->datalen) - printf("uio move not yet supported\n"); - else { - copy_cnt = MIN(size, xs->datalen); - bcopy(data, xs->data, copy_cnt); - } -} - /* Emulated SCSI operation on cache device */ void gdt_internal_cache_cmd(struct scsi_xfer *xs) @@ -901,7 +885,7 @@ gdt_internal_cache_cmd(struct scsi_xfer *xs) sd.flags = SKEY_NO_SENSE; gdt_enc32(sd.info, 0); sd.extra_len = 0; - gdt_copy_internal_data(xs, (u_int8_t *)&sd, sizeof sd); + scsi_copy_internal_data(xs, &sd, sizeof(sd)); break; case INQUIRY: @@ -920,7 +904,7 @@ gdt_internal_cache_cmd(struct scsi_xfer *xs) snprintf(inq.product, sizeof inq.product, "Host drive #%02d", target); strlcpy(inq.revision, " ", sizeof inq.revision); - gdt_copy_internal_data(xs, (u_int8_t *)&inq, sizeof inq); + scsi_copy_internal_data(xs, &inq, sizeof(inq)); break; case READ_CAPACITY: @@ -928,7 +912,7 @@ gdt_internal_cache_cmd(struct scsi_xfer *xs) bzero(&rcd, sizeof rcd); _lto4b(sc->sc_hdr[target].hd_size - 1, rcd.addr); _lto4b(GDT_SECTOR_SIZE, rcd.length); - gdt_copy_internal_data(xs, (u_int8_t *)&rcd, sizeof rcd); + scsi_copy_internal_data(xs, &rcd, sizeof(rcd)); break; default: diff --git a/sys/dev/ic/twe.c b/sys/dev/ic/twe.c index 86b97912b9f..baf65f9eaac 100644 --- a/sys/dev/ic/twe.c +++ b/sys/dev/ic/twe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: twe.c,v 1.63 2020/09/22 19:32:53 krw Exp $ */ +/* $OpenBSD: twe.c,v 1.64 2020/10/15 00:01:24 krw Exp $ */ /* * Copyright (c) 2000-2002 Michael Shalayeff. All rights reserved. @@ -75,7 +75,6 @@ int twe_cmd(struct twe_ccb *ccb, int flags, int wait); int twe_start(struct twe_ccb *ccb, int wait); int twe_complete(struct twe_ccb *ccb); int twe_done(struct twe_softc *sc, struct twe_ccb *ccb); -void twe_copy_internal_data(struct scsi_xfer *xs, void *v, size_t size); void twe_thread_create(void *v); void twe_thread(void *v); void twe_aen(void *, void *); @@ -753,24 +752,6 @@ twe_done(sc, ccb) } void -twe_copy_internal_data(xs, v, size) - struct scsi_xfer *xs; - void *v; - size_t size; -{ - size_t copy_cnt; - - TWE_DPRINTF(TWE_D_MISC, ("twe_copy_internal_data ")); - - if (!xs->datalen) - printf("uio move is not yet supported\n"); - else { - copy_cnt = MIN(size, xs->datalen); - bcopy(v, xs->data, copy_cnt); - } -} - -void twe_scsi_cmd(xs) struct scsi_xfer *xs; { @@ -818,7 +799,7 @@ twe_scsi_cmd(xs) sd.flags = SKEY_NO_SENSE; *(u_int32_t*)sd.info = htole32(0); sd.extra_len = 0; - twe_copy_internal_data(xs, &sd, sizeof sd); + scsi_copy_internal_data(xs, &sd, sizeof(sd)); break; case INQUIRY: @@ -836,7 +817,7 @@ twe_scsi_cmd(xs) snprintf(inq.product, sizeof inq.product, "Host drive #%02d", target); strlcpy(inq.revision, " ", sizeof inq.revision); - twe_copy_internal_data(xs, &inq, sizeof inq); + scsi_copy_internal_data(xs, &inq, sizeof(inq)); break; case READ_CAPACITY: @@ -844,7 +825,7 @@ twe_scsi_cmd(xs) bzero(&rcd, sizeof rcd); _lto4b(sc->sc_hdr[target].hd_size - 1, rcd.addr); _lto4b(TWE_SECTOR_SIZE, rcd.length); - twe_copy_internal_data(xs, &rcd, sizeof rcd); + scsi_copy_internal_data(xs, &rcd, sizeof(rcd)); break; case PREVENT_ALLOW: |