Subject: Re: The devvp branch
To: None <eeh@netbsd.org>
From: Jason R Thorpe <thorpej@wasabisystems.com>
List: tech-kern
Date: 10/01/2001 18:19:56
On Tue, Oct 02, 2001 at 12:18:14AM -0000, eeh@netbsd.org wrote:

 > I understand why you want to get rid of dev_t, especially for the 
 > cdevsw/bdevsw operations, but why replace that with a vnode pointer?
 > Those routines really want to get at the device's softc, which is a 
 > device pointer.  What was the rationale behind that?  

Because you don't alway want just the "device's softc".  Sometimes
you want to know the minor number .. which might have "control bits".

Besides, the vnode is the focus of all file system (and thus
device) operations in our kernel, so why not just use it?

 > If a kernel routine or some other driver wanted to access a device,
 > all it really needed to do is locate the appropriate devsw and generate
 > the correct dev_t.  How does this work with the new scheme?

Take a look at e.g. sdsize() on the devvp branch.  It's quite easy to do.
Use bdevvp() or cdevvp(), and then use the appropriate VOP_*() routines.
When you're done, use vrele() to get rid of the vnode.

-- 
        -- Jason R. Thorpe <thorpej@wasabisystems.com>