[log] More logging, make output of dmesg prettier

This commit is contained in:
Kevin Lange 2011-12-14 19:43:14 -06:00
parent 6d27ef0ffe
commit 258e2bfbfe
7 changed files with 26 additions and 10 deletions

View File

@ -3,6 +3,7 @@
#include <system.h>
#include <ext2.h>
#include <fs.h>
#include <logging.h>
#define EXT2_DEBUG_BLOCK_DESCRIPTORS 0
@ -503,6 +504,7 @@ void ext2_disk_mount() {
RN = (fs_node_t *)malloc(sizeof(fs_node_t));
assert(ext2_disk_node_root(root_inode, RN));
fs_root = RN;
LOG(INFO,"Mounted EXT2 disk, root VFS node is at 0x%x", RN);
}
void ext2_disk_forget_superblock() {

View File

@ -1,6 +1,7 @@
#include <system.h>
#include <ext2.h>
#include <fs.h>
#include <logging.h>
ext2_superblock_t * initrd_superblock;
ext2_inodetable_t * initrd_root_node;
@ -387,4 +388,5 @@ initrd_mount(
initrd_root = (fs_node_t *)malloc(sizeof(fs_node_t));
assert(initrd_node_root(root_inode, initrd_root));
fs_root = initrd_root;
LOG(INFO, "Mounted EXT2 ramdisk at 0x%x-0x%x, root VFS node is 0x%x", mem_head, mem_top, initrd_root);
}

View File

@ -99,7 +99,7 @@ vasprintf(char * buf, const char *fmt, va_list args) {
* @param fmt Formatted string to print
* @param ... Additional arguments to format
*/
void
int
kprintf(
const char *fmt,
...
@ -107,7 +107,7 @@ kprintf(
char buf[1024] = {-1};
va_list args;
va_start(args, fmt);
vasprintf(buf, fmt, args);
int out = vasprintf(buf, fmt, args);
/* We're done with our arguments */
va_end(args);
/* Print that sucker */
@ -116,6 +116,7 @@ kprintf(
} else {
puts(buf);
}
return out;
}
int

View File

@ -27,11 +27,20 @@ void logging_install() {
}
void debug_print_log_entry(log_entry_t * l) {
kprintf("[%s] %s line %d: %s\n",
int i;
i = kprintf("[%s] %s ",
messages[l->type],
l->module,
l->line,
l->text);
l->module);
while (i < 40) {
kprintf(" ");
++i;
}
i = kprintf("line %d", l->line);
while (i < 10) {
kprintf(" ");
++i;
}
kprintf("%s\n", l->text);
}
void debug_print_log() {

View File

@ -2,6 +2,7 @@
* Mouse driver
*/
#include <system.h>
#include <logging.h>
uint8_t mouse_cycle = 0;
int8_t mouse_byte[3];
@ -201,6 +202,7 @@ uint8_t mouse_read() {
}
void mouse_install() {
LOG(INFO, "Initializing mouse cursor driver");
uint8_t status;
IRQ_OFF;
mouse_wait(1);

View File

@ -320,7 +320,7 @@ ansi_put(
void
ansi_init(void (*writer)(char), int w, int y) {
LOG(INFO,"Initializing ANSI console with writer function 0x%x and terminal size of %dx%d", (uint32_t)writer, (uint32_t)w, (uint32_t)y);
LOG(INFO,"Initializing ANSI console, writer=0x%x, size=%dx%d", (uint32_t)writer, (uint32_t)w, (uint32_t)y);
/* Terminal Defaults */
state.fg = 7; /* Light grey */
state.bg = 0; /* Black */

View File

@ -133,9 +133,9 @@ extern void mouse_install();
/* kprintf */
extern size_t vasprintf(char * buf, const char *fmt, va_list args);
extern void kprintf(const char *fmt, ...);
extern int sprintf(char *buf, const char *fmt, ...);
extern int kgets(char *buf, int size);
extern int kprintf(const char *fmt, ...);
extern int sprintf(char *buf, const char *fmt, ...);
extern int kgets(char *buf, int size);
typedef void (*kgets_redraw_t)();
extern kgets_redraw_t kgets_redraw_func;
typedef void (*kgets_tab_complete_t)(char *);