From e6dc7903e4277bf6e22527ed611df619c7e645f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Thu, 27 Sep 2007 12:21:33 +0000 Subject: [PATCH] * vm.h no longer includes vm_types.h - only those that actually need access to the private VM types are including vm_types.h now. * Removed vm_page, vm_area, vm_cache, and vm_address_space typedefs; it's cleaner this way, and the actual types are only used in C++ files now, anyway. * And that caused changes in many files... * Made commpage.h self-containing. * Minor cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22329 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/private/kernel/arch/vm.h | 19 +++++--- headers/private/kernel/arch/x86/commpage.h | 10 ++-- headers/private/kernel/util/syscall_args.h | 4 +- headers/private/kernel/vm.h | 36 ++++++++------ headers/private/kernel/vm_address_space.h | 19 ++++---- headers/private/kernel/vm_cache.h | 34 ++++++++------ headers/private/kernel/vm_page.h | 21 +++++---- headers/private/kernel/vm_priv.h | 5 +- headers/private/kernel/vm_types.h | 52 +++++++++------------ src/system/kernel/arch/x86/arch_cpu.c | 16 +++---- src/system/kernel/arch/x86/arch_debug.cpp | 8 ++-- src/system/kernel/arch/x86/arch_thread.c | 8 ++-- src/system/kernel/arch/x86/commpage.c | 29 ++++++++---- src/system/kernel/cache/block_allocator.cpp | 1 + src/system/kernel/cache/vnode_store.h | 2 +- src/system/kernel/debug/debug.c | 1 + src/system/kernel/debug/gdb.c | 11 +++-- src/system/kernel/elf.cpp | 33 +++++++------ src/system/kernel/slab/Slab.cpp | 10 ++-- src/system/kernel/system_info.c | 10 ++-- src/system/kernel/thread.cpp | 2 + src/system/kernel/util/cbuf.c | 10 ++-- src/system/kernel/vm/vm.cpp | 1 + src/system/kernel/vm/vm_cache.cpp | 6 +-- src/system/kernel/vm/vm_store_device.c | 9 ++-- src/system/kernel/vm/vm_store_device.h | 4 +- src/system/kernel/vm/vm_store_null.c | 20 ++++---- src/system/kernel/vm/vm_store_null.h | 4 +- 28 files changed, 216 insertions(+), 169 deletions(-) diff --git a/headers/private/kernel/arch/vm.h b/headers/private/kernel/arch/vm.h index b01c3bbbe7..d40cc9bbce 100644 --- a/headers/private/kernel/arch/vm.h +++ b/headers/private/kernel/arch/vm.h @@ -1,5 +1,5 @@ /* - * Copyright 2002-2005, Axel Dörfler, axeld@pinc-software.de. + * Copyright 2002-2007, Axel Dörfler, axeld@pinc-software.de. * Distributed under the terms of the MIT License. * * Copyright 2001-2002, Travis Geiselbrecht. All rights reserved. @@ -9,9 +9,15 @@ #define KERNEL_ARCH_VM_H -#include #include +#include + + +struct kernel_args; +struct vm_area; +struct vm_address_space; + #ifdef __cplusplus extern "C" { @@ -20,12 +26,13 @@ extern "C" { status_t arch_vm_init(struct kernel_args *args); status_t arch_vm_init_post_area(struct kernel_args *args); status_t arch_vm_init_end(struct kernel_args *args); -status_t arch_vm_init_post_modules(kernel_args *args); -void arch_vm_aspace_swap(vm_address_space *aspace); +status_t arch_vm_init_post_modules(struct kernel_args *args); +void arch_vm_aspace_swap(struct vm_address_space *aspace); bool arch_vm_supports_protection(uint32 protection); -status_t arch_vm_set_memory_type(vm_area *area, addr_t physicalBase, uint32 type); -void arch_vm_unset_memory_type(vm_area *area); +status_t arch_vm_set_memory_type(struct vm_area *area, addr_t physicalBase, + uint32 type); +void arch_vm_unset_memory_type(struct vm_area *area); #ifdef __cplusplus } diff --git a/headers/private/kernel/arch/x86/commpage.h b/headers/private/kernel/arch/x86/commpage.h index 2c6e10c591..16c9549e62 100644 --- a/headers/private/kernel/arch/x86/commpage.h +++ b/headers/private/kernel/arch/x86/commpage.h @@ -5,7 +5,12 @@ #ifndef _KERNEL_ARCH_x86_COMMPAGE_H #define _KERNEL_ARCH_x86_COMMPAGE_H -/* some systemwide commpage constants, used in the kernel and libroot */ +/*! Some systemwide commpage constants, used in the kernel and libroot */ + +#ifndef _ASSEMBLER +# include +#endif + /* be careful what you put here, this file is included from assembly */ #define COMMPAGE_ENTRY_MAGIC 0 @@ -23,5 +28,4 @@ status_t commpage_init(void); #endif -#endif - +#endif /* _KERNEL_ARCH_x86_COMMPAGE_H */ diff --git a/headers/private/kernel/util/syscall_args.h b/headers/private/kernel/util/syscall_args.h index c26177ed6c..bf9d82e83e 100644 --- a/headers/private/kernel/util/syscall_args.h +++ b/headers/private/kernel/util/syscall_args.h @@ -3,8 +3,8 @@ #ifndef _SYSCALL_ARGS_H #define _SYSCALL_ARGS_H -#include -#include +#include +//#include // Hack to be able to use the IS_USER_ADDRESS macro when compiling for R5. #ifdef R5_MEMORY_LAYOUT diff --git a/headers/private/kernel/vm.h b/headers/private/kernel/vm.h index 77d861f443..6135b09805 100644 --- a/headers/private/kernel/vm.h +++ b/headers/private/kernel/vm.h @@ -9,12 +9,17 @@ #define _KERNEL_VM_H -#include #include -#include + +#include + struct kernel_args; struct team; +struct vm_page; +struct vm_cache; +struct vm_area; +struct vm_address_space; struct vnode; @@ -23,13 +28,13 @@ extern "C" { #endif // startup only -status_t vm_init(kernel_args *args); +status_t vm_init(struct kernel_args *args); status_t vm_init_post_sem(struct kernel_args *args); status_t vm_init_post_thread(struct kernel_args *args); status_t vm_init_post_modules(struct kernel_args *args); -void vm_free_kernel_args(kernel_args *args); +void vm_free_kernel_args(struct kernel_args *args); void vm_free_unused_boot_loader_range(addr_t start, addr_t end); -addr_t vm_allocate_early(kernel_args *args, size_t virtualSize, +addr_t vm_allocate_early(struct kernel_args *args, size_t virtualSize, size_t physicalSize, uint32 attributes); @@ -56,8 +61,8 @@ area_id vm_map_physical_memory(team_id team, const char *name, void **address, area_id vm_map_file(team_id aid, const char *name, void **address, uint32 addressSpec, addr_t size, uint32 protection, uint32 mapping, const char *path, off_t offset); -vm_cache *vm_area_get_locked_cache(vm_area *area); -void vm_area_put_locked_cache(vm_cache *cache); +struct vm_cache *vm_area_get_locked_cache(struct vm_area *area); +void vm_area_put_locked_cache(struct vm_cache *cache); area_id vm_create_null_area(team_id team, const char *name, void **address, uint32 addressSpec, addr_t size); area_id vm_copy_area(team_id team, const char *name, void **_address, @@ -65,16 +70,17 @@ area_id vm_copy_area(team_id team, const char *name, void **_address, area_id vm_clone_area(team_id team, const char *name, void **address, uint32 addressSpec, uint32 protection, uint32 mapping, area_id sourceArea); -status_t vm_delete_area(team_id aid, area_id id); -status_t vm_create_vnode_cache(struct vnode *vnode, vm_cache **_cache); -vm_area *vm_area_lookup(vm_address_space *addressSpace, addr_t address); +status_t vm_delete_area(team_id teamID, area_id areaID); +status_t vm_create_vnode_cache(struct vnode *vnode, struct vm_cache **_cache); +struct vm_area *vm_area_lookup(struct vm_address_space *addressSpace, + addr_t address); status_t vm_set_area_memory_type(area_id id, addr_t physicalBase, uint32 type); status_t vm_get_page_mapping(team_id team, addr_t vaddr, addr_t *paddr); -int32 vm_test_map_activation(vm_page *page, bool *_modified); -void vm_clear_map_activation(vm_page *page); -void vm_remove_all_page_mappings(vm_page *page); -status_t vm_unmap_pages(vm_area *area, addr_t base, size_t length); -status_t vm_map_page(vm_area *area, vm_page *page, addr_t address, +int32 vm_test_map_activation(struct vm_page *page, bool *_modified); +void vm_clear_map_activation(struct vm_page *page); +void vm_remove_all_page_mappings(struct vm_page *page); +status_t vm_unmap_pages(struct vm_area *area, addr_t base, size_t length); +status_t vm_map_page(struct vm_area *area, struct vm_page *page, addr_t address, uint32 protection); status_t vm_get_physical_page(addr_t paddr, addr_t *vaddr, uint32 flags); status_t vm_put_physical_page(addr_t vaddr); diff --git a/headers/private/kernel/vm_address_space.h b/headers/private/kernel/vm_address_space.h index cea24167d8..5b3c6456bd 100644 --- a/headers/private/kernel/vm_address_space.h +++ b/headers/private/kernel/vm_address_space.h @@ -9,10 +9,11 @@ #define _KERNEL_VM_ADDRESS_SPACE_H -#include -#include +#include + struct kernel_args; +struct vm_address_space; #ifdef __cplusplus @@ -22,17 +23,17 @@ extern "C" { status_t vm_address_space_init(void); status_t vm_address_space_init_post_sem(void); -void vm_delete_address_space(vm_address_space *aspace); +void vm_delete_address_space(struct vm_address_space *aspace); status_t vm_create_address_space(team_id id, addr_t base, addr_t size, - bool kernel, vm_address_space **_aspace); + bool kernel, struct vm_address_space **_aspace); status_t vm_delete_areas(struct vm_address_space *aspace); -vm_address_space *vm_get_kernel_address_space(void); -vm_address_space *vm_kernel_address_space(void); +struct vm_address_space *vm_get_kernel_address_space(void); +struct vm_address_space *vm_kernel_address_space(void); team_id vm_kernel_address_space_id(void); -vm_address_space *vm_get_current_user_address_space(void); +struct vm_address_space *vm_get_current_user_address_space(void); team_id vm_current_user_address_space_id(void); -vm_address_space *vm_get_address_space_by_id(team_id aid); -void vm_put_address_space(vm_address_space *aspace); +struct vm_address_space *vm_get_address_space_by_id(team_id aid); +void vm_put_address_space(struct vm_address_space *aspace); #define vm_swap_address_space(aspace) arch_vm_aspace_swap(aspace) #ifdef __cplusplus diff --git a/headers/private/kernel/vm_cache.h b/headers/private/kernel/vm_cache.h index e039a004e7..fe51cc0dfe 100644 --- a/headers/private/kernel/vm_cache.h +++ b/headers/private/kernel/vm_cache.h @@ -12,28 +12,34 @@ #include #include + struct kernel_args; +//typedef struct vm_store vm_store; + #ifdef __cplusplus extern "C" { #endif status_t vm_cache_init(struct kernel_args *args); -vm_cache *vm_cache_create(vm_store *store); -void vm_cache_acquire_ref(vm_cache *cache); -void vm_cache_release_ref(vm_cache *cache); -vm_cache *vm_cache_acquire_page_cache_ref(vm_page *page); -vm_page *vm_cache_lookup_page(vm_cache *cache, off_t page); -void vm_cache_insert_page(vm_cache *cache, vm_page *page, off_t offset); -void vm_cache_remove_page(vm_cache *cache, vm_page *page); -void vm_cache_remove_consumer(vm_cache *cache, vm_cache *consumer); -void vm_cache_add_consumer_locked(vm_cache *cache, vm_cache *consumer); -status_t vm_cache_write_modified(vm_cache *cache, bool fsReenter); -status_t vm_cache_set_minimal_commitment_locked(vm_cache *cache, off_t commitment); -status_t vm_cache_resize(vm_cache *cache, off_t newSize); -status_t vm_cache_insert_area_locked(vm_cache *cache, vm_area *area); -status_t vm_cache_remove_area(vm_cache *cache, vm_area *area); +struct vm_cache *vm_cache_create(struct vm_store *store); +void vm_cache_acquire_ref(struct vm_cache *cache); +void vm_cache_release_ref(struct vm_cache *cache); +struct vm_cache *vm_cache_acquire_page_cache_ref(struct vm_page *page); +struct vm_page *vm_cache_lookup_page(struct vm_cache *cache, off_t page); +void vm_cache_insert_page(struct vm_cache *cache, struct vm_page *page, + off_t offset); +void vm_cache_remove_page(struct vm_cache *cache, struct vm_page *page); +void vm_cache_remove_consumer(struct vm_cache *cache, struct vm_cache *consumer); +void vm_cache_add_consumer_locked(struct vm_cache *cache, + struct vm_cache *consumer); +status_t vm_cache_write_modified(struct vm_cache *cache, bool fsReenter); +status_t vm_cache_set_minimal_commitment_locked(struct vm_cache *cache, + off_t commitment); +status_t vm_cache_resize(struct vm_cache *cache, off_t newSize); +status_t vm_cache_insert_area_locked(struct vm_cache *cache, vm_area *area); +status_t vm_cache_remove_area(struct vm_cache *cache, struct vm_area *area); #ifdef __cplusplus } diff --git a/headers/private/kernel/vm_page.h b/headers/private/kernel/vm_page.h index aed7b7eced..978e465828 100644 --- a/headers/private/kernel/vm_page.h +++ b/headers/private/kernel/vm_page.h @@ -19,31 +19,32 @@ struct kernel_args; extern "C" { #endif -void vm_page_init_num_pages(kernel_args *args); +void vm_page_init_num_pages(struct kernel_args *args); status_t vm_page_init(struct kernel_args *args); status_t vm_page_init_post_area(struct kernel_args *args); status_t vm_page_init_post_thread(struct kernel_args *args); status_t vm_mark_page_inuse(addr_t page); status_t vm_mark_page_range_inuse(addr_t startPage, addr_t length); -status_t vm_page_set_state(vm_page *page, int state); +status_t vm_page_set_state(struct vm_page *page, int state); // get some data about the number of pages in the system size_t vm_page_num_pages(void); size_t vm_page_num_free_pages(void); -status_t vm_page_write_modified_page(vm_cache *cache, struct vm_page *page, - bool fsReenter); -status_t vm_page_write_modified_pages(vm_cache *cache, bool fsReenter); +status_t vm_page_write_modified_page(struct vm_cache *cache, + struct vm_page *page, bool fsReenter); +status_t vm_page_write_modified_pages(struct vm_cache *cache, bool fsReenter); void vm_page_unreserve_pages(uint32 count); void vm_page_reserve_pages(uint32 count); -vm_page *vm_page_allocate_page(int pageState, bool reserved); -status_t vm_page_allocate_pages(int pageState, vm_page **pages, uint32 numPages); -vm_page *vm_page_allocate_page_run(int state, addr_t length); -vm_page *vm_page_at_index(int32 index); -vm_page *vm_lookup_page(addr_t pageNumber); +struct vm_page *vm_page_allocate_page(int pageState, bool reserved); +status_t vm_page_allocate_pages(int pageState, struct vm_page **pages, + uint32 numPages); +struct vm_page *vm_page_allocate_page_run(int state, addr_t length); +struct vm_page *vm_page_at_index(int32 index); +struct vm_page *vm_lookup_page(addr_t pageNumber); #ifdef __cplusplus } diff --git a/headers/private/kernel/vm_priv.h b/headers/private/kernel/vm_priv.h index 5e1724e040..69448102a0 100644 --- a/headers/private/kernel/vm_priv.h +++ b/headers/private/kernel/vm_priv.h @@ -8,8 +8,9 @@ #ifndef _KERNEL_VM_PRIV_H #define _KERNEL_VM_PRIV_H -#include -#include + +#include + /* should make these scale with the system */ #define DEFAULT_KERNEL_WORKING_SET 1024 diff --git a/headers/private/kernel/vm_types.h b/headers/private/kernel/vm_types.h index 34f91c667f..50a0031ce2 100644 --- a/headers/private/kernel/vm_types.h +++ b/headers/private/kernel/vm_types.h @@ -69,8 +69,7 @@ class DoublyLinkedAreaLink { typedef class DoublyLinkedQueue vm_page_mappings; typedef class DoublyLinkedQueue vm_area_mappings; -// vm page -typedef struct vm_page { +struct vm_page { struct vm_page *queue_prev; struct vm_page *queue_next; @@ -104,7 +103,7 @@ typedef struct vm_page { uint16 wired_count; int8 usage_count; -} vm_page; +}; enum { PAGE_TYPE_PHYSICAL = 0, @@ -134,8 +133,7 @@ struct vm_dummy_page : vm_page { ConditionVariable busy_condition; }; -// vm_cache -typedef struct vm_cache { +struct vm_cache { mutex lock; struct vm_area *areas; vint32 ref_count; @@ -158,15 +156,14 @@ typedef struct vm_cache { struct vm_cache* debug_previous; struct vm_cache* debug_next; #endif -} vm_cache; +}; #if DEBUG_CACHE_LIST extern vm_cache* gDebugCacheList; #endif -// vm area -typedef struct vm_area { +struct vm_area { char *name; area_id id; addr_t base; @@ -186,24 +183,18 @@ typedef struct vm_area { struct vm_area *cache_next; struct vm_area *cache_prev; struct vm_area *hash_next; -} vm_area; +}; -#else // !__cplusplus -// these are just opaque types in C -typedef struct vm_page vm_page; -typedef struct vm_cache vm_cache; -typedef struct vm_area vm_area; -#endif +#endif // __cplusplus enum { VM_ASPACE_STATE_NORMAL = 0, VM_ASPACE_STATE_DELETION }; -// address space -typedef struct vm_address_space { - vm_area *areas; - vm_area *area_hint; +struct vm_address_space { + struct vm_area *areas; + struct vm_area *area_hint; sem_id sem; addr_t base; addr_t size; @@ -219,26 +210,24 @@ typedef struct vm_address_space { addr_t min_working_set; bigtime_t last_working_set_adjust; struct vm_address_space *hash_next; -} vm_address_space; +}; -// vm_store -typedef struct vm_store { +struct vm_store { struct vm_store_ops *ops; struct vm_cache *cache; off_t committed_size; -} vm_store; +}; -// vm_store_ops typedef struct vm_store_ops { void (*destroy)(struct vm_store *backing_store); status_t (*commit)(struct vm_store *backing_store, off_t size); bool (*has_page)(struct vm_store *backing_store, off_t offset); - status_t (*read)(struct vm_store *backing_store, off_t offset, const iovec *vecs, - size_t count, size_t *_numBytes, bool fsReenter); - status_t (*write)(struct vm_store *backing_store, off_t offset, const iovec *vecs, - size_t count, size_t *_numBytes, bool fsReenter); - status_t (*fault)(struct vm_store *backing_store, struct vm_address_space *aspace, - off_t offset); + status_t (*read)(struct vm_store *backing_store, off_t offset, + const iovec *vecs, size_t count, size_t *_numBytes, bool fsReenter); + status_t (*write)(struct vm_store *backing_store, off_t offset, + const iovec *vecs, size_t count, size_t *_numBytes, bool fsReenter); + status_t (*fault)(struct vm_store *backing_store, + struct vm_address_space *aspace, off_t offset); void (*acquire_ref)(struct vm_store *backing_store); void (*release_ref)(struct vm_store *backing_store); } vm_store_ops; @@ -291,6 +280,7 @@ enum { // flags region in the protection field. #define B_USER_AREA_FLAGS (B_USER_PROTECTION) -#define B_KERNEL_AREA_FLAGS (B_KERNEL_PROTECTION | B_USER_CLONEABLE_AREA | B_OVERCOMMITTING_AREA) +#define B_KERNEL_AREA_FLAGS \ + (B_KERNEL_PROTECTION | B_USER_CLONEABLE_AREA | B_OVERCOMMITTING_AREA) #endif /* _KERNEL_VM_TYPES_H */ diff --git a/src/system/kernel/arch/x86/arch_cpu.c b/src/system/kernel/arch/x86/arch_cpu.c index 19fbe0df7a..d0aacda771 100644 --- a/src/system/kernel/arch/x86/arch_cpu.c +++ b/src/system/kernel/arch/x86/arch_cpu.c @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006, Axel Dörfler, axeld@pinc-software.de. All rights reserved. + * Copyright 2002-2007, Axel Dörfler, axeld@pinc-software.de. All rights reserved. * Distributed under the terms of the MIT License. * * Copyright 2001-2002, Travis Geiselbrecht. All rights reserved. @@ -7,24 +7,24 @@ */ +#include + +#include +#include +#include + #include #include #include -#include +#include #include -#include -#include #include #include #include #include "interrupts.h" -#include -#include -#include - /* cpu vendor info */ struct cpu_vendor_info { diff --git a/src/system/kernel/arch/x86/arch_debug.cpp b/src/system/kernel/arch/x86/arch_debug.cpp index 4aa56f70c3..d92fe2c546 100644 --- a/src/system/kernel/arch/x86/arch_debug.cpp +++ b/src/system/kernel/arch/x86/arch_debug.cpp @@ -7,18 +7,20 @@ */ +#include + +#include + #include #include #include #include #include #include +#include -#include #include -#include - struct stack_frame { struct stack_frame *previous; diff --git a/src/system/kernel/arch/x86/arch_thread.c b/src/system/kernel/arch/x86/arch_thread.c index c4ed0b2a80..8f49993242 100644 --- a/src/system/kernel/arch/x86/arch_thread.c +++ b/src/system/kernel/arch/x86/arch_thread.c @@ -7,15 +7,17 @@ */ -#include #include + #include #include -#include #include +#include #include -#include +#include #include +#include +#include #include diff --git a/src/system/kernel/arch/x86/commpage.c b/src/system/kernel/arch/x86/commpage.c index de92d24661..f48677b59f 100644 --- a/src/system/kernel/arch/x86/commpage.c +++ b/src/system/kernel/arch/x86/commpage.c @@ -2,12 +2,18 @@ * Copyright 2007, Travis Geiselbrecht. All rights reserved. * Distributed under the terms of the MIT License. */ -#include + + #include -#include #include +#include + +#include +#include + + static area_id comm_area; static area_id user_comm_area; static unsigned long *comm_ptr; @@ -18,14 +24,16 @@ static void *next_comm_addr; extern void _user_syscall_int(void); extern unsigned int _user_syscall_int_end; -static inline -addr_t commpage_ptr_to_user_ptr(const void *ptr) + +static inline addr_t +commpage_ptr_to_user_ptr(const void *ptr) { return ((addr_t)ptr) + ((addr_t)user_comm_ptr - (addr_t)comm_ptr); } -static -status_t initialize_commpage_syscall(void) + +static status_t +initialize_commpage_syscall(void) { size_t len; @@ -40,19 +48,20 @@ status_t initialize_commpage_syscall(void) return B_OK; } + status_t commpage_init(void) { int i; // create a read/write kernel area - comm_area = create_area("commpage", (void **)&comm_ptr, B_ANY_ADDRESS, COMMPAGE_SIZE, B_FULL_LOCK, - B_KERNEL_WRITE_AREA | B_KERNEL_READ_AREA); + comm_area = create_area("commpage", (void **)&comm_ptr, B_ANY_ADDRESS, + COMMPAGE_SIZE, B_FULL_LOCK, B_KERNEL_WRITE_AREA | B_KERNEL_READ_AREA); // clone it at a fixed address with user read/only permissions user_comm_ptr = (void *)USER_COMMPAGE_ADDR; - user_comm_area = clone_area("user_commpage", (void **)&user_comm_ptr, B_EXACT_ADDRESS, - B_READ_AREA | B_EXECUTE_AREA, comm_area); + user_comm_area = clone_area("user_commpage", (void **)&user_comm_ptr, + B_EXACT_ADDRESS, B_READ_AREA | B_EXECUTE_AREA, comm_area); // zero it out memset(comm_ptr, 0, COMMPAGE_SIZE); diff --git a/src/system/kernel/cache/block_allocator.cpp b/src/system/kernel/cache/block_allocator.cpp index d4d0f0d6fb..c98e1306c1 100644 --- a/src/system/kernel/cache/block_allocator.cpp +++ b/src/system/kernel/cache/block_allocator.cpp @@ -10,6 +10,7 @@ #include #include +#include #include #include diff --git a/src/system/kernel/cache/vnode_store.h b/src/system/kernel/cache/vnode_store.h index 0d76c7dc79..b3a18e2b64 100644 --- a/src/system/kernel/cache/vnode_store.h +++ b/src/system/kernel/cache/vnode_store.h @@ -6,7 +6,7 @@ #define VNODE_STORE_H -#include +#include struct vnode_store { diff --git a/src/system/kernel/debug/debug.c b/src/system/kernel/debug/debug.c index 3df46247b3..d09b59db1d 100644 --- a/src/system/kernel/debug/debug.c +++ b/src/system/kernel/debug/debug.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include diff --git a/src/system/kernel/debug/gdb.c b/src/system/kernel/debug/gdb.c index 14baa215fd..40bb27e28f 100644 --- a/src/system/kernel/debug/gdb.c +++ b/src/system/kernel/debug/gdb.c @@ -1,5 +1,5 @@ /* - * Copyright 2005-2006, Axel Dörfler, axeld@pinc-software.de. + * Copyright 2005-2007, Axel Dörfler, axeld@pinc-software.de. * Distributed under the terms of the MIT License. * * Copyright 2002, Manuel J. Petit. All rights reserved. @@ -13,10 +13,13 @@ #include #include #include -#include -#include -#include + +#include + #include +#include +#include +#include enum { INIT = 0, CMDREAD, CKSUM1, CKSUM2, WAITACK, QUIT, GDBSTATES }; diff --git a/src/system/kernel/elf.cpp b/src/system/kernel/elf.cpp index bc3d879512..e382d417ed 100644 --- a/src/system/kernel/elf.cpp +++ b/src/system/kernel/elf.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006, Axel Dörfler, axeld@pinc-software.de. All rights reserved. + * Copyright 2002-2007, Axel Dörfler, axeld@pinc-software.de. All rights reserved. * Distributed under the terms of the MIT License. * * Copyright 2001, Travis Geiselbrecht. All rights reserved. @@ -8,22 +8,9 @@ /* Contains the ELF loader */ -#include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include #include #include @@ -31,6 +18,22 @@ #include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + //#define TRACE_ELF #ifdef TRACE_ELF # define TRACE(x) dprintf x diff --git a/src/system/kernel/slab/Slab.cpp b/src/system/kernel/slab/Slab.cpp index d1a5781d6d..72b6948933 100644 --- a/src/system/kernel/slab/Slab.cpp +++ b/src/system/kernel/slab/Slab.cpp @@ -10,21 +10,21 @@ #include "slab_private.h" +#include +#include #include #include #include + +#include #include #include #include - -#include #include +#include #include -#include // swap -#include - // TODO kMagazineCapacity should be dynamically tuned per cache. diff --git a/src/system/kernel/system_info.c b/src/system/kernel/system_info.c index 6cf58f3e65..fda4ebb87c 100644 --- a/src/system/kernel/system_info.c +++ b/src/system/kernel/system_info.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004-2006, Haiku, Inc. + * Copyright (c) 2004-2007, Haiku, Inc. * Distributed under the terms of the MIT license. * * Authors: @@ -8,14 +8,14 @@ */ +#include + #include #include -#include -#include - #include #include +#include #include #include #include @@ -25,6 +25,8 @@ #include #include +#include + #include diff --git a/src/system/kernel/thread.cpp b/src/system/kernel/thread.cpp index b6188d8bf0..b6fa9c1405 100644 --- a/src/system/kernel/thread.cpp +++ b/src/system/kernel/thread.cpp @@ -24,7 +24,9 @@ #include #include #include +#include #include +#include #include #include diff --git a/src/system/kernel/util/cbuf.c b/src/system/kernel/util/cbuf.c index b7265615f0..aa1028d182 100644 --- a/src/system/kernel/util/cbuf.c +++ b/src/system/kernel/util/cbuf.c @@ -1,5 +1,5 @@ /* - * Copyright 2002-2005, Axel Dörfler, axeld@pinc-software.de. All rights reserved. + * Copyright 2002-2007, Axel Dörfler, axeld@pinc-software.de. All rights reserved. * Distributed under the terms of the MIT License. * * Copyright 2001-2002, Travis Geiselbrecht. All rights reserved. @@ -12,13 +12,15 @@ */ -#include -#include #include -#include #include +#include + +#include +#include + #define CBUF_LENGTH 2048 diff --git a/src/system/kernel/vm/vm.cpp b/src/system/kernel/vm/vm.cpp index afb5c8777f..1064b84dbc 100644 --- a/src/system/kernel/vm/vm.cpp +++ b/src/system/kernel/vm/vm.cpp @@ -35,6 +35,7 @@ #include #include #include +#include #include #include diff --git a/src/system/kernel/vm/vm_cache.cpp b/src/system/kernel/vm/vm_cache.cpp index b312a4168a..9117083d81 100644 --- a/src/system/kernel/vm/vm_cache.cpp +++ b/src/system/kernel/vm/vm_cache.cpp @@ -11,9 +11,6 @@ #include #include -#include -#include - #include #include #include @@ -21,9 +18,12 @@ #include #include #include +#include +#include #include #include #include +#include //#define TRACE_VM_CACHE diff --git a/src/system/kernel/vm/vm_store_device.c b/src/system/kernel/vm/vm_store_device.c index 19899560bc..ca1946cbb7 100644 --- a/src/system/kernel/vm/vm_store_device.c +++ b/src/system/kernel/vm/vm_store_device.c @@ -16,8 +16,8 @@ struct device_store { - vm_store vm; - addr_t base_address; + struct vm_store vm; + addr_t base_address; }; @@ -63,7 +63,8 @@ device_write(struct vm_store *store, off_t offset, const iovec *vecs, size_t cou static status_t -device_fault(struct vm_store *_store, struct vm_address_space *aspace, off_t offset) +device_fault(struct vm_store *_store, struct vm_address_space *aspace, + off_t offset) { // devices are mapped in completely, so we shouldn't experience faults return B_BAD_ADDRESS; @@ -82,7 +83,7 @@ static vm_store_ops device_ops = { }; -vm_store * +struct vm_store * vm_store_create_device(addr_t baseAddress) { struct device_store *store = malloc(sizeof(struct device_store)); diff --git a/src/system/kernel/vm/vm_store_device.h b/src/system/kernel/vm/vm_store_device.h index 379ce5c8df..6afdadc4ab 100644 --- a/src/system/kernel/vm/vm_store_device.h +++ b/src/system/kernel/vm/vm_store_device.h @@ -1,5 +1,5 @@ /* - * Copyright 2005, Axel Dörfler, axeld@pinc-software.de. + * Copyright 2005-2007, Axel Dörfler, axeld@pinc-software.de. * Distributed under the terms of the MIT License. * * Copyright 2001-2002, Travis Geiselbrecht. All rights reserved. @@ -15,6 +15,6 @@ #ifdef __cplusplus extern "C" #endif -vm_store *vm_store_create_device(addr_t base_addr); +struct vm_store *vm_store_create_device(addr_t base_addr); #endif /* _KERNEL_VM_STORE_DEVICE_H */ diff --git a/src/system/kernel/vm/vm_store_null.c b/src/system/kernel/vm/vm_store_null.c index 9b863f9078..3f001f4607 100644 --- a/src/system/kernel/vm/vm_store_null.c +++ b/src/system/kernel/vm/vm_store_null.c @@ -35,25 +35,27 @@ null_has_page(struct vm_store *store, off_t offset) static status_t -null_read(struct vm_store *store, off_t offset, const iovec *vecs, size_t count, - size_t *_numBytes, bool fsReenter) +null_read(struct vm_store *store, off_t offset, const iovec *vecs, + size_t count, size_t *_numBytes, bool fsReenter) { return -1; } static status_t -null_write(struct vm_store *store, off_t offset, const iovec *vecs, size_t count, - size_t *_numBytes, bool fsReenter) +null_write(struct vm_store *store, off_t offset, const iovec *vecs, + size_t count, size_t *_numBytes, bool fsReenter) { return -1; } static status_t -null_fault(struct vm_store *store, struct vm_address_space *aspace, off_t offset) +null_fault(struct vm_store *store, struct vm_address_space *aspace, + off_t offset) { - /* we can't fault on this region, that's pretty much the point of the null store object */ + /* we can't fault on this region, that's pretty much the point of the + null store object */ return B_BAD_ADDRESS; } @@ -70,12 +72,12 @@ static vm_store_ops null_ops = { }; -vm_store * +struct vm_store * vm_store_create_null(void) { - vm_store *store; + struct vm_store *store; - store = malloc(sizeof(vm_store)); + store = malloc(sizeof(struct vm_store)); if (store == NULL) return NULL; diff --git a/src/system/kernel/vm/vm_store_null.h b/src/system/kernel/vm/vm_store_null.h index 04e9fb2208..395a22bd92 100644 --- a/src/system/kernel/vm/vm_store_null.h +++ b/src/system/kernel/vm/vm_store_null.h @@ -1,5 +1,5 @@ /* - * Copyright 2005, Axel Dörfler, axeld@pinc-software.de. + * Copyright 2005-2007, Axel Dörfler, axeld@pinc-software.de. * Distributed under the terms of the MIT License. * * Copyright 2001-2002, Travis Geiselbrecht. All rights reserved. @@ -15,6 +15,6 @@ #ifdef __cplusplus extern "C" #endif -vm_store *vm_store_create_null(void); +struct vm_store *vm_store_create_null(void); #endif /* _KERNEL_VM_STORE_NULL_H */