summaryrefslogtreecommitdiff
path: root/device
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2006-11-05 18:54:52 +0000
committerThomas Schwinge <tschwinge@gnu.org>2009-06-18 00:26:50 +0200
commitffc607f8a4c1c6f1c63a7b61b54f185ada87a9a5 (patch)
tree35fb5835c103b647de4de4a53ba94e4b1b5cb563 /device
parent7e8b31e61e4bd9207bde37662e757a5988c556df (diff)
2006-11-05 Barry deFreese <bddebian@comcast.net>
memcpy/memset cleanup. * include/string.h: New file. * include/mach/mig_support.h: Include `string.h'. [MACH_KERNEL] (bcopy): Remove extern declaration. [MACH_KERNEL] (memcpy): Remove macro. * device/cirbuf.c: Include `string.h'. (q_to_b, b_to_q): Replace bcopy() with memcpy() and bzero() with memset(), clean memcpy() and memset() invocation. * device/cons.c (cnputc): Likewise. * device/dev_pager.c (device_pager_data_request_done): Likewise. * device/ds_routines.c (device_write_get, ds_read_done): Likewise. * device/kmsg.c: Likewise. * device/net_io.c (net_filter, net_set_filter, net_getstat): Likewise. * i386/i386/fpu.c (fpu_set_state, fpu_get_state) fp_load) (fp_state_alloc): Likewise. * i386/i386/iopb.c (io_tss_init, i386_io_port_list): Likewise. * i386/i386/mp_desc.c (mp_desc_init): Likewise. * i386/i386/pcb.c (pcb_init, thread_setstatus) (thread_getstatus): Likewise. * i386/i386/phys.c (pmap_zero_page, pmap_copy_page, copy_to_phys) (copy_from_phys): Likewise. * i386/i386/trap.c (v86_assist): Likewise. * i386/i386/user_ldt.c (i386_set_ldt, i386_get_ldt): Likewise. * i386/i386at/immc.c (immc_cnputc): Likewise. * i386/i386at/kd_event.c (X_kdb_enter_init, X_kdb_exit_init): Likewise. * i386/intel/pmap.c (pmap_init, pmap_page_table_page_alloc) (pmap_create): Likewise. * ipc/ipc_entry.c (ipc_entry_grow_table): Likewise. * ipc/ipc_kmsg.c (ipc_kmsg_get_from_kernel) (ipc_kmsg_put_to_kernel): Likewise. * ipc/ipc_object.c (ipc_object_alloc, ipc_object_alloc_name): Likewise. * ipc/ipc_port.c (ipc_port_dngrow): Likewise. * ipc/ipc_space.c: Likewise. * ipc/mach_debug.c (mach_port_space_info) (mach_port_space_info): Likewise. * kern/act.c (act_create): Likewise. * kern/boot_script.c: Likewise. * kern/bootstrap.c: Likewise. * kern/eventcount.c (evc_init): Likewise. * kern/host.c (host_info, host_processor_sets): Likewise. * kern/lock.c (lock_init): Likewise. * kern/lock_mon.c (lock_info_clear): Likewise. * kern/mach_clock.c (mapable_time_init): Likewise. * kern/pc_sample.c (get_sampled_pcs): Likewise. * kern/processor.c (processor_set_things): Likewise. * kern/syscall_emulation.c (task_set_emulation_vector_internal) (task_get_emulation_vector, xxx_task_get_emulation_vector): Likewise. * kern/task.c (task_threads): Likewise. * kern/xpr.c (xprbootstrap): Likewise. * kern/zalloc.c (host_zone_info): Likewise. * vm/vm_debug.c (mach_vm_object_pages): Likewise. * vm/vm_kern.c (projected_buffer_allocate, copyinmap) (copyoutmap): Likewise. * vm/vm_object.c (vm_object_bootstrap): Likewise. * vm/vm_resident.c (vm_page_grab_contiguous_pages): Likewise.
Diffstat (limited to 'device')
-rw-r--r--device/cirbuf.c5
-rw-r--r--device/cons.c3
-rw-r--r--device/dev_pager.c5
-rw-r--r--device/ds_routines.c8
-rw-r--r--device/kmsg.c2
-rw-r--r--device/net_io.c21
6 files changed, 25 insertions, 19 deletions
diff --git a/device/cirbuf.c b/device/cirbuf.c
index 9653168..c6ca196 100644
--- a/device/cirbuf.c
+++ b/device/cirbuf.c
@@ -30,6 +30,7 @@
* Circular buffers for TTY
*/
+#include <string.h>
#include <device/cirbuf.h>
#include <kern/kalloc.h>
@@ -143,7 +144,7 @@ q_to_b( register struct cirbuf *cb,
i = cb->c_cl - cb->c_cf;
if (i > count)
i = count;
- bcopy(cb->c_cf, cp, i);
+ memcpy(cp, cb->c_cf, i);
cp += i;
count -= i;
cb->c_cf += i;
@@ -184,7 +185,7 @@ b_to_q( register char * cp,
if (i > count)
i = count;
- bcopy(cp, cb->c_cl, i);
+ memcpy(cb->c_cl, cp, i);
cp += i;
count -= i;
cb->c_cc += i;
diff --git a/device/cons.c b/device/cons.c
index bbcb408..ded971e 100644
--- a/device/cons.c
+++ b/device/cons.c
@@ -20,6 +20,7 @@
* Utah $Hdr: cons.c 1.14 94/12/14$
*/
+#include <string.h>
#ifdef MACH_KERNEL
#include <sys/types.h>
#include <device/conf.h>
@@ -268,7 +269,7 @@ cnputc(c)
if (consbufused == 0) {
consbp = consbuf;
consbufused = 1;
- bzero(consbuf, CONSBUFSIZE);
+ memset(consbuf, 0, CONSBUFSIZE);
}
*consbp++ = c;
if (consbp >= &consbuf[CONSBUFSIZE])
diff --git a/device/dev_pager.c b/device/dev_pager.c
index 60e9f95..75b7451 100644
--- a/device/dev_pager.c
+++ b/device/dev_pager.c
@@ -30,6 +30,8 @@
* Device pager.
*/
+#include <string.h>
+
#include <mach/boolean.h>
#include <mach/port.h>
#include <mach/message.h>
@@ -424,8 +426,7 @@ boolean_t device_pager_data_request_done(register io_req_t ior)
if (ior->io_residual) {
if (device_pager_debug)
printf("(device_pager)data_request_done: r: 0x%x\n",ior->io_residual);
- bzero( (char *) (&ior->io_data[ior->io_count -
- ior->io_residual]),
+ memset((&ior->io_data[ior->io_count - ior->io_residual]), 0,
(unsigned) ior->io_residual);
}
} else {
diff --git a/device/ds_routines.c b/device/ds_routines.c
index dd2b7f5..f7ca4e6 100644
--- a/device/ds_routines.c
+++ b/device/ds_routines.c
@@ -28,6 +28,8 @@
* Date: 3/89
*/
+#include <string.h>
+
#include <mach/boolean.h>
#include <mach/kern_return.h>
#include <mach/mig_errors.h>
@@ -618,7 +620,7 @@ device_write_get(ior, wait)
if (ior->io_op & IO_INBAND) {
assert(ior->io_count <= sizeof (io_buf_ptr_inband_t));
new_addr = zalloc(io_inband_zone);
- bcopy((void*)ior->io_data, (void*)new_addr, ior->io_count);
+ memcpy((void*)new_addr, ior->io_data, ior->io_count);
ior->io_data = (io_buf_ptr_t)new_addr;
ior->io_alloc_size = sizeof (io_buf_ptr_inband_t);
@@ -1083,9 +1085,9 @@ boolean_t ds_read_done(ior)
* Zero memory that the device did not fill.
*/
if (start_sent < start_data)
- bzero((char *)start_sent, start_data - start_sent);
+ memset((char *)start_sent, 0, start_data - start_sent);
if (end_sent > end_data)
- bzero((char *)end_data, end_sent - end_data);
+ memset((char *)end_data, 0, end_sent - end_data);
/*
diff --git a/device/kmsg.c b/device/kmsg.c
index 96f7d70..d1612ad 100644
--- a/device/kmsg.c
+++ b/device/kmsg.c
@@ -19,6 +19,8 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
/* Now kmsg provides stream interface, not random access methods. */
#include <sys/types.h>
+#include <string.h>
+
#include <device/conf.h>
#include <device/io_req.h>
#include <mach/boolean.h>
diff --git a/device/net_io.c b/device/net_io.c
index 25c75ae..6a08235 100644
--- a/device/net_io.c
+++ b/device/net_io.c
@@ -39,6 +39,8 @@
*/
#include <sys/types.h>
+#include <string.h>
+
#include <device/net_status.h>
#include <machine/machspl.h> /* spl definitions */
#include <device/net_io.h>
@@ -805,13 +807,13 @@ net_filter(kmsg, send_list)
break;
}
- bcopy(
- net_kmsg(kmsg)->packet,
+ memcpy(
net_kmsg(new_kmsg)->packet,
+ net_kmsg(kmsg)->packet,
ret_count);
- bcopy(
- net_kmsg(kmsg)->header,
+ memcpy(
net_kmsg(new_kmsg)->header,
+ net_kmsg(kmsg)->header,
NET_HDW_HDR_MAX);
}
net_kmsg(new_kmsg)->net_rcv_msg_packet_count = ret_count;
@@ -1297,8 +1299,7 @@ net_set_filter(ifp, rcv_port, priority, filter, filter_count)
my_infp->rcv_count = 0;
/* Copy filter program. */
- bcopy ((vm_offset_t)filter, (vm_offset_t)my_infp->filter,
- filter_bytes);
+ memcpy (my_infp->filter, filter, filter_bytes);
my_infp->filter_end =
(filter_t *)((char *)my_infp->filter + filter_bytes);
@@ -1410,12 +1411,10 @@ printf ("net_getstat: count: %d, addr_int_count: %d\n",
return (D_INVALID_OPERATION);
}
- bcopy((char *)ifp->if_address,
- (char *)status,
- (unsigned) addr_byte_count);
+ memcpy(status, ifp->if_address, addr_byte_count);
if (addr_byte_count < addr_int_count * sizeof(int))
- bzero((char *)status + addr_byte_count,
- (unsigned) (addr_int_count * sizeof(int)
+ memset((char *)status + addr_byte_count, 0,
+ (addr_int_count * sizeof(int)
- addr_byte_count));
for (i = 0; i < addr_int_count; i++) {