aboutsummaryrefslogtreecommitdiff
path: root/device
diff options
context:
space:
mode:
authorFlavio Cruz <flaviocruz@gmail.com>2022-12-25 20:41:46 -0500
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2022-12-27 00:00:50 +0100
commit84e0fb3f287864eca3a9322ef364b913f6a260bd (patch)
tree123333bce32a7d57c5112aa0d4c07b12821b6305 /device
parent63eefc08b5e762937118254ad0b82583cc38a2d2 (diff)
downloadgnumach-84e0fb3f287864eca3a9322ef364b913f6a260bd.tar.gz
gnumach-84e0fb3f287864eca3a9322ef364b913f6a260bd.tar.bz2
gnumach-84e0fb3f287864eca3a9322ef364b913f6a260bd.zip
Fix some warnings with -Wmissing-prototypes.
Marked some functions as static (private) as needed and added missing includes. This also revealed some dead code which was removed. Note that -Wmissing-prototypes is not enabled here since there is a bunch more warnings. Message-Id: <Y6j72lWRL9rsYy4j@mars>
Diffstat (limited to 'device')
-rw-r--r--device/blkio.c2
-rw-r--r--device/blkio.h2
-rw-r--r--device/chario.c11
-rw-r--r--device/cirbuf.c25
-rw-r--r--device/dev_lookup.c6
-rw-r--r--device/dev_name.c23
-rw-r--r--device/dev_pager.c20
-rw-r--r--device/device_init.c1
-rw-r--r--device/ds_routines.c4
-rw-r--r--device/net_io.c12
-rw-r--r--device/subrs.c1
11 files changed, 32 insertions, 75 deletions
diff --git a/device/blkio.c b/device/blkio.c
index 62fc6295..0dfa33c4 100644
--- a/device/blkio.c
+++ b/device/blkio.c
@@ -31,6 +31,8 @@
*/
#include <mach/kern_return.h>
+#include <device/blkio.h>
+#include <device/buf.h>
#include <device/param.h>
#include <device/device_types.h>
#include <device/io_req.h>
diff --git a/device/blkio.h b/device/blkio.h
index aaff9f8a..b188f388 100644
--- a/device/blkio.h
+++ b/device/blkio.h
@@ -19,6 +19,8 @@
#ifndef _DEVICE_BLKIO_H_
#define _DEVICE_BLKIO_H_
+#include <sys/types.h>
+
extern vm_offset_t block_io_mmap(dev_t dev, vm_offset_t off, int prot);
#endif /* _DEVICE_BLKIO_H_ */
diff --git a/device/chario.c b/device/chario.c
index 0e9dd70b..64640981 100644
--- a/device/chario.c
+++ b/device/chario.c
@@ -230,7 +230,7 @@ boolean_t char_open_done(
return TRUE;
}
-boolean_t tty_close_open_reply(
+static boolean_t tty_close_open_reply(
io_req_t ior)
{
ior->io_error = D_DEVICE_DOWN;
@@ -366,7 +366,7 @@ boolean_t char_write_done(
return TRUE;
}
-boolean_t tty_close_write_reply(
+static boolean_t tty_close_write_reply(
io_req_t ior)
{
ior->io_residual = ior->io_count;
@@ -473,7 +473,7 @@ boolean_t char_read_done(
return TRUE;
}
-boolean_t tty_close_read_reply(
+static boolean_t tty_close_read_reply(
io_req_t ior)
{
ior->io_residual = ior->io_count;
@@ -524,7 +524,7 @@ void ttyclose(
/*
* Port-death routine to clean up reply messages.
*/
-boolean_t
+static boolean_t
tty_queue_clean(
queue_t q,
const ipc_port_t port,
@@ -882,8 +882,7 @@ void tty_output(
/*
* Send any buffered recvd chars up to user
*/
-void ttypush(
- void * _tp)
+static void ttypush(void * _tp)
{
struct tty *tp = _tp;
spl_t s = spltty();
diff --git a/device/cirbuf.c b/device/cirbuf.c
index a3c9407a..ed09f3d1 100644
--- a/device/cirbuf.c
+++ b/device/cirbuf.c
@@ -203,31 +203,6 @@ b_to_q( char *cp,
}
/*
- * Return number of contiguous characters up to a character
- * that matches the mask.
- */
-int
-ndqb( struct cirbuf *cb,
- int mask)
-{
- char *cp, *lim;
-
- if (cb->c_cl < cb->c_cf)
- lim = cb->c_end;
- else
- lim = cb->c_cl;
- if (mask == 0)
- return (lim - cb->c_cf);
- cp = cb->c_cf;
- while (cp < lim) {
- if (*cp & mask)
- break;
- cp++;
- }
- return (cp - cb->c_cf);
-}
-
-/*
* Flush characters from circular buffer.
*/
void
diff --git a/device/dev_lookup.c b/device/dev_lookup.c
index e9d38925..febaebdd 100644
--- a/device/dev_lookup.c
+++ b/device/dev_lookup.c
@@ -69,7 +69,7 @@ struct kmem_cache dev_hdr_cache;
* Enter device in the number lookup table.
* The number table lock must be held.
*/
-void
+static void
dev_number_enter(const mach_device_t device)
{
queue_t q;
@@ -82,7 +82,7 @@ dev_number_enter(const mach_device_t device)
* Remove device from the device-number lookup table.
* The device-number table lock must be held.
*/
-void
+static void
dev_number_remove(const mach_device_t device)
{
queue_t q;
@@ -95,7 +95,7 @@ dev_number_remove(const mach_device_t device)
* Lookup a device by device operations and minor number.
* The number table lock must be held.
*/
-mach_device_t
+static mach_device_t
dev_number_lookup(const dev_ops_t ops, int devnum)
{
queue_t q;
diff --git a/device/dev_name.c b/device/dev_name.c
index 13ff6dc9..66e6eafe 100644
--- a/device/dev_name.c
+++ b/device/dev_name.c
@@ -241,26 +241,3 @@ dev_set_indirection(const char *name, dev_ops_t ops, int unit)
}
}
}
-
-boolean_t dev_change_indirect(const char *iname, const char *dname, int unit)
-{
- struct dev_ops *dp;
- struct dev_indirect *di;
- boolean_t found = FALSE;
-
- dev_search(dp) {
- if (!strcmp(dp->d_name, dname)) {
- found = TRUE;
- break;
- }
- }
- if (!found) return FALSE;
- dev_indirect_search(di) {
- if (!strcmp(di->d_name, iname)) {
- di->d_ops = dp;
- di->d_unit = unit;
- return TRUE;
- }
- }
- return FALSE;
-}
diff --git a/device/dev_pager.c b/device/dev_pager.c
index 6729d507..3a37a14d 100644
--- a/device/dev_pager.c
+++ b/device/dev_pager.c
@@ -128,14 +128,14 @@ typedef struct dev_pager *dev_pager_t;
struct kmem_cache dev_pager_cache;
-void dev_pager_reference(dev_pager_t ds)
+static void dev_pager_reference(dev_pager_t ds)
{
simple_lock(&ds->lock);
ds->ref_count++;
simple_unlock(&ds->lock);
}
-void dev_pager_deallocate(dev_pager_t ds)
+static void dev_pager_deallocate(dev_pager_t ds)
{
simple_lock(&ds->lock);
if (--ds->ref_count > 0) {
@@ -189,7 +189,7 @@ decl_simple_lock_data(,
#define dev_hash(name_port) \
(((vm_offset_t)(name_port) & 0xffffff) % DEV_HASH_COUNT)
-void dev_pager_hash_init(void)
+static void dev_pager_hash_init(void)
{
int i;
vm_size_t size;
@@ -202,7 +202,7 @@ void dev_pager_hash_init(void)
simple_lock_init(&dev_pager_hash_lock);
}
-void dev_pager_hash_insert(
+static void dev_pager_hash_insert(
const ipc_port_t name_port,
const dev_pager_t rec)
{
@@ -218,7 +218,7 @@ void dev_pager_hash_insert(
simple_unlock(&dev_pager_hash_lock);
}
-void dev_pager_hash_delete(const ipc_port_t name_port)
+static void dev_pager_hash_delete(const ipc_port_t name_port)
{
queue_t bucket;
dev_pager_entry_t entry;
@@ -239,7 +239,7 @@ void dev_pager_hash_delete(const ipc_port_t name_port)
kmem_cache_free(&dev_pager_hash_cache, (vm_offset_t)entry);
}
-dev_pager_t dev_pager_hash_lookup(const ipc_port_t name_port)
+static dev_pager_t dev_pager_hash_lookup(const ipc_port_t name_port)
{
queue_t bucket;
dev_pager_entry_t entry;
@@ -262,7 +262,7 @@ dev_pager_t dev_pager_hash_lookup(const ipc_port_t name_port)
return (DEV_PAGER_NULL);
}
-void dev_device_hash_init(void)
+static void dev_device_hash_init(void)
{
int i;
vm_size_t size;
@@ -276,7 +276,7 @@ void dev_device_hash_init(void)
simple_lock_init(&dev_device_hash_lock);
}
-void dev_device_hash_insert(
+static void dev_device_hash_insert(
const mach_device_t device,
const vm_offset_t offset,
const dev_pager_t rec)
@@ -294,7 +294,7 @@ void dev_device_hash_insert(
simple_unlock(&dev_device_hash_lock);
}
-void dev_device_hash_delete(
+static void dev_device_hash_delete(
const mach_device_t device,
const vm_offset_t offset)
{
@@ -317,7 +317,7 @@ void dev_device_hash_delete(
kmem_cache_free(&dev_device_hash_cache, (vm_offset_t)entry);
}
-dev_pager_t dev_device_hash_lookup(
+static dev_pager_t dev_device_hash_lookup(
const mach_device_t device,
const vm_offset_t offset)
{
diff --git a/device/device_init.c b/device/device_init.c
index 794186ee..287d0a20 100644
--- a/device/device_init.c
+++ b/device/device_init.c
@@ -38,6 +38,7 @@
#include <device/device_types.h>
#include <device/device_port.h>
#include <device/tty.h>
+#include <device/device_init.h>
#include <device/ds_routines.h>
#include <device/net_io.h>
#include <device/chario.h>
diff --git a/device/ds_routines.c b/device/ds_routines.c
index ba233a91..11589d63 100644
--- a/device/ds_routines.c
+++ b/device/ds_routines.c
@@ -1680,7 +1680,7 @@ mach_device_trap_init(void)
* Could have lists of different size caches.
* Could call a device-specific routine.
*/
-io_req_t
+static io_req_t
ds_trap_req_alloc(const mach_device_t device, vm_size_t data_size)
{
return (io_req_t) kmem_cache_alloc(&io_trap_cache);
@@ -1689,7 +1689,7 @@ ds_trap_req_alloc(const mach_device_t device, vm_size_t data_size)
/*
* Called by iodone to release ior.
*/
-boolean_t
+static boolean_t
ds_trap_write_done(const io_req_t ior)
{
mach_device_t dev;
diff --git a/device/net_io.c b/device/net_io.c
index 338b433c..4392f711 100644
--- a/device/net_io.c
+++ b/device/net_io.c
@@ -235,7 +235,7 @@ net_kmsg_collect(void)
(void) splx(s);
}
-void
+static void
net_kmsg_more(void)
{
ipc_kmsg_t kmsg;
@@ -412,7 +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(boolean_t nonblocking)
+static boolean_t net_deliver(boolean_t nonblocking)
{
ipc_kmsg_t kmsg;
boolean_t high_priority;
@@ -549,7 +549,7 @@ void net_ast(void)
(void) splx(s);
}
-void __attribute__ ((noreturn)) net_thread_continue(void)
+static void __attribute__ ((noreturn)) net_thread_continue(void)
{
for (;;) {
spl_t s;
@@ -602,7 +602,7 @@ void net_thread(void)
/*NOTREACHED*/
}
-void
+static void
reorder_queue(
queue_t first,
queue_t last)
@@ -1010,7 +1010,7 @@ net_do_filter(infp, data, data_count, header)
/*
* Check filter for invalid operations or stack over/under-flow.
*/
-boolean_t
+static boolean_t
parse_net_filter(
filter_t *filter,
unsigned int count)
@@ -2100,7 +2100,7 @@ net_add_q_info(ipc_port_t rcv_port)
return (int)qlimit;
}
-void
+static void
net_del_q_info(int qlimit)
{
simple_lock(&net_kmsg_total_lock);
diff --git a/device/subrs.c b/device/subrs.c
index 7a56f4b7..2cf7e6f4 100644
--- a/device/subrs.c
+++ b/device/subrs.c
@@ -34,6 +34,7 @@
#include <device/buf.h>
#include <device/if_hdr.h>
#include <device/if_ether.h>
+#include <device/subrs.h>