delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1996/09/25/09:25:16

Date: Wed, 25 Sep 1996 15:09:11 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Mark Habersack <grendel AT ananke DOT amu DOT edu DOT pl>
Cc: Chris Matrakidis <cmatraki AT eleceng DOT ucl DOT ac DOT uk>, djgpp-workers AT delorie DOT com
Subject: Re: `_flush_disk_cache'
In-Reply-To: <Pine.NEB.3.95.960925133250.19799F-100000@ananke.amu.edu.pl>
Message-Id: <Pine.SUN.3.91.960925150129.14328C-100000@is>
Mime-Version: 1.0

On Wed, 25 Sep 1996, Mark Habersack wrote:

> >Btw, if anybody knows a simple enough way to map DOS drive letters to 
> >BIOS drive numbers, I'd like to know about it.  Right now, 
> >
> AFAIK, the DOS scheme to assign drive letters is as follows:
>   Letter 'C' is ALWAYS assigned to first primary partition on the first
>   physical HD (0x80)

My problem is the opposite: given a DOS drive letter like "F:" find the 
BIOS drive number (0x80 or 0x81) which corresponds to it.  Walking all of 
the partitions is (IMHO) too complicated.

> But there's a simpler way. You have to get a hold of head of DDT (Drive
> Description Table) chain.

I don't want to walk the device driver chain either, since this is
inherently DOS version-dependent, and probably won't work on DR-DOS,
Windows 3.11 with 32-bit File Access, and the rest of compatible systems. 
I thought about something like getting the DPB (device parameter block)
and using it and/or the corresponding BPB (BIOS parameter block) to get
the info I need.  Is there any way like that? 

> including physical drive it is on. If you want I can send you code that
> identifies disks on the system (local, network, RAM, CD-ROMs) and takes
> advantage of DDTs. All the necessary info can be found in Ralph Browns's
> Interrupt List (I've used v51).

This code is already part of DJGPP.  Look at the source of `getmntent' 
function, it reports the type of every drive.  But it loops through all 
the drives (which is slow) and it still doesn't tell me what BIOS drive 
number is disk F: on.

Anyway, thanks for the info.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019