9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] port/devcons.c is not port-able
@ 2004-07-13 13:57 ron minnich
  2004-07-14  1:24 ` Geoff Collyer
  2004-07-14  4:31 ` Dan Cross
  0 siblings, 2 replies; 36+ messages in thread
From: ron minnich @ 2004-07-13 13:57 UTC (permalink / raw)
  To: 9fans

working with Xen has convinced me that devcons.c is not totally portable.
The key problems are assumptions that certain devices are there, such as a
uart.

Also, there is the
	/*
	 *  how many different output devices do we need?
	 */

comment, which leads me to believe whoever wrote it was thinking that all
the permuations of devices for devcons were getting out of hand.  There
are a lot of cases in there.

Your kernel has to define some symbols it might not really want to. If you
don't have a uart, what do you do about uartputs? You have to define a
dummy of course.

So I got to wondering: what if we used the fact that namec is so simple
and easy in the kernel? Define the following two files in devcons.c:
consout
consin

Let me take the case of consout first. If you write this:
+file
to consout, devcons driver does a namec of 'file' and adds it to the list
of files it writes to when it does output. So, e.g.,
echo +/dev/eia0 >>/dev/consout

will add serial output for console output. Of course it can go to a file:
echo +/log/console >>/dev/consout

or a socket:
echo +/net/tcp/blahblah >>/dev/consout (console logging to a remote machine)

or a window you want:
echo +/dev/wsys/9/cons >>/dev/consout
console output goes to the window of your choice (try doing that in X!)

or a pipe or whatever.

to remove a file that is used as console output
echo -file >>/dev/consout

you can select some devices:
cat /dev/consout | sed '/eai0/s/\+/-/' > /dev/consout
eliminates console output to eia0

Now, we've got a really portable console output design. You can do the
initial setup in main() in the kernel, you remove all the special cases,
and you don't need special things like uartputs in devcons.c

OK, what about input? I don't know. The multiple output case is easy to
do, the input case I don't understand in all variants due to the use of
interrupts for console input devices. I don't know how to hook them up.

Currently, as interrupts happen on (e.g.) /dev/eia0, there is a callback
(what else to call it?) that is provided by /dev/console to buffer up the
characters and lower interrupt overhead. The driver for a console device
has to know it is a driver for a console device, and it has to call the
right thing in devcons. You get multiple console devices by making sure
that each device that *might* be a console knows to call one of several
console handlers from their own interrupt handler (I have the Xen stuff
call echo()). Unlike almost everything else in Plan 9, you can't really
use any random file for a console.

So:
echo +/dev/eia0 >>/dev/consin
echo +/dev/xencons >>/dev/consin

is not going to work, since xencons might be a socket.

So does that kill this whole idea, or is there a way to do it, or is it
just a bad idea?

ron



^ permalink raw reply	[flat|nested] 36+ messages in thread
[parent not found: <00aba352392cbadebd943e05d1e17412@plan9.ucalgary.ca>]

end of thread, other threads:[~2004-07-15  3:14 UTC | newest]

Thread overview: 36+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-13 13:57 [9fans] port/devcons.c is not port-able ron minnich
2004-07-14  1:24 ` Geoff Collyer
2004-07-14  2:10   ` ron minnich
2004-07-14  2:30     ` Geoff Collyer
2004-07-14  2:47       ` ron minnich
2004-07-14  2:34     ` andrey mirtchovski
2004-07-14  2:47       ` ron minnich
2004-07-14  2:51         ` Kenji Okamoto
2004-07-14  4:40           ` Dan Cross
2004-07-14 13:33           ` OT: " Dave Lukes
2004-07-14 14:08             ` ron minnich
2004-07-14 15:31               ` Jack Johnson
2004-07-14  5:00         ` Skip Tavakkolian
2004-07-14 10:34         ` matt
2004-07-14 14:04           ` ron minnich
2004-07-14 14:04           ` Dave Lukes
2004-07-14 15:03             ` ron minnich
2004-07-14 16:13               ` boyd, rounin
2004-07-14 14:52           ` boyd, rounin
2004-07-14  2:49       ` Kenji Okamoto
2004-07-14  4:36       ` Dan Cross
2004-07-14  2:38     ` Kenji Okamoto
2004-07-14  2:49       ` ron minnich
2004-07-14  5:15         ` Geoff Collyer
2004-07-14  6:36           ` Geoff Collyer
2004-07-14 13:47           ` ron minnich
2004-07-14 18:29             ` Dan Cross
2004-07-14 18:53               ` boyd, rounin
2004-07-14 19:42               ` ron minnich
2004-07-14 20:14                 ` Charles Forsyth
2004-07-14 20:19                 ` Frank Palazzolo
2004-07-14 20:18                   ` Charles Forsyth
2004-07-14 21:06                     ` Geoff Collyer
2004-07-14 21:31                   ` boyd, rounin
2004-07-14  4:31 ` Dan Cross
     [not found] <00aba352392cbadebd943e05d1e17412@plan9.ucalgary.ca>
2004-07-15  3:14 ` Geoff Collyer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).