Mailing-List: contact cygwin-developers-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-developers-owner AT sources DOT redhat DOT com Delivered-To: mailing list cygwin-developers AT sources DOT redhat DOT com Date: Sun, 16 Sep 2001 11:22:21 +0200 From: Corinna Vinschen To: cygdev Subject: Fixed device names Message-ID: <20010916112221.B15312@cygbert.vinschen.de> Reply-To: cygdev Mail-Followup-To: cygdev Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i Hi, for a long time I'm thinking about giving fixed device names to the devices which are handled by the fhandler_dev_raw and subsequent classes. I don't like the solution that these devices have to have mount table entries and I would like to get rid of them. The new device name mapping using fixed names could work as follows (note that it works on NT systems anyway): Floppies: /dev/fd0, /dev/rfd0 -> map to NT internal name "\device\floppy0". QueryDosDevice("\device\floppy0") returns "A:" -> \\.\A: CD-ROMs: /dev/cdrom1 -> map to NT internal name "\device\cdrom1". QueryDosDevice("\device\cdrom1") returns some "X:" -> \\.\X: Tapes: /dev/st2, /dev/nst2 -> map to NT internal name "\device\tape2". QueryDosDevice("\device\tape2") returns "TAPE2" -> \\.\TAPE2 Disks: /dev/hdd -> map to NT internal name "\device\harddisk3\partition0" (NT) or "\device\harddisk3\dr3" (W2K/XP). QueryDosDevice("\device\harddisk3\...") returns "PhysicalDrive3" -> \\.\PhysicalDrive3 Partitions: /dev/hde1 -> thats tricky from W2K on: Up to NT4 mapped to the NT internal name "\device\harddisk4\partition1". QueryDosDevice("\device\harddisk4\partition1") returns some "X:" -> \\.\X: from W2K on: h = CreateFile("\\.\physicaldrive4"); DeviceIoControl(h, IOCTL_DISK_GET_DRIVE_LAYOUT, ...); returns structure containing drive signature. QueryDosDevice() to get list of entries with NT internal name "\device\harddiskvolumeX". There are at least three entries per partition. One of these entries contains the drive signature and an offset. Take the partition with the matching offset, grab the matching entry for that volume which contains the drive letter -> \\.\X: or which contains the unique ID -> \\?\Volume{GUID} That could be easier again from XP on since XP adds the useful IOCTL_DISK_GET_DRIVE_LAYOUT_EX code which returns the partition list including the GUIDs of the partitions. The QueryDosDevice call and the messing around with the drive signature could be dropped then. What do you think? Would you like that? Do you have a better idea? Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Developer mailto:cygwin AT cygwin DOT com Red Hat, Inc.