Subject: Re: Cloning bdev/cdev devices, step one
To: None <mjacob@feral.com>
From: Darren Reed <darrenr@reed.wattle.id.au>
List: tech-kern
Date: 07/12/2000 15:13:15
In some email I received from Matthew Jacob, sie wrote:
> 
> > On Tue, 11 Jul 2000, Jason R Thorpe wrote:
> > 
> > > In Solaris, IIRC, the devfs is actually /devices, and /dev/... are
> > > symlinks to /devices/...  I seem to recall that the /devices nodes
> > > have strict permissions, and the /dev symlinks have permissions that
> > > override the permissions of the target ... or something.
> > 
> > Solaris (as of 2.8 and likely to continue for the forseeable future) does
> > not have a devfs.  What it has is a series of programs, scripts, and
> > configuration files that extract the device tree from the kernel, store it
> > in configuration files, and then generate a set of device nodes and
> > symbolic links.  The eventual goal is to have a true devfs, but that may
> > take another decade to complete.
> 
> This is known (in the DDI group) as the "All singing, all dancing, devfs".
> 
> A point to remember is that it is the *drivers* who do the device node
> creation here, IIRC.

Yes, this is correct.  For example, in the IP Filter kernel driver:

                if (ddi_create_minor_node(dip, "ipnat", S_IFCHR, IPL_LOGIPF,
                                          DDI_PSEUDO, 0) == DDI_FAILURE) {
                        ddi_remove_minor_node(dip, NULL);
                        goto attach_failed;
                }

That creates /devices/pseudo/ipf@0:ipnat

In /etc/devlink.tab:

type=ddi_pseudo;name=ipf;minor=ipnat    \M0

creates /dev/ipnat -> /devices/pseudo/ipf@0:ipnat
The real PITA about this approach is that whilst you're developing your
driver, if it causes a panic "too soon" after loading, inodes are a mess
in /etc, files like /etc/devlink.tab don't contain what they are supposed
to (or can't be parsed) and (re)booting fails leaving you with no option
but to boot off CD (or a "spare" partition).

Darren