tech-kern archive

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

Re: Getting the device name from a struct tty *



>> In a tty line discipline, I want to get the name of the tty driver
>> instance, e.g. "dtyU0".

In what sense is that the name of the tty driver instance?

I'm not just being snarky; that's a real question.  Names of the dtyU0
kind normally name device special files in /dev but nothing else - the
kernel doesn't know anything about them.  In theory you could read
/dev, but (a) nothing says device special files can't exist elsewhere
and (b) you then have to decide what to do if you find other than
exactly one device special file pointing to the device in question.
(And, of course, (c) you may not be in a context from which reading
/dev is feasible.)  But if that's the name you want, there may be
little choice.

>> The line disciplines are called with a "struct tty *" [...]

> Alternatively, you should be able to parse it from the dev_xname
> field of one of the fields of the struct dev you're passed.

struct tty != struct device.  I see no obvious way to go from a struct
tty * to a struct device *, unless of course struct tty has grown
additional members in the kernel version in question (as compared to
what I have at easy hand, that is).  Even then, you'd probably wind up
with something like ucom0, not ttyU0.

/~\ The ASCII                             Mouse
\ / Ribbon Campaign
 X  Against HTML                mouse%rodents-montreal.org@localhost
/ \ Email!           7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B


Home | Main Index | Thread Index | Old Index