From 2afe7f534074faeb947251dd26b6bbb1db8e09e9 Mon Sep 17 00:00:00 2001 From: Wenchao Wang Date: Tue, 28 Dec 2021 21:29:09 +0800 Subject: [PATCH] linux: Adjust coding style of include path Adjust the format of include path for Linux platform. * Add header search paths to the project file and remove the redundant relative paths * Sort the order of included headers Signed-off-by: Wenchao Wang --- include/linux/hax_types_linux.h | 7 ++++--- platforms/linux/Kbuild | 1 + platforms/linux/components.c | 5 ++--- platforms/linux/hax_entry.c | 11 +++++------ platforms/linux/hax_event.c | 2 +- platforms/linux/hax_host_mem.c | 7 ++++--- platforms/linux/hax_mem_alloc.c | 4 ++-- platforms/linux/hax_mm.c | 4 ++-- platforms/linux/hax_wrapper.c | 8 +++----- 9 files changed, 24 insertions(+), 25 deletions(-) diff --git a/include/linux/hax_types_linux.h b/include/linux/hax_types_linux.h index da90b6d4..e4b8b3cb 100644 --- a/include/linux/hax_types_linux.h +++ b/include/linux/hax_types_linux.h @@ -32,11 +32,13 @@ #ifndef HAX_LINUX_HAX_TYPES_LINUX_H_ #define HAX_LINUX_HAX_TYPES_LINUX_H_ -#include +#include #define _ASM_X86_CPUFEATURES_H #include #undef _ASM_X86_CPUFEATURES_H -#include +#include + +#include "hax_list.h" // Signed Types typedef int8_t int8; @@ -62,7 +64,6 @@ typedef uint64_t mword; #endif typedef mword HAX_VADDR_T; -#include "../hax_list.h" struct hax_page { void *kva; struct page *page; diff --git a/platforms/linux/Kbuild b/platforms/linux/Kbuild index 1cb9e816..536a6888 100644 --- a/platforms/linux/Kbuild +++ b/platforms/linux/Kbuild @@ -1,4 +1,5 @@ ccflags-y += -Wno-unused-function +ccflags-y += -I$(src)/../../include -I$(src)/../../core/include obj-m := haxm.o # haxm diff --git a/platforms/linux/components.c b/platforms/linux/components.c index 2a465d9d..2aefaddb 100644 --- a/platforms/linux/components.c +++ b/platforms/linux/components.c @@ -30,14 +30,13 @@ #include #include +#include #include #include #include #include -#include - -#include "../../core/include/hax_core_interface.h" +#include "interface.h" #define HAX_VM_DEVFS_FMT "hax_vm/vm%02d" #define HAX_VCPU_DEVFS_FMT "hax_vm%02d/vcpu%02d" diff --git a/platforms/linux/hax_entry.c b/platforms/linux/hax_entry.c index 9a66de18..444185b3 100644 --- a/platforms/linux/hax_entry.c +++ b/platforms/linux/hax_entry.c @@ -29,16 +29,15 @@ */ #include -#include -#include #include +#include #include +#include #include -#include "../../include/hax.h" -#include "../../include/hax_interface.h" -#include "../../include/hax_release_ver.h" -#include "../../core/include/hax_core_interface.h" +#include "hax_release_ver.h" + +#include "interface.h" MODULE_LICENSE("Dual BSD/GPL"); MODULE_AUTHOR("Kryptos Logic"); diff --git a/platforms/linux/hax_event.c b/platforms/linux/hax_event.c index d5a66eba..02816422 100644 --- a/platforms/linux/hax_event.c +++ b/platforms/linux/hax_event.c @@ -28,7 +28,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "../../include/hax.h" +#include "hax.h" int hax_notify_host_event(enum hax_notify_event event, uint32_t *param, uint32_t size) diff --git a/platforms/linux/hax_host_mem.c b/platforms/linux/hax_host_mem.c index 28ed8253..acf2b52e 100644 --- a/platforms/linux/hax_host_mem.c +++ b/platforms/linux/hax_host_mem.c @@ -28,15 +28,16 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "../../include/hax_host_mem.h" -#include "../../core/include/paging.h" - #include #include #include #include #include +#include "hax_host_mem.h" + +#include "paging.h" + int hax_pin_user_pages(uint64_t start_uva, uint64_t size, hax_memdesc_user *memdesc) { int nr_pages; diff --git a/platforms/linux/hax_mem_alloc.c b/platforms/linux/hax_mem_alloc.c index 73c8103d..5e034733 100644 --- a/platforms/linux/hax_mem_alloc.c +++ b/platforms/linux/hax_mem_alloc.c @@ -28,12 +28,12 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "../../include/hax.h" - #include #include #include +#include "hax.h" + void * hax_vmalloc(uint32_t size, uint32_t flags) { void *ptr; diff --git a/platforms/linux/hax_mm.c b/platforms/linux/hax_mm.c index 3bcf7fdf..e4a30de8 100644 --- a/platforms/linux/hax_mm.c +++ b/platforms/linux/hax_mm.c @@ -28,8 +28,6 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "../../include/hax.h" - #include #include #include @@ -37,6 +35,8 @@ #include #include +#include "hax.h" + typedef struct hax_vcpu_mem_hinfo_t { int flags; int nr_pages; diff --git a/platforms/linux/hax_wrapper.c b/platforms/linux/hax_wrapper.c index e5263a9e..a78db7d0 100644 --- a/platforms/linux/hax_wrapper.c +++ b/platforms/linux/hax_wrapper.c @@ -28,17 +28,15 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "../../include/hax.h" -#include "../../core/include/hax_core_interface.h" -#include "../../core/include/ia32.h" - +#include #include #include #include #include #include -#include +#include "ia32.h" +#include "interface.h" static const char* kLogLevel[] = { KERN_ERR,