Skip to content
This repository has been archived by the owner on Jan 28, 2023. It is now read-only.

Commit

Permalink
linux: Adjust coding style of include path
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
wcwang committed Jan 7, 2022
1 parent f3fb435 commit 2afe7f5
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 25 deletions.
7 changes: 4 additions & 3 deletions include/linux/hax_types_linux.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,13 @@
#ifndef HAX_LINUX_HAX_TYPES_LINUX_H_
#define HAX_LINUX_HAX_TYPES_LINUX_H_

#include <linux/types.h>
#include <linux/errno.h>
#define _ASM_X86_CPUFEATURES_H
#include <linux/string.h>
#undef _ASM_X86_CPUFEATURES_H
#include <linux/errno.h>
#include <linux/types.h>

#include "hax_list.h"

// Signed Types
typedef int8_t int8;
Expand All @@ -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;
Expand Down
1 change: 1 addition & 0 deletions platforms/linux/Kbuild
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
ccflags-y += -Wno-unused-function
ccflags-y += -I$(src)/../../include -I$(src)/../../core/include
obj-m := haxm.o

# haxm
Expand Down
5 changes: 2 additions & 3 deletions platforms/linux/components.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,13 @@

#include <linux/cred.h>
#include <linux/dm-ioctl.h>
#include <linux/fs.h>
#include <linux/miscdevice.h>
#include <linux/namei.h>
#include <linux/slab.h>
#include <linux/uaccess.h>

#include <linux/fs.h>

#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"
Expand Down
11 changes: 5 additions & 6 deletions platforms/linux/hax_entry.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,15 @@
*/

#include <linux/init.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/fs.h>
#include <linux/kernel.h>
#include <linux/miscdevice.h>
#include <linux/module.h>
#include <linux/uaccess.h>

#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");
Expand Down
2 changes: 1 addition & 1 deletion platforms/linux/hax_event.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
7 changes: 4 additions & 3 deletions platforms/linux/hax_host_mem.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,16 @@
* POSSIBILITY OF SUCH DAMAGE.
*/

#include "../../include/hax_host_mem.h"
#include "../../core/include/paging.h"

#include <linux/mm.h>
#include <linux/pagemap.h>
#include <linux/slab.h>
#include <linux/version.h>
#include <linux/vmalloc.h>

#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;
Expand Down
4 changes: 2 additions & 2 deletions platforms/linux/hax_mem_alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@
* POSSIBILITY OF SUCH DAMAGE.
*/

#include "../../include/hax.h"

#include <asm/io.h>
#include <linux/mm.h>
#include <linux/slab.h>

#include "hax.h"

void * hax_vmalloc(uint32_t size, uint32_t flags)
{
void *ptr;
Expand Down
4 changes: 2 additions & 2 deletions platforms/linux/hax_mm.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@
* POSSIBILITY OF SUCH DAMAGE.
*/

#include "../../include/hax.h"

#include <linux/mm.h>
#include <linux/mman.h>
#include <linux/pagemap.h>
#include <linux/slab.h>
#include <linux/version.h>
#include <linux/vmalloc.h>

#include "hax.h"

typedef struct hax_vcpu_mem_hinfo_t {
int flags;
int nr_pages;
Expand Down
8 changes: 3 additions & 5 deletions platforms/linux/hax_wrapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 <asm/cmpxchg.h>
#include <linux/atomic.h>
#include <linux/mutex.h>
#include <linux/slab.h>
#include <linux/spinlock.h>
#include <linux/spinlock_types.h>

#include <asm/cmpxchg.h>
#include "ia32.h"
#include "interface.h"

static const char* kLogLevel[] = {
KERN_ERR,
Expand Down

0 comments on commit 2afe7f5

Please sign in to comment.