Piercarlo Grandi writes:
> >>> On Fri, 16 Nov 2001 08:31:42 +0100, "Bjorn Boxstart"
> >>> <boxstart@xxxxxxxx> said:
> boxstart> Hello All, According to the readme that comes with devfs,
> boxstart> Devfs should solve the problem of having minors and majors.
> Ah, it does, it does...
> boxstart> I thought this would help me with using over 16 USB printers
> boxstart> at once. After installation however, I still can use only 16
> boxstart> printers. Can anybody clarify for me what I misunderstood.....
> Well, how the minor device number (device id) is interepreted is up to
> the driver, and how big its internal tables are, 'devfs' cannot work
> around that.
> If the driver has a compiled in number of devices, like in your case in
> #define USBLP_MINORS 16
> static struct usblp *usblp_table[USBLP_MINORS];
> that's how the driver is written. If you want more than 16 printers you
> have to change that definition above and recompile the driver, there is
> no way around that.
> Most drivers don't support an arbitrary number of devices, they have
> statically allocated device state tables, like the USB printer driver.
> 'devfs' solves the two big problems with static allocation of '/dev/'
> entries (not of device state entries in the driver) to major and minor
> * Static allocation of major device numbers (driver id).
> * Static definition of an '/dev/' entry for every possible minor number
> (device id).
Another thing that devfs does is make writing of completely dynamic
device drivers much easier. It's easy to use a linked list of device
entries, rather than a static table. Each devfs entry will correspond
to a device instance structure, with the two pointing to each other.
You put the device instance structures in a linked list so that at
module unload time, you can loop through and free everything.
It'd be nice if someone did that for the USB printer driver. You can
even do it in a way that keeps it compatible with old-style
(non-devfs) device nodes.