diff options
author | Richard Braun <rbraun@sceen.net> | 2017-04-29 21:52:54 +0200 |
---|---|---|
committer | Richard Braun <rbraun@sceen.net> | 2017-04-29 21:52:54 +0200 |
commit | d78a948f0a1d8b7b3385944c736d7cffd8ca67a7 (patch) | |
tree | 73f5b4b37b73311d768670f1838688dd4505d47a | |
parent | 6ba94ce79c8477758dd440d3563ffd4dd88883df (diff) |
kern/printk: rename to printf
The printk functions are close enough to the printf ones to bear the
same names.
32 files changed, 138 insertions, 138 deletions
diff --git a/Makefrag.am b/Makefrag.am index 1036aff9..b7013c23 100644 --- a/Makefrag.am +++ b/Makefrag.am @@ -46,8 +46,8 @@ x15_SOURCES += \ kern/plist.c \ kern/plist.h \ kern/plist_types.h \ - kern/printk.c \ - kern/printk.h \ + kern/printf.c \ + kern/printf.h \ kern/rbtree.c \ kern/rbtree.h \ kern/rbtree_i.h \ diff --git a/arch/x86/machine/acpimp.c b/arch/x86/machine/acpimp.c index 2c3dc6c2..527b3056 100644 --- a/arch/x86/machine/acpimp.c +++ b/arch/x86/machine/acpimp.c @@ -24,7 +24,7 @@ #include <kern/kmem.h> #include <kern/macros.h> #include <kern/panic.h> -#include <kern/printk.h> +#include <kern/printf.h> #include <machine/acpimp.h> #include <machine/biosmem.h> #include <machine/cpu.h> @@ -159,7 +159,7 @@ acpimp_register_table(struct acpimp_sdth *table) for (i = 0; i < ARRAY_SIZE(acpimp_table_addrs); i++) if (strcmp(sig, acpimp_table_addrs[i].sig) == 0) { if (acpimp_table_addrs[i].table != NULL) { - printk("acpimp: warning: table %s ignored:" + printf("acpimp: warning: table %s ignored:" " already registered\n", sig); return; } @@ -168,7 +168,7 @@ acpimp_register_table(struct acpimp_sdth *table) return; } - printk("acpimp: warning: table '%s' ignored: unknown table\n", sig); + printf("acpimp: warning: table '%s' ignored: unknown table\n", sig); } static struct acpimp_sdth * __init @@ -191,7 +191,7 @@ acpimp_check_tables(void) for (i = 0; i < ARRAY_SIZE(acpimp_table_addrs); i++) if (acpimp_table_addrs[i].table == NULL) { - printk("acpimp: error: table %s missing\n", + printf("acpimp: error: table %s missing\n", acpimp_table_addrs[i].sig); return -1; } @@ -325,7 +325,7 @@ acpimp_find_rsdp(struct acpimp_rsdp *rsdp) return 0; } - printk("acpimp: unable to find root system description pointer\n"); + printf("acpimp: unable to find root system description pointer\n"); return -1; } @@ -336,7 +336,7 @@ acpimp_info(void) rsdt = acpimp_lookup_table("RSDT"); assert(rsdt != NULL); - printk("acpimp: revision: %u, oem: %.*s\n", rsdt->revision, + printf("acpimp: revision: %u, oem: %.*s\n", rsdt->revision, (int)sizeof(rsdt->oem_id), rsdt->oem_id); } @@ -375,7 +375,7 @@ acpimp_copy_table(uint32_t addr) char sig[ACPIMP_SIG_SIZE]; acpimp_table_sig(table, sig); - printk("acpimp: table %s: invalid checksum\n", sig); + printf("acpimp: table %s: invalid checksum\n", sig); copy = NULL; goto out; } diff --git a/arch/x86/machine/biosmem.c b/arch/x86/machine/biosmem.c index fecf67a5..060be44e 100644 --- a/arch/x86/machine/biosmem.c +++ b/arch/x86/machine/biosmem.c @@ -25,7 +25,7 @@ #include <kern/macros.h> #include <kern/panic.h> #include <kern/param.h> -#include <kern/printk.h> +#include <kern/printf.h> #include <machine/biosmem.h> #include <machine/boot.h> #include <machine/cpu.h> @@ -224,7 +224,7 @@ biosmem_unregister_boot_data(phys_addr_t start, phys_addr_t end) } #if DEBUG - printk("biosmem: unregister boot data: %llx:%llx\n", + printf("biosmem: unregister boot data: %llx:%llx\n", (unsigned long long)biosmem_boot_data_array[i].start, (unsigned long long)biosmem_boot_data_array[i].end); #endif /* DEBUG */ @@ -776,16 +776,16 @@ biosmem_map_show(void) { const struct biosmem_map_entry *entry, *end; - printk("biosmem: physical memory map:\n"); + printf("biosmem: physical memory map:\n"); for (entry = biosmem_map, end = entry + biosmem_map_size; entry < end; entry++) - printk("biosmem: %018llx:%018llx, %s\n", entry->base_addr, + printf("biosmem: %018llx:%018llx, %s\n", entry->base_addr, entry->base_addr + entry->length, biosmem_type_desc(entry->type)); - printk("biosmem: heap: %llx:%llx\n", + printf("biosmem: heap: %llx:%llx\n", (unsigned long long)biosmem_heap_start, (unsigned long long)biosmem_heap_end); } @@ -806,12 +806,12 @@ biosmem_load_zone(struct biosmem_zone *zone, uint64_t max_phys_end) if (phys_end > max_phys_end) { if (max_phys_end <= phys_start) { - printk("biosmem: warning: zone %s physically unreachable, " + printf("biosmem: warning: zone %s physically unreachable, " "not loaded\n", vm_page_zone_name(zone_index)); return; } - printk("biosmem: warning: zone %s truncated to %#llx\n", + printf("biosmem: warning: zone %s truncated to %#llx\n", vm_page_zone_name(zone_index), (unsigned long long)max_phys_end); phys_end = max_phys_end; } @@ -889,7 +889,7 @@ biosmem_free_usable_range(phys_addr_t start, phys_addr_t end) struct vm_page *page; #if DEBUG - printk("biosmem: release to vm_page: %llx:%llx (%lluk)\n", + printf("biosmem: release to vm_page: %llx:%llx (%lluk)\n", (unsigned long long)start, (unsigned long long)end, (unsigned long long)((end - start) >> 10)); #endif diff --git a/arch/x86/machine/boot.c b/arch/x86/machine/boot.c index e14e2fc1..e7879011 100644 --- a/arch/x86/machine/boot.c +++ b/arch/x86/machine/boot.c @@ -54,7 +54,7 @@ #include <kern/panic.h> #include <kern/param.h> #include <kern/percpu.h> -#include <kern/printk.h> +#include <kern/printf.h> #include <kern/sleepq.h> #include <kern/sref.h> #include <kern/syscnt.h> @@ -307,7 +307,7 @@ boot_setup_paging(struct multiboot_raw_info *mbi, unsigned long eax) static void __init boot_show_version(void) { - printk(KERNEL_NAME "/" QUOTE(X15_X86_MACHINE) " " KERNEL_VERSION + printf(KERNEL_NAME "/" QUOTE(X15_X86_MACHINE) " " KERNEL_VERSION #ifdef X15_X86_PAE " PAE" #endif /* X15_X86_PAE */ @@ -453,7 +453,7 @@ boot_main(void) cpu_setup(); thread_bootstrap(); cga_setup(); - printk_setup(); + printf_setup(); boot_show_version(); pmap_bootstrap(); sref_bootstrap(); diff --git a/arch/x86/machine/cpu.c b/arch/x86/machine/cpu.c index 9bb593da..1fd3fa8f 100644 --- a/arch/x86/machine/cpu.c +++ b/arch/x86/machine/cpu.c @@ -25,7 +25,7 @@ #include <kern/panic.h> #include <kern/param.h> #include <kern/percpu.h> -#include <kern/printk.h> +#include <kern/printf.h> #include <kern/thread.h> #include <kern/xcall.h> #include <machine/acpimp.h> @@ -543,16 +543,16 @@ cpu_check(const struct cpu *cpu) void cpu_info(const struct cpu *cpu) { - printk("cpu%u: %s, type %u, family %u, model %u, stepping %u\n", + printf("cpu%u: %s, type %u, family %u, model %u, stepping %u\n", cpu->id, cpu->vendor_id, cpu->type, cpu->family, cpu->model, cpu->stepping); if (strlen(cpu->model_name) > 0) { - printk("cpu%u: %s\n", cpu->id, cpu->model_name); + printf("cpu%u: %s\n", cpu->id, cpu->model_name); } if ((cpu->phys_addr_width != 0) && (cpu->virt_addr_width != 0)) { - printk("cpu%u: address widths: physical: %hu, virtual: %hu\n", + printf("cpu%u: address widths: physical: %hu, virtual: %hu\n", cpu->id, cpu->phys_addr_width, cpu->virt_addr_width); } } @@ -597,7 +597,7 @@ cpu_mp_probe(void) panic("cpu: ACPI required to initialize local APIC"); } - printk("cpu: %u processor(s) configured\n", cpu_count()); + printf("cpu: %u processor(s) configured\n", cpu_count()); } void __init diff --git a/arch/x86/machine/lapic.c b/arch/x86/machine/lapic.c index c0d10e5c..90886c71 100644 --- a/arch/x86/machine/lapic.c +++ b/arch/x86/machine/lapic.c @@ -22,7 +22,7 @@ #include <kern/macros.h> #include <kern/panic.h> #include <kern/param.h> -#include <kern/printk.h> +#include <kern/printf.h> #include <kern/thread.h> #include <machine/cpu.h> #include <machine/lapic.h> @@ -211,7 +211,7 @@ lapic_setup_timer(void) cpu_delay(LAPIC_TIMER_CAL_DELAY); c2 = lapic_read(&lapic_map->timer_ccr); lapic_bus_freq = (c1 - c2) * (1000000 / LAPIC_TIMER_CAL_DELAY); - printk("lapic: bus frequency: %u.%02u MHz\n", lapic_bus_freq / 1000000, + printf("lapic: bus frequency: %u.%02u MHz\n", lapic_bus_freq / 1000000, lapic_bus_freq % 1000000); lapic_write(&lapic_map->timer_icr, lapic_bus_freq / HZ); } @@ -343,7 +343,7 @@ lapic_error_intr(struct trap_frame *frame) (void)frame; esr = lapic_read(&lapic_map->esr); - printk("lapic: error on cpu%u: esr:%08x\n", cpu_id(), esr); + printf("lapic: error on cpu%u: esr:%08x\n", cpu_id(), esr); lapic_write(&lapic_map->esr, 0); lapic_eoi(); } @@ -352,7 +352,7 @@ void lapic_spurious_intr(struct trap_frame *frame) { (void)frame; - printk("lapic: warning: spurious interrupt\n"); + printf("lapic: warning: spurious interrupt\n"); /* No EOI for this interrupt */ } diff --git a/arch/x86/machine/pmap.c b/arch/x86/machine/pmap.c index a7c49610..63a29095 100644 --- a/arch/x86/machine/pmap.c +++ b/arch/x86/machine/pmap.c @@ -1162,7 +1162,7 @@ pmap_enter_local(struct pmap *pmap, uintptr_t va, phys_addr_t pa, page = vm_page_alloc(0, VM_PAGE_SEL_DIRECTMAP, VM_PAGE_PMAP); if (page == NULL) { - printk("pmap: warning: page table page allocation failure\n"); + printf("pmap: warning: page table page allocation failure\n"); return ERROR_NOMEM; } diff --git a/arch/x86/machine/strace.c b/arch/x86/machine/strace.c index e40b3645..89f85698 100644 --- a/arch/x86/machine/strace.c +++ b/arch/x86/machine/strace.c @@ -21,7 +21,7 @@ #include <kern/init.h> #include <kern/kmem.h> #include <kern/param.h> -#include <kern/printk.h> +#include <kern/printf.h> #include <machine/elf.h> #include <machine/multiboot.h> #include <machine/pmap.h> @@ -74,9 +74,9 @@ strace_show_one(unsigned int index, unsigned long ip) name = strace_lookup(ip, &offset, &size); if (name == NULL) { - printk("strace: #%u [" STRACE_ADDR_FORMAT "]\n", index, ip); + printf("strace: #%u [" STRACE_ADDR_FORMAT "]\n", index, ip); } else { - printk("strace: #%u [" STRACE_ADDR_FORMAT "] %s+%#lx/%#lx\n", + printf("strace: #%u [" STRACE_ADDR_FORMAT "] %s+%#lx/%#lx\n", index, ip, name, (unsigned long)offset, (unsigned long)size); } } @@ -89,7 +89,7 @@ strace_show(unsigned long ip, unsigned long bp) unsigned int i; int error; - printk("strace: stack trace:\n"); + printf("strace: stack trace:\n"); strace_show_one(0, ip); i = 1; @@ -103,7 +103,7 @@ strace_show(unsigned long ip, unsigned long bp) error = pmap_kextract((uintptr_t)&frame[1], &pa); if (error) { - printk("strace: unmapped return address at %p\n", &frame[1]); + printf("strace: unmapped return address at %p\n", &frame[1]); break; } @@ -111,7 +111,7 @@ strace_show(unsigned long ip, unsigned long bp) error = pmap_kextract((uintptr_t)frame, &pa); if (error) { - printk("strace: unmapped frame address at %p\n", frame); + printf("strace: unmapped frame address at %p\n", frame); break; } @@ -119,7 +119,7 @@ strace_show(unsigned long ip, unsigned long bp) frame = frame[0]; } - printk("strace: end of trace\n"); + printf("strace: end of trace\n"); } static void * __init @@ -133,14 +133,14 @@ strace_copy_section(const struct elf_shdr *shdr) src = vm_kmem_map_pa(shdr->addr, shdr->size, &map_addr, &map_size); if (src == NULL) { - printk("strace: unable to map section\n"); + printf("strace: unable to map section\n"); goto error_map; } copy = kmem_alloc(shdr->size); if (copy == NULL) { - printk("strace: unable to allocate section copy\n"); + printf("strace: unable to allocate section copy\n"); goto error_copy; } @@ -191,12 +191,12 @@ strace_setup(const struct multiboot_raw_info *mbi) table = vm_kmem_map_pa(mbi->shdr_addr, size, &map_addr, &map_size); if (table == NULL) { - printk("strace: unable to map section headers table\n"); + printf("strace: unable to map section headers table\n"); goto no_syms; } if (mbi->shdr_strndx >= mbi->shdr_num) { - printk("strace: invalid section names index\n"); + printf("strace: invalid section names index\n"); goto error_shstrndx; } @@ -205,21 +205,21 @@ strace_setup(const struct multiboot_raw_info *mbi) &shstrtab_map_addr, &shstrtab_map_size); if (shstrtab == NULL) { - printk("strace: unable to map section names\n"); + printf("strace: unable to map section names\n"); goto error_shstrtab; } symtab_hdr = strace_lookup_section(mbi, table, shstrtab, ".symtab"); if (symtab_hdr == NULL) { - printk("strace: unable to find symbol table\n"); + printf("strace: unable to find symbol table\n"); goto error_symtab_lookup; } strtab_hdr = strace_lookup_section(mbi, table, shstrtab, ".strtab"); if (strtab_hdr == NULL) { - printk("strace: unable to find symbol string table\n"); + printf("strace: unable to find symbol string table\n"); goto error_strtab_lookup; } diff --git a/arch/x86/machine/trap.c b/arch/x86/machine/trap.c index 5aeb63c4..2d25ce92 100644 --- a/arch/x86/machine/trap.c +++ b/arch/x86/machine/trap.c @@ -23,7 +23,7 @@ #include <kern/init.h> #include <kern/macros.h> #include <kern/param.h> -#include <kern/printk.h> +#include <kern/printf.h> #include <kern/thread.h> #include <machine/cpu.h> #include <machine/lapic.h> @@ -112,7 +112,7 @@ trap_show_thread(void) struct thread *thread; thread = thread_self(); - printk("trap: interrupted thread: %p (%s)\n", thread, thread->name); + printf("trap: interrupted thread: %p (%s)\n", thread, thread->name); } static void @@ -151,7 +151,7 @@ trap_double_fault(struct trap_frame *frame) frame->ss = cpu->tss.ss; #endif /* __LP64__ */ - printk("trap: double fault (cpu%u):\n", cpu_id()); + printf("trap: double fault (cpu%u):\n", cpu_id()); trap_show_thread(); trap_frame_show(frame); trap_stack_show(frame); @@ -169,7 +169,7 @@ static void trap_default(struct trap_frame *frame) { cpu_halt_broadcast(); - printk("trap: unhandled interrupt or exception (cpu%u):\n", cpu_id()); + printf("trap: unhandled interrupt or exception (cpu%u):\n", cpu_id()); trap_show_thread(); trap_frame_show(frame); trap_stack_show(frame); @@ -255,7 +255,7 @@ trap_main(struct trap_frame *frame) void trap_frame_show(struct trap_frame *frame) { - printk("trap: rax: %016lx rbx: %016lx rcx: %016lx\n" + printf("trap: rax: %016lx rbx: %016lx rcx: %016lx\n" "trap: rdx: %016lx rbp: %016lx rsi: %016lx\n" "trap: rdi: %016lx r8: %016lx r9: %016lx\n" "trap: r10: %016lx r11: %016lx r12: %016lx\n" @@ -277,7 +277,7 @@ trap_frame_show(struct trap_frame *frame) /* XXX Until the page fault handler is written */ if (frame->vector == 14) { - printk("trap: cr2: %016lx\n", (unsigned long)cpu_get_cr2()); + printf("trap: cr2: %016lx\n", (unsigned long)cpu_get_cr2()); } } @@ -296,7 +296,7 @@ trap_frame_show(struct trap_frame *frame) ss = 0; } - printk("trap: eax: %08lx ebx: %08lx ecx: %08lx edx: %08lx\n" + printf("trap: eax: %08lx ebx: %08lx ecx: %08lx edx: %08lx\n" "trap: ebp: %08lx esi: %08lx edi: %08lx\n" "trap: ds: %hu es: %hu fs: %hu gs: %hu\n" "trap: vector: %lu error: %08lx\n" @@ -315,7 +315,7 @@ trap_frame_show(struct trap_frame *frame) /* XXX Until the page fault handler is written */ if (frame->vector == 14) { - printk("trap: cr2: %08lx\n", (unsigned long)cpu_get_cr2()); + printf("trap: cr2: %08lx\n", (unsigned long)cpu_get_cr2()); } } diff --git a/arch/x86/machine/trap.h b/arch/x86/machine/trap.h index a9369fd2..f38c0c4b 100644 --- a/arch/x86/machine/trap.h +++ b/arch/x86/machine/trap.h @@ -70,7 +70,7 @@ #include <stdint.h> #include <kern/macros.h> -#include <kern/printk.h> +#include <kern/printf.h> #ifdef __LP64__ @@ -127,7 +127,7 @@ struct trap_frame { static inline void trap_test_double_fault(void) { - printk("trap: double fault test\n"); + printf("trap: double fault test\n"); asm volatile("movl $0xdead, %esp; push $0"); } diff --git a/doc/intro.9.txt b/doc/intro.9.txt index 16635ada..c53f65f1 100644 --- a/doc/intro.9.txt +++ b/doc/intro.9.txt @@ -119,7 +119,7 @@ module:kern/list:: Linked list. module:kern/macros:: Useful generic macros. -module:kern/printk:: +module:kern/printf:: Formatted output functions. module:kern/rbtree:: Red-black tree. diff --git a/doc/style.9.txt b/doc/style.9.txt index 94f2515e..101f3406 100644 --- a/doc/style.9.txt +++ b/doc/style.9.txt @@ -634,7 +634,7 @@ error = do_something(); if (error) { if (error != ERROR_AGAIN) { - printk("unexpected error\n"); + printf("unexpected error\n"); } return error; diff --git a/kern/kmem.c b/kern/kmem.c index d9ca7e4a..60b8db9c 100644 --- a/kern/kmem.c +++ b/kern/kmem.c @@ -57,7 +57,7 @@ #include <kern/mutex.h> #include <kern/panic.h> #include <kern/param.h> -#include <kern/printk.h> +#include <kern/printf.h> #include <kern/sprintf.h> #include <kern/thread.h> #include <machine/cpu.h> @@ -441,7 +441,7 @@ kmem_cache_error(struct kmem_cache *cache, void *buf, int error, void *arg) { struct kmem_buftag *buftag; - printk("kmem: error: cache: %s, buffer: %p\n", cache->name, buf); + printf("kmem: error: cache: %s, buffer: %p\n", cache->name, buf); switch(error) { case KMEM_ERR_INVALID: @@ -1111,7 +1111,7 @@ kmem_cache_info(struct kmem_cache *cache) mutex_lock(&cache->lock); - printk("kmem: name: %s\n" + printf("kmem: name: %s\n" "kmem: flags: 0x%x%s\n" "kmem: obj_size: %zu\n" "kmem: align: %zu\n" @@ -1286,7 +1286,7 @@ kmem_info(void) struct kmem_cache *cache; size_t mem_usage, mem_reclaimable; - printk("kmem: cache obj slab bufs objs bufs " + printf("kmem: cache obj slab bufs objs bufs " " total reclaimable\n" "kmem: name size size /slab usage count " " memory memory\n"); @@ -1299,7 +1299,7 @@ kmem_info(void) mem_usage = (cache->nr_slabs * cache->slab_size) >> 10; mem_reclaimable = (cache->nr_free_slabs * cache->slab_size) >> 10; - printk("kmem: %-19s %6zu %3zuk %4lu %6lu %6lu %7zuk %10zuk\n", + printf("kmem: %-19s %6zu %3zuk %4lu %6lu %6lu %7zuk %10zuk\n", cache->name, cache->obj_size, cache->slab_size >> 10, cache->bufs_per_slab, cache->nr_objs, cache->nr_bufs, mem_usage, mem_reclaimable); diff --git a/kern/llsync.c b/kern/llsync.c index 023548a9..0c81c0ff 100644 --- a/kern/llsync.c +++ b/kern/llsync.c @@ -46,7 +46,7 @@ #include <kern/mutex.h> #include <kern/param.h> #include <kern/percpu.h> -#include <kern/printk.h> +#include <kern/printf.h> #include <kern/spinlock.h> #include <kern/sprintf.h> #include <kern/syscnt.h> @@ -123,7 +123,7 @@ llsync_process_global_checkpoint(void) /* TODO Handle hysteresis */ if (!llsync_data.no_warning && (nr_works >= LLSYNC_NR_PENDING_WORKS_WARN)) { llsync_data.no_warning = 1; - printk("llsync: warning: large number of pending works\n"); + printf("llsync: warning: large number of pending works\n"); } if (llsync_data.nr_registered_cpus == 0) { diff --git a/kern/panic.c b/kern/panic.c index a9599f26..470c4212 100644 --- a/kern/panic.c +++ b/kern/panic.c @@ -19,7 +19,7 @@ #include <kern/atomic.h> #include <kern/panic.h> -#include <kern/printk.h> +#include <kern/printf.h> #include <machine/cpu.h> #include <machine/strace.h> @@ -42,10 +42,10 @@ panic(const char *format, ...) cpu_intr_disable(); cpu_halt_broadcast(); - printk("\npanic: "); + printf("\npanic: "); va_start(list, format); - vprintk(format, list); - printk("\n"); + vprintf(format, list); + printf("\n"); strace_dump(); cpu_halt(); diff --git a/kern/percpu.c b/kern/percpu.c index ad007724..6008b64c 100644 --- a/kern/percpu.c +++ b/kern/percpu.c @@ -26,7 +26,7 @@ #include <kern/panic.h> #include <kern/param.h> #include <kern/percpu.h> -#include <kern/printk.h> +#include <kern/printf.h> #include <machine/cpu.h> #include <vm/vm_kmem.h> #include <vm/vm_page.h> @@ -50,7 +50,7 @@ percpu_setup(void) unsigned int order; percpu_area_size = &_percpu_end - &_percpu; - printk("percpu: max_cpus: %u, section size: %zuk\n", X15_MAX_CPUS, + printf("percpu: max_cpus: %u, section size: %zuk\n", X15_MAX_CPUS, percpu_area_size >> 10); assert(vm_page_aligned(percpu_area_size)); @@ -77,7 +77,7 @@ percpu_add(unsigned int cpu) if (cpu >= ARRAY_SIZE(percpu_areas)) { if (!percpu_skip_warning) { - printk("percpu: ignoring processor beyond id %zu\n", + printf("percpu: ignoring processor beyond id %zu\n", ARRAY_SIZE(percpu_areas) - 1); percpu_skip_warning = 1; } @@ -86,7 +86,7 @@ percpu_add(unsigned int cpu) } if (percpu_areas[cpu] != NULL) { - printk("percpu: error: id %u ignored, already registered\n", cpu); + printf("percpu: error: id %u ignored, already registered\n", cpu); return ERROR_INVAL; } @@ -98,7 +98,7 @@ percpu_add(unsigned int cpu) page = vm_page_alloc(order, VM_PAGE_SEL_DIRECTMAP, VM_PAGE_KERNEL); if (page == NULL) { - printk("percpu: error: unable to allocate percpu area\n"); + printf("percpu: error: unable to allocate percpu area\n"); return ERROR_NOMEM; } diff --git a/kern/printk.c b/kern/printf.c index dd5cc87f..6cd6464b 100644 --- a/kern/printk.c +++ b/kern/printf.c @@ -15,7 +15,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include <kern/printk.h> +#include <kern/printf.h> #include <kern/spinlock.h> #include <kern/sprintf.h> #include <machine/cpu.h> @@ -30,44 +30,44 @@ */ extern void console_write_byte(char c); -static char printk_buffer[PRINTK_BUFSIZE]; -static struct spinlock printk_lock; +static char printf_buffer[PRINTK_BUFSIZE]; +static struct spinlock printf_lock; int -printk(const char *format, ...) +printf(const char *format, ...) { va_list ap; int length; va_start(ap, format); - length = vprintk(format, ap); + length = vprintf(format, ap); va_end(ap); return length; } int -vprintk(const char *format, va_list ap) +vprintf(const char *format, va_list ap) { unsigned long flags; int length; char *ptr; - spinlock_lock_intr_save(&printk_lock, &flags); + spinlock_lock_intr_save(&printf_lock, &flags); - length = vsnprintf(printk_buffer, sizeof(printk_buffer), format, ap); + length = vsnprintf(printf_buffer, sizeof(printf_buffer), format, ap); - for (ptr = printk_buffer; *ptr != '\0'; ptr++) { + for (ptr = printf_buffer; *ptr != '\0'; ptr++) { console_write_byte(*ptr); } - spinlock_unlock_intr_restore(&printk_lock, flags); + spinlock_unlock_intr_restore(&printf_lock, flags); return length; } void -printk_setup(void) +printf_setup(void) { - spinlock_init(&printk_lock); + spinlock_init(&printf_lock); } diff --git a/kern/printk.h b/kern/printf.h index 02173b33..efaf2f9c 100644 --- a/kern/printk.h +++ b/kern/printf.h @@ -17,7 +17,7 @@ * * Formatted output functions. * - * The printk() and vprintk() functions internally use a statically + * The printf() and vprintf() functions internally use a statically * allocated buffer. They won't produce output larger than 1 KiB. They can * be used safely in any context. * @@ -31,8 +31,8 @@ #include <kern/macros.h> -int printk(const char *format, ...) __format_printf(1, 2); -int vprintk(const char *format, va_list ap) __format_printf(1, 0); -void printk_setup(void); +int printf(const char *format, ...) __format_printf(1, 2); +int vprintf(const char *format, va_list ap) __format_printf(1, 0); +void printf_setup(void); #endif /* _KERN_PRINTK_H */ diff --git a/kern/sref.c b/kern/sref.c index 23fb0ad6..9c2ddead 100644 --- a/kern/sref.c +++ b/kern/sref.c @@ -503,7 +503,7 @@ sref_end_epoch(struct sref_queue *queue) if (!sref_data.no_warning && (sref_review_queue_size() >= SREF_NR_COUNTERS_WARN)) { sref_data.no_warning = 1; - printk("sref: warning: large number of counters in review queue\n"); + printf("sref: warning: large number of counters in review queue\n"); } if (sref_data.nr_registered_cpus == 1) { diff --git a/kern/syscnt.c b/kern/syscnt.c index 4336ef1e..74559ea5 100644 --- a/kern/syscnt.c +++ b/kern/syscnt.c @@ -21,7 +21,7 @@ #include <kern/init.h> #include <kern/list.h> #include <kern/mutex.h> -#include <kern/printk.h> +#include <kern/printf.h> #include <kern/spinlock.h> #include <kern/syscnt.h> @@ -61,7 +61,7 @@ syscnt_info(const char *prefix) prefix_length = (prefix == NULL) ? 0 : strlen(prefix); - printk("syscnt: name value\n"); + printf("syscnt: name value\n"); mutex_lock(&syscnt_lock); @@ -77,7 +77,7 @@ syscnt_info(const char *prefix) value = syscnt_read(syscnt); - printk("syscnt: %-30s %17llu\n", syscnt->name, + printf("syscnt: %-30s %17llu\n", syscnt->name, (unsigned long long)value); } diff --git a/kern/task.c b/kern/task.c index c7caeb48..d2aaa80d 100644 --- a/kern/task.c +++ b/kern/task.c @@ -131,7 +131,7 @@ task_info(struct task *task) spinlock_lock(&task_list_lock); list_for_each_entry(&task_list, task, node) { - printk("task: %s\n", task->name); + printf("task: %s\n", task->name); } spinlock_unlock(&task_list_lock); @@ -141,7 +141,7 @@ task_info(struct task *task) spinlock_lock(&task->lock); - printk("task: name: %s, threads:\n", task->name); + printf("task: name: %s, threads:\n", task->name); /* * Don't grab any lock when accessing threads, so that the function @@ -150,7 +150,7 @@ task_info(struct task *task) * so holding the task lock is enough to guarantee existence. */ list_for_each_entry(&task->threads, thread, task_node) { - printk(TASK_INFO_ADDR_FMT " %c %8s:" TASK_INFO_ADDR_FMT + printf(TASK_INFO_ADDR_FMT " %c %8s:" TASK_INFO_ADDR_FMT " %.2s:%02hu %02u %s\n", (unsigned long)thread, thread_state_to_chr(thread), diff --git a/kern/work.c b/kern/work.c index f6309e79..a81e8de3 100644 --- a/kern/work.c +++ b/kern/work.c @@ -27,7 +27,7 @@ #include <kern/panic.h> #include <kern/param.h> #include <kern/percpu.h> -#include <kern/printk.h> +#include <kern/printf.h> #include <kern/spinlock.h> #include <kern/sprintf.h> #include <kern/syscnt.h> @@ -375,7 +375,7 @@ work_process(void *arg) if (error) { work_pool_free_id(pool, id); - printk("work: warning: unable to create worker thread\n"); + printf("work: warning: unable to create worker thread\n"); } } } @@ -491,7 +491,7 @@ work_setup(void) work_pool_init(&work_pool_highprio, WORK_INVALID_CPU, WORK_PF_GLOBAL | WORK_PF_HIGHPRIO); - printk("work: threads per pool (per-cpu/global): %u/%u, spare: %u\n", + printf("work: threads per pool (per-cpu/global): %u/%u, spare: %u\n", percpu_var(work_pool_cpu_main.max_threads, 0), work_pool_main.max_threads, WORK_THREADS_SPARE); } diff --git a/test/test_llsync_defer.c b/test/test_llsync_defer.c index 929ece64..9bce0162 100644 --- a/test/test_llsync_defer.c +++ b/test/test_llsync_defer.c @@ -39,7 +39,7 @@ #include <kern/mutex.h> #include <kern/panic.h> #include <kern/param.h> -#include <kern/printk.h> +#include <kern/printf.h> #include <kern/thread.h> #include <kern/work.h> #include <test/test.h> @@ -91,7 +91,7 @@ test_alloc(void *arg) condition_signal(&test_condition); if ((i % TEST_LOOPS_PER_PRINT) == 0) { - printk("alloc "); + printf("alloc "); } i++; @@ -140,7 +140,7 @@ test_free(void *arg) condition_signal(&test_condition); if ((i % TEST_LOOPS_PER_PRINT) == 0) { - printk("free "); + printf("free "); } i++; @@ -173,7 +173,7 @@ test_read(void *arg) } if ((i % TEST_LOOPS_PER_PRINT) == 0) { - printk("read "); + printf("read "); } i++; diff --git a/test/test_mutex_pi.c b/test/test_mutex_pi.c index ca03b32b..8f864756 100644 --- a/test/test_mutex_pi.c +++ b/test/test_mutex_pi.c @@ -84,7 +84,7 @@ #include <kern/error.h> #include <kern/mutex.h> #include <kern/panic.h> -#include <kern/printk.h> +#include <kern/printf.h> #include <kern/syscnt.h> #include <kern/thread.h> #include <kern/turnstile.h> @@ -181,7 +181,7 @@ test_for_priority_boosted(unsigned short *highest_priority) } if (real_priority > *highest_priority) { - printk("%c: real priority boosted to %s\n", + printf("%c: real priority boosted to %s\n", test_get_name(), test_thread_from_priority(real_priority)); *highest_priority = real_priority; } @@ -215,7 +215,7 @@ test_for_priority_deboosted(void) static void test_report_progress(unsigned int i) { - printk("%c:%u ", test_get_name(), i); + printf("%c:%u ", test_get_name(), i); } static void @@ -304,7 +304,7 @@ test_manage_b(void *arg) test_consume_cpu(); } - printk("b:%u ", i); + printf("b:%u ", i); syscnt_info("thread_boosts"); } } diff --git a/test/test_pmap_update_mp.c b/test/test_pmap_update_mp.c index 5f40c8ce..0c5e2dbd 100644 --- a/test/test_pmap_update_mp.c +++ b/test/test_pmap_update_mp.c @@ -33,7 +33,7 @@ #include <kern/mutex.h> #include <kern/panic.h> #include <kern/param.h> -#include <kern/printk.h> +#include <kern/printf.h> #include <kern/thread.h> #include <test/test.h> #include <vm/vm_kmem.h> @@ -49,12 +49,12 @@ test_run1(void *arg) (void)arg; - printk("allocating page\n"); + printf("allocating page\n"); ptr = vm_kmem_alloc(PAGE_SIZE); - printk("writing page\n"); + printf("writing page\n"); memset(ptr, 'a', PAGE_SIZE); - printk("passing page to second thread (%p)\n", ptr); + printf("passing page to second thread (%p)\n", ptr); mutex_lock(&test_lock); test_va = ptr; @@ -70,7 +70,7 @@ test_run2(void *arg) (void)arg; - printk("waiting for page\n"); + printf("waiting for page\n"); mutex_lock(&test_lock); @@ -82,7 +82,7 @@ test_run2(void *arg) mutex_unlock(&test_lock); - printk("page received (%p), checking page\n", ptr); + printf("page received (%p), checking page\n", ptr); for (i = 0; i < PAGE_SIZE; i++) { if (ptr[i] != 'a') { @@ -91,7 +91,7 @@ test_run2(void *arg) } vm_kmem_free(ptr, PAGE_SIZE); - printk("done\n"); + printf("done\n"); } void diff --git a/test/test_sref_dirty_zeroes.c b/test/test_sref_dirty_zeroes.c index 2b844d47..40997601 100644 --- a/test/test_sref_dirty_zeroes.c +++ b/test/test_sref_dirty_zeroes.c @@ -67,7 +67,7 @@ test_inc(void *arg) mutex_unlock(&test_lock); } - printk("counter global value: %lu\n", test_counter.value); + printf("counter global value: %lu\n", test_counter.value); syscnt_info("sref_epoch"); syscnt_info("sref_dirty_zero"); syscnt_info("sref_true_zero"); diff --git a/test/test_sref_noref.c b/test/test_sref_noref.c index d7dbc3d0..b98edd38 100644 --- a/test/test_sref_noref.c +++ b/test/test_sref_noref.c @@ -76,7 +76,7 @@ test_ref(void *arg) mutex_lock(&test_lock); - printk("waiting for page\n"); + printf("waiting for page\n"); while (test_obj == NULL) { condition_wait(&test_condition, &test_lock); @@ -86,13 +86,13 @@ test_ref(void *arg) mutex_unlock(&test_lock); - printk("page received, manipulate reference counter\n"); + printf("page received, manipulate reference counter\n"); while (!test_stop) { test_manipulate_counter(obj); } - printk("thread exiting\n"); + printf("thread exiting\n"); } static void @@ -102,7 +102,7 @@ test_obj_noref(struct sref_counter *counter) obj = structof(counter, struct test_obj, ref_counter); vm_kmem_free(obj, sizeof(*obj)); - printk("0 references, page released\n"); + printf("0 references, page released\n"); syscnt_info("sref_epoch"); syscnt_info("sref_dirty_zero"); syscnt_info("sref_true_zero"); @@ -135,7 +135,7 @@ test_run(void *arg) error_check(error, "thread_create"); } - printk("allocating page\n"); + printf("allocating page\n"); obj = vm_kmem_alloc(sizeof(*obj)); if (obj == NULL) { @@ -144,7 +144,7 @@ test_run(void *arg) sref_counter_init(&obj->ref_counter, NULL, test_obj_noref); - printk("page allocated, 1 reference, publishing\n"); + printf("page allocated, 1 reference, publishing\n"); mutex_lock(&test_lock); test_obj = obj; @@ -155,14 +155,14 @@ test_run(void *arg) test_manipulate_counter(obj); } - printk("stopping test, wait for threads\n"); + printf("stopping test, wait for threads\n"); test_stop = 1; for (i = 0; i < nr_threads; i++) { thread_join(threads[i]); } - printk("releasing initial reference\n"); + printf("releasing initial reference\n"); sref_counter_dec(&obj->ref_counter); kmem_free(threads, sizeof(*threads) * nr_threads); diff --git a/test/test_sref_weakref.c b/test/test_sref_weakref.c index e28851f7..65918a1f 100644 --- a/test/test_sref_weakref.c +++ b/test/test_sref_weakref.c @@ -71,7 +71,7 @@ test_run(void *arg) for (j = 0; j < 0x20000000; j++); - printk("run: iterations: %lu\n", i); + printf("run: iterations: %lu\n", i); syscnt_info("sref_epoch"); syscnt_info("sref_dirty_zero"); syscnt_info("sref_revive"); @@ -95,7 +95,7 @@ test_ref(void *arg) } if ((i % 100000000) == 0) { - printk("ref: iterations: %lu\n", i); + printf("ref: iterations: %lu\n", i); } } } diff --git a/test/test_vm_page_fill.c b/test/test_vm_page_fill.c index c334407d..71711995 100644 --- a/test/test_vm_page_fill.c +++ b/test/test_vm_page_fill.c @@ -115,7 +115,7 @@ test_run(void *arg) (void)arg; for (i = 0; /* no condition */; i++) { - printk("test: pass:%u pattern:%hhx\n", i, test_pattern); + printf("test: pass:%u pattern:%hhx\n", i, test_pattern); test_write_pages(); test_reset_pages(); test_pattern++; diff --git a/test/test_xcall.c b/test/test_xcall.c index ab4fa113..3552944a 100644 --- a/test/test_xcall.c +++ b/test/test_xcall.c @@ -25,7 +25,7 @@ #include <kern/error.h> #include <kern/cpumap.h> #include <kern/panic.h> -#include <kern/printk.h> +#include <kern/printf.h> #include <kern/thread.h> #include <kern/xcall.h> #include <test/test.h> @@ -37,7 +37,7 @@ test_fn(void *arg) { (void)arg; - printk("function called, running on cpu%u\n", cpu_id()); + printf("function called, running on cpu%u\n", cpu_id()); test_done = 1; } @@ -46,7 +46,7 @@ test_once(unsigned int cpu) { test_done = 0; - printk("cross-call on cpu%u:\n", cpu); + printf("cross-call on cpu%u:\n", cpu); xcall_call(test_fn, NULL, cpu); if (!test_done) { @@ -61,7 +61,7 @@ test_run(void *arg) test_once(0); test_once(1); - printk("done\n"); + printf("done\n"); } void diff --git a/vm/vm_map.c b/vm/vm_map.c index 7e91f9eb..217aae7a 100644 --- a/vm/vm_map.c +++ b/vm/vm_map.c @@ -31,7 +31,7 @@ #include <kern/mutex.h> #include <kern/panic.h> #include <kern/param.h> -#include <kern/printk.h> +#include <kern/printf.h> #include <kern/rbtree.h> #include <machine/pmap.h> #include <vm/vm_adv.h> @@ -751,7 +751,7 @@ vm_map_info(struct vm_map *map) mutex_lock(&map->lock); - printk("vm_map: %s: %016lx-%016lx\n" + printf("vm_map: %s: %016lx-%016lx\n" "vm_map: start end " "size offset flags type\n", name, (unsigned long)map->start, (unsigned long)map->end); @@ -763,13 +763,13 @@ vm_map_info(struct vm_map *map) type = "object"; } - printk("vm_map: %016lx %016lx %8luk %08llx %08x %s\n", + printf("vm_map: %016lx %016lx %8luk %08llx %08x %s\n", (unsigned long)entry->start, (unsigned long)entry->end, (unsigned long)(entry->end - entry->start) >> 10, (unsigned long long)entry->offset, entry->flags, type); } - printk("vm_map: total: %zuk\n", map->size >> 10); + printf("vm_map: total: %zuk\n", map->size >> 10); mutex_unlock(&map->lock); } diff --git a/vm/vm_page.c b/vm/vm_page.c index cbbfd137..138f028a 100644 --- a/vm/vm_page.c +++ b/vm/vm_page.c @@ -41,7 +41,7 @@ #include <kern/mutex.h> #include <kern/panic.h> #include <kern/param.h> -#include <kern/printk.h> +#include <kern/printf.h> #include <kern/sprintf.h> #include <kern/thread.h> #include <machine/cpu.h> @@ -512,7 +512,7 @@ vm_page_load(unsigned int zone_index, phys_addr_t start, phys_addr_t end) zone->heap_present = false; #if DEBUG - printk("vm_page: load: %s: %llx:%llx\n", + printf("vm_page: load: %s: %llx:%llx\n", vm_page_zone_name(zone_index), (unsigned long long)start, (unsigned long long)end); #endif @@ -539,7 +539,7 @@ vm_page_load_heap(unsigned int zone_index, phys_addr_t start, phys_addr_t end) zone->heap_present = true; #if DEBUG - printk("vm_page: heap: %s: %llx:%llx\n", + printf("vm_page: heap: %s: %llx:%llx\n", vm_page_zone_name(zone_index), (unsigned long long)start, (unsigned long long)end); #endif @@ -664,7 +664,7 @@ vm_page_setup(void) } table_size = vm_page_round(nr_pages * sizeof(struct vm_page)); - printk("vm_page: page table size: %zu entries (%zuk)\n", nr_pages, + printf("vm_page: page table size: %zu entries (%zuk)\n", nr_pages, table_size >> 10); table = vm_page_bootalloc(table_size); va = (uintptr_t)table; @@ -782,7 +782,7 @@ vm_page_info(void) for (i = 0; i < vm_page_zones_size; i++) { zone = &vm_page_zones[i]; pages = (unsigned long)(zone->pages_end - zone->pages); - printk("vm_page: %s: pages: %lu (%luM), free: %lu (%luM)\n", + printf("vm_page: %s: pages: %lu (%luM), free: %lu (%luM)\n", vm_page_zone_name(i), pages, pages >> (20 - PAGE_SHIFT), zone->nr_free_pages, zone->nr_free_pages >> (20 - PAGE_SHIFT)); } |