Subject: Re: Layered device driver question
To: Constantine Sapuntzakis <email@example.com>
From: Bill Studenmund <firstname.lastname@example.org>
Date: 09/22/1999 12:53:31
On Wed, 22 Sep 1999, Constantine Sapuntzakis wrote:
> I've got a device driver that would like to pass an ioctl request
> to its parent. What is the best way of doing this?
Why? Knowing that might help us answer your question or suggest a better
way of doing things. :-)
> A couple observations:
> I will use the term "low-level device" to refer to the object
> described by struct device *.
> The low-level device tree is largely independent from the bdevsw and
> cdevsw arrays.
> Not every low-level device actually implements an
> open/read/write/ioctl interface and thus not every low-level device
> needs a bdevsw/cdevsw entry.
> Given a struct device * to a low-level device with an
> open/read/write/ioctl interface, there seems to be no easy way to get at the
> function pointers to open, read, etc. Nor is there any easy way to get
> the major device number. Is this because a single low-level device
> can implement multiple block or character devices?
Right. For instance disk drives (sd, wd), raid devices (ccd, raid) &
others have both character and block device interfaces. Thus there's a
major number for each. They usually aren't the same. ;-)
The only thing you can really do is to guess the name of the
open/read/write/ioctl driver you want (say zsopen for Zilog serial ports)
and walk the cdev table looking for it.