www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1999/01/04/08:32:39

Date: Mon, 4 Jan 1999 15:32:46 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Martin Str|mberg <ams AT ludd DOT luth DOT se>
cc: DJGPP-WORKERS <djgpp-workers AT delorie DOT com>
Subject: Re: FAT32X and DJGPP
In-Reply-To: <199901040945.KAA29614@father.ludd.luth.se>
Message-ID: <Pine.SUN.3.91.990104151732.4597D-100000@is>
MIME-Version: 1.0
Reply-To: djgpp-workers AT delorie DOT com

On Mon, 4 Jan 1999, Martin Str|mberg wrote:

> Here's the result this far.

Okay, I tested these new versions.  Here are the results:

  - on Windows 95:

	* local hard disks return FAT16, as they should
	* floppies return FAT12, also as expected
	* I didn't try a Novell drives, since I think they might have been 
	  the reason for the wedges the other day
	* a CD-ROM was reported as FAT16 (??)

  - on Windows/NT (v4.00):

	* NTFS partition is reported as NTFS (good!)
	* networked drive mounted via NFS is reported as InterDri 
	  (InterDrive is the name of the installed redirector)
	* a floppy formatted for DOS/Windows 95 is reported as just FAT (!!)

So, as usual, NT screws up everything a bit: the filesystem name is not 
guaranteed to be 8-character long (the "NTFS" and "FAT" strings were NOT 
blank-padded), and they don't bother to put the FAT size into the name.  
Seems like the code will need to be prepared for these atrocities.

I don't have any machine, including NT, with access to FAT32 drives, so 
it would be interesting to know what does NT return for a FAT32 drive (if 
and when it supports it), or whether NT at all supports FAT32 features 
for DOS programs.  Anybody?

I have still to test in plain DOS.

Allow me several comments about the code:

> int /* 0 == error; 1 == result_str filled in. */
> _get_fs_type(const int drive /* drive number (1=A:). */
>            , char *const result_str  /* String to put result in. At
               ^^^^^^^^^^^^^^^^^^^^^^
Why does this have to be "char * const"?  It might be quite a nuisance 
for some programs compiled with -Wall or stricter switches, and I don't 
see any reason for that.  Shouldn't "char *" be enough?

>     /* Get the file system type. */
>     for(n = 0; n < 8; n++)
>     {
>       result_str[n] = _farpeekb( _dos_ds, __tb + 0x11 + n);
>     }
>     result_str[8] = 0;

I suggest to remove the trailing blanks from the result.

>   if( _get_fs_type( drive, s ) )
>   {
>     if( sscanf(s, " FAT%d", &n) == 1 )

`sscanf' seems too gross.  This function will be linked into every DJGPP 
image, so something leaner, like a literal test for `F', then `A', then 
`T', and a simple loop that computes the number from what follows, is a 
much better idea, I think.

- Raw text -


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