From c1ab2b546088f2d3d068b3c77d169a461a83fa9e Mon Sep 17 00:00:00 2001 From: scw Date: Sat, 7 Jul 2001 09:06:43 +0000 Subject: [PATCH] bcopy -> memcpy bzero -> memset bcmp -> memcmp (note that the MI libsa's memcmp() still calls bcmp()...) --- sys/arch/mvme68k/stand/bootst/dev_tape.c | 6 ++--- sys/arch/mvme68k/stand/bootst/rawfs.c | 4 ++-- sys/arch/mvme68k/stand/libsa/Makefile | 7 ++++-- sys/arch/mvme68k/stand/libsa/bugdev.c | 11 +++++---- sys/arch/mvme68k/stand/netboot/boot.c | 4 ++-- sys/arch/mvme68k/stand/netboot/if_ie.c | 19 ++++++++------- sys/arch/mvme68k/stand/netboot/if_le.c | 13 +++++----- sys/arch/mvme68k/stand/sboot/etherfun.c | 30 ++++++++++++------------ sys/arch/mvme68k/stand/sboot/le_poll.c | 10 ++++---- sys/arch/mvme68k/stand/wrtvid/wrtvid.c | 4 ++-- 10 files changed, 57 insertions(+), 51 deletions(-) diff --git a/sys/arch/mvme68k/stand/bootst/dev_tape.c b/sys/arch/mvme68k/stand/bootst/dev_tape.c index d8a4856f88b1..3a95c415158c 100644 --- a/sys/arch/mvme68k/stand/bootst/dev_tape.c +++ b/sys/arch/mvme68k/stand/bootst/dev_tape.c @@ -1,4 +1,4 @@ -/* $NetBSD: dev_tape.c,v 1.4 2000/07/24 18:39:15 jdolecek Exp $ */ +/* $NetBSD: dev_tape.c,v 1.5 2001/07/07 09:06:43 scw Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -106,7 +106,7 @@ tape_open(struct open_file *f, ...) * (determines what gets opened) */ ti = &tape_ioreq; - bzero((caddr_t)ti, sizeof(*ti)); + memset((caddr_t)ti, 0, sizeof(*ti)); ti->ctrl_lun = bugargs.ctrl_lun; ti->dev_lun = bugargs.dev_lun; @@ -215,7 +215,7 @@ hackprom_diskrd(struct mvmeprom_dskio *ti) /* * Grab the required number of block(s) */ - bcopy(&(hackload_addr[blkoffset]), ti->pbuffer, + memcpy(ti->pbuffer, &(hackload_addr[blkoffset]), ti->blk_cnt * MVMEPROM_BLOCK_SIZE); blkoffset += (ti->blk_cnt * MVMEPROM_BLOCK_SIZE); diff --git a/sys/arch/mvme68k/stand/bootst/rawfs.c b/sys/arch/mvme68k/stand/bootst/rawfs.c index 0c9dd5e23504..3372ef75b2db 100644 --- a/sys/arch/mvme68k/stand/bootst/rawfs.c +++ b/sys/arch/mvme68k/stand/bootst/rawfs.c @@ -1,4 +1,4 @@ -/* $NetBSD: rawfs.c,v 1.1 1996/05/28 15:23:56 chuck Exp $ */ +/* $NetBSD: rawfs.c,v 1.2 2001/07/07 09:06:43 scw Exp $ */ /* * Copyright (c) 1995 Gordon W. Ross @@ -116,7 +116,7 @@ int rawfs_read(f, start, size, resid) if (csize > fs->fs_len) csize = fs->fs_len; - bcopy(fs->fs_ptr, addr, csize); + memcpy(addr, fs->fs_ptr, csize); fs->fs_ptr += csize; fs->fs_len -= csize; addr += csize; diff --git a/sys/arch/mvme68k/stand/libsa/Makefile b/sys/arch/mvme68k/stand/libsa/Makefile index 1522250159a2..5b14cd963680 100644 --- a/sys/arch/mvme68k/stand/libsa/Makefile +++ b/sys/arch/mvme68k/stand/libsa/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.16 2001/06/10 14:12:48 scw Exp $ +# $NetBSD: Makefile,v 1.17 2001/07/07 09:06:44 scw Exp $ LIB=sa @@ -13,7 +13,10 @@ SRC_net= nfs.c rpc.c net.c ether.c arp.c in_cksum.c netif.c \ SRC_sa = alloc.c memcpy.c memset.c close.c exit.c getfile.c gets.c \ open.c printf.c read.c strerror.c ufs.c globals.c lseek.c panic.c \ closeall.c dev.c dkcksum.c nullfs.c fstat.c twiddle.c sprintf.c \ - subr_prf.c intoa.c udp.c memcmp.c bcmp.c loadfile.c dev_net.c + subr_prf.c intoa.c udp.c memcmp.c loadfile.c dev_net.c + +# XXX Needed until libsa's memcmp.c doesn't depend on bcmp... +SRC_sa+= bcmp.c SRC_kern= ashrdi3.c strcmp.c strlen.c strncpy.c inet_addr.c diff --git a/sys/arch/mvme68k/stand/libsa/bugdev.c b/sys/arch/mvme68k/stand/libsa/bugdev.c index 7f75b991e495..890d59a1b2e4 100644 --- a/sys/arch/mvme68k/stand/libsa/bugdev.c +++ b/sys/arch/mvme68k/stand/libsa/bugdev.c @@ -1,4 +1,4 @@ -/* $NetBSD: bugdev.c,v 1.5 1998/09/05 15:20:48 pk Exp $ */ +/* $NetBSD: bugdev.c,v 1.6 2001/07/07 09:06:44 scw Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -211,8 +211,8 @@ cputobsdlabel(lp, clp) lp->d_type = (u_int16_t)clp->type; lp->d_subtype = (u_int16_t)clp->subtype; - bcopy(clp->vid_vd, lp->d_typename, 16); - bcopy(clp->packname, lp->d_packname, 16); + memcpy(lp->d_typename, clp->vid_vd, 16); + memcpy(lp->d_packname, clp->packname, 16); lp->d_secsize = (u_int32_t)clp->cfg_psm; lp->d_nsectors = (u_int32_t)clp->cfg_spt; @@ -264,9 +264,10 @@ cputobsdlabel(lp, clp) lp->d_bbsize = (u_int32_t)clp->bbsize; lp->d_sbsize = (u_int32_t)clp->sbsize; - bcopy(clp->vid_4, &(lp->d_partitions[0]),sizeof (struct partition) * 4); + memcpy(&(lp->d_partitions[0]), clp->vid_4, + sizeof (struct partition) * 4); /* CONSTCOND */ - bcopy(clp->cfg_4, &(lp->d_partitions[4]), sizeof (struct partition) + memcpy(&(lp->d_partitions[4]), clp->cfg_4, sizeof (struct partition) * ((MAXPARTITIONS < 16) ? (MAXPARTITIONS - 4) : 12)); } diff --git a/sys/arch/mvme68k/stand/netboot/boot.c b/sys/arch/mvme68k/stand/netboot/boot.c index b6b2bb466707..f232f6f61d76 100644 --- a/sys/arch/mvme68k/stand/netboot/boot.c +++ b/sys/arch/mvme68k/stand/netboot/boot.c @@ -1,4 +1,4 @@ -/* $NetBSD: boot.c,v 1.7 2001/06/10 14:12:49 scw Exp $ */ +/* $NetBSD: boot.c,v 1.8 2001/07/07 09:06:44 scw Exp $ */ /* * Copyright (c) 1982, 1986, 1990, 1993 @@ -58,7 +58,7 @@ main() printf(">> %s MVME%x netboot (via %s) [%s]\n", bootprog_name, bugargs.cputyp, bugargs.arg_start, bootprog_rev); - if (bcmp("sboot", bugargs.arg_start, 5) == 0) + if (memcmp("sboot", bugargs.arg_start, 5) == 0) sboot = 1; /* cycle in the correct args */ bugargs.arg_start = bugargs.nbarg_start; diff --git a/sys/arch/mvme68k/stand/netboot/if_ie.c b/sys/arch/mvme68k/stand/netboot/if_ie.c index a8fcf0ddbb7a..4556e01a5772 100644 --- a/sys/arch/mvme68k/stand/netboot/if_ie.c +++ b/sys/arch/mvme68k/stand/netboot/if_ie.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_ie.c,v 1.5 2000/07/24 18:39:51 jdolecek Exp $ */ +/* $NetBSD: if_ie.c,v 1.6 2001/07/07 09:06:44 scw Exp $ */ /* * Copyright (c) 1995 Theo de Raadt @@ -120,7 +120,7 @@ ie_match(nif, machdep_hint) if (bugargs.cputyp == CPU_147) return (0); name = machdep_hint; - if (name && !bcmp(ie_driver.netif_bname, name, 2)) + if (name && !memcmp(ie_driver.netif_bname, name, 2)) val += 10; for (i = 0; i < nie_config; i++) { if (ie_config[i].used) @@ -189,7 +189,7 @@ ie_reset(nif, myea) *(u_char *)0xfff4202a = 0x40; - bzero(iem, sizeof(*iem)); + memset(iem, 0, sizeof(*iem)); iem->im_scp.scp_sysbus = 0; iem->im_scp.scp_iscp_low = (int) &iem->im_iscp & 0xffff; iem->im_scp.scp_iscp_high = (int) &iem->im_iscp >> 16; @@ -260,7 +260,8 @@ ie_reset(nif, myea) iem->im_ic.com.ie_cmd_status = 0; iem->im_ic.com.ie_cmd_cmd = IE_CMD_IASETUP | IE_CMD_LAST; iem->im_ic.com.ie_cmd_link = 0xffff; - bcopy(myea, (void *)&iem->im_ic.ie_address, sizeof iem->im_ic.ie_address); + memcpy((void *)&iem->im_ic.ie_address, myea, + sizeof iem->im_ic.ie_address); ier->ie_attention = 1; /* chan attention! */ for (t = timo * 10; t--;) @@ -321,8 +322,8 @@ ie_poll(desc, pkt, len) length = iem->im_rbd[slot].ie_rbd_actual & 0x3fff; if (length > len) length = len; - bcopy((void *)&iem->im_rxbuf[slot * IE_RBUF_SIZE], - pkt, length); + memcpy(pkt, (void *)&iem->im_rxbuf[slot * IE_RBUF_SIZE], + length); iem->im_rfd[slot].ie_fd_status = 0; iem->im_rfd[slot].ie_fd_last |= IE_FD_LAST; @@ -382,7 +383,7 @@ ie_put(desc, pkt, len) ; /* copy data */ - bcopy(p, (void *)&iem->im_txbuf[xx], len); + memcpy((void *)&iem->im_txbuf[xx], p, len); len = MAX(len, ETHER_MIN_LEN); @@ -399,7 +400,7 @@ ie_put(desc, pkt, len) iem->im_xc[xx].com.ie_cmd_link = 0xffff; iem->im_xc[xx].ie_xmit_desc = (int) &iem->im_xd[xx] - (int) iem; iem->im_xc[xx].ie_xmit_length = len; - bcopy(p, (void *)&iem->im_xc[xx].ie_xmit_addr, + memcpy((void *)&iem->im_xc[xx].ie_xmit_addr, p, sizeof iem->im_xc[xx].ie_xmit_addr); iem->im_scb.ie_command = IE_CU_START; @@ -445,7 +446,7 @@ ie_init(desc, machdep_hint) if (ie_debug) printf("ie%d: ie_init called\n", desc->io_netif->nif_unit); machdep_common_ether(desc->myea); - bzero(&ie_softc, sizeof(ie_softc)); + memset(&ie_softc, 0, sizeof(ie_softc)); ie_softc.sc_reg = (struct iereg *) ie_config[desc->io_netif->nif_unit].phys_addr; ie_softc.sc_mem = (struct iemem *) 0x3e0000; diff --git a/sys/arch/mvme68k/stand/netboot/if_le.c b/sys/arch/mvme68k/stand/netboot/if_le.c index 16d13cc64311..b8615dd76efa 100644 --- a/sys/arch/mvme68k/stand/netboot/if_le.c +++ b/sys/arch/mvme68k/stand/netboot/if_le.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_le.c,v 1.2 2000/07/24 18:39:52 jdolecek Exp $ */ +/* $NetBSD: if_le.c,v 1.3 2001/07/07 09:06:44 scw Exp $ */ /* * Copyright (c) 1995 Theo de Raadt @@ -140,7 +140,7 @@ le_match(nif, machdep_hint) if (bugargs.cputyp != CPU_147) return (0); name = machdep_hint; - if (name && !bcmp(le_driver.netif_bname, name, 2)) + if (name && !memcmp(le_driver.netif_bname, name, 2)) val += 10; for (i = 0; i < nle_config; i++) { if (le_config[i].used) @@ -208,7 +208,7 @@ le_reset(nif, myea) ler1->ler1_rap = LE_CSR0; ler1->ler1_rdp = LE_C0_STOP; /* do nothing until we are finished */ - bzero(ler2, sizeof(*ler2)); + memset(ler2, 0, sizeof(*ler2)); ler2->ler2_mode = LE_MODE_NORMAL; ler2->ler2_padr[0] = myea[1]; @@ -323,7 +323,8 @@ le_poll(desc, pkt, len) if (length > len) length = len; - bcopy((void *)&ler2->ler2_rbuf[le_softc.next_rmd], pkt, length); + memcpy(pkt, (void *)&ler2->ler2_rbuf[le_softc.next_rmd], + length); } cleanup: a = (u_int) & ler2->ler2_rbuf[le_softc.next_rmd]; @@ -355,7 +356,7 @@ le_put(desc, pkt, len) while (tmd->tmd1_bits & LE_T1_OWN) { printf("le%d: output buffer busy\n", desc->io_netif->nif_unit); } - bcopy(pkt, (void *)ler2->ler2_tbuf[le_softc.next_tmd], len); + memcpy((void *)ler2->ler2_tbuf[le_softc.next_tmd], pkt, len); if (len < 64) tmd->tmd2 = -64; else @@ -443,7 +444,7 @@ le_init(desc, machdep_hint) if (le_debug) printf("le%d: le_init called\n", desc->io_netif->nif_unit); machdep_common_ether(desc->myea); - bzero(&le_softc, sizeof(le_softc)); + memset(&le_softc, 0, sizeof(le_softc)); le_softc.sc_r1 = (struct lereg1 *) le_config[desc->io_netif->nif_unit].phys_addr; le_softc.sc_r2 = (struct lereg2 *) (eram - (1024 * 1024)); diff --git a/sys/arch/mvme68k/stand/sboot/etherfun.c b/sys/arch/mvme68k/stand/sboot/etherfun.c index 7e77a20bac56..198c9995aa12 100644 --- a/sys/arch/mvme68k/stand/sboot/etherfun.c +++ b/sys/arch/mvme68k/stand/sboot/etherfun.c @@ -1,4 +1,4 @@ -/* $NetBSD: etherfun.c,v 1.3 2001/06/12 15:17:19 wiz Exp $ */ +/* $NetBSD: etherfun.c,v 1.4 2001/07/07 09:06:45 scw Exp $ */ /* * @@ -45,7 +45,7 @@ do_rev_arp () for ( i = 0; i < 6; i++ ) { eh->ether_dhost[i] = 0xff; } - bcopy(myea, eh->ether_shost, 6); + memcpy(eh->ether_shost, myea, 6); eh->ether_type = ETYPE_RARP; rarp->ar_hrd = 1; /* hardware type is 1 */ @@ -53,8 +53,8 @@ do_rev_arp () rarp->ar_hln = 6; /* length of hardware address is 6 bytes */ rarp->ar_pln = 4; /* length of ip address is 4 byte */ rarp->ar_op = OPCODE_RARP; - bcopy(myea, rarp->arp_sha, sizeof(myea)); - bcopy(myea, rarp->arp_tha, sizeof(myea)); + memcpy(rarp->arp_sha, myea, sizeof(myea)); + memcpy(rarp->arp_tha, myea, sizeof(myea)); for ( i = 0; i < 4; i++ ) { rarp->arp_spa[i] = rarp->arp_tpa[i] = 0x00; } @@ -69,9 +69,9 @@ get_rev_arp () { le_get(buf, sizeof(buf), 6); if ( eh->ether_type == ETYPE_RARP && rarp->ar_op == OPCODE_REPLY ) { - bcopy(rarp->arp_tpa, myip, sizeof(rarp->arp_tpa)); - bcopy(rarp->arp_spa, servip, sizeof(rarp->arp_spa)); - bcopy(rarp->arp_sha, servea, sizeof(rarp->arp_sha)); + memcpy(myip, rarp->arp_tpa, sizeof(rarp->arp_tpa)); + memcpy(servip, rarp->arp_spa, sizeof(rarp->arp_spa)); + memcpy(servea, rarp->arp_sha, sizeof(rarp->arp_sha)); return 1; } return 0; @@ -111,8 +111,8 @@ do_send_tftp ( int mesgtype ) tot = (char *)tftp_a + 4; } - bcopy (servea, eh->ether_dhost, sizeof(servea)); - bcopy (myea, eh->ether_shost, sizeof(myea)); + memcpy (eh->ether_dhost, servea, sizeof(servea)); + memcpy (eh->ether_shost, myea, sizeof(myea)); eh->ether_type = ETYPE_IP; iph->ip_v = IP_VERSION; @@ -122,8 +122,8 @@ do_send_tftp ( int mesgtype ) iph->ip_off = IP_DF; iph->ip_ttl = 3; /* time to live is 3 seconds/hops */ iph->ip_p = IPP_UDP; - bcopy(myip, iph->ip_src, sizeof(myip)); - bcopy(servip, iph->ip_dst, sizeof(servip)); + memcpy(iph->ip_src, myip, sizeof(myip)); + memcpy(iph->ip_dst, servip, sizeof(servip)); iph->ip_sum = 0; iph->ip_len = tot - (char *)iph; res = oc_cksum(iph, sizeof(struct ip), 0); @@ -136,8 +136,8 @@ do_send_tftp ( int mesgtype ) tftp_a->op_code = FTPOP_ACKN; tftp_a->block = (u_short)(mesgtype); } else { - bcopy (myip, &iptmp, sizeof(iptmp)); - bcopy(MSG, tftp_r, (sizeof(MSG)-1)); + memcpy (&iptmp, myip, sizeof(iptmp)); + memcpy(tftp_r, MSG, (sizeof(MSG)-1)); for (lcv = 9; lcv >= 2; lcv--) { tftp_r[lcv] = "0123456789ABCDEF"[iptmp & 0xF]; @@ -196,8 +196,8 @@ do_get_file () last_ack++; oldlen = udph->uh_ulen; do_send_tftp( last_ack ); - /*printf("bcopy %x %x %d\n", &tftp->data, loadat, oldlen - 12);*/ - bcopy(&tftp->data, loadat, oldlen - 12); + /*printf("memcpy %x %x %d\n", loadat, &tftp->data, oldlen - 12);*/ + memcpy(loadat, &tftp->data, oldlen - 12); loadat += oldlen - 12; if (oldlen < (8 + 4 + 512)) { printf("\n"); diff --git a/sys/arch/mvme68k/stand/sboot/le_poll.c b/sys/arch/mvme68k/stand/sboot/le_poll.c index 5c7c1fb5c40a..638d132a5a7b 100644 --- a/sys/arch/mvme68k/stand/sboot/le_poll.c +++ b/sys/arch/mvme68k/stand/sboot/le_poll.c @@ -1,4 +1,4 @@ -/* $NetBSD: le_poll.c,v 1.2 2000/07/24 18:40:02 jdolecek Exp $ */ +/* $NetBSD: le_poll.c,v 1.3 2001/07/07 09:06:45 scw Exp $ */ /* * Copyright (c) 1993 Adam Glass @@ -80,7 +80,7 @@ le_reset(myea) ler1->ler1_rap = LE_CSR0; ler1->ler1_rdp = LE_C0_STOP; /* do nothing until we are finished */ - bzero(ler2, sizeof(*ler2)); + memset(ler2, 0, sizeof(*ler2)); ler2->ler2_mode = LE_MODE_NORMAL; ler2->ler2_padr[0] = myea[1]; @@ -185,7 +185,7 @@ le_poll(pkt, len) if (!length) goto cleanup; length -= 4; if (length > 0) - bcopy((char *)&ler2->ler2_rbuf[le_softc.next_rmd], pkt, length); + memcpy(pkt, (char *)&ler2->ler2_rbuf[le_softc.next_rmd], length); cleanup: a = (u_int)&ler2->ler2_rbuf[le_softc.next_rmd]; @@ -215,7 +215,7 @@ int le_put(pkt, len) while(tmd->tmd1_bits & LE_T1_OWN) { printf("le0: output buffer busy\n"); } - bcopy(pkt, (char *)ler2->ler2_tbuf[le_softc.next_tmd], len); + memcpy((char *)ler2->ler2_tbuf[le_softc.next_tmd], pkt, len); if (len < 64) tmd->tmd2 = -64; else @@ -311,7 +311,7 @@ void le_init() myea[3] = e; printf("le0: ethernet address: %x:%x:%x:%x:%x:%x\n", myea[0], myea[1], myea[2], myea[3], myea[4], myea[5]); - bzero(&le_softc, sizeof(le_softc)); + memset(&le_softc, 0, sizeof(le_softc)); le_softc.sc_r1 = (struct lereg1 *) LANCE_REG_ADDR; le_softc.sc_r2 = (struct lereg2 *)(*eram - (1024*1024)); le_reset(myea); diff --git a/sys/arch/mvme68k/stand/wrtvid/wrtvid.c b/sys/arch/mvme68k/stand/wrtvid/wrtvid.c index 0d50a077935d..c49f7031714e 100644 --- a/sys/arch/mvme68k/stand/wrtvid/wrtvid.c +++ b/sys/arch/mvme68k/stand/wrtvid/wrtvid.c @@ -1,4 +1,4 @@ -/* $NetBSD: wrtvid.c,v 1.2 2000/12/04 21:24:34 scw Exp $ */ +/* $NetBSD: wrtvid.c,v 1.3 2001/07/07 09:06:45 scw Exp $ */ #include #include @@ -52,7 +52,7 @@ main(int argc, char **argv) tape_exe = open(fileext, O_WRONLY|O_CREAT|O_TRUNC,0644); pcpul = (struct cpu_disklabel *)malloc(sizeof(struct cpu_disklabel)); - bzero(pcpul, sizeof(struct cpu_disklabel)); + memset(pcpul, 0, sizeof(struct cpu_disklabel)); strcpy(pcpul->vid_id, "NBSD");