diff options
author | Marin Ramesa <mpr@hi.t-com.hr> | 2013-12-16 23:55:12 +0100 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2013-12-17 19:02:20 +0100 |
commit | f4963a52e96230374826137cce44813c94853e6f (patch) | |
tree | f2cb67804faa33f4a735b9781f5bf77a830782c4 /device | |
parent | 68bbdd1e18a87afede6cbdffdb8c7078ed3fa835 (diff) |
device: qualify pointers whose dereferenced values are constant with const
Diffstat (limited to 'device')
-rw-r--r-- | device/chario.c | 10 | ||||
-rw-r--r-- | device/dev_hdr.h | 10 | ||||
-rw-r--r-- | device/dev_lookup.c | 10 | ||||
-rw-r--r-- | device/dev_name.c | 14 | ||||
-rw-r--r-- | device/dev_pager.c | 74 | ||||
-rw-r--r-- | device/ds_routines.c | 26 | ||||
-rw-r--r-- | device/ds_routines.h | 10 | ||||
-rw-r--r-- | device/if_ether.h | 2 | ||||
-rw-r--r-- | device/kmsg.c | 2 | ||||
-rw-r--r-- | device/net_io.c | 14 | ||||
-rw-r--r-- | device/net_io.h | 8 | ||||
-rw-r--r-- | device/subrs.c | 6 |
12 files changed, 93 insertions, 93 deletions
diff --git a/device/chario.c b/device/chario.c index 91bd8e8..0d9f803 100644 --- a/device/chario.c +++ b/device/chario.c @@ -526,9 +526,9 @@ void ttyclose( */ boolean_t tty_queue_clean( - queue_t q, - ipc_port_t port, - boolean_t (*routine)(io_req_t) ) + queue_t q, + const ipc_port_t port, + boolean_t (*routine)(io_req_t) ) { io_req_t ior; @@ -552,8 +552,8 @@ tty_queue_clean( */ boolean_t tty_portdeath( - struct tty * tp, - ipc_port_t port) + struct tty * tp, + const ipc_port_t port) { spl_t spl = spltty(); boolean_t result; diff --git a/device/dev_hdr.h b/device/dev_hdr.h index 340a2db..ff7d2ef 100644 --- a/device/dev_hdr.h +++ b/device/dev_hdr.h @@ -134,16 +134,16 @@ boolean_t dev_map(boolean_t (*)(), mach_port_t); * device name lookup */ extern boolean_t dev_name_lookup( - char * name, - dev_ops_t *ops, /* out */ - int *unit); /* out */ + char * name, + dev_ops_t *ops, /* out */ + int *unit); /* out */ /* * Change an entry in the indirection list. */ extern void dev_set_indirection( - char *name, + const char *name, dev_ops_t ops, - int unit); + int unit); #endif /* _DEVICE_DEV_HDR_H_ */ diff --git a/device/dev_lookup.c b/device/dev_lookup.c index 255102c..d371b60 100644 --- a/device/dev_lookup.c +++ b/device/dev_lookup.c @@ -71,7 +71,7 @@ struct kmem_cache dev_hdr_cache; */ void dev_number_enter(device) - mach_device_t device; + const mach_device_t device; { queue_t q; @@ -85,7 +85,7 @@ dev_number_enter(device) */ void dev_number_remove(device) - mach_device_t device; + const mach_device_t device; { queue_t q; @@ -99,7 +99,7 @@ dev_number_remove(device) */ mach_device_t dev_number_lookup(ops, devnum) - dev_ops_t ops; + const dev_ops_t ops; int devnum; { queue_t q; @@ -121,7 +121,7 @@ dev_number_lookup(ops, devnum) */ mach_device_t device_lookup(name) - char * name; + char * name; { dev_ops_t dev_ops; int dev_minor; @@ -306,7 +306,7 @@ dev_port_lookup(port) */ ipc_port_t convert_device_to_port(device) - device_t device; + const device_t device; { if (device == DEVICE_NULL) return IP_NULL; diff --git a/device/dev_name.c b/device/dev_name.c index 930930b..49d96aa 100644 --- a/device/dev_name.c +++ b/device/dev_name.c @@ -65,9 +65,9 @@ nomap(void) */ boolean_t name_equal(src, len, target) - char *src; - int len; - char *target; + const char *src; + int len; + const char *target; { while (--len >= 0) if (*src++ != *target++) @@ -191,7 +191,7 @@ boolean_t dev_name_lookup(name, ops, unit) */ void dev_set_indirection(name, ops, unit) - char *name; + const char *name; dev_ops_t ops; int unit; { @@ -207,9 +207,9 @@ dev_set_indirection(name, ops, unit) } boolean_t dev_change_indirect(iname, dname, unit) - char *iname; - char *dname; - int unit; + const char *iname; + const char *dname; + int unit; { struct dev_ops *dp; struct dev_indirect *di; diff --git a/device/dev_pager.c b/device/dev_pager.c index 7c3e088..3fe47c7 100644 --- a/device/dev_pager.c +++ b/device/dev_pager.c @@ -180,8 +180,8 @@ void dev_pager_hash_init(void) } void dev_pager_hash_insert( - ipc_port_t name_port, - dev_pager_t rec) + const ipc_port_t name_port, + const dev_pager_t rec) { dev_pager_entry_t new_entry; @@ -195,7 +195,7 @@ void dev_pager_hash_insert( simple_unlock(&dev_pager_hash_lock); } -void dev_pager_hash_delete(ipc_port_t name_port) +void dev_pager_hash_delete(const ipc_port_t name_port) { queue_t bucket; dev_pager_entry_t entry; @@ -216,7 +216,7 @@ void dev_pager_hash_delete(ipc_port_t name_port) kmem_cache_free(&dev_pager_hash_cache, (vm_offset_t)entry); } -dev_pager_t dev_pager_hash_lookup(ipc_port_t name_port) +dev_pager_t dev_pager_hash_lookup(const ipc_port_t name_port) { queue_t bucket; dev_pager_entry_t entry; @@ -240,11 +240,11 @@ dev_pager_t dev_pager_hash_lookup(ipc_port_t name_port) } kern_return_t device_pager_setup( - mach_device_t device, - int prot, - vm_offset_t offset, - vm_size_t size, - mach_port_t *pager) + const mach_device_t device, + int prot, + vm_offset_t offset, + vm_size_t size, + mach_port_t *pager) { dev_pager_t d; @@ -318,11 +318,11 @@ void device_pager_release(memory_object_t object) boolean_t device_pager_debug = FALSE; kern_return_t device_pager_data_request( - ipc_port_t pager, - ipc_port_t pager_request, - vm_offset_t offset, - vm_size_t length, - vm_prot_t protection_required) + const ipc_port_t pager, + const ipc_port_t pager_request, + vm_offset_t offset, + vm_size_t length, + vm_prot_t protection_required) { dev_pager_t ds; @@ -457,8 +457,8 @@ boolean_t device_pager_data_request_done(io_req_t ior) } kern_return_t device_pager_data_write( - ipc_port_t pager, - ipc_port_t pager_request, + const ipc_port_t pager, + const ipc_port_t pager_request, vm_offset_t offset, pointer_t addr, vm_size_t data_count) @@ -523,19 +523,19 @@ boolean_t device_pager_data_write_done(ior) } kern_return_t device_pager_copy( - ipc_port_t pager, - ipc_port_t pager_request, + const ipc_port_t pager, + const ipc_port_t pager_request, vm_offset_t offset, vm_size_t length, - ipc_port_t new_pager) + const ipc_port_t new_pager) { panic("(device_pager)copy: called"); } kern_return_t device_pager_supply_completed( - ipc_port_t pager, - ipc_port_t pager_request, + const ipc_port_t pager, + const ipc_port_t pager_request, vm_offset_t offset, vm_size_t length, kern_return_t result, @@ -546,8 +546,8 @@ device_pager_supply_completed( kern_return_t device_pager_data_return( - ipc_port_t pager, - ipc_port_t pager_request, + const ipc_port_t pager, + const ipc_port_t pager_request, vm_offset_t offset, pointer_t addr, vm_size_t data_cnt, @@ -559,7 +559,7 @@ device_pager_data_return( kern_return_t device_pager_change_completed( - ipc_port_t pager, + const ipc_port_t pager, boolean_t may_cache, memory_object_copy_strategy_t copy_strategy) { @@ -584,10 +584,10 @@ vm_offset_t device_map_page( } kern_return_t device_pager_init_pager( - ipc_port_t pager, - ipc_port_t pager_request, - ipc_port_t pager_name, - vm_size_t pager_page_size) + const ipc_port_t pager, + const ipc_port_t pager_request, + const ipc_port_t pager_name, + vm_size_t pager_page_size) { dev_pager_t ds; @@ -635,9 +635,9 @@ kern_return_t device_pager_init_pager( } kern_return_t device_pager_terminate( - ipc_port_t pager, - ipc_port_t pager_request, - ipc_port_t pager_name) + const ipc_port_t pager, + const ipc_port_t pager_request, + const ipc_port_t pager_name) { dev_pager_t ds; @@ -677,8 +677,8 @@ kern_return_t device_pager_terminate( } kern_return_t device_pager_data_unlock( - ipc_port_t memory_object, - ipc_port_t memory_control_port, + const ipc_port_t memory_object, + const ipc_port_t memory_control_port, vm_offset_t offset, vm_size_t length, vm_prot_t desired_access) @@ -688,10 +688,10 @@ kern_return_t device_pager_data_unlock( } kern_return_t device_pager_lock_completed( - ipc_port_t memory_object, - ipc_port_t pager_request_port, - vm_offset_t offset, - vm_size_t length) + const ipc_port_t memory_object, + const ipc_port_t pager_request_port, + vm_offset_t offset, + vm_size_t length) { panic("(device_pager)lock_completed: called"); return (KERN_FAILURE); diff --git a/device/ds_routines.c b/device/ds_routines.c index a68dc7a..146b7eb 100644 --- a/device/ds_routines.c +++ b/device/ds_routines.c @@ -418,7 +418,7 @@ mach_convert_device_to_port (mach_device_t device) static io_return_t device_open(reply_port, reply_port_type, mode, name, device_p) - ipc_port_t reply_port; + const ipc_port_t reply_port; mach_msg_type_name_t reply_port_type; dev_mode_t mode; char * name; @@ -538,7 +538,7 @@ device_open(reply_port, reply_port_type, mode, name, device_p) boolean_t ds_open_done(ior) - io_req_t ior; + const io_req_t ior; { kern_return_t result; mach_device_t device; @@ -663,11 +663,11 @@ static io_return_t device_write(device, reply_port, reply_port_type, mode, recnum, data, data_count, bytes_written) mach_device_t device; - ipc_port_t reply_port; + const ipc_port_t reply_port; mach_msg_type_name_t reply_port_type; dev_mode_t mode; recnum_t recnum; - io_buf_ptr_t data; + const io_buf_ptr_t data; unsigned int data_count; int *bytes_written; /* out */ { @@ -754,7 +754,7 @@ static io_return_t device_write_inband(device, reply_port, reply_port_type, mode, recnum, data, data_count, bytes_written) mach_device_t device; - ipc_port_t reply_port; + const ipc_port_t reply_port; mach_msg_type_name_t reply_port_type; dev_mode_t mode; recnum_t recnum; @@ -1021,7 +1021,7 @@ device_write_dealloc(ior) */ boolean_t ds_write_done(ior) - io_req_t ior; + const io_req_t ior; { /* * device_write_dealloc discards the data that has been @@ -1069,7 +1069,7 @@ static io_return_t device_read(device, reply_port, reply_port_type, mode, recnum, bytes_wanted, data, data_count) mach_device_t device; - ipc_port_t reply_port; + const ipc_port_t reply_port; mach_msg_type_name_t reply_port_type; dev_mode_t mode; recnum_t recnum; @@ -1146,7 +1146,7 @@ static io_return_t device_read_inband(device, reply_port, reply_port_type, mode, recnum, bytes_wanted, data, data_count) mach_device_t device; - ipc_port_t reply_port; + const ipc_port_t reply_port; mach_msg_type_name_t reply_port_type; dev_mode_t mode; recnum_t recnum; @@ -1251,7 +1251,7 @@ kern_return_t device_read_alloc(ior, size) } boolean_t ds_read_done(ior) - io_req_t ior; + const io_req_t ior; { vm_offset_t start_data, end_data; vm_offset_t start_sent, end_sent; @@ -1384,7 +1384,7 @@ mach_device_get_status(device, flavor, status, status_count) static io_return_t device_set_filter(device, receive_port, priority, filter, filter_count) mach_device_t device; - ipc_port_t receive_port; + const ipc_port_t receive_port; int priority; filter_t filter[]; /* pointer to IN array */ unsigned int filter_count; @@ -1433,7 +1433,7 @@ device_map(device, protection, offset, size, pager, unmap) */ static void ds_no_senders(notification) - mach_no_senders_notification_t *notification; + const mach_no_senders_notification_t *notification; { printf("ds_no_senders called! device_port=0x%lx count=%d\n", notification->not_header.msgh_remote_port, @@ -1617,7 +1617,7 @@ mach_device_trap_init(void) * Could call a device-specific routine. */ io_req_t -ds_trap_req_alloc(mach_device_t device, vm_size_t data_size) +ds_trap_req_alloc(const mach_device_t device, vm_size_t data_size) { return (io_req_t) kmem_cache_alloc(&io_trap_cache); } @@ -1626,7 +1626,7 @@ ds_trap_req_alloc(mach_device_t device, vm_size_t data_size) * Called by iodone to release ior. */ boolean_t -ds_trap_write_done(io_req_t ior) +ds_trap_write_done(const io_req_t ior) { mach_device_t dev; diff --git a/device/ds_routines.h b/device/ds_routines.h index 497b6ac..a68c6c6 100644 --- a/device/ds_routines.h +++ b/device/ds_routines.h @@ -58,11 +58,11 @@ boolean_t ds_write_done(io_req_t); void iowait (io_req_t ior); kern_return_t device_pager_setup( - mach_device_t device, - int prot, - vm_offset_t offset, - vm_size_t size, - mach_port_t *pager); + const mach_device_t device, + int prot, + vm_offset_t offset, + vm_size_t size, + mach_port_t *pager); extern void mach_device_init(void); extern void dev_lookup_init(void); diff --git a/device/if_ether.h b/device/if_ether.h index e368fbf..91d4d9a 100644 --- a/device/if_ether.h +++ b/device/if_ether.h @@ -46,7 +46,7 @@ struct ether_header { }; #ifdef KERNEL -extern char * ether_sprintf(u_char *); +extern char * ether_sprintf(const u_char *); #endif /* KERNEL */ #endif /*_DEVICE_IF_ETHER_H_*/ diff --git a/device/kmsg.c b/device/kmsg.c index 7034bfc..40956dd 100644 --- a/device/kmsg.c +++ b/device/kmsg.c @@ -61,7 +61,7 @@ kmsginit (void) /* Kernel Message Open Handler */ io_return_t -kmsgopen (dev_t dev, int flag, io_req_t ior) +kmsgopen (dev_t dev, int flag, const io_req_t ior) { simple_lock (&kmsg_lock); if (kmsg_in_use) diff --git a/device/net_io.c b/device/net_io.c index 4c03f8c..bce27b3 100644 --- a/device/net_io.c +++ b/device/net_io.c @@ -196,7 +196,7 @@ net_kmsg_get(void) } void -net_kmsg_put(ipc_kmsg_t kmsg) +net_kmsg_put(const ipc_kmsg_t kmsg) { spl_t s; @@ -373,7 +373,7 @@ decl_simple_lock_data(,net_hash_header_lock) */ boolean_t ethernet_priority(kmsg) - ipc_kmsg_t kmsg; + const ipc_kmsg_t kmsg; { unsigned char *addr = (unsigned char *) net_kmsg(kmsg)->header; @@ -694,7 +694,7 @@ int net_filter_queue_reorder = 0; /* non-zero to enable reordering */ */ void net_filter(kmsg, send_list) - ipc_kmsg_t kmsg; + const ipc_kmsg_t kmsg; ipc_kmsg_queue_t send_list; { struct ifnet *ifp; @@ -876,9 +876,9 @@ net_filter(kmsg, send_list) boolean_t net_do_filter(infp, data, data_count, header) net_rcv_port_t infp; - char * data; + const char * data; unsigned int data_count; - char * header; + const char * header; { int stack[NET_FILTER_STACK_DEPTH+1]; int *sp; @@ -1986,7 +1986,7 @@ bpf_eq (f1, f2, bytes) unsigned int bpf_hash (n, keys) int n; - unsigned int *keys; + const unsigned int *keys; { unsigned int hval = 0; @@ -2001,7 +2001,7 @@ int bpf_match (hash, n_keys, keys, hash_headpp, entpp) net_hash_header_t hash; int n_keys; - unsigned int *keys; + const unsigned int *keys; net_hash_entry_t **hash_headpp, *entpp; { net_hash_entry_t head, entp; diff --git a/device/net_io.h b/device/net_io.h index 0cdd712..0ffdc92 100644 --- a/device/net_io.h +++ b/device/net_io.h @@ -100,14 +100,14 @@ extern unsigned short int ntohs(unsigned short int); extern unsigned int htonl(unsigned int); extern unsigned short int htons(unsigned short int); -unsigned int bpf_hash(int n, unsigned int *keys); +unsigned int bpf_hash(int n, const unsigned int *keys); extern boolean_t net_do_filter( net_rcv_port_t infp, - char * data, + const char * data, unsigned int data_count, - char * header); /* CSPF */ + const char * header); /* CSPF */ extern int bpf_do_filter( @@ -145,7 +145,7 @@ int net_add_q_info(ipc_port_t rcv_port); int bpf_match ( net_hash_header_t hash, int n_keys, - unsigned int *keys, + const unsigned int *keys, net_hash_entry_t **hash_headpp, net_hash_entry_t *entpp); diff --git a/device/subrs.c b/device/subrs.c index 0a7d690..7e6e30d 100644 --- a/device/subrs.c +++ b/device/subrs.c @@ -41,8 +41,8 @@ * Print out disk name and block number for hard disk errors. */ void harderr(ior, cp) - io_req_t ior; - char * cp; + const io_req_t ior; + const char * cp; { printf("%s%d%c: hard error sn%d ", cp, @@ -56,7 +56,7 @@ void harderr(ior, cp) */ char * ether_sprintf(ap) - u_char *ap; + const u_char *ap; { int i; static char etherbuf[18]; |