1
0
Fork 0
mirror of https://github.com/tailix/libkernaux.git synced 2024-10-30 11:54:01 -04:00

Rename argument

This commit is contained in:
Alex Kotov 2020-12-06 07:47:45 +05:00
parent fac70421d7
commit 683e86271e
Signed by: kotovalexarian
GPG key ID: 553C0EBBEB5D5F08
2 changed files with 65 additions and 65 deletions

View file

@ -334,13 +334,13 @@ __attribute__((nonnull));
void KernAux_Multiboot2_print( void KernAux_Multiboot2_print(
const struct KernAux_Multiboot2 *multiboot2, const struct KernAux_Multiboot2 *multiboot2,
void (*print)(const char *format, ...) void (*printf)(const char *format, ...)
) )
__attribute__((nonnull)); __attribute__((nonnull));
void KernAux_Multiboot2_TagBase_print( void KernAux_Multiboot2_TagBase_print(
const struct KernAux_Multiboot2_TagBase *tag_base, const struct KernAux_Multiboot2_TagBase *tag_base,
void (*print)(const char *format, ...) void (*printf)(const char *format, ...)
) )
__attribute__((nonnull)); __attribute__((nonnull));

View file

@ -8,13 +8,13 @@ static const char *KernAux_Multiboot2_TagType_to_str(
static void KernAux_Multiboot2_Tag_MemoryMap_print( static void KernAux_Multiboot2_Tag_MemoryMap_print(
const struct KernAux_Multiboot2_Tag_MemoryMap *tag, const struct KernAux_Multiboot2_Tag_MemoryMap *tag,
void (*print)(const char *format, ...) void (*printf)(const char *format, ...)
) )
__attribute__((nonnull)); __attribute__((nonnull));
static void KernAux_Multiboot2_Tag_ELFSymbols_print( static void KernAux_Multiboot2_Tag_ELFSymbols_print(
const struct KernAux_Multiboot2_Tag_ELFSymbols *tag, const struct KernAux_Multiboot2_Tag_ELFSymbols *tag,
void (*print)(const char *format, ...) void (*printf)(const char *format, ...)
) )
__attribute__((nonnull)); __attribute__((nonnull));
@ -73,11 +73,11 @@ const char *KernAux_Multiboot2_TagType_to_str(
void KernAux_Multiboot2_print( void KernAux_Multiboot2_print(
const struct KernAux_Multiboot2 *const multiboot2, const struct KernAux_Multiboot2 *const multiboot2,
void (*const print)(const char *format, ...) void (*const printf)(const char *format, ...)
) { ) {
print("Multiboot 2 info\n"); printf("Multiboot 2 info\n");
print(" size: %u\n", multiboot2->total_size); printf(" size: %u\n", multiboot2->total_size);
print(" reserved1: %u\n", multiboot2->reserved1); printf(" reserved1: %u\n", multiboot2->reserved1);
const struct KernAux_Multiboot2_TagBase *tag_base = const struct KernAux_Multiboot2_TagBase *tag_base =
(struct KernAux_Multiboot2_TagBase*)multiboot2->data; (struct KernAux_Multiboot2_TagBase*)multiboot2->data;
@ -87,7 +87,7 @@ void KernAux_Multiboot2_print(
return; return;
} }
KernAux_Multiboot2_TagBase_print(tag_base, print); KernAux_Multiboot2_TagBase_print(tag_base, printf);
tag_base = (struct KernAux_Multiboot2_TagBase*)( tag_base = (struct KernAux_Multiboot2_TagBase*)(
(void*)tag_base + ((tag_base->size + 7) & ~7) (void*)tag_base + ((tag_base->size + 7) & ~7)
@ -97,33 +97,33 @@ void KernAux_Multiboot2_print(
void KernAux_Multiboot2_TagBase_print( void KernAux_Multiboot2_TagBase_print(
const struct KernAux_Multiboot2_TagBase *const tag_base, const struct KernAux_Multiboot2_TagBase *const tag_base,
void (*const print)(const char *format, ...) void (*const printf)(const char *format, ...)
) { ) {
if (!KernAux_Multiboot2_TagBase_is_valid(tag_base)) { if (!KernAux_Multiboot2_TagBase_is_valid(tag_base)) {
return; return;
} }
print("Multiboot 2 tag\n"); printf("Multiboot 2 tag\n");
print( printf(
" type: %u (%s)\n", " type: %u (%s)\n",
tag_base->type, tag_base->type,
KernAux_Multiboot2_TagType_to_str(tag_base->type) KernAux_Multiboot2_TagType_to_str(tag_base->type)
); );
print(" size: %u\n", tag_base->size); printf(" size: %u\n", tag_base->size);
switch (tag_base->type) { switch (tag_base->type) {
case KERNAUX_MULTIBOOT2_TAGTYPE_NONE: case KERNAUX_MULTIBOOT2_TAGTYPE_NONE:
break; break;
case KERNAUX_MULTIBOOT2_TAGTYPE_BOOT_CMD_LINE: case KERNAUX_MULTIBOOT2_TAGTYPE_BOOT_CMD_LINE:
print( printf(
" cmdline: %s\n", " cmdline: %s\n",
((struct KernAux_Multiboot2_Tag_BootCmdLine*)tag_base)->cmdline ((struct KernAux_Multiboot2_Tag_BootCmdLine*)tag_base)->cmdline
); );
break; break;
case KERNAUX_MULTIBOOT2_TAGTYPE_BOOT_LOADER_NAME: case KERNAUX_MULTIBOOT2_TAGTYPE_BOOT_LOADER_NAME:
print( printf(
" name: %s\n", " name: %s\n",
((struct KernAux_Multiboot2_Tag_BootLoaderName*)tag_base)->name ((struct KernAux_Multiboot2_Tag_BootLoaderName*)tag_base)->name
); );
@ -133,9 +133,9 @@ void KernAux_Multiboot2_TagBase_print(
const struct KernAux_Multiboot2_Tag_Module *const tag_module = const struct KernAux_Multiboot2_Tag_Module *const tag_module =
(struct KernAux_Multiboot2_Tag_Module*)tag_base; (struct KernAux_Multiboot2_Tag_Module*)tag_base;
print(" start: %u\n", tag_module->mod_start); printf(" start: %u\n", tag_module->mod_start);
print(" end: %u\n", tag_module->mod_end); printf(" end: %u\n", tag_module->mod_end);
print(" cmdline: %s\n", tag_module->cmdline); printf(" cmdline: %s\n", tag_module->cmdline);
} }
break; break;
case KERNAUX_MULTIBOOT2_TAGTYPE_BASIC_MEMORY_INFO: case KERNAUX_MULTIBOOT2_TAGTYPE_BASIC_MEMORY_INFO:
@ -143,8 +143,8 @@ void KernAux_Multiboot2_TagBase_print(
const struct KernAux_Multiboot2_Tag_BasicMemoryInfo *const tag_bmi = const struct KernAux_Multiboot2_Tag_BasicMemoryInfo *const tag_bmi =
(struct KernAux_Multiboot2_Tag_BasicMemoryInfo*)tag_base; (struct KernAux_Multiboot2_Tag_BasicMemoryInfo*)tag_base;
print(" mem lower: %u\n", tag_bmi->mem_lower); printf(" mem lower: %u\n", tag_bmi->mem_lower);
print(" mem upper: %u\n", tag_bmi->mem_upper); printf(" mem upper: %u\n", tag_bmi->mem_upper);
} }
break; break;
case KERNAUX_MULTIBOOT2_TAGTYPE_BIOS_BOOT_DEVICE: case KERNAUX_MULTIBOOT2_TAGTYPE_BIOS_BOOT_DEVICE:
@ -152,15 +152,15 @@ void KernAux_Multiboot2_TagBase_print(
const struct KernAux_Multiboot2_Tag_BIOSBootDevice *const tag_bbd = const struct KernAux_Multiboot2_Tag_BIOSBootDevice *const tag_bbd =
(struct KernAux_Multiboot2_Tag_BIOSBootDevice*)tag_base; (struct KernAux_Multiboot2_Tag_BIOSBootDevice*)tag_base;
print(" bios dev: %u\n", tag_bbd->bios_dev); printf(" bios dev: %u\n", tag_bbd->bios_dev);
print(" partition: %u\n", tag_bbd->partition); printf(" partition: %u\n", tag_bbd->partition);
print(" sub_partition: %u\n", tag_bbd->sub_partition); printf(" sub_partition: %u\n", tag_bbd->sub_partition);
} }
break; break;
case KERNAUX_MULTIBOOT2_TAGTYPE_MEMORY_MAP: case KERNAUX_MULTIBOOT2_TAGTYPE_MEMORY_MAP:
KernAux_Multiboot2_Tag_MemoryMap_print( KernAux_Multiboot2_Tag_MemoryMap_print(
(struct KernAux_Multiboot2_Tag_MemoryMap*)tag_base, (struct KernAux_Multiboot2_Tag_MemoryMap*)tag_base,
print printf
); );
break; break;
case KERNAUX_MULTIBOOT2_TAGTYPE_VBE_INFO: case KERNAUX_MULTIBOOT2_TAGTYPE_VBE_INFO:
@ -168,10 +168,10 @@ void KernAux_Multiboot2_TagBase_print(
const struct KernAux_Multiboot2_Tag_VBEInfo *const tag_vbe = const struct KernAux_Multiboot2_Tag_VBEInfo *const tag_vbe =
(struct KernAux_Multiboot2_Tag_VBEInfo*)tag_base; (struct KernAux_Multiboot2_Tag_VBEInfo*)tag_base;
print(" VBE mode: %hu\n", tag_vbe->vbe_mode); printf(" VBE mode: %hu\n", tag_vbe->vbe_mode);
print(" VBE interface seg: %hu\n", tag_vbe->vbe_interface_seg); printf(" VBE interface seg: %hu\n", tag_vbe->vbe_interface_seg);
print(" VBE interface off: %hu\n", tag_vbe->vbe_interface_off); printf(" VBE interface off: %hu\n", tag_vbe->vbe_interface_off);
print(" VBE interface len: %hu\n", tag_vbe->vbe_interface_len); printf(" VBE interface len: %hu\n", tag_vbe->vbe_interface_len);
} }
break; break;
case KERNAUX_MULTIBOOT2_TAGTYPE_FRAMEBUFFER_INFO: case KERNAUX_MULTIBOOT2_TAGTYPE_FRAMEBUFFER_INFO:
@ -179,19 +179,19 @@ void KernAux_Multiboot2_TagBase_print(
const struct KernAux_Multiboot2_Tag_FramebufferInfo *const tag_fb = const struct KernAux_Multiboot2_Tag_FramebufferInfo *const tag_fb =
(struct KernAux_Multiboot2_Tag_FramebufferInfo*)tag_base; (struct KernAux_Multiboot2_Tag_FramebufferInfo*)tag_base;
print(" framebuffer addr: %llu\n", tag_fb->framebuffer_addr); printf(" framebuffer addr: %llu\n", tag_fb->framebuffer_addr);
print(" framebuffer pitch: %u\n", tag_fb->framebuffer_pitch); printf(" framebuffer pitch: %u\n", tag_fb->framebuffer_pitch);
print(" framebuffer width: %u\n", tag_fb->framebuffer_width); printf(" framebuffer width: %u\n", tag_fb->framebuffer_width);
print(" framebuffer height: %u\n", tag_fb->framebuffer_height); printf(" framebuffer height: %u\n", tag_fb->framebuffer_height);
print(" framebuffer bpp: %u\n", tag_fb->framebuffer_bpp); printf(" framebuffer bpp: %u\n", tag_fb->framebuffer_bpp);
print(" framebuffer type: %u\n", tag_fb->framebuffer_type); printf(" framebuffer type: %u\n", tag_fb->framebuffer_type);
print(" reserved1: %u\n", tag_fb->reserved1); printf(" reserved1: %u\n", tag_fb->reserved1);
} }
break; break;
case KERNAUX_MULTIBOOT2_TAGTYPE_ELF_SYMBOLS: case KERNAUX_MULTIBOOT2_TAGTYPE_ELF_SYMBOLS:
KernAux_Multiboot2_Tag_ELFSymbols_print( KernAux_Multiboot2_Tag_ELFSymbols_print(
(struct KernAux_Multiboot2_Tag_ELFSymbols*)tag_base, (struct KernAux_Multiboot2_Tag_ELFSymbols*)tag_base,
print printf
); );
break; break;
case KERNAUX_MULTIBOOT2_TAGTYPE_APM_TABLE: case KERNAUX_MULTIBOOT2_TAGTYPE_APM_TABLE:
@ -199,15 +199,15 @@ void KernAux_Multiboot2_TagBase_print(
const struct KernAux_Multiboot2_Tag_APMTable *const tag_apm = const struct KernAux_Multiboot2_Tag_APMTable *const tag_apm =
(struct KernAux_Multiboot2_Tag_APMTable*)tag_base; (struct KernAux_Multiboot2_Tag_APMTable*)tag_base;
print(" version: %hu\n", tag_apm->version); printf(" version: %hu\n", tag_apm->version);
print(" cseg: %hu\n", tag_apm->cseg); printf(" cseg: %hu\n", tag_apm->cseg);
print(" offset: %u\n", tag_apm->offset); printf(" offset: %u\n", tag_apm->offset);
print(" cseg 16: %hu\n", tag_apm->cseg_16); printf(" cseg 16: %hu\n", tag_apm->cseg_16);
print(" dseg: %hu\n", tag_apm->dseg); printf(" dseg: %hu\n", tag_apm->dseg);
print(" flags: %hu\n", tag_apm->flags); printf(" flags: %hu\n", tag_apm->flags);
print(" cseg len: %hu\n", tag_apm->cseg_len); printf(" cseg len: %hu\n", tag_apm->cseg_len);
print(" cseg 16 len: %hu\n", tag_apm->cseg_16_len); printf(" cseg 16 len: %hu\n", tag_apm->cseg_16_len);
print(" dseg len: %hu\n", tag_apm->dseg_len); printf(" dseg len: %hu\n", tag_apm->dseg_len);
} }
break; break;
case KERNAUX_MULTIBOOT2_TAGTYPE_EFI_32BIT_SYSTEM_TABLE_PTR: case KERNAUX_MULTIBOOT2_TAGTYPE_EFI_32BIT_SYSTEM_TABLE_PTR:
@ -225,10 +225,10 @@ void KernAux_Multiboot2_TagBase_print(
const struct KernAux_Multiboot2_Tag_SMBIOSTables *const tag_smbios = const struct KernAux_Multiboot2_Tag_SMBIOSTables *const tag_smbios =
(struct KernAux_Multiboot2_Tag_SMBIOSTables*)tag_base; (struct KernAux_Multiboot2_Tag_SMBIOSTables*)tag_base;
print(" major: %u\n", tag_smbios->major); printf(" major: %u\n", tag_smbios->major);
print(" minor: %u\n", tag_smbios->minor); printf(" minor: %u\n", tag_smbios->minor);
print( printf(
" reserved1: {%u, %u, %u, %u, %u, %u}\n", " reserved1: {%u, %u, %u, %u, %u, %u}\n",
tag_smbios->reserved1[0], tag_smbios->reserved1[0],
tag_smbios->reserved1[1], tag_smbios->reserved1[1],
@ -272,7 +272,7 @@ void KernAux_Multiboot2_TagBase_print(
} }
break; break;
case KERNAUX_MULTIBOOT2_TAGTYPE_IMAGE_LOAD_BASE_PHYS_ADDR: case KERNAUX_MULTIBOOT2_TAGTYPE_IMAGE_LOAD_BASE_PHYS_ADDR:
print( printf(
" load base addr: %u\n", " load base addr: %u\n",
((struct KernAux_Multiboot2_Tag_ImageLoadBasePhysAddr*)tag_base)-> ((struct KernAux_Multiboot2_Tag_ImageLoadBasePhysAddr*)tag_base)->
load_base_addr load_base_addr
@ -283,17 +283,17 @@ void KernAux_Multiboot2_TagBase_print(
void KernAux_Multiboot2_Tag_MemoryMap_print( void KernAux_Multiboot2_Tag_MemoryMap_print(
const struct KernAux_Multiboot2_Tag_MemoryMap *const tag, const struct KernAux_Multiboot2_Tag_MemoryMap *const tag,
void (*print)(const char *format, ...) void (*printf)(const char *format, ...)
) { ) {
if (!KernAux_Multiboot2_Tag_MemoryMap_is_valid(tag)) { if (!KernAux_Multiboot2_Tag_MemoryMap_is_valid(tag)) {
print(" invalid!\n"); printf(" invalid!\n");
return; return;
} }
print(" entry size: %u\n", tag->entry_size); printf(" entry size: %u\n", tag->entry_size);
print(" entry version: %u\n", tag->entry_version); printf(" entry version: %u\n", tag->entry_version);
print(" entries:\n"); printf(" entries:\n");
const struct KernAux_Multiboot2_Tag_MemoryMap_EntryBase *const entries = const struct KernAux_Multiboot2_Tag_MemoryMap_EntryBase *const entries =
(struct KernAux_Multiboot2_Tag_MemoryMap_EntryBase*)tag->data; (struct KernAux_Multiboot2_Tag_MemoryMap_EntryBase*)tag->data;
@ -303,27 +303,27 @@ void KernAux_Multiboot2_Tag_MemoryMap_print(
index < (tag->base.size - sizeof(*tag)) / tag->entry_size; index < (tag->base.size - sizeof(*tag)) / tag->entry_size;
++index ++index
) { ) {
print(" entry %u\n", index); printf(" entry %u\n", index);
print(" base addr: %llu\n", entries[index].base_addr); printf(" base addr: %llu\n", entries[index].base_addr);
print(" length: %llu\n", entries[index].length); printf(" length: %llu\n", entries[index].length);
print(" type: %u\n", entries[index].type); printf(" type: %u\n", entries[index].type);
print(" reserved1: %u\n", entries[index].reserved1); printf(" reserved1: %u\n", entries[index].reserved1);
} }
} }
void KernAux_Multiboot2_Tag_ELFSymbols_print( void KernAux_Multiboot2_Tag_ELFSymbols_print(
const struct KernAux_Multiboot2_Tag_ELFSymbols *const tag, const struct KernAux_Multiboot2_Tag_ELFSymbols *const tag,
void (*print)(const char *format, ...) void (*printf)(const char *format, ...)
) { ) {
if (!KernAux_Multiboot2_Tag_ELFSymbols_is_valid(tag)) { if (!KernAux_Multiboot2_Tag_ELFSymbols_is_valid(tag)) {
print(" invalid!\n"); printf(" invalid!\n");
return; return;
} }
print(" num: %hu\n", tag->num); printf(" num: %hu\n", tag->num);
print(" entsize: %hu\n", tag->ent_size); printf(" entsize: %hu\n", tag->ent_size);
print(" shndx: %hu\n", tag->shndx); printf(" shndx: %hu\n", tag->shndx);
print(" reserved1: %hu\n", tag->reserved1); printf(" reserved1: %hu\n", tag->reserved1);
// TODO: implement this // TODO: implement this
} }