summaryrefslogtreecommitdiff
path: root/vm
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 /vm
parent63eefc08b5e762937118254ad0b82583cc38a2d2 (diff)
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 'vm')
-rw-r--r--vm/vm_debug.c2
-rw-r--r--vm/vm_fault.c4
-rw-r--r--vm/vm_init.c1
-rw-r--r--vm/vm_map.c92
-rw-r--r--vm/vm_object.c6
-rw-r--r--vm/vm_pageout.c2
-rw-r--r--vm/vm_resident.c1
7 files changed, 16 insertions, 92 deletions
diff --git a/vm/vm_debug.c b/vm/vm_debug.c
index 3339d0c8..c76e63b7 100644
--- a/vm/vm_debug.c
+++ b/vm/vm_debug.c
@@ -65,7 +65,7 @@
* or IP_NULL if the object or its name port is null.
*/
-ipc_port_t
+static ipc_port_t
vm_object_real_name(vm_object_t object)
{
ipc_port_t port = IP_NULL;
diff --git a/vm/vm_fault.c b/vm/vm_fault.c
index 44801911..c6e28004 100644
--- a/vm/vm_fault.c
+++ b/vm/vm_fault.c
@@ -1129,7 +1129,7 @@ vm_fault_return_t vm_fault_page(
* and deallocated when leaving vm_fault.
*/
-void
+static void
vm_fault_continue(void)
{
vm_fault_state_t *state =
@@ -1767,7 +1767,7 @@ kern_return_t vm_fault_wire_fast(
* Release a page used by vm_fault_copy.
*/
-void vm_fault_copy_cleanup(
+static void vm_fault_copy_cleanup(
vm_page_t page,
vm_page_t top_page)
{
diff --git a/vm/vm_init.c b/vm/vm_init.c
index 23d5d46e..593af11b 100644
--- a/vm/vm_init.c
+++ b/vm/vm_init.c
@@ -38,6 +38,7 @@
#include <kern/slab.h>
#include <kern/kalloc.h>
#include <vm/vm_fault.h>
+#include <vm/vm_init.h>
#include <vm/vm_object.h>
#include <vm/vm_map.h>
#include <vm/vm_page.h>
diff --git a/vm/vm_map.c b/vm/vm_map.c
index 963aa507..b142ab9d 100644
--- a/vm/vm_map.c
+++ b/vm/vm_map.c
@@ -280,7 +280,8 @@ void vm_map_unlock(struct vm_map *map)
#define vm_map_copy_entry_create(copy) \
_vm_map_entry_create(&(copy)->cpy_hdr)
-vm_map_entry_t _vm_map_entry_create(const struct vm_map_header *map_header)
+static vm_map_entry_t
+_vm_map_entry_create(const struct vm_map_header *map_header)
{
vm_map_entry_t entry;
@@ -302,7 +303,8 @@ vm_map_entry_t _vm_map_entry_create(const struct vm_map_header *map_header)
#define vm_map_copy_entry_dispose(map, entry) \
_vm_map_entry_dispose(&(copy)->cpy_hdr, (entry))
-void _vm_map_entry_dispose(const struct vm_map_header *map_header,
+static void
+_vm_map_entry_dispose(const struct vm_map_header *map_header,
vm_map_entry_t entry)
{
(void)map_header;
@@ -633,27 +635,6 @@ boolean_t vm_map_lookup_entry(
}
/*
- * Routine: invalid_user_access
- *
- * Verifies whether user access is valid.
- */
-
-boolean_t
-invalid_user_access(
- vm_map_t map,
- vm_offset_t start,
- vm_offset_t end,
- vm_prot_t prot)
-{
- vm_map_entry_t entry;
-
- return (map == VM_MAP_NULL || map == kernel_map ||
- !vm_map_lookup_entry(map, start, &entry) ||
- entry->vme_end < end ||
- (prot & ~(entry->protection)));
-}
-
-/*
* Find a range of available space from the specified map.
*
* If successful, this function returns the map entry immediately preceding
@@ -913,7 +894,7 @@ boolean_t vm_map_pmap_enter_enable = FALSE;
* In/out conditions:
* The source map should not be locked on entry.
*/
-void
+static void
vm_map_pmap_enter(
vm_map_t map,
vm_offset_t addr,
@@ -2047,7 +2028,7 @@ kern_return_t vm_map_remove(
* Steal all the pages from a vm_map_copy page_list by copying ones
* that have not already been stolen.
*/
-void
+static void
vm_map_copy_steal_pages(vm_map_copy_t copy)
{
vm_page_t m, new_m;
@@ -3673,7 +3654,7 @@ kern_return_t vm_map_copyin_object(
* the scheduler.
*/
-kern_return_t vm_map_copyin_page_list_cont(
+static kern_return_t vm_map_copyin_page_list_cont(
vm_map_copyin_args_t cont_args,
vm_map_copy_t *copy_result) /* OUT */
{
@@ -4875,65 +4856,6 @@ vm_region_create_proxy (task_t task, vm_address_t address,
}
/*
- * Routine: vm_map_simplify
- *
- * Description:
- * Attempt to simplify the map representation in
- * the vicinity of the given starting address.
- * Note:
- * This routine is intended primarily to keep the
- * kernel maps more compact -- they generally don't
- * benefit from the "expand a map entry" technology
- * at allocation time because the adjacent entry
- * is often wired down.
- */
-void vm_map_simplify(
- vm_map_t map,
- vm_offset_t start)
-{
- vm_map_entry_t this_entry;
- vm_map_entry_t prev_entry;
-
- vm_map_lock(map);
- if (
- (vm_map_lookup_entry(map, start, &this_entry)) &&
- ((prev_entry = this_entry->vme_prev) != vm_map_to_entry(map)) &&
-
- (prev_entry->vme_end == start) &&
-
- (prev_entry->is_shared == FALSE) &&
- (prev_entry->is_sub_map == FALSE) &&
-
- (this_entry->is_shared == FALSE) &&
- (this_entry->is_sub_map == FALSE) &&
-
- (prev_entry->inheritance == this_entry->inheritance) &&
- (prev_entry->protection == this_entry->protection) &&
- (prev_entry->max_protection == this_entry->max_protection) &&
- (prev_entry->wired_count == this_entry->wired_count) &&
-
- (prev_entry->needs_copy == this_entry->needs_copy) &&
-
- (prev_entry->object.vm_object == this_entry->object.vm_object) &&
- ((prev_entry->offset + (prev_entry->vme_end - prev_entry->vme_start))
- == this_entry->offset) &&
- (prev_entry->projected_on == 0) &&
- (this_entry->projected_on == 0)
- ) {
- if (map->first_free == this_entry)
- map->first_free = prev_entry;
-
- SAVE_HINT(map, prev_entry);
- prev_entry->vme_end = this_entry->vme_end;
- vm_map_entry_unlink(map, this_entry);
- vm_object_deallocate(this_entry->object.vm_object);
- vm_map_entry_dispose(map, this_entry);
- }
- vm_map_unlock(map);
-}
-
-
-/*
* Routine: vm_map_machine_attribute
* Purpose:
* Provide machine-specific attributes to mappings,
diff --git a/vm/vm_object.c b/vm/vm_object.c
index 0dc3d540..141bd094 100644
--- a/vm/vm_object.c
+++ b/vm/vm_object.c
@@ -226,7 +226,7 @@ static void _vm_object_setup(
object->size = size;
}
-vm_object_t _vm_object_allocate(
+static vm_object_t _vm_object_allocate(
vm_size_t size)
{
vm_object_t object;
@@ -725,7 +725,7 @@ void memory_object_release(
* In/out conditions:
* The object is locked on entry and exit.
*/
-void vm_object_abort_activity(
+static void vm_object_abort_activity(
vm_object_t object)
{
vm_page_t p;
@@ -1288,7 +1288,7 @@ boolean_t vm_object_copy_temporary(
* If the return value indicates an error, this parameter
* is not valid.
*/
-kern_return_t vm_object_copy_call(
+static kern_return_t vm_object_copy_call(
vm_object_t src_object,
vm_offset_t src_offset,
vm_size_t size,
diff --git a/vm/vm_pageout.c b/vm/vm_pageout.c
index 575a9f5d..e2f4cf2b 100644
--- a/vm/vm_pageout.c
+++ b/vm/vm_pageout.c
@@ -412,7 +412,7 @@ vm_pageout_page(
* It returns with vm_page_queue_free_lock held.
*/
-boolean_t vm_pageout_scan(boolean_t *should_wait)
+static boolean_t vm_pageout_scan(boolean_t *should_wait)
{
boolean_t done;
diff --git a/vm/vm_resident.c b/vm/vm_resident.c
index 4af103d4..13709a90 100644
--- a/vm/vm_resident.c
+++ b/vm/vm_resident.c
@@ -52,6 +52,7 @@
#include <vm/vm_page.h>
#include <vm/vm_pageout.h>
#include <vm/vm_kern.h>
+#include <vm/vm_resident.h>
#if MACH_VM_DEBUG
#include <mach/kern_return.h>