Hi, Martin

Thanks for the patch.

A few problems remain.  Minor number is not the same as tty->index
except in the (typical) case that driver->minor_start is 0; the index of
the first tty will always be 0.  I've had success in initializing
driver->minor_start to 1 and the argument of alloc_tty_driver() to 255,
and the last argument to raw3270_{add,find}_view() to index plus one.
This obviates your test for minor number 0 at tty3270_open(), since
227,0 is not registered for the tty3270 driver.

In fs3270.c:fs3270_read() after the wait_event_interruptible(...,
fp->attention), I set fp->attention to 0; otherwise subsequent reads
will not wait at that point but complete prematurely.  In fs3270_open()
for the generic fullscreen device I set minor to tty->index + 1.

In raw3270_set_online() if a failure occurs after
raw3270_create_device() succeeds, I invoke raw3270_delete_device() to
return the minor number and avoid minor-number leakage.  And in
raw3270_remove() I test rp and return if it's NULL.  It seems like
.remove is the opposite of .probe, and .remove can be invoked when a
3270 is detached having never been varied online.

I'm adding class_simple_*() calls at the appropriate places in raw3270.c
to create /sys/class/3270 and thence (for, say, device 6a0)
/sys/class/3270/tty06a0 and /sys/class/3270/tub06a0; this leads to what
I'm doing in /etc/udev/udev.rules, which is work in progress.  I'll come
up with a patch for you in a day or two with all the above stuff, if you
like; or you may want to fix at least the bugs and send me another
patch, and I'll rebase on it.

Dick Hitt


Martin Schwidefsky wrote:

As to /dev/3270/tub, believe me, devfs was the furthest thing from my
mind.  Here's what I was talking about.  Consider the device /dev/tty.
It exists to provide a path for the application to the current
controlling tty.  What would the application have to do (absent
stdout/stderr) to access its controlling terminal if there was no
/dev/tty device?  It wouldn't be easy, right?


Hmm, the controlling terminal for a fullscreen application still is
/dev/tty. If I start the test program on a ssh terminal any output to
stdout goes the the ssh terminal. If I start the test program on the
3270 terminal I get nothing though. Kind of strange, the output should
have gone to the tty view of the 3270. Needs more investigation.



Found the reason why the tty stopped while the fullscreen view is
activ: the tty is stopped... Removed the stop_tty/start_tty calls
from tty3270_deactivate/tty3270_activate.



Similarly, /dev/3270/tub needs to exist to provide a path for the
application to the fullscreen, when the controlling tty is in fact a
line-mode 3270 (and ENODEV otherwise).

Notice that the permissions of /dev/tty are crw-rw-rw and those of
/dev/3270/tub are crw-rw-rw as well.  For /dev/tty notice the logic in
drivers/char/tty_io.c:tty_open(), right at retry_open:, where a test is
made for major 5, minor 0 (the maj/min of /dev/tty) and the device at
current->signal->tty is used.  That's what /dev/3270/tub wants as well,
only of course to use the corresponding full-screen major number 228
with the minor number of the current->signal->tty device.  In 2.4 I
reserved minor number 0 strictly for /dev/3270/tub, analogous to
/dev/tty, and I ensured that 227,N and 228,N referred to the same
physical device.  That is, there was no 227,0 device: the console would
probably come in at 227,1.  My test program should work with no operands
when invoked from a logged-on 3270: in that case, it opens /dev/3270/tub.


Ok, I think I understand. You want some special device node analog to
/dev/tty that redirects you automatically to the 3270 fullscreen node
that corresponds to your controlling 3270 terminal. So that you can do
a simple open("/dev/tub") in your application and that gets redirected
to the fullscreen node. That shouldn't be too hard to implement.



Ok, used the old approach from the 2.4 driver to reserve the minor 0 as
multiplexer device. Open on char-major/minor 227/0 always returns -ENODEV,
open on char-major/minor 228/0 opens a fullscreen view on the 3270 device
that is associated with the current tty. If the controling tty isn't
a 3270 then again -ENODEV is returned.

In addition I fixed a few other bugs I found along the way. Latest patch
attached. Can you give it a try ?

blue skies,
  Martin

Martin Schwidefsky
Linux for zSeries Development & Services
IBM Deutschland Entwicklung GmbH

(See attached file: fs3270.diff)

----------------------------------------------------------------------
For LINUX-390 subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390


----------------------------------------------------------------------
For LINUX-390 subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390

Reply via email to