Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 1 Feb 2012 21:11:06 +0000 (UTC)
From:      Marius Strobl <marius@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r230884 - stable/9/sys/dev/ofw
Message-ID:  <201202012111.q11LB7AH004997@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: marius
Date: Wed Feb  1 21:11:06 2012
New Revision: 230884
URL: http://svn.freebsd.org/changeset/base/230884

Log:
  MFC: r230631
  
  Implement OF_printf() using kvprintf() directly, avoiding to use a
  buffer and allowing to handle newlines properly.

Modified:
  stable/9/sys/dev/ofw/openfirm.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/amd64/include/xen/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/boot/i386/efi/   (props changed)
  stable/9/sys/boot/ia64/efi/   (props changed)
  stable/9/sys/boot/ia64/ski/   (props changed)
  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
  stable/9/sys/boot/powerpc/ofw/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/contrib/dev/acpica/   (props changed)
  stable/9/sys/contrib/octeon-sdk/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)
  stable/9/sys/contrib/x86emu/   (props changed)

Modified: stable/9/sys/dev/ofw/openfirm.c
==============================================================================
--- stable/9/sys/dev/ofw/openfirm.c	Wed Feb  1 21:10:00 2012	(r230883)
+++ stable/9/sys/dev/ofw/openfirm.c	Wed Feb  1 21:11:06 2012	(r230884)
@@ -72,6 +72,8 @@ __FBSDID("$FreeBSD$");
 
 #include "ofw_if.h"
 
+static void OF_putchar(int c, void *arg);
+
 MALLOC_DEFINE(M_OFWPROP, "openfirm", "Open Firmware properties");
 
 static ihandle_t stdout;
@@ -82,7 +84,7 @@ static struct ofw_kobj	ofw_kernel_obj;
 static struct kobj_ops	ofw_kernel_kops;
 
 /*
- * OFW install routines. Highest priority wins, equal priority also
+ * OFW install routines.  Highest priority wins, equal priority also
  * overrides allowing last-set to win.
  */
 SET_DECLARE(ofw_set, ofw_def_t);
@@ -138,15 +140,27 @@ OF_init(void *cookie)
 	return (rv);
 }
 
+static void
+OF_putchar(int c, void *arg __unused)
+{
+	char cbuf;
+
+	if (c == '\n') {
+		cbuf = '\r';
+		OF_write(stdout, &cbuf, 1);
+	}
+
+	cbuf = c;
+	OF_write(stdout, &cbuf, 1);
+}
+
 void
 OF_printf(const char *fmt, ...)
 {
 	va_list	va;
-	char buf[1024];
 
 	va_start(va, fmt);
-	vsprintf(buf, fmt, va);
-	OF_write(stdout, buf, strlen(buf));
+	(void)kvprintf(fmt, OF_putchar, NULL, 10, va);
 	va_end(va);
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201202012111.q11LB7AH004997>