Re: Calling do_mknod() from init_module()

Rick Richardson (rick@dgii.com)
Thu, 3 Apr 1997 05:19:01 -0600 (CST)


I wrote...
> > We were wondering why no drivers use do_mknod() from
> > init_module() to automatically create the minor device
> > nodes when a loadable driver with dynamic major number
> > allocation is loaded.

Systemkennung Linux writes...
> Not a good idea because it's a behaviour highly inconsistent with
> other devices, makes it impossible to do persistant changes to
> the devices files (chown, chmod), won't work on readonly filesystems.
> And what happens if someone tries to open one of the minor devices?
> The file doesn't exist -> an error message instead of the module
> getting loaded. Last not least this strategy assumes your driver
> is a module, not built in.

The issues of node naming, permissions, and ownership can be handled
on the insmod command line via parameters.

The readonly filesystem is a valid point, as is the issue of not
getting the module to automatically load since the device node isn't
present.

But this then brings up the issue: what good are dynamically
allocated major numbers, then? If you don't know what the
major number is going to be you can't make the device nodes
when the driver is installed.

There really needs to be a standardized method so that a driver
which is prepared to use any convenient major number can get
a permanent major number assigned when the driver is installed
on the system for the first time. Once the major is allocated
from the pool, the driver can be loaded with a major=NNN
parameter by insmod. The major=NNN paramter would be
stored in /etc/conf.modules.

-Rick

-- 
Rick Richardson        Sr. Principal Engr.    Can you be sure I'm really me
Digi Intl.             Email: rick@dgii.com   and not my clone???  Has anybody
11001 Bren Rd. East    Fax:   (612) 912-4955  seen The Leader's nose???
Minnetonka, MN 55343   Tel:   (612) 912-3212  http://www.dgii.com/people/rick/