[Top] [All Lists]

Re: Devfs and Minors

To: pg_mh@xxxxxxxxxxxxxxxx (Piercarlo Grandi)
Subject: Re: Devfs and Minors
From: Richard Gooch <rgooch@xxxxxxxxxxxxxxx>
Date: Fri, 16 Nov 2001 08:38:52 -0700
Cc: Bjorn Boxstart <boxstart@xxxxxxxx>, <devfs@xxxxxxxxxxx>
In-reply-to: <15349.891.971146.271789@xxxxxxxxxxxxxxx>
References: <000101c16e70$bdaa1f40$9e06a8c0@ws105> <15349.891.971146.271789@xxxxxxxxxxxxxxx>
Sender: owner-devfs@xxxxxxxxxxx
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
> 'drivers/usb/printer.c':
>   #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
> numbers:
> * 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.


Permanent: rgooch@xxxxxxxxxxxxx
Current:   rgooch@xxxxxxxxxxxxxxx

<Prev in Thread] Current Thread [Next in Thread>