From: Steve Y. <sd...@mi...> - 2005-07-12 08:51:11
|
Hello, Here is a patch that moves scrollback handling out of the low-level *con drivers and into the virtual console layer in vt.c. It's non-intrusive insofar as low-level drivers that do not take advantage of it continue to function as usual, but drivers that do want to use it (eg, vgacon after this patch is applied) can do so through a rather simple API. Basically a low-level driver signals it wants the vt layer to maintain scrollback through vc_data->vc_use_scrollback, and then grabs chunks of scrollback by calling vt_get_scrollback from the consw->con_scrolldelta function. The payoff for users is (a) scrollback can now be an arbitrary length, limited only by memory and (b) scrollback is preserved between console switches, something vgacon/etc are unable to do when they are relying solely on origin tricks to make scrollback happen. A few points: - ioctls are used to control the vt scrollback. This is probably not the best way to do it, but I wasn't sure if procfs, sysfs, or sysctl were the way to go. If anyone can recommend a better way to do it I'd be happy to implement it. - A userspace program, cfgscroll (attached) is used to configure scrollback. It has reasonable defaults, but cfgscroll -e needs to be called to enable scrollback. This is because we can't start saving scrollback before kmalloc works, and I couldn't determine a reasonable way to find out if kmalloc is working yet (is there some kind of kmalloc_running flag somewhere?). The source is junky because hopefully it will go away. - /dev/vcs* will return whatever is really on the screen, so if the user is in the middle of scrollback that's what vcs will return. If/when gpm starts using the vcs devices, this means users will be able to select text out of scrollback. - This patch is against 2.6.13-rc1-mm1. Finally, this is my first attempt at a kernel patch so there's probably some other things that will need attention. Any constructive criticism would be appreciated - hopefully this patch doesn't clash with the work being done by the linuxconsole folks. Thanks, Steve. |