Messages in this thread | | | Date | Wed, 9 Jun 1999 13:01:40 +0100 (GMT) | From | Riley Williams <> | Subject | Re: Devfs, was Re: Migrating to larger numbers |
| |
Hi Richard.
>>>>> if all your CD-ROMs devices are unloaded and you have module >>>>> autoloading, then to find all CD-ROMs on the system, you just >>>>> do:
>>>>> opendir ("/dev/ide/cd"); >>>>> loop; >>>>> opendir ("/dev/sr"); >>>>> loop;
>>>>> and your directory scanning code knows that each and every >>>>> entry (besides "." and "..":-) is a Genuine CD-ROM[tm] that >>>>> actually exists on your system.
>>>> Ugh, it will miss the _other_ CD-ROMs in your system.
>>>> /dev/parport/cd >>>> /dev/pcmcia/cd >>>> /dev/usb/cd
>>>> Doesn't look like the right way to me.
>>> It is the right way. The concept is still valid. Just extend my >>> example code. It wasn't meant to be complete, just enough to >>> convey the idea. Did I really have to spell that out?
>>> Also, I expect that a PCMCIA CD-ROM will really be an IDE CD-ROM. >>> A parport CD-ROM will probably be either IDE or SCSI.
>> Out of curiosity, why not also have the reverse? since it's a >> virtual device it can be done automatically and then if you want >> a cd you can open /dev/cd/ (or something similar) and go through >> anything in there. That way you don't have to guess at the >> possible ways of connecting a cd to the machine when you want to >> find them all.
> You can't directly because they come from different drivers. > This scheme works because each of the CD-ROM drivers has it's > own directory. To do what you want would require something > clever with devfsd.
Why would it? All it would require is for each interface type to add a SymLink to /dev/cd (and the vaarious other drive types) pointing to /dev/`me`/cd and it works fine, as the normal directory mechanisms handle the rest.
Q> # ls -l /dev/cd | sed 's/ //' Q> lrwxrwxrwx 1 root 9 Apr 29 14:53 ide -> ../ide/cd Q> lrwxrwxrwx 1 root 13 Apr 29 14:53 parport -> ../parport/cd Q> lrwxrwxrwx 1 root 12 Apr 29 14:53 pcmcia -> ../pcmcia/cd Q> lrwxrwxrwx 1 root 10 Apr 29 14:53 scsi -> ../scsi/cd Q> #
Just add similar virtual symlinks for each type of drive supported.
Best wishes from Riley.
+----------------------------------------------------------------------+ | There is something frustrating about the quality and speed of Linux | | development, ie., the quality is too high and the speed is too high, | | in other words, I can implement this XXXX feature, but I bet someone | | else has already done so and is just about to release their patch. | +----------------------------------------------------------------------+ * ftp://ftp.MemAlpha.cx/pub/rhw/Linux * http://www.MemAlpha.cx/kernel.versions.html
- 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/
| |