From 135dceca8f722e24bc319889985be2294442104f Mon Sep 17 00:00:00 2001 From: Pawel Wieczorkiewicz Date: Mon, 18 Jul 2022 10:57:20 +0200 Subject: [PATCH] clang-format: do not enforce one-line functions Signed-off-by: Pawel Wieczorkiewicz --- .clang-format | 2 +- arch/x86/apic.c | 4 ++- arch/x86/real_mode_func.c | 4 ++- common/console.c | 4 ++- common/cpu.c | 8 +++-- common/pci.c | 4 ++- common/setup.c | 4 ++- drivers/acpi/acpica/osl.c | 16 +++++++--- drivers/pit.c | 4 ++- include/arch/x86/apic.h | 4 ++- include/arch/x86/atomic.h | 8 +++-- include/arch/x86/page.h | 12 ++++++-- include/arch/x86/pagetable.h | 8 +++-- include/cpu.h | 4 ++- include/lib.h | 60 +++++++++++++++++++++++++++--------- include/list.h | 4 ++- include/mm/pmm.h | 8 +++-- include/mm/vmm.h | 4 ++- include/sched.h | 4 ++- include/string.h | 40 ++++++++++++++++++------ include/time.h | 4 ++- lib/lib.c | 4 ++- lib/semaphore.c | 12 ++++++-- lib/time.c | 4 ++- mm/pmm.c | 4 ++- mm/regions.c | 8 +++-- mm/slab.c | 8 +++-- tests/unittests.c | 4 ++- 28 files changed, 190 insertions(+), 64 deletions(-) diff --git a/.clang-format b/.clang-format index db955f5a..5d87b358 100644 --- a/.clang-format +++ b/.clang-format @@ -13,7 +13,7 @@ AllowAllConstructorInitializersOnNextLine: true AllowAllParametersOfDeclarationOnNextLine: true AllowShortBlocksOnASingleLine: Never AllowShortCaseLabelsOnASingleLine: false -AllowShortFunctionsOnASingleLine: All +AllowShortFunctionsOnASingleLine: false AllowShortLambdasOnASingleLine: All AllowShortIfStatementsOnASingleLine: Never AllowShortLoopsOnASingleLine: false diff --git a/arch/x86/apic.c b/arch/x86/apic.c index bbb4223e..bff081da 100644 --- a/arch/x86/apic.c +++ b/arch/x86/apic.c @@ -106,7 +106,9 @@ void apic_icr_write(const apic_icr_t *icr) { apic_msr_write(X2APIC_REG(APIC_ICR0), icr->reg); } -apic_mode_t apic_get_mode(void) { return apic_mode; } +apic_mode_t apic_get_mode(void) { + return apic_mode; +} void init_apic(unsigned int cpu_id, apic_mode_t mode) { apic_base_t apic_base; diff --git a/arch/x86/real_mode_func.c b/arch/x86/real_mode_func.c index 8a787f6a..7f89cbce 100644 --- a/arch/x86/real_mode_func.c +++ b/arch/x86/real_mode_func.c @@ -45,4 +45,6 @@ void long_to_real(void) { spin_unlock(&lock); } -void init_real_mode(void) { init_rmode_traps(); } +void init_real_mode(void) { + init_rmode_traps(); +} diff --git a/common/console.c b/common/console.c index 7447eef5..f820103b 100644 --- a/common/console.c +++ b/common/console.c @@ -72,7 +72,9 @@ void printk(const char *fmt, ...) { } #ifdef KTF_ACPICA -void AcpiOsVprintf(const char *Format, va_list args) { vprintk(Format, args); } +void AcpiOsVprintf(const char *Format, va_list args) { + vprintk(Format, args); +} void AcpiOsPrintf(const char *Format, ...) { va_list args; diff --git a/common/cpu.c b/common/cpu.c index 1cdab4d6..0a915878 100644 --- a/common/cpu.c +++ b/common/cpu.c @@ -91,9 +91,13 @@ cpu_t *get_cpu(unsigned int id) { return NULL; } -unsigned int get_nr_cpus(void) { return nr_cpus; } +unsigned int get_nr_cpus(void) { + return nr_cpus; +} -cpu_t *get_bsp_cpu(void) { return &bsp; } +cpu_t *get_bsp_cpu(void) { + return &bsp; +} void for_each_cpu(void (*func)(cpu_t *cpu)) { cpu_t *cpu; diff --git a/common/pci.c b/common/pci.c index a8f74026..4241262b 100644 --- a/common/pci.c +++ b/common/pci.c @@ -30,7 +30,9 @@ static list_head_t pci_list = LIST_INIT(pci_list); -static inline uint8_t pci_dev_hdr_type(pcidev_t *dev) { return dev->hdr & PCI_HDR_TYPE; } +static inline uint8_t pci_dev_hdr_type(pcidev_t *dev) { + return dev->hdr & PCI_HDR_TYPE; +} static inline bool pci_dev_is_multifunc(pcidev_t *dev) { return ((dev->hdr & PCI_HDR_MULTIFUNC) != 0); diff --git a/common/setup.c b/common/setup.c index 6700f784..58039c45 100644 --- a/common/setup.c +++ b/common/setup.c @@ -135,7 +135,9 @@ static void display_cpu_info(void) { printk("Frequency: %lu MHz\n", cpu_frequency / MHZ(1)); } -static void display_banner(void) { draw_logo(); } +static void display_banner(void) { + draw_logo(); +} static void __text_init init_vga_console(void) { if (!boot_flags.vga) diff --git a/drivers/acpi/acpica/osl.c b/drivers/acpi/acpica/osl.c index 158becd7..a823135e 100644 --- a/drivers/acpi/acpica/osl.c +++ b/drivers/acpi/acpica/osl.c @@ -222,9 +222,13 @@ ACPI_STATUS AcpiOsPhysicalTableOverride(ACPI_TABLE_HEADER *ExistingTable, /* Memory management functions */ -void *AcpiOsAllocate(ACPI_SIZE Size) { return kmalloc(Size); } +void *AcpiOsAllocate(ACPI_SIZE Size) { + return kmalloc(Size); +} -void AcpiOsFree(void *Memory) { kfree(Memory); } +void AcpiOsFree(void *Memory) { + kfree(Memory); +} BOOLEAN AcpiOsReadable(void *Memory, ACPI_SIZE Length) { volatile bool success = false; @@ -476,10 +480,14 @@ ACPI_STATUS AcpiOsSignalSemaphore(ACPI_SEMAPHORE Handle, UINT32 Units) { /* Time management functions */ -void AcpiOsSleep(UINT64 Miliseconds) { msleep(Miliseconds); } +void AcpiOsSleep(UINT64 Miliseconds) { + msleep(Miliseconds); +} /* FIXME: Return in correct 100ns units */ -UINT64 AcpiOsGetTimer(void) { return get_timer_ticks(); } +UINT64 AcpiOsGetTimer(void) { + return get_timer_ticks(); +} /* FIXME: Use actual microseconds granularity */ void AcpiOsStall(UINT32 Microseconds) { diff --git a/drivers/pit.c b/drivers/pit.c index de81e679..b5328204 100644 --- a/drivers/pit.c +++ b/drivers/pit.c @@ -38,4 +38,6 @@ void init_pit(const cpu_t *cpu) { configure_isa_irq(PIT_IRQ, PIT_IRQ0_OFFSET, IOAPIC_DEST_MODE_PHYSICAL, cpu->id); } -void pit_disable(void) { pic_disable_irq(PIC1_DEVICE_SEL, PIT_IRQ); } +void pit_disable(void) { + pic_disable_irq(PIC1_DEVICE_SEL, PIT_IRQ); +} diff --git a/include/arch/x86/apic.h b/include/arch/x86/apic.h index 953861e7..b3923adc 100644 --- a/include/arch/x86/apic.h +++ b/include/arch/x86/apic.h @@ -505,7 +505,9 @@ static inline void apic_icr_set_dest(apic_icr_t *icr, uint32_t dest) { icr->x2apic_dest = dest; } -static inline void apic_EOI(void) { apic_write(APIC_EOI, APIC_EOI_SIGNAL); } +static inline void apic_EOI(void) { + apic_write(APIC_EOI, APIC_EOI_SIGNAL); +} #endif /* __ASSEMBLY__ */ diff --git a/include/arch/x86/atomic.h b/include/arch/x86/atomic.h index 55fe8e3c..0510242f 100644 --- a/include/arch/x86/atomic.h +++ b/include/arch/x86/atomic.h @@ -115,7 +115,9 @@ static inline int64_t atomic64_add_return(atomic64_t *v, int64_t n) { return val; } -static inline int32_t atomic_inc_return(atomic_t *v) { return atomic_add_return(v, 1); } +static inline int32_t atomic_inc_return(atomic_t *v) { + return atomic_add_return(v, 1); +} static inline int64_t atomic64_inc_return(atomic64_t *v) { return atomic64_add_return(v, 1); @@ -155,7 +157,9 @@ static inline int64_t atomic64_sub_return(atomic64_t *v, int64_t n) { return atomic64_add_return(v, -n); } -static inline int32_t atomic_dec_return(atomic_t *v) { return atomic_sub_return(v, 1); } +static inline int32_t atomic_dec_return(atomic_t *v) { + return atomic_sub_return(v, 1); +} static inline int64_t atomic64_dec_return(atomic64_t *v) { return atomic64_sub_return(v, 1); diff --git a/include/arch/x86/page.h b/include/arch/x86/page.h index d9206398..a8f3560c 100644 --- a/include/arch/x86/page.h +++ b/include/arch/x86/page.h @@ -178,8 +178,12 @@ extern pat_memory_type_t pat_get_type(pat_field_t field); /* Static declarations */ -static inline mfn_t paddr_to_mfn(paddr_t pa) { return (mfn_t)(pa >> PAGE_SHIFT); } -static inline paddr_t mfn_to_paddr(mfn_t mfn) { return (paddr_t)(mfn << PAGE_SHIFT); } +static inline mfn_t paddr_to_mfn(paddr_t pa) { + return (mfn_t)(pa >> PAGE_SHIFT); +} +static inline paddr_t mfn_to_paddr(mfn_t mfn) { + return (paddr_t)(mfn << PAGE_SHIFT); +} static inline void *_paddr_to_virt(paddr_t pa, unsigned long addr_space) { return _ptr(pa + addr_space); @@ -213,7 +217,9 @@ static inline void *mfn_to_virt_user(mfn_t mfn) { return paddr_to_virt_user(mfn << PAGE_SHIFT); } -static inline void *mfn_to_virt(mfn_t mfn) { return paddr_to_virt(mfn << PAGE_SHIFT); } +static inline void *mfn_to_virt(mfn_t mfn) { + return paddr_to_virt(mfn << PAGE_SHIFT); +} static inline paddr_t virt_to_paddr(const void *va) { paddr_t pa = (paddr_t) va; diff --git a/include/arch/x86/pagetable.h b/include/arch/x86/pagetable.h index 3d7f7866..c1cf6ab2 100644 --- a/include/arch/x86/pagetable.h +++ b/include/arch/x86/pagetable.h @@ -215,7 +215,9 @@ static inline pgentry_t pgentry_from_virt(const void *va, unsigned long flags) { #define INVALID_PGENTRY(e) (!(e) || mfn_invalid((e)->mfn)) #if defined(__x86_64__) -static inline pml4_t *get_l4_table(void) { return paddr_to_virt_kern(read_cr3()); } +static inline pml4_t *get_l4_table(void) { + return paddr_to_virt_kern(read_cr3()); +} static inline pdpe_t *get_l3_table(const void *va) { pml4_t *l3e = l4_table_entry(get_l4_table(), va); @@ -223,7 +225,9 @@ static inline pdpe_t *get_l3_table(const void *va) { return INVALID_PGENTRY(l3e) ? NULL : mfn_to_virt_kern(l3e->mfn); } #elif defined(__i386__) -static inline pdpe_t *get_l3_table(void) { return paddr_to_virt_kern(read_cr3()); } +static inline pdpe_t *get_l3_table(void) { + return paddr_to_virt_kern(read_cr3()); +} #endif static inline pde_t *get_l2_table(const void *va) { diff --git a/include/cpu.h b/include/cpu.h index 3c3787d1..4b68761b 100644 --- a/include/cpu.h +++ b/include/cpu.h @@ -64,7 +64,9 @@ extern void wait_for_all_cpus(void); /* Static declarations */ -static inline void init_cpu_runstate(cpu_t *cpu) { atomic_set(&cpu->run_state, 0); } +static inline void init_cpu_runstate(cpu_t *cpu) { + atomic_set(&cpu->run_state, 0); +} static inline bool is_cpu_finished(cpu_t *cpu) { return atomic_test_bit(CPU_FINISHED, &cpu->run_state); diff --git a/include/lib.h b/include/lib.h index 8d20a429..78568583 100644 --- a/include/lib.h +++ b/include/lib.h @@ -151,13 +151,21 @@ static inline void wrmsr(uint32_t msr_idx, uint64_t value) { "d"((uint32_t)(value >> 32))); } -static inline void sti(void) { asm volatile("sti"); } +static inline void sti(void) { + asm volatile("sti"); +} -static inline void cli(void) { asm volatile("cli"); } +static inline void cli(void) { + asm volatile("cli"); +} -static inline void pause(void) { asm volatile("pause"); } +static inline void pause(void) { + asm volatile("pause"); +} -static inline void hlt(void) { asm volatile("hlt"); } +static inline void hlt(void) { + asm volatile("hlt"); +} static inline unsigned long read_flags(void) { unsigned long flags; @@ -215,7 +223,9 @@ static inline unsigned long read_fs(void) { return fs; } -static inline void write_fs(unsigned long fs) { asm volatile("mov %0, %%fs" ::"r"(fs)); } +static inline void write_fs(unsigned long fs) { + asm volatile("mov %0, %%fs" ::"r"(fs)); +} static inline unsigned long read_gs(void) { unsigned long gs; @@ -225,7 +235,9 @@ static inline unsigned long read_gs(void) { return gs; } -static inline void write_gs(unsigned long gs) { asm volatile("mov %0, %%gs" ::"r"(gs)); } +static inline void write_gs(unsigned long gs) { + asm volatile("mov %0, %%gs" ::"r"(gs)); +} static inline unsigned long read_cr0(void) { unsigned long cr0; @@ -296,21 +308,33 @@ static inline void ltr(unsigned int selector) { asm volatile("ltr %w0" ::"rm"(selector)); } -static inline void sgdt(gdt_ptr_t *gdt_ptr) { asm volatile("sgdt %0" : "=m"(*gdt_ptr)); } +static inline void sgdt(gdt_ptr_t *gdt_ptr) { + asm volatile("sgdt %0" : "=m"(*gdt_ptr)); +} -static inline void sidt(idt_ptr_t *idt_ptr) { asm volatile("sidt %0" : "=m"(*idt_ptr)); } +static inline void sidt(idt_ptr_t *idt_ptr) { + asm volatile("sidt %0" : "=m"(*idt_ptr)); +} static inline void str(unsigned int *selector) { asm volatile("str %0" : "=m"(*selector)); } -static inline void flush_tlb(void) { write_cr3(read_cr3()); } +static inline void flush_tlb(void) { + write_cr3(read_cr3()); +} -static inline void ud2(void) { asm volatile("ud2"); } +static inline void ud2(void) { + asm volatile("ud2"); +} -static inline void swapgs(void) { asm volatile("swapgs"); } +static inline void swapgs(void) { + asm volatile("swapgs"); +} -static inline void syscall(void) { asm volatile("syscall"); } +static inline void syscall(void) { + asm volatile("syscall"); +} static inline void sysret(void) { #if defined(__i386__) @@ -374,7 +398,9 @@ static inline void outd(io_port_t port, uint32_t value) { asm volatile("out %0, %1" ::"a"(value), "Nd"(port)); } -static inline void putc(io_port_t port, int c) { outb(port, c); } +static inline void putc(io_port_t port, int c) { + outb(port, c); +} static inline void puts(io_port_t port, const char *buf, size_t len) { asm volatile("rep; outsb" : "+S"(buf), "+c"(len) : "d"(port)); @@ -382,7 +408,9 @@ static inline void puts(io_port_t port, const char *buf, size_t len) { /* I/O port delay is believed to take ~1ms */ #define IO_DELAY_PORT 0x80 -static inline void io_delay(void) { outb(IO_DELAY_PORT, 0xff); /* Random data write */ } +static inline void io_delay(void) { + outb(IO_DELAY_PORT, 0xff); /* Random data write */ +} static inline uint64_t rdtsc(void) { unsigned int low, high; @@ -400,7 +428,9 @@ static inline uint64_t rdtscp(void) { return ((uint64_t) high << 32) | low; } -static inline void rep_nop(void) { asm volatile("rep;nop" ::: "memory"); } +static inline void rep_nop(void) { + asm volatile("rep;nop" ::: "memory"); +} #define cpu_relax() rep_nop() static inline void wait_cycles(unsigned int cycles) { diff --git a/include/list.h b/include/list.h index e84b3413..7ad62060 100644 --- a/include/list.h +++ b/include/list.h @@ -67,7 +67,9 @@ static inline void list_unlink(list_head_t *entry) { entry->prev = NULL; } -static inline bool list_is_empty(list_head_t *list) { return list->next == list; } +static inline bool list_is_empty(list_head_t *list) { + return list->next == list; +} #define list_entry(elem, type, member) container_of(elem, type, member) diff --git a/include/mm/pmm.h b/include/mm/pmm.h index f20c5ed5..0f30a4d6 100644 --- a/include/mm/pmm.h +++ b/include/mm/pmm.h @@ -84,7 +84,9 @@ static inline bool paddr_invalid(paddr_t pa) { return pa == PADDR_INVALID || !has_memory_range(pa); } -static inline bool mfn_invalid(mfn_t mfn) { return paddr_invalid(mfn_to_paddr(mfn)); } +static inline bool mfn_invalid(mfn_t mfn) { + return paddr_invalid(mfn_to_paddr(mfn)); +} static inline bool has_frames(list_head_t *frames, unsigned int order) { return !(order > MAX_PAGE_ORDER || list_is_empty(&frames[order])); @@ -97,7 +99,9 @@ static inline frame_t *get_first_frame(list_head_t *frames, unsigned int order) return list_first_entry(&frames[order], frame_t, list); } -static inline frame_t *get_free_frame(void) { return get_free_frames(PAGE_ORDER_4K); } +static inline frame_t *get_free_frame(void) { + return get_free_frames(PAGE_ORDER_4K); +} static inline void put_free_frame(mfn_t mfn) { return put_free_frames(mfn, PAGE_ORDER_4K); } diff --git a/include/mm/vmm.h b/include/mm/vmm.h index e8e48c21..fbdb927c 100644 --- a/include/mm/vmm.h +++ b/include/mm/vmm.h @@ -53,7 +53,9 @@ static inline void *get_free_page_top(uint32_t flags) { return get_free_page(flags) + PAGE_SIZE; } -static inline void put_page(void *page) { put_pages(page, PAGE_ORDER_4K); } +static inline void put_page(void *page) { + put_pages(page, PAGE_ORDER_4K); +} static inline void put_page_top(void *page) { put_pages(page - PAGE_SIZE, PAGE_ORDER_4K); diff --git a/include/sched.h b/include/sched.h index cb4a9671..8f433c20 100644 --- a/include/sched.h +++ b/include/sched.h @@ -88,7 +88,9 @@ extern void wait_for_task_group(const cpu_t *cpu, task_group_t group); /* Static declarations */ -static inline void set_task_group(task_t *task, task_group_t gid) { task->gid = gid; } +static inline void set_task_group(task_t *task, task_group_t gid) { + task->gid = gid; +} static inline void wait_for_cpu_tasks(cpu_t *cpu) { wait_for_task_group(cpu, TASK_GROUP_ALL); diff --git a/include/string.h b/include/string.h index 4c437d89..9a0a3c8a 100644 --- a/include/string.h +++ b/include/string.h @@ -27,27 +27,45 @@ #include #include -static inline int isspace(int c) { return c == ' ' || c == '\t'; } +static inline int isspace(int c) { + return c == ' ' || c == '\t'; +} -static inline int iseostr(int c) { return c == '\0'; } +static inline int iseostr(int c) { + return c == '\0'; +} -static inline int ispunct(int c) { return c == '.'; } +static inline int ispunct(int c) { + return c == '.'; +} -static inline int isdigit(int c) { return c >= '0' && c <= '9'; } +static inline int isdigit(int c) { + return c >= '0' && c <= '9'; +} static inline int isxdigit(int c) { return (isdigit(c) || (c >= 'A' && c <= 'F') || (c >= 'a' && c <= 'f')); } -static inline int isascii(int c) { return c >= 0 && c <= 127; } +static inline int isascii(int c) { + return c >= 0 && c <= 127; +} -static inline int islower(int c) { return c >= 'a' && c <= 'z'; } +static inline int islower(int c) { + return c >= 'a' && c <= 'z'; +} -static inline int isupper(int c) { return c >= 'A' && c <= 'Z'; } +static inline int isupper(int c) { + return c >= 'A' && c <= 'Z'; +} -static inline int isalpha(int c) { return islower(c) || isupper(c); } +static inline int isalpha(int c) { + return islower(c) || isupper(c); +} -static inline int isprint(char c) { return c >= 0x20 && c <= 0x7e; } +static inline int isprint(char c) { + return c >= 0x20 && c <= 0x7e; +} static inline size_t strlen(const char *str) { size_t len = 0; @@ -236,7 +254,9 @@ static inline const char *string_trim_whitspace(const char *s) { return s; } -static inline int string_empty(const char *s) { return !s || *s == '\0'; } +static inline int string_empty(const char *s) { + return !s || *s == '\0'; +} static inline int string_equal(const char *s1, const char *s2) { return (!s1 || !s2) ? s1 == s2 : !strcmp(s1, s2); diff --git a/include/time.h b/include/time.h index 63cc21c6..6e5bad40 100644 --- a/include/time.h +++ b/include/time.h @@ -32,6 +32,8 @@ extern time_t get_timer_ticks(void); /* Static declarations */ -static inline void msleep(time_t ms) { sleep(ms); } +static inline void msleep(time_t ms) { + sleep(ms); +} #endif diff --git a/lib/lib.c b/lib/lib.c index e02179ba..6e63cdc5 100644 --- a/lib/lib.c +++ b/lib/lib.c @@ -38,7 +38,9 @@ void __noreturn halt(void) { static uint64_t seed; -void srand(unsigned s) { seed = s - 1; } +void srand(unsigned s) { + seed = s - 1; +} int rand(void) { seed = 6364136223846793005ULL * seed + 1; diff --git a/lib/semaphore.c b/lib/semaphore.c index 00db75da..83d9d30a 100644 --- a/lib/semaphore.c +++ b/lib/semaphore.c @@ -33,7 +33,9 @@ void sem_init(sem_t *sem, uint32_t value) { atomic_set(&(sem->v), value); } -int32_t sem_value(const sem_t *sem) { return atomic_read(&sem->v); } +int32_t sem_value(const sem_t *sem) { + return atomic_read(&sem->v); +} bool sem_trywait(sem_t *sem) { int64_t val; @@ -79,6 +81,10 @@ void sem_wait_units(sem_t *sem, int32_t units) { } } -void sem_post(sem_t *sem) { atomic_inc(&(sem->v)); } +void sem_post(sem_t *sem) { + atomic_inc(&(sem->v)); +} -void sem_post_units(sem_t *sem, int32_t units) { atomic_add_return(&(sem->v), units); } +void sem_post_units(sem_t *sem, int32_t units) { + atomic_add_return(&(sem->v), units); +} diff --git a/lib/time.c b/lib/time.c index c2af0c47..f3bbd5ea 100644 --- a/lib/time.c +++ b/lib/time.c @@ -39,4 +39,6 @@ void sleep(time_t ms) { } } -time_t get_timer_ticks(void) { return ticks; } +time_t get_timer_ticks(void) { + return ticks; +} diff --git a/mm/pmm.c b/mm/pmm.c index 382dd225..e3486790 100644 --- a/mm/pmm.c +++ b/mm/pmm.c @@ -316,7 +316,9 @@ static inline void display_frames(void) { } } -void reclaim_frame(mfn_t mfn, unsigned int order) { add_frame(mfn, order); } +void reclaim_frame(mfn_t mfn, unsigned int order) { + add_frame(mfn, order); +} static inline void check_early_frames(void) { unsigned early_frames_cnt; diff --git a/mm/regions.c b/mm/regions.c index c97b692f..bf80ec55 100644 --- a/mm/regions.c +++ b/mm/regions.c @@ -106,6 +106,10 @@ int get_avail_memory_range(unsigned index, addr_range_t *r) { return mbi_get_avail_memory_range(index, r); } -bool has_memory_range(paddr_t pa) { return mbi_get_memory_range(pa, NULL) == 0; } +bool has_memory_range(paddr_t pa) { + return mbi_get_memory_range(pa, NULL) == 0; +} -void init_regions(void) { regions_num = mbi_get_avail_memory_ranges_num(); } +void init_regions(void) { + regions_num = mbi_get_avail_memory_ranges_num(); +} diff --git a/mm/slab.c b/mm/slab.c index 04859800..55798f73 100644 --- a/mm/slab.c +++ b/mm/slab.c @@ -259,7 +259,9 @@ static void *ktf_alloc(size_t size) { return alloc; } -void *kmalloc(size_t size) { return ktf_alloc(size); } +void *kmalloc(size_t size) { + return ktf_alloc(size); +} void *kzalloc(size_t size) { void *ptr = ktf_alloc(size); @@ -323,7 +325,9 @@ static void ktf_free(void *ptr) { UNREACHABLE(); } -void kfree(void *ptr) { ktf_free(ptr); } +void kfree(void *ptr) { + ktf_free(ptr); +} int init_slab(void) { int ret = 0; diff --git a/tests/unittests.c b/tests/unittests.c index 04bc2afa..779d6dda 100644 --- a/tests/unittests.c +++ b/tests/unittests.c @@ -64,7 +64,9 @@ static void cpu_freq_expect(const char *cpu_str, uint64_t expectation) { return; } -static int __user_text func(void *arg) { return 0; } +static int __user_text func(void *arg) { + return 0; +} int unit_tests(void *_unused) { usermode_call(func, NULL);