Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/wscons add vcons_replay_msgbuf() for use by wsdispla...



details:   https://anonhg.NetBSD.org/src/rev/2c6ba8fe620d
branches:  trunk
changeset: 746792:2c6ba8fe620d
user:      macallan <macallan%NetBSD.org@localhost>
date:      Thu Aug 20 02:01:08 2009 +0000

description:
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

diffstat:

 sys/dev/wscons/files.wscons           |   3 +-
 sys/dev/wscons/wsdisplay_vcons_util.c |  60 +++++++++++++++++++++++++++++++++++
 sys/dev/wscons/wsdisplay_vconsvar.h   |   4 +-
 3 files changed, 64 insertions(+), 3 deletions(-)

diffs (96 lines):

diff -r 9d3d810bf731 -r 2c6ba8fe620d sys/dev/wscons/files.wscons
--- a/sys/dev/wscons/files.wscons       Thu Aug 20 01:33:39 2009 +0000
+++ b/sys/dev/wscons/files.wscons       Thu Aug 20 02:01:08 2009 +0000
@@ -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
diff -r 9d3d810bf731 -r 2c6ba8fe620d sys/dev/wscons/wsdisplay_vcons_util.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/dev/wscons/wsdisplay_vcons_util.c     Thu Aug 20 02:01:08 2009 +0000
@@ -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);
+}
diff -r 9d3d810bf731 -r 2c6ba8fe620d sys/dev/wscons/wsdisplay_vconsvar.h
--- a/sys/dev/wscons/wsdisplay_vconsvar.h       Thu Aug 20 01:33:39 2009 +0000
+++ b/sys/dev/wscons/wsdisplay_vconsvar.h       Thu Aug 20 02:01:08 2009 +0000
@@ -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_ */



Home | Main Index | Thread Index | Old Index