delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2000/06/14/12:32:14

From: Martin Str|mberg <ams AT ludd DOT luth DOT se>
Message-Id: <200006141632.SAA11882@father.ludd.luth.se>
Subject: Re: LONG: fat32 diff in cvs (second try)
In-Reply-To: <Pine.SUN.3.91.1000611115713.23732A-100000@is> from Eli Zaretskii at "Jun 11, 2000 11:58:19 am"
To: djgpp-workers AT delorie DOT com
Date: Wed, 14 Jun 2000 18:32:06 +0200 (MET DST)
X-Mailer: ELM [version 2.4ME+ PL54 (25)]
MIME-Version: 1.0
Reply-To: djgpp-workers AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

Here follows the diffs of the files in question (pasted).

According to Eli Zaretskii:
> Thanks.  I have a few more comments (if these problems were in the
> original patches you posted, I'm sorry I missed them):
> 
> >   uid_t		getuid(void);
> >   int		isatty(int _fildes);
> >   int		link(const char *_existing, const char *_new);
> > + offset_t	llseek(int _fildes, offset_t _offset, int _whence);
> 
> llseek should go into the non-Posix part of unistd.h, below the
> #ifndef _POSIX_SOURCE directive.

Index: djgpp/include/unistd.h
===================================================================
RCS file: /cvs/djgpp/djgpp/include/unistd.h,v
retrieving revision 1.5
diff -p -3 -r1.5 unistd.h
*** unistd.h    1999/12/24 22:08:40     1.5
--- unistd.h    2000/06/14 16:20:23
*************** int             getdtablesize(void);
*** 135,140 ****
--- 135,141 ----
  int           gethostname(char *buf, int size);
  int           getpagesize(void);
  char *                getwd(char *__buffer);
+ offset_t      llseek(int _fildes, offset_t _offset, int _whence);
  int           nice(int _increment);
  void *                sbrk(int _delta);
  int           symlink (const char *, const char *);

> > + This function tries to determine the number bits used to enumerate the
> 
> This should have said "...the number of bits...", ``of'' is missing.

Index: djgpp/src/libc/dos/dos/getfatsz.txh
===================================================================
RCS file: getfatsz.txh
diff -N getfatsz.txh
*** /dev/null   Tue May  5 16:32:27 1998
--- getfatsz.txh        Wed Jun 14 12:20:39 2000
***************
*** 0 ****
--- 1,65 ----
+ @ignore
+  * Copyright (C) 2000 Martin Str<F6>mberg <ams AT ludd DOT luth DOT se>.
+  *
+  * This software may be used freely so long as this copyright notice is
+  * left intact. There is no warranty on this software.
+  *
+ @end ignore
+
+ @node _get_fat_size, file system
+ @subheading Syntax
+
+ @example
+ #include <dos.h>
+
+ int _get_fat_size( const int drive );
+ @end example
+
+ @subheading Description
+
+ This function tries to determine the number of bits used to enumerate
+ the clusters by the FAT on drive number @var{drive}. 1 == A:, 2 == B:,
+ etc., 0 == default drive.
+
+ This function will not succeed on DOS version < 4, setting
+ @code{errno} to @code{ENOSYS}.  It is also known to have trouble
+ detecting the file system type of disks formatted with a later version
+ of DOS than the version it is run on.  E. g. floppies with LFN
+ entries can cause this function to fail or detect the fat size as 16
+ if used in plain DOS.
+
+ If you are looking for a function that is able to detect other file
+ systems, perhaps the function @code{_get_fs_type}
+ (@pxref{_get_fs_type}) can be of use.
+
+ @subheading Return Value
+
+ The number of bits used by the FAT (12, 16 or 32).  0 if the drive was
+ formatted with FAT but of unknown size (NT reports that on FAT16).
+ -1 on error.
+
+
+ @subheading Portability
+
+ @portability !ansi, !posix
+
+ @subheading Example
+
+ @example
+ #include <stdio.h>
+ #include <dos.h>
+
+ int main(void)
+ @{
+   int size;
+
+   size = _get_fat_size( 'C' - 'A' + 1 );
+   if( 0 <= size )
+   @{
+     printf("The size of FAT on C: is %d bits.\n", size);
+   @}
+
+   exit(0);
+ @}
+
+ @end example

> > + If you are interested in which kind of FAT file system that is in use
> > + try the function @xref{_get_fat_size} which will reliably detect the
> 
> This use of @xref might seem like a clever trick, but in fact it is a
> bad idea.  It looks awkward in Info:
> 
>    ...try the function *Note _get_fat_size:: which will...
> 
> and downright unreadable in the printed version:
> 
>    ...try the function See Section 123.4 [_get_fat_size], page 1234
>    which will...
> 
> It is much better, if less ``sexy'', to use the following paradigm:
> 
>    ...try the function @code{_get_fat_size} (@pxref{_get_fat_size})
>    which will...
> 
> In any case, @xref should only be used at the beginning of a
> sentence, since it generates capitalized Note and See.  In the middle
> of a sentence, use @ref instead.

See above and:

Index: djgpp/src/libc/dos/dos/getfstyp.txh
===================================================================
RCS file: getfstyp.txh
diff -N getfstyp.txh
*** /dev/null   Tue May  5 16:32:27 1998
--- getfstyp.txh        Wed Jun 14 12:20:39 2000
***************
*** 0 ****
--- 1,69 ----
+ @ignore
+  * Copyright (C) 2000 Martin Str<F6>mberg <ams AT ludd DOT luth DOT se>.
+  *
+  * This software may be used freely so long as this copyright notice is
+  * left intact. There is no warranty on this software.
+  *
+ @end ignore
+
+ @node _get_fs_type, file system
+ @subheading Syntax
+
+ @example
+ #include <dos.h>
+
+ int _get_fs_type( const int drive,
+                   char *const result_str );
+ @end example
+
+ @subheading Description
+
+ This function tries to extract the file system type of the drive
+ number @var{drive}, 1 == A:, 2 == B:, etc., 0 == default drive.  It
+ does this by calling INT21, AX=0x6900, Get Disk Serial Number (sic!),
+ which returns, among other things, an eight character field which is
+ set while formatting the drive. Now, this field can be set to whatever
+ the formatting program wishes, but so far every FAT formatted drive
+ has returned a string starting with "FAT".
+
+ If successful the result is put in @var{result_str} which must be at
+ least 9 characters long.  If unsuccessful @code{errno} is set.
+
+ This function will not succeed on DOS version < 4, setting
+ @code{errno} to @code{ENOSYS}.  It is also known to have trouble
+ detecting the file system type of disks formatted with a later version
+ of DOS than the version it is run on.  E. g. floppies with LFN
+ entries can cause this function to fail or detect the floppy as
+ FAT16 if used in plain DOS.
+
+ If you are interested in which kind of FAT file system that is in use
+ try the function @code{_get_fat_size} (@pxref{_get_fat_size}) which
+ will reliably detect the right kind of FAT file system.
+
+ @subheading Return Value
+
+ 0 if the file system type was extracted successfully; otherwise -1.
+
+ @subheading Portability
+
+ @portability !ansi, !posix
+
+ @subheading Example
+
+ @example
+ #include <stdio.h>
+ #include <dos.h>
+
+ int main(void)
+ @{
+   char buffer[9];
+
+   if( ! _get_fs_type( 3, buffer ) )
+   @{
+     printf("The file system on C: is '%s'.\n", buffer);
+   @}
+
+   exit(0);
+ @}
+
+ @end example


Right,

							MartinS

- Raw text -


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