From df9270ef134498d4fffb921286375137d3639ae5 Mon Sep 17 00:00:00 2001 From: Flavio Cruz Date: Mon, 12 Feb 2024 01:26:33 -0500 Subject: Replace kernel header includes in include/mach/mach_types.h with forward declarations. I was trying to reuse TASK_NAME_SIZE in kern/thread.h but it was impossible because files included from kern/task.h end up requiring kern/thread.h (through percpu.h), creating a recursive dependency. With this change, mach_types.h only defines forward declarations and modules have to explicitly include the appropriate header file if they want to be able touch those structures. Most of the other includes are required because we no longer grab many different includes through mach_types.h. Message-ID: <20240212062634.1082207-1-flaviocruz@gmail.com> --- include/mach/mach_types.h | 13 ++++++------- include/mach/std_types.h | 4 ---- 2 files changed, 6 insertions(+), 11 deletions(-) (limited to 'include') diff --git a/include/mach/mach_types.h b/include/mach/mach_types.h index 57f8f22d..5ecd686a 100644 --- a/include/mach/mach_types.h +++ b/include/mach/mach_types.h @@ -57,13 +57,12 @@ #include #ifdef MACH_KERNEL -#include /* for task_array_t */ -#include /* for thread_array_t */ -#include /* for processor_array_t, - processor_set_array_t, - processor_set_name_array_t */ -#include - /* for emulation_vector_t */ + +typedef struct task *task_t; +typedef struct thread *thread_t; +typedef struct processor *processor_t; +typedef struct processor_set *processor_set_t; + #else /* MACH_KERNEL */ typedef mach_port_t task_t; typedef task_t *task_array_t; diff --git a/include/mach/std_types.h b/include/mach/std_types.h index f78e236a..0d5db0ae 100644 --- a/include/mach/std_types.h +++ b/include/mach/std_types.h @@ -41,8 +41,4 @@ typedef vm_offset_t pointer_t; typedef vm_offset_t vm_address_t; -#ifdef MACH_KERNEL -#include -#endif /* MACH_KERNEL */ - #endif /* _MACH_STD_TYPES_H_ */ -- cgit v1.2.3