kernel: don't use typedef for enums or non-opaque structs

This commit is contained in:
2023-04-12 20:17:11 +01:00
parent 0d75e347e9
commit b6f8c1ccaa
51 changed files with 663 additions and 665 deletions

View File

@@ -10,7 +10,7 @@
static int kmalloc_initialised = 0;
/* reserve space for the size-N caches: */
static vm_cache_t size_n_caches[] = {
static struct vm_cache size_n_caches[] = {
SIZE_N_CACHE(16),
SIZE_N_CACHE(32),
SIZE_N_CACHE(48),
@@ -40,7 +40,7 @@ void kmalloc_init(void)
kmalloc_initialised = 1;
}
void *kmalloc(size_t count, vm_flags_t flags)
void *kmalloc(size_t count, enum vm_flags flags)
{
if (!count) {
return NULL;
@@ -58,7 +58,7 @@ void *kmalloc(size_t count, vm_flags_t flags)
return memblock_alloc(count, align);
}
vm_cache_t *best_fit = NULL;
struct vm_cache *best_fit = NULL;
for (unsigned int i = 0; i < nr_size_n_caches; i++) {
if (size_n_caches[i].c_obj_size >= count) {
best_fit = &size_n_caches[i];
@@ -73,7 +73,7 @@ void *kmalloc(size_t count, vm_flags_t flags)
return vm_cache_alloc(best_fit, flags);
}
void *kzalloc(size_t count, vm_flags_t flags)
void *kzalloc(size_t count, enum vm_flags flags)
{
void *p = kmalloc(count, flags);
if (p) {
@@ -92,7 +92,7 @@ void kfree(void *p)
}
phys_addr_t phys = vm_virt_to_phys(p);
vm_page_t *pg = vm_page_get(phys);
struct vm_page *pg = vm_page_get(phys);
if (!pg || !pg->p_slab) {
return;
}