From fe0231ba14d8597b0d78bf6121dd15a82bbab34a Mon Sep 17 00:00:00 2001 From: Marin Ramesa Date: Fri, 4 Apr 2014 22:32:14 +0200 Subject: Convert from K&R to ANSI Convert from K&R style function definitions to ANSI style function definitions. * ddb/db_access.c: Convert function prototypes from K&R to ANSI. * ddb/db_aout.c: Likewise. * ddb/db_break.c: Likewise. * ddb/db_command.c: Likewise. * ddb/db_cond.c: Likewise. * ddb/db_examine.c: Likewise. * ddb/db_expr.c: Likewise. * ddb/db_ext_symtab.c: Likewise. * ddb/db_input.c: Likewise. * ddb/db_lex.c: Likewise. * ddb/db_macro.c: Likewise. * ddb/db_mp.c: Likewise. * ddb/db_output.c: Likewise. * ddb/db_print.c: Likewise. * ddb/db_run.c: Likewise. * ddb/db_sym.c: Likewise. * ddb/db_task_thread.c: Likewise. * ddb/db_trap.c: Likewise. * ddb/db_variables.c: Likewise. * ddb/db_watch.c: Likewise. * device/blkio.c: Likewise. * device/chario.c: Likewise. * device/dev_lookup.c: Likewise. * device/dev_name.c: Likewise. * device/dev_pager.c: Likewise. * device/ds_routines.c: Likewise. * device/net_io.c: Likewise. * device/subrs.c: Likewise. * i386/i386/db_interface.c: Likewise. * i386/i386/fpu.c: Likewise. * i386/i386/io_map.c: Likewise. * i386/i386/loose_ends.c: Likewise. * i386/i386/mp_desc.c: Likewise. * i386/i386/pcb.c: Likewise. * i386/i386/phys.c: Likewise. * i386/i386/trap.c: Likewise. * i386/i386/user_ldt.c: Likewise. * i386/i386at/com.c: Likewise. * i386/i386at/kd.c: Likewise. * i386/i386at/kd_event.c: Likewise. * i386/i386at/kd_mouse.c: Likewise. * i386/i386at/kd_queue.c: Likewise. * i386/i386at/lpr.c: Likewise. * i386/i386at/model_dep.c: Likewise. * i386/i386at/rtc.c: Likewise. * i386/intel/pmap.c: Likewise. * i386/intel/read_fault.c: Likewise. * ipc/ipc_entry.c: Likewise. * ipc/ipc_hash.c: Likewise. * ipc/ipc_kmsg.c: Likewise. * ipc/ipc_marequest.c: Likewise. * ipc/ipc_mqueue.c: Likewise. * ipc/ipc_notify.c: Likewise. * ipc/ipc_port.c: Likewise. * ipc/ipc_right.c: Likewise. * ipc/mach_debug.c: Likewise. * ipc/mach_msg.c: Likewise. * ipc/mach_port.c: Likewise. * ipc/mach_rpc.c: Likewise. * kern/act.c: Likewise. * kern/exception.c: Likewise. * kern/ipc_mig.c: Likewise. * kern/ipc_tt.c: Likewise. * kern/lock_mon.c: Likewise. * kern/mach_clock.c: Likewise. * kern/machine.c: Likewise. * kern/printf.c: Likewise. * kern/priority.c: Likewise. * kern/startup.c: Likewise. * kern/syscall_emulation.c: Likewise. * kern/syscall_subr.c: Likewise. * kern/thread_swap.c: Likewise. * kern/time_stamp.c: Likewise. * kern/timer.c: Likewise. * kern/xpr.c: Likewise. * vm/memory_object.c: Likewise. * vm/vm_debug.c: Likewise. * vm/vm_external.c: Likewise. * vm/vm_fault.c: Likewise. * vm/vm_kern.c: Likewise. * vm/vm_map.c: Likewise. * vm/vm_pageout.c: Likewise. * vm/vm_user.c: Likewise. --- device/blkio.c | 11 +++--- device/chario.c | 3 +- device/dev_lookup.c | 24 +++++------- device/dev_name.c | 8 ++-- device/dev_pager.c | 3 +- device/ds_routines.c | 58 +++++++++++++-------------- device/net_io.c | 109 +++++++++++++++++++++++++-------------------------- device/subrs.c | 3 +- 8 files changed, 102 insertions(+), 117 deletions(-) (limited to 'device') diff --git a/device/blkio.c b/device/blkio.c index 52d8c00..ee86634 100644 --- a/device/blkio.c +++ b/device/blkio.c @@ -38,10 +38,10 @@ -io_return_t block_io(strat, max_count, ior) - void (*strat)(); - void (*max_count)(); - io_req_t ior; +io_return_t block_io( + void (*strat)(), + void (*max_count)(), + io_req_t ior) { kern_return_t rc; boolean_t wait = FALSE; @@ -88,8 +88,7 @@ io_return_t block_io(strat, max_count, ior) */ #define MAX_PHYS (256 * 1024) -void minphys(ior) - io_req_t ior; +void minphys(io_req_t ior) { if ((ior->io_op & (IO_WRITE | IO_READ | IO_OPEN)) == IO_WRITE) return; diff --git a/device/chario.c b/device/chario.c index 0d9f803..0e9dd70 100644 --- a/device/chario.c +++ b/device/chario.c @@ -839,8 +839,7 @@ void ttrstrt( * Called at spltty, tty already locked. * Must be on master CPU if device runs on master. */ -void ttstart(tp) - struct tty *tp; +void ttstart(struct tty *tp) { if ((tp->t_state & (TS_TIMEOUT|TS_TTSTOP|TS_BUSY)) == 0) { /* diff --git a/device/dev_lookup.c b/device/dev_lookup.c index d371b60..a80830c 100644 --- a/device/dev_lookup.c +++ b/device/dev_lookup.c @@ -120,8 +120,7 @@ dev_number_lookup(ops, devnum) * table. */ mach_device_t -device_lookup(name) - char * name; +device_lookup(char *name) { dev_ops_t dev_ops; int dev_minor; @@ -198,8 +197,7 @@ device_lookup(name) * Add a reference to the device. */ void -mach_device_reference(device) - mach_device_t device; +mach_device_reference(mach_device_t device) { simple_lock(&device->ref_lock); device->ref_count++; @@ -211,8 +209,7 @@ mach_device_reference(device) * structure if no references are left. */ void -mach_device_deallocate(device) - mach_device_t device; +mach_device_deallocate(mach_device_t device) { simple_lock(&device->ref_lock); if (--device->ref_count > 0) { @@ -248,8 +245,7 @@ mach_device_deallocate(device) * Enter a port-to-device mapping. */ void -dev_port_enter(device) - mach_device_t device; +dev_port_enter(mach_device_t device) { mach_device_reference(device); @@ -267,8 +263,7 @@ dev_port_enter(device) * Remove a port-to-device mapping. */ void -dev_port_remove(device) - mach_device_t device; +dev_port_remove(mach_device_t device) { ipc_kobject_set(device->port, IKO_NULL, IKOT_NONE); mach_device_deallocate(device); @@ -279,8 +274,7 @@ dev_port_remove(device) * Doesn't consume the naked send right; produces a device reference. */ device_t -dev_port_lookup(port) - ipc_port_t port; +dev_port_lookup(ipc_port_t port) { device_t device; @@ -321,9 +315,9 @@ convert_device_to_port(device) * return FALSE. */ boolean_t -dev_map(routine, port) - boolean_t (*routine)(); - mach_port_t port; +dev_map( + boolean_t (*routine)(), + mach_port_t port) { int i; queue_t q; diff --git a/device/dev_name.c b/device/dev_name.c index cd3a28a..5bf62a0 100644 --- a/device/dev_name.c +++ b/device/dev_name.c @@ -112,10 +112,10 @@ name_equal(src, len, target) /* * device name lookup */ -boolean_t dev_name_lookup(name, ops, unit) - char *name; - dev_ops_t *ops; /* out */ - int *unit; /* out */ +boolean_t dev_name_lookup( + char *name, + dev_ops_t *ops, /* out */ + int *unit) /* out */ { /* * Assume that block device names are of the form diff --git a/device/dev_pager.c b/device/dev_pager.c index 3fe47c7..815473a 100644 --- a/device/dev_pager.c +++ b/device/dev_pager.c @@ -513,8 +513,7 @@ kern_return_t device_pager_data_write( return (KERN_SUCCESS); } -boolean_t device_pager_data_write_done(ior) - io_req_t ior; +boolean_t device_pager_data_write_done(io_req_t ior) { device_write_dealloc(ior); mach_device_deallocate(ior->io_device); diff --git a/device/ds_routines.c b/device/ds_routines.c index 4e04445..38d773c 100644 --- a/device/ds_routines.c +++ b/device/ds_routines.c @@ -597,8 +597,7 @@ ds_open_done(ior) } static io_return_t -device_close(device) - mach_device_t device; +device_close(mach_device_t device) { device_lock(device); @@ -824,9 +823,9 @@ device_write_inband(device, reply_port, reply_port_type, mode, recnum, * Wire down incoming memory to give to device. */ kern_return_t -device_write_get(ior, wait) - io_req_t ior; - boolean_t *wait; +device_write_get( + io_req_t ior, + boolean_t *wait) { vm_map_copy_t io_copy; vm_offset_t new_addr; @@ -919,8 +918,7 @@ device_write_get(ior, wait) * Clean up memory allocated for IO. */ boolean_t -device_write_dealloc(ior) - io_req_t ior; +device_write_dealloc(io_req_t ior) { vm_map_copy_t new_copy = VM_MAP_COPY_NULL; vm_map_copy_t io_copy; @@ -1221,9 +1219,9 @@ device_read_inband(device, reply_port, reply_port_type, mode, recnum, /* * Allocate wired-down memory for device read. */ -kern_return_t device_read_alloc(ior, size) - io_req_t ior; - vm_size_t size; +kern_return_t device_read_alloc( + io_req_t ior, + vm_size_t size) { vm_offset_t addr; kern_return_t kr; @@ -1346,11 +1344,11 @@ boolean_t ds_read_done(ior) } static io_return_t -device_set_status(device, flavor, status, status_count) - mach_device_t device; - dev_flavor_t flavor; - dev_status_t status; - mach_msg_type_number_t status_count; +device_set_status( + mach_device_t device, + dev_flavor_t flavor, + dev_status_t status, + mach_msg_type_number_t status_count) { if (device->state != DEV_STATE_OPEN) return (D_NO_SUCH_DEVICE); @@ -1364,11 +1362,11 @@ device_set_status(device, flavor, status, status_count) } io_return_t -mach_device_get_status(device, flavor, status, status_count) - mach_device_t device; - dev_flavor_t flavor; - dev_status_t status; /* pointer to OUT array */ - mach_msg_type_number_t *status_count; /* out */ +mach_device_get_status( + mach_device_t device, + dev_flavor_t flavor, + dev_status_t status, /* pointer to OUT array */ + mach_msg_type_number_t *status_count) /* out */ { if (device->state != DEV_STATE_OPEN) return (D_NO_SUCH_DEVICE); @@ -1408,13 +1406,13 @@ device_set_filter(device, receive_port, priority, filter, filter_count) } static io_return_t -device_map(device, protection, offset, size, pager, unmap) - mach_device_t device; - vm_prot_t protection; - vm_offset_t offset; - vm_size_t size; - ipc_port_t *pager; /* out */ - boolean_t unmap; /* ? */ +device_map( + mach_device_t device, + vm_prot_t protection, + vm_offset_t offset, + vm_size_t size, + ipc_port_t *pager, /* out */ + boolean_t unmap) /* ? */ { if (protection & ~VM_PROT_ALL) return (KERN_INVALID_ARGUMENT); @@ -1445,8 +1443,7 @@ decl_simple_lock_data(, io_done_list_lock) #define splio splsched /* XXX must block ALL io devices */ -void iodone(ior) - io_req_t ior; +void iodone(io_req_t ior) { spl_t s; @@ -1566,8 +1563,7 @@ void mach_device_init(void) mach_device_trap_init(); } -void iowait(ior) - io_req_t ior; +void iowait(io_req_t ior) { spl_t s; diff --git a/device/net_io.c b/device/net_io.c index e758f2d..82b6fb9 100644 --- a/device/net_io.c +++ b/device/net_io.c @@ -412,8 +412,7 @@ mach_msg_type_t packet_type = { * Dequeues a message and delivers it at spl0. * Returns FALSE if no messages. */ -boolean_t net_deliver(nonblocking) - boolean_t nonblocking; +boolean_t net_deliver(boolean_t nonblocking) { ipc_kmsg_t kmsg; boolean_t high_priority; @@ -603,8 +602,9 @@ void net_thread(void) } void -reorder_queue(first, last) - queue_t first, last; +reorder_queue( + queue_t first, + queue_t last) { queue_entry_t prev, next; @@ -626,11 +626,11 @@ reorder_queue(first, last) * We are already at splimp. */ void -net_packet(ifp, kmsg, count, priority) - struct ifnet *ifp; - ipc_kmsg_t kmsg; - unsigned int count; - boolean_t priority; +net_packet( + struct ifnet *ifp, + ipc_kmsg_t kmsg, + unsigned int count, + boolean_t priority) { boolean_t awake; @@ -1010,9 +1010,9 @@ net_do_filter(infp, data, data_count, header) * Check filter for invalid operations or stack over/under-flow. */ boolean_t -parse_net_filter(filter, count) - filter_t *filter; - unsigned int count; +parse_net_filter( + filter_t *filter, + unsigned int count) { int sp; filter_t *fpe = &filter[count]; @@ -1104,12 +1104,12 @@ parse_net_filter(filter, count) * If we are successful, we must consume that right. */ io_return_t -net_set_filter(ifp, rcv_port, priority, filter, filter_count) - struct ifnet *ifp; - ipc_port_t rcv_port; - int priority; - filter_t *filter; - unsigned int filter_count; +net_set_filter( + struct ifnet *ifp, + ipc_port_t rcv_port, + int priority, + filter_t *filter, + unsigned int filter_count) { int filter_bytes; bpf_insn_t match; @@ -1369,11 +1369,11 @@ clean_and_return: * Other network operations */ io_return_t -net_getstat(ifp, flavor, status, count) - struct ifnet *ifp; - dev_flavor_t flavor; - dev_status_t status; /* pointer to OUT array */ - natural_t *count; /* OUT */ +net_getstat( + struct ifnet *ifp, + dev_flavor_t flavor, + dev_status_t status, /* pointer to OUT array */ + natural_t *count) /* OUT */ { switch (flavor) { case NET_STATUS: @@ -1434,10 +1434,10 @@ printf ("net_getstat: count: %d, addr_int_count: %d\n", } io_return_t -net_write(ifp, start, ior) - struct ifnet *ifp; - int (*start)(); - io_req_t ior; +net_write( + struct ifnet *ifp, + int (*start)(), + io_req_t ior) { spl_t s; kern_return_t rc; @@ -1590,13 +1590,14 @@ net_io_init(void) */ int -bpf_do_filter(infp, p, wirelen, header, hlen, hash_headpp, entpp) - net_rcv_port_t infp; - char * p; /* packet data */ - unsigned int wirelen; /* data_count (in bytes) */ - char * header; - unsigned int hlen; /* header len (in bytes) */ - net_hash_entry_t **hash_headpp, *entpp; /* out */ +bpf_do_filter( + net_rcv_port_t infp, + char * p, /* packet data */ + unsigned int wirelen, /* data_count (in bytes) */ + char * header, + unsigned int hlen, /* header len (in bytes) */ + net_hash_entry_t **hash_headpp, + net_hash_entry_t *entpp) /* out */ { bpf_insn_t pc, pc_end; unsigned int buflen; @@ -1889,10 +1890,10 @@ bpf_do_filter(infp, p, wirelen, header, hlen, hash_headpp, entpp) * Otherwise, a bogus program could easily crash the system. */ int -bpf_validate(f, bytes, match) - bpf_insn_t f; - int bytes; - bpf_insn_t *match; +bpf_validate( + bpf_insn_t f, + int bytes, + bpf_insn_t *match) { int i, j, len; bpf_insn_t p; @@ -1961,9 +1962,10 @@ bpf_validate(f, bytes, match) } int -bpf_eq (f1, f2, bytes) - bpf_insn_t f1, f2; - int bytes; +bpf_eq( + bpf_insn_t f1, + bpf_insn_t f2, + int bytes) { int count; @@ -2035,12 +2037,13 @@ bpf_match (hash, n_keys, keys, hash_headpp, entpp) */ int -hash_ent_remove (ifp, hp, used, head, entp, dead_p) - struct ifnet *ifp; - net_hash_header_t hp; - int used; - net_hash_entry_t *head, entp; - queue_entry_t *dead_p; +hash_ent_remove( + struct ifnet *ifp, + net_hash_header_t hp, + int used, + net_hash_entry_t *head, + net_hash_entry_t entp, + queue_entry_t *dead_p) { hp->ref_count--; @@ -2072,8 +2075,7 @@ hash_ent_remove (ifp, hp, used, head, entp, dead_p) } int -net_add_q_info (rcv_port) - ipc_port_t rcv_port; +net_add_q_info(ipc_port_t rcv_port) { mach_port_msgcount_t qlimit = 0; @@ -2098,8 +2100,7 @@ net_add_q_info (rcv_port) } void -net_del_q_info (qlimit) - int qlimit; +net_del_q_info(int qlimit) { simple_lock(&net_kmsg_total_lock); net_queue_free_min--; @@ -2116,8 +2117,7 @@ net_del_q_info (qlimit) * No locks should be held when called. */ void -net_free_dead_infp (dead_infp) - queue_entry_t dead_infp; +net_free_dead_infp(queue_entry_t dead_infp) { net_rcv_port_t infp, nextfp; @@ -2138,8 +2138,7 @@ net_free_dead_infp (dead_infp) * No locks should be held when called. */ void -net_free_dead_entp (dead_entp) - queue_entry_t dead_entp; +net_free_dead_entp(queue_entry_t dead_entp) { net_hash_entry_t entp, nextentp; diff --git a/device/subrs.c b/device/subrs.c index 7e6e30d..a10b72d 100644 --- a/device/subrs.c +++ b/device/subrs.c @@ -75,8 +75,7 @@ ether_sprintf(ap) /* * Initialize send and receive queues on an interface. */ -void if_init_queues(ifp) - struct ifnet *ifp; +void if_init_queues(struct ifnet *ifp) { IFQ_INIT(&ifp->if_snd); queue_init(&ifp->if_rcv_port_list); -- cgit v1.2.3