diff options
author | Justus Winter <4winter@informatik.uni-hamburg.de> | 2014-12-02 00:20:51 +0100 |
---|---|---|
committer | Justus Winter <4winter@informatik.uni-hamburg.de> | 2014-12-10 16:09:53 +0100 |
commit | 82a87d043498eeacb7e4f3edc85d1b7c424ea853 (patch) | |
tree | 60d3978b0722d23f01da47eb534ec6fa271b3ed8 | |
parent | 0a4ada8d40fb687a659161ff7e0d1d0994264402 (diff) |
Replace `bcopy' with `memcpy' or `memmove' as appropriate
* ext2fs/inode.c: Replace `bcopy' with `memcpy' or `memmove' as
appropriate.
* ext2fs/pager.c: Likewise.
* isofs/lookup.c: Likewise.
* isofs/main.c: Likewise.
* isofs/rr.c: Likewise.
* libdiskfs/file-get-trans.c: Likewise.
* libiohelp/return-buffer.c: Likewise.
* libpager/pagemap.c: Likewise.
* libpipe/pq.c: Likewise.
* libpipe/pq.h: Likewise.
* libstore/unzipstore.c: Likewise.
* mach-defpager/default_pager.c: Likewise.
* pfinet/ethernet.c: Likewise.
* pfinet/tunnel.c: Likewise.
* storeio/dev.c: Likewise.
-rw-r--r-- | ext2fs/inode.c | 6 | ||||
-rw-r--r-- | ext2fs/pager.c | 4 | ||||
-rw-r--r-- | isofs/lookup.c | 4 | ||||
-rw-r--r-- | isofs/main.c | 2 | ||||
-rw-r--r-- | isofs/rr.c | 6 | ||||
-rw-r--r-- | libdiskfs/file-get-trans.c | 10 | ||||
-rw-r--r-- | libiohelp/return-buffer.c | 2 | ||||
-rw-r--r-- | libpager/pagemap.c | 2 | ||||
-rw-r--r-- | libpipe/pq.c | 12 | ||||
-rw-r--r-- | libpipe/pq.h | 2 | ||||
-rw-r--r-- | libstore/unzipstore.c | 6 | ||||
-rw-r--r-- | mach-defpager/default_pager.c | 4 | ||||
-rw-r--r-- | pfinet/ethernet.c | 10 | ||||
-rw-r--r-- | pfinet/tunnel.c | 2 | ||||
-rw-r--r-- | storeio/dev.c | 6 |
15 files changed, 39 insertions, 39 deletions
diff --git a/ext2fs/inode.c b/ext2fs/inode.c index 27530fbe..6b8b7499 100644 --- a/ext2fs/inode.c +++ b/ext2fs/inode.c @@ -733,7 +733,7 @@ diskfs_set_translator (struct node *np, const char *name, unsigned namelen, buf[0] = namelen & 0xFF; buf[1] = (namelen >> 8) & 0xFF; - bcopy (name, buf + 2, namelen); + memcpy (buf + 2, name, namelen); blkptr = disk_cache_block_ref (blkno); memcpy (blkptr, buf, block_size); @@ -805,7 +805,7 @@ write_symlink (struct node *node, const char *target) assert (node->dn_stat.st_blocks == 0); - bcopy (target, node->dn->info.i_data, len); + memcpy (node->dn->info.i_data, target, len); node->dn_stat.st_size = len - 1; node->dn_set_ctime = 1; node->dn_set_mtime = 1; @@ -822,7 +822,7 @@ read_symlink (struct node *node, char *target) assert (node->dn_stat.st_size < MAX_INODE_SYMLINK); - bcopy (node->dn->info.i_data, target, node->dn_stat.st_size); + memcpy (target, node->dn->info.i_data, node->dn_stat.st_size); return 0; } diff --git a/ext2fs/pager.c b/ext2fs/pager.c index ae515305..a6c4fbb5 100644 --- a/ext2fs/pager.c +++ b/ext2fs/pager.c @@ -209,7 +209,7 @@ file_pager_read_page (struct node *node, vm_offset_t page, else /* We've already got some buffer, so copy into it. */ { - bcopy (new_buf, *buf + offs, new_len); + memcpy (*buf + offs, new_buf, new_len); free_page_buf (new_buf); /* Return NEW_BUF to our pool. */ STAT_INC (file_pagein_freed_bufs); } @@ -316,7 +316,7 @@ pending_blocks_write (struct pending_blocks *pb) /* Put what we're going to write into a page-aligned buffer. */ { void *page_buf = get_page_buf (); - bcopy (pb->buf + pb->offs, (void *)page_buf, length); + memcpy ((void *)page_buf, pb->buf + pb->offs, length); err = store_write (store, dev_block, page_buf, length, &amount); free_page_buf (page_buf); } diff --git a/isofs/lookup.c b/isofs/lookup.c index b5b814db..e51b9cb1 100644 --- a/isofs/lookup.c +++ b/isofs/lookup.c @@ -338,7 +338,7 @@ diskfs_get_directs (struct node *dp, (ouralloc ? (allocsize *= 2) : (allocsize = vm_page_size * 2)), 1); - bcopy ((void *) *data, (void *)newdata, datap - *data); + memcpy ((void *) newdata, (void *) *data, datap - *data); if (ouralloc) munmap (*data, allocsize / 2); @@ -374,7 +374,7 @@ diskfs_get_directs (struct node *dp, userp->d_type = DT_UNKNOWN; userp->d_reclen = reclen; userp->d_namlen = namlen; - bcopy (name, userp->d_name, namlen); + memcpy (userp->d_name, name, namlen); userp->d_name[namlen] = '\0'; /* And move along */ diff --git a/isofs/main.c b/isofs/main.c index 5d002aff..4f531f7e 100644 --- a/isofs/main.c +++ b/isofs/main.c @@ -101,7 +101,7 @@ read_sblock () sblock = malloc (sizeof (struct sblock)); if (!sblock) error (1, errno, "Could not allocate memory for superblock"); - bcopy (sb, sblock, sizeof (struct sblock)); + memcpy (sblock, sb, sizeof (struct sblock)); diskfs_end_catch_exception (); /* Parse some important bits of this */ @@ -282,7 +282,7 @@ rrip_work (struct dirrect *dr, struct rrip_lookup *rr, nmbuf = realloc (nmbuf, (nmbufsize += nmlen) + 1); assert (nmbuf); - bcopy (nm->name, nmbuf + nmbufsize - nmlen, nmlen); + memcpy (nmbuf + nmbufsize - nmlen, nm->name, nmlen); if (nm->flags & NAME_CONTINUE) goto next_field; @@ -375,7 +375,7 @@ rrip_work (struct dirrect *dr, struct rrip_lookup *rr, rr->target = realloc (rr->target, targalloced *= 2); assert (rr->target); - bcopy (cname, rr->target + targused, cnamelen); + memcpy (rr->target + targused, cname, cnamelen); targused += cnamelen; } @@ -391,7 +391,7 @@ rrip_work (struct dirrect *dr, struct rrip_lookup *rr, slbuf = realloc (slbuf, slbufsize += crlen); assert (slbuf); - bcopy (sl->data, slbuf + slbufsize - crlen, crlen); + memcpy (slbuf + slbufsize - crlen, sl->data, crlen); if (sl->flags & 1) /* We'll finish later. */ diff --git a/libdiskfs/file-get-trans.c b/libdiskfs/file-get-trans.c index db5bbdad..e6e994df 100644 --- a/libdiskfs/file-get-trans.c +++ b/libdiskfs/file-get-trans.c @@ -45,7 +45,7 @@ diskfs_S_file_get_translator (struct protid *cred, assert (diskfs_shortcut_symlink); if (len > *translen) *trans = mmap (0, len, PROT_READ|PROT_WRITE, MAP_ANON, 0, 0); - bcopy (_HURD_SYMLINK, *trans, sizeof _HURD_SYMLINK); + memcpy (*trans, _HURD_SYMLINK, sizeof _HURD_SYMLINK); if (diskfs_read_symlink_hook) err = (*diskfs_read_symlink_hook) (np, @@ -85,7 +85,7 @@ diskfs_S_file_get_translator (struct protid *cred, if (buflen > *translen) *trans = mmap (0, buflen, PROT_READ|PROT_WRITE, MAP_ANON, 0, 0); - bcopy (buf, *trans, buflen); + memcpy (*trans, buf, buflen); free (buf); *translen = buflen; err = 0; @@ -97,7 +97,7 @@ diskfs_S_file_get_translator (struct protid *cred, len = sizeof _HURD_FIFO; if (len > *translen) *trans = mmap (0, len, PROT_READ|PROT_WRITE, MAP_ANON, 0, 0); - bcopy (_HURD_FIFO, *trans, sizeof _HURD_FIFO); + memcpy (*trans, _HURD_FIFO, sizeof _HURD_FIFO); *translen = len; err = 0; } @@ -108,7 +108,7 @@ diskfs_S_file_get_translator (struct protid *cred, len = sizeof _HURD_IFSOCK; if (len > *translen) *trans = mmap (0, len, PROT_READ|PROT_WRITE, MAP_ANON, 0, 0); - bcopy (_HURD_IFSOCK, *trans, sizeof _HURD_IFSOCK); + memcpy (*trans, _HURD_IFSOCK, sizeof _HURD_IFSOCK); *translen = len; err = 0; } @@ -125,7 +125,7 @@ diskfs_S_file_get_translator (struct protid *cred, { if (len > *translen) *trans = mmap (0, len, PROT_READ|PROT_WRITE, MAP_ANON, 0, 0); - bcopy (string, *trans, len); + memcpy (*trans, string, len); *translen = len; free (string); } diff --git a/libiohelp/return-buffer.c b/libiohelp/return-buffer.c index e186698f..1beb4aeb 100644 --- a/libiohelp/return-buffer.c +++ b/libiohelp/return-buffer.c @@ -44,7 +44,7 @@ iohelp_return_malloced_buffer (char *buf, size_t len, if (! err) { if (len) - bcopy (buf, *rbuf, len); + memcpy (*rbuf, buf, len); *rlen = len; } diff --git a/libpager/pagemap.c b/libpager/pagemap.c index b8b3362c..963f6567 100644 --- a/libpager/pagemap.c +++ b/libpager/pagemap.c @@ -36,7 +36,7 @@ _pager_pagemap_resize (struct pager *p, vm_address_t off) err = (newaddr == (void *) -1) ? errno : 0; if (! err) { - bcopy (p->pagemap, newaddr, p->pagemapsize * sizeof (*p->pagemap)); + memcpy (newaddr, p->pagemap, p->pagemapsize * sizeof (*p->pagemap)); munmap (p->pagemap, p->pagemapsize * sizeof (*p->pagemap)); p->pagemap = newaddr; p->pagemapsize = newsize; diff --git a/libpipe/pq.c b/libpipe/pq.c index 102f3ee3..fe7dd8ae 100644 --- a/libpipe/pq.c +++ b/libpipe/pq.c @@ -249,10 +249,10 @@ packet_realloc (struct packet *packet, size_t new_len) /* If there was an operation like vm_move, we could use that in the case where both the old and the new buffers were vm_alloced (on the assumption that creating COW pages is somewhat more costly). - But there's not, and bcopy will do vm_copy where it can. Will we + But there's not, and memcpy may do vm_copy where it can. Will we still takes faults on the new copy, even though we've deallocated the old one??? XXX */ - bcopy (start, new_buf, end - start); + memcpy (new_buf, start, end - start); /* And get rid of the old buffer. */ if (old_len > 0) @@ -305,7 +305,7 @@ packet_set_ports (struct packet *packet, packet->ports = new_ports; packet->ports_alloced = num_ports; } - bcopy (ports, packet->ports, sizeof (mach_port_t) * num_ports); + memcpy (packet->ports, ports, sizeof (mach_port_t) * num_ports); packet->num_ports = num_ports; return 0; } @@ -324,7 +324,7 @@ packet_read_ports (struct packet *packet, return errno; } *num_ports = packet->num_ports; - bcopy (packet->ports, *ports, length); + memcpy (*ports, packet->ports, length); packet->num_ports = 0; return 0; } @@ -341,7 +341,7 @@ packet_write (struct packet *packet, return err; /* Add the new data. */ - bcopy (data, packet->buf_end, data_len); + memcpy (packet->buf_end, data, data_len); packet->buf_end += data_len; if (amount != NULL) *amount = data_len; @@ -411,7 +411,7 @@ packet_fetch (struct packet *packet, if (*data_len < amount) *data = mmap (0, amount, PROT_READ|PROT_WRITE, MAP_ANON, 0, 0); - bcopy (start, *data, amount); + memcpy (*data, start, amount); start += amount; if (remove && start - buf > 2 * PACKET_SIZE_LARGE) diff --git a/libpipe/pq.h b/libpipe/pq.h index 4e500b6c..7238ace0 100644 --- a/libpipe/pq.h +++ b/libpipe/pq.h @@ -176,7 +176,7 @@ packet_fit (struct packet *packet, size_t amount) than 25% of the buffer size, then move the data instead of growing the buffer. */ { - bcopy (start, buf, cur_len); + memmove (buf, start, cur_len); packet->buf_start = buf; packet->buf_end = buf + cur_len; } diff --git a/libstore/unzipstore.c b/libstore/unzipstore.c index 8d500c1b..cc86887e 100644 --- a/libstore/unzipstore.c +++ b/libstore/unzipstore.c @@ -81,7 +81,7 @@ unzip_store (struct store *from, void **buf, size_t *buf_len) { if (left > maxread) left = maxread; - bcopy (in_buf + in_buf_offs, buf, left); + memcpy (buf, in_buf + in_buf_offs, left); in_buf_offs += left; buf += left; maxread -= left; @@ -150,7 +150,7 @@ unzip_store (struct store *from, void **buf, size_t *buf_len) if (out_buf_offs > 0) /* Copy the old buffer into the start of the new & free it. */ - bcopy (old_buf, new_buf, out_buf_offs); + memcpy (new_buf, old_buf, out_buf_offs); munmap (old_buf, old_buf_len); @@ -160,7 +160,7 @@ unzip_store (struct store *from, void **buf, size_t *buf_len) *buf_len = new_buf_len; } - bcopy (wbuf, *buf + out_buf_offs, nwrite); + memcpy (*buf + out_buf_offs, wbuf, nwrite); out_buf_offs += nwrite; } diff --git a/mach-defpager/default_pager.c b/mach-defpager/default_pager.c index 9e4b0e76..83382c05 100644 --- a/mach-defpager/default_pager.c +++ b/mach-defpager/default_pager.c @@ -431,7 +431,7 @@ create_paging_partition(const char *name, memset (new_list, 0, n * sizeof(partition_t)); if (i) { old_list = all_partitions.partition_list; - bcopy(old_list, new_list, i*sizeof(partition_t)); + memcpy (new_list, old_list, i*sizeof(partition_t)); } all_partitions.partition_list = new_list; all_partitions.n_partitions = n; @@ -1678,7 +1678,7 @@ ddprintf ("default_read(%x,%x,%x,%d)\n",addr,size,offset,block.block.p_index); * the next piece. */ first_time = FALSE; - bcopy((char *)raddr, (char *)addr, rsize); + memcpy ((char *)addr, (char *)raddr, rsize); addr += rsize; offset += rsize; size -= rsize; diff --git a/pfinet/ethernet.c b/pfinet/ethernet.c index 16782435..e6ae53ce 100644 --- a/pfinet/ethernet.c +++ b/pfinet/ethernet.c @@ -158,10 +158,10 @@ ethernet_demuxer (mach_msg_header_t *inp, skb->dev = dev; /* Copy the two parts of the frame into the buffer. */ - bcopy (msg->header, skb->data, ETH_HLEN); - bcopy (msg->packet + sizeof (struct packet_header), - skb->data + ETH_HLEN, - datalen - ETH_HLEN); + memcpy (skb->data, msg->header, ETH_HLEN); + memcpy (skb->data + ETH_HLEN, + msg->packet + sizeof (struct packet_header), + datalen - ETH_HLEN); /* Drop it on the queue. */ skb->protocol = eth_type_trans (skb, dev); @@ -389,7 +389,7 @@ setup_ethernet_device (char *name, struct device **device) error (2, err, "%s: Cannot get hardware Ethernet address", name); net_address[0] = ntohl (net_address[0]); net_address[1] = ntohl (net_address[1]); - bcopy (net_address, dev->dev_addr, ETH_ALEN); + memcpy (dev->dev_addr, net_address, ETH_ALEN); /* That should be enough. */ diff --git a/pfinet/tunnel.c b/pfinet/tunnel.c index 6a7f355d..02e9ee81 100644 --- a/pfinet/tunnel.c +++ b/pfinet/tunnel.c @@ -395,7 +395,7 @@ trivfs_S_io_write (struct trivfs_protid *cred, skb->len = datalen; skb->dev = &tdev->dev; - bcopy (data, skb->data, datalen); + memcpy (skb->data, data, datalen); /* Drop it on the queue. */ skb->mac.raw = skb->data; diff --git a/storeio/dev.c b/storeio/dev.c index 8f520cd2..614c257f 100644 --- a/storeio/dev.c +++ b/storeio/dev.c @@ -336,7 +336,7 @@ dev_write (struct dev *dev, off_t offs, void *buf, size_t len, { error_t buf_write (size_t buf_offs, size_t io_offs, size_t len) { - bcopy (buf + io_offs, dev->buf + buf_offs, len); + memcpy (dev->buf + buf_offs, buf + io_offs, len); dev->buf_dirty = 1; return 0; } @@ -398,7 +398,7 @@ dev_read (struct dev *dev, off_t offs, size_t whole_amount, { error_t err = ensure_buf (); if (! err) - bcopy (dev->buf + buf_offs, *buf + io_offs, len); + memcpy (*buf + io_offs, dev->buf + buf_offs, len); return err; } error_t raw_read (off_t offs, size_t io_offs, size_t len, size_t *amount) @@ -424,7 +424,7 @@ dev_read (struct dev *dev, off_t offs, size_t whole_amount, if (req_buf != _req_buf) /* Copy from wherever the read put it. */ { - bcopy (req_buf, _req_buf, req_len); + memcpy (_req_buf, req_buf, req_len); munmap (req_buf, req_len); } *amount = req_len; |