From: claudio Date: Sat, 19 Apr 2014 18:31:33 +0000 (+0000) Subject: COnveret the bcopy() to memcpy() X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=a86db512c158d195462f21ef80c3a33856d644a2;p=openbsd COnveret the bcopy() to memcpy() --- diff --git a/usr.sbin/iscsid/control.c b/usr.sbin/iscsid/control.c index 9bb08e04c65..cd2142e8c39 100644 --- a/usr.sbin/iscsid/control.c +++ b/usr.sbin/iscsid/control.c @@ -1,4 +1,4 @@ -/* $OpenBSD: control.c,v 1.5 2014/04/07 19:55:46 claudio Exp $ */ +/* $OpenBSD: control.c,v 1.6 2014/04/19 18:31:33 claudio Exp $ */ /* * Copyright (c) 2010 Claudio Jeker @@ -279,7 +279,7 @@ control_getpdu(char *buf, size_t len) n = sizeof(*cmh); cmh = pdu_alloc(n); - bcopy(buf, cmh, n); + memcpy(cmh, buf, n); buf += n; len -= n; @@ -298,7 +298,7 @@ fail: goto fail; if (!(data = pdu_alloc(n))) goto fail; - bcopy(buf, data, n); + memcpy(data, buf, n); if (pdu_addbuf(p, data, n, i + 1)) { free(data); goto fail; @@ -344,7 +344,7 @@ control_compose(void *ch, u_int16_t type, void *buf, size_t len) if (len > 0) { if ((ptr = pdu_alloc(len)) == NULL) goto fail; - bcopy(buf, ptr, len); + memcpy(ptr, buf, len); pdu_addbuf(pdu, ptr, len, 1); } diff --git a/usr.sbin/iscsid/initiator.c b/usr.sbin/iscsid/initiator.c index 599eef8a5e1..99e914ab43a 100644 --- a/usr.sbin/iscsid/initiator.c +++ b/usr.sbin/iscsid/initiator.c @@ -1,4 +1,4 @@ -/* $OpenBSD: initiator.c,v 1.10 2014/04/19 18:19:57 claudio Exp $ */ +/* $OpenBSD: initiator.c,v 1.11 2014/04/19 18:31:33 claudio Exp $ */ /* * Copyright (c) 2009 Claudio Jeker @@ -338,7 +338,7 @@ initiator_login_build(struct connection *c, struct task_login *tl) } n = htonl(n); /* copy 32bit value over ahslen and datalen */ - bcopy(&n, &lreq->ahslen, sizeof(n)); + memcpy(&lreq->ahslen, &n, sizeof(n)); return p; } @@ -362,7 +362,7 @@ initiator_text_build(struct task *t, struct session *s, struct kvp *kvp) if ((n = text_to_pdu(kvp, p)) == -1) return NULL; n = htonl(n); - bcopy(&n, &lreq->ahslen, sizeof(n)); + memcpy(&lreq->ahslen, &n, sizeof(n)); return p; } diff --git a/usr.sbin/iscsid/log.c b/usr.sbin/iscsid/log.c index df06d281090..3ae75977e14 100644 --- a/usr.sbin/iscsid/log.c +++ b/usr.sbin/iscsid/log.c @@ -1,4 +1,4 @@ -/* $OpenBSD: log.c,v 1.5 2011/08/20 19:03:39 sthen Exp $ */ +/* $OpenBSD: log.c,v 1.6 2014/04/19 18:31:33 claudio Exp $ */ /* * Copyright (c) 2009 Claudio Jeker @@ -178,7 +178,7 @@ log_hexdump(void *buf, size_t len) for (i = 0; i < len; i += l) { fprintf(stderr, "%4zi:", i); l = sizeof(b) < len - i ? sizeof(b) : len - i; - bcopy((char *)buf + i, b, l); + memcpy(b, (char *)buf + i, l); for (j = 0; j < sizeof(b); j++) { if (j % 2 == 0) diff --git a/usr.sbin/iscsid/pdu.c b/usr.sbin/iscsid/pdu.c index 57a5c21bcdd..26ef6f9b5b1 100644 --- a/usr.sbin/iscsid/pdu.c +++ b/usr.sbin/iscsid/pdu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pdu.c,v 1.6 2011/05/04 21:00:04 claudio Exp $ */ +/* $OpenBSD: pdu.c,v 1.7 2014/04/19 18:31:33 claudio Exp $ */ /* * Copyright (c) 2009 Claudio Jeker @@ -417,12 +417,12 @@ pdu_readbuf_read(struct pdu_readbuf *rb, void *ptr, size_t len) return (0); } else if (rb->rpos < rb->wpos) { l = PDU_MIN(rb->wpos - rb->rpos, len); - bcopy(rb->buf + rb->rpos, ptr, l); + memcpy(ptr, rb->buf + rb->rpos, l); rb->rpos += l; return l; } else { l = PDU_MIN(rb->size - rb->rpos, len); - bcopy(rb->buf + rb->rpos, ptr, l); + memcpy(ptr, rb->buf + rb->rpos, l); rb->rpos += l; if (rb->rpos == rb->size) rb->rpos = 0; diff --git a/usr.sbin/iscsid/util.c b/usr.sbin/iscsid/util.c index 15c908fa7d1..0592fc76f3e 100644 --- a/usr.sbin/iscsid/util.c +++ b/usr.sbin/iscsid/util.c @@ -1,4 +1,4 @@ -/* $OpenBSD: util.c,v 1.2 2010/09/25 16:20:06 sobrado Exp $ */ +/* $OpenBSD: util.c,v 1.3 2014/04/19 18:31:33 claudio Exp $ */ /* * Copyright (c) 2009 Claudio Jeker @@ -56,7 +56,7 @@ pdu_dup(void *data, size_t len) void *p; if ((p = malloc(PDU_LEN(len)))) - bcopy(data, p, len); + memcpy(p, data, len); return p; } diff --git a/usr.sbin/iscsid/vscsi.c b/usr.sbin/iscsid/vscsi.c index 35c9dd84c9a..26bcacc5f6c 100644 --- a/usr.sbin/iscsid/vscsi.c +++ b/usr.sbin/iscsid/vscsi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vscsi.c,v 1.8 2011/05/04 21:00:04 claudio Exp $ */ +/* $OpenBSD: vscsi.c,v 1.9 2014/04/19 18:31:33 claudio Exp $ */ /* * Copyright (c) 2009 Claudio Jeker @@ -113,14 +113,14 @@ vscsi_dispatch(int fd, short event, void *arg) "I'm afraid I can't do that."); sreq->lun[1] = t->lun; - bcopy(&i2t.cmd, sreq->cdb, i2t.cmdlen); + memcpy(sreq->cdb, &i2t.cmd, i2t.cmdlen); #if 0 if (i2t.direction == VSCSI_DIR_WRITE) { if (!(buf = pdu_alloc(i2t.datalen))) fatal("vscsi_dispatch"); t32 = htonl(i2t.datalen); - bcopy(&t32, &sreq->ahslen, sizeof(t32)); + memcpy(&sreq->ahslen, &t32, sizeof(t32)); vscsi_data(VSCSI_DATA_WRITE, i2t.tag, buf, i2t.datalen); pdu_addbuf(p, buf, i2t.datalen, PDU_DATA); } @@ -155,7 +155,7 @@ vscsi_status(int tag, int status, void *buf, size_t len) if (buf) { if (len > sizeof(t2i.sense)) len = sizeof(t2i.sense); - bcopy(buf, &t2i.sense, len); + memcpy(&t2i.sense, buf, len); } if (ioctl(v.fd, VSCSI_T2I, &t2i) == -1) @@ -291,7 +291,7 @@ vscsi_dataout(struct connection *c, struct scsi_task *t, u_int32_t ttt, dout->ttt = ttt; dout->datasn = htonl(dsn++); t32 = htonl(size); - bcopy(&t32, &dout->ahslen, sizeof(t32)); + memcpy(&dout->ahslen, &t32, sizeof(t32)); dout->buffer_offs = htonl(off); if (!(buf = pdu_alloc(size)))