1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
|
From 82a87d043498eeacb7e4f3edc85d1b7c424ea853 Mon Sep 17 00:00:00 2001
From: Justus Winter <4winter@informatik.uni-hamburg.de>
Date: Tue, 2 Dec 2014 00:20:51 +0100
Subject: [PATCH hurd 5/5] 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.
---
ext2fs/inode.c | 6 +++---
ext2fs/pager.c | 4 ++--
isofs/lookup.c | 4 ++--
isofs/main.c | 2 +-
isofs/rr.c | 6 +++---
libdiskfs/file-get-trans.c | 10 +++++-----
libiohelp/return-buffer.c | 2 +-
libpager/pagemap.c | 2 +-
libpipe/pq.c | 12 ++++++------
libpipe/pq.h | 2 +-
libstore/unzipstore.c | 6 +++---
mach-defpager/default_pager.c | 4 ++--
pfinet/ethernet.c | 10 +++++-----
pfinet/tunnel.c | 2 +-
storeio/dev.c | 6 +++---
15 files changed, 39 insertions(+), 39 deletions(-)
diff --git a/ext2fs/inode.c b/ext2fs/inode.c
index 27530fb..6b8b749 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 ae51530..a6c4fbb 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 b5b814d..e51b9cb 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 5d002af..4f531f7 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 */
diff --git a/isofs/rr.c b/isofs/rr.c
index be4395d..adc95c3 100644
--- a/isofs/rr.c
+++ b/isofs/rr.c
@@ -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 db5bbda..e6e994d 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 e186698..1beb4ae 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 b8b3362..963f656 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 102f3ee..fe7dd8a 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 4e500b6..7238ace 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 8d500c1..cc86887 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 9e4b0e7..83382c0 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 1678243..e6ae53c 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 6a7f355..02e9ee8 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 8f520cd..614c257 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;
--
2.1.3
|