From owner-svn-src-stable-9@FreeBSD.ORG Wed Feb 1 21:11:07 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4767C106566B; Wed, 1 Feb 2012 21:11:07 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 358C18FC16; Wed, 1 Feb 2012 21:11:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q11LB7ED004999; Wed, 1 Feb 2012 21:11:07 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q11LB7AH004997; Wed, 1 Feb 2012 21:11:07 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201202012111.q11LB7AH004997@svn.freebsd.org> From: Marius Strobl Date: Wed, 1 Feb 2012 21:11:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230884 - stable/9/sys/dev/ofw X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Feb 2012 21:11:07 -0000 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); }