void hvlogOutput(const char *buf, int count) { unsigned long flags; int begin; int index; static const char cr = '\r'; begin = 0; spin_lock_irqsave(&consoleloglock, flags); for (index = 0; index < count; index++) { if (buf[index] == '\n') { /* * Start right after the last '\n' or at the zeroth * array position and output the number of characters * including the newline. */ HvCall_writeLogBuffer(&buf[begin], index - begin + 1); begin = index + 1; HvCall_writeLogBuffer(&cr, 1); } } if ((index - begin) > 0) HvCall_writeLogBuffer(&buf[begin], index - begin); spin_unlock_irqrestore(&consoleloglock, flags); }
static void hvputc(char c) { if (c == '\n') hvputc('\r'); HvCall_writeLogBuffer(&c, 1); }
/* * Handle a config charLpEvent. Could be either interrupt or ack */ static void vioHandleConfig(struct HvLpEvent *event) { struct viocharlpevent *cevent = (struct viocharlpevent *)event; HvCall_writeLogBuffer(cevent->data, cevent->len); if (cevent->data[0] == 0x01) printk(VIOCONS_KERN_INFO "window resized to %d: %d: %d: %d\n", cevent->data[1], cevent->data[2], cevent->data[3], cevent->data[4]); else printk(VIOCONS_KERN_WARN "unknown config event\n"); }
void hvlog(char *fmt, ...) { int i; unsigned long flags; va_list args; static char buf[256]; spin_lock_irqsave(&consoleloglock, flags); va_start(args, fmt); i = vscnprintf(buf, sizeof(buf) - 1, fmt, args); va_end(args); buf[i++] = '\r'; HvCall_writeLogBuffer(buf, i); spin_unlock_irqrestore(&consoleloglock, flags); }