Messages in this thread | | | Date | Tue, 12 Oct 1999 08:28:49 -0400 (EDT) | From | "Richard B. Johnson" <> | Subject | RE: [linux-usb] Re: USB device allocation |
| |
On Fri, 8 Oct 1999, David Waite wrote:
> > -----Original Message----- > > From: Richard B. Johnson [mailto:root@chaos.analogic.com] > > <some snippage> > > To give a simple example, given: > > > > LargeFileNameDirectory/LFN-Subdirectory/MyFile.txt > > > > ... requires 3 directory lookups to obtain a number. After which, > > the file is accessed as a number. It is read/written/extended/truncated, > > /seeked, etc, without ever having to parse strings again. > > > > The same is true for 'special files'. These require a lookup first > > to associate a major/minor number (instead of an inode). Then the > > human readable name string is never accessed again. To do it any other > > way would be to return to the days before even CP/M. > > > > Historical buffs may remember that the file-system on the famous > > "green-machine" (MDS-200), circa 1967, consisted of 'directory' entries > > that contained only numbers. A directory program translated these numbers > > into strings in a "container file". (No M$ didn't invent the container > > file). Even then, it was understood that strings didn't belong within > > an operating system. > > > > > > So, we are not "fumbling around" with the major/minor concept. It > > is an excellent, efficient way of handling devices. However, soon > > it will have to be extended because we need more numbers. > > I think I am beginning to understand (sorry, I am definately _not_ an OS > expert :)). But after a file is open'ed, does it even matter how the user > got there? I am under the impression that an open'ed character device is > just a pipe to the respective hardware driver. After you have a file > descriptor, it doesn't matter if there was a major/minor number associated > at all. > > But what a major/minor does buy is an easy transition from a file to the > respective subsystem. 192/12 might mean 'the usb driver, 12th device'. After > everything is in place, it really doesn't matter that we used the > major/minor pair at all to open things up. > [SNIPPED]
What does matter is that the drivers use the major number to represent what they are, and the minor number as either a particular instance of a device or a particular parameter, depending upon the device. Look at /dev/fdxxxx (major/minor) as an example.
If these devices used strings, asside from having to all be rewritten, you need a variable-length string-lookup every time they are accessed.
Cheers, Dick Johnson **** FILE SYSTEM WAS MODIFIED **** Penguin : Linux version 2.3.13 on an i686 machine (400.59 BogoMips). Warning : It's hard to remain at the trailing edge of technology.
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |