Module Name:    src
Committed By:   macallan
Date:           Thu Aug 20 02:01:08 UTC 2009

Modified Files:
        src/sys/dev/wscons: files.wscons wsdisplay_vconsvar.h
Added Files:
        src/sys/dev/wscons: wsdisplay_vcons_util.c

Log Message:
add vcons_replay_msgbuf() for use by wsdisplay drivers to replay the message
buffer when attaching so older log messages will show up in the scrollback
buffer
Idea from gimpy


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/dev/wscons/files.wscons
cvs rdiff -u -r0 -r1.1 src/sys/dev/wscons/wsdisplay_vcons_util.c
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/wscons/wsdisplay_vconsvar.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/wscons/files.wscons
diff -u src/sys/dev/wscons/files.wscons:1.40 src/sys/dev/wscons/files.wscons:1.41
--- src/sys/dev/wscons/files.wscons:1.40	Mon Aug  6 03:11:32 2007
+++ src/sys/dev/wscons/files.wscons	Thu Aug 20 02:01:08 2009
@@ -1,4 +1,4 @@
-# $NetBSD: files.wscons,v 1.40 2007/08/06 03:11:32 macallan Exp $
+# $NetBSD: files.wscons,v 1.41 2009/08/20 02:01:08 macallan Exp $
 
 #
 # "Workstation Console" glue; attaches frame buffer to emulator & keyboard,
@@ -74,4 +74,5 @@
 
 # generic virtual console support on bitmapped framebuffers
 file	dev/wscons/wsdisplay_vcons.c		vcons
+file	dev/wscons/wsdisplay_vcons_util.c	vcons
 defflag	opt_vcons.h		VCONS_SWITCH_ASYNC

Index: src/sys/dev/wscons/wsdisplay_vconsvar.h
diff -u src/sys/dev/wscons/wsdisplay_vconsvar.h:1.9 src/sys/dev/wscons/wsdisplay_vconsvar.h:1.10
--- src/sys/dev/wscons/wsdisplay_vconsvar.h:1.9	Mon Apr 28 20:24:01 2008
+++ src/sys/dev/wscons/wsdisplay_vconsvar.h	Thu Aug 20 02:01:08 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: wsdisplay_vconsvar.h,v 1.9 2008/04/28 20:24:01 martin Exp $ */
+/*	$NetBSD: wsdisplay_vconsvar.h,v 1.10 2009/08/20 02:01:08 macallan Exp $ */
 
 /*-
  * Copyright (c) 2005, 2006 Michael Lorenz
@@ -124,6 +124,6 @@
 
 void	vcons_redraw_screen(struct vcons_screen *);
 
-
+void	vcons_replay_msgbuf(struct vcons_screen *);
 
 #endif /* _WSDISPLAY_VCONS_H_ */

Added files:

Index: src/sys/dev/wscons/wsdisplay_vcons_util.c
diff -u /dev/null src/sys/dev/wscons/wsdisplay_vcons_util.c:1.1
--- /dev/null	Thu Aug 20 02:01:08 2009
+++ src/sys/dev/wscons/wsdisplay_vcons_util.c	Thu Aug 20 02:01:08 2009
@@ -0,0 +1,60 @@
+/*	$NetBSD: wsdisplay_vcons_util.c,v 1.1 2009/08/20 02:01:08 macallan Exp $ */
+
+/*-
+ * Copyright (c) 2005, 2006 Michael Lorenz
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/* some utility functions for use with vcons */
+#include <sys/param.h>
+#include <sys/stdint.h>
+#include <sys/systm.h>
+#include <sys/buf.h>
+#include <sys/device.h>
+#include <sys/msgbuf.h>
+#include <dev/cons.h>
+
+#include <dev/wscons/wsdisplayvar.h>
+#include <dev/wscons/wsconsio.h>
+#include <dev/wsfont/wsfont.h>
+#include <dev/rasops/rasops.h>
+
+#include <dev/wscons/wsdisplay_vconsvar.h>
+
+void	
+vcons_replay_msgbuf(struct vcons_screen *scr)
+{
+	int status = scr->scr_status;
+	int rptr = msgbufp->msg_bufr;
+
+	scr->scr_status &= ~VCONS_IS_VISIBLE;
+	while (rptr != msgbufp->msg_bufx) {
+		cnputc(msgbufp->msg_bufc[rptr]);
+		rptr++;
+		if (rptr >= msgbufp->msg_bufs)
+			rptr = 0;
+	}
+	scr->scr_status = status;
+	vcons_redraw_screen(scr);
+}

Reply via email to