[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

New file system IDs



Hi!
 
While working on a new port of GNU file-utils I've add the following
patch to
MiNT lib PL48. 
By default statfs() set the statfs.f_type to 0 and only Minixfs support
a
special Dcnt() which generate a f_type != 0. With this patch the new
MiNT FATFS and the modified ramfs.xfs also returning there real f_type. 
The second thing I've change is the struct 'mfsinfo'. MinixFS do not
returned 
the current blocksize, because it use always 1024. For new MiNT/ramfs I
need 
a posibility to return the current blocksize via the Dcntl(0x104). Now
I've 
use the first of the reserved longs in the mfsinfo structure. This would
be 
backward-compatible because MinixFS doen't touch the reserved compones
of the 
structure.

The new port of file-utils 3.16 use this patch and produce the following
output on my system:

        Drive    Type   1024-blocks  Used Available Capacity Mounted on
        a:       minix       1421       1     1420      0%   u:/
        c:       tos        30650   25274     5376     82%   u:/
        d:       minix2     30071   18028    12043     60%   u:/
        e:       fat16     102328   44000    58328     43%   u:/
        f:       minix2    117392   94415    22977     80%   u:/
        g:       vfat16    119780     512   119268      0%   u:/
        h:       ramfs       8630       0     8630      0%   u:/

I thing it's nice to see, which kind of file system each partition is
used!
Any comments? If not, Yves, please add this patch to the lib.

I've upload the file-utils and the modified ramfs.xfs to my server:
        ftp://ftp.rz.tu-harburg.de/pub/software/systems/atari/...
                .../gnu/gnu-utils/fileu316.tgz
                .../mint/filesys/ramfs-16.lzh

 Chris.

PS: I've talk to Axel Kaiser and he'll add the Dcntl() to his ext2.xfs!
    
--- orig/include/statfs.h       Fri Jun  5 09:52:06 1998
+++ include/statfs.h    Tue Jun  9 19:02:28 1998
@@ -17,8 +17,22 @@
   long val[2];
 } fsid_t;
 
+
+/* values of statfs.f_type */
+#define FS_TOS         0
+#define FS_MINIX       2
+#define FS_MINIXV2     3
+#define FS_RAM         4       /* ramfs.xfs version 1.6 */
+#define FS_EXT2                5       /* ext2.xfs version 1.?? */
+#define FS_FAT12       6       /* MiNT 1.15 */
+#define FS_FAT16       7       /* MiNT 1.15 */
+#define FS_FAT32       8       /* MiNT 1.15 */
+#define FS_VFAT12      9       /* MiNT 1.15 */
+#define FS_VFAT16      10      /* MiNT 1.15 */
+#define FS_VFAT32      11      /* MiNT 1.15 */
+
 struct statfs {
-  long f_type;         /* type of info, zero for now */
+  long f_type;         /* type of info */
   long f_bsize;                /* fundamental file system block size */
   long f_blocks;       /* total blocks in file system */
   long f_bfree;                /* free blocks */

--- orig/statfs.c       Fri Jun  5 08:48:38 1998
+++ src/statfs.c        Fri Jun  5 09:03:42 1998
@@ -53,12 +53,21 @@
  * (0x104) tells us how many exist and how many are free.
  * Also f_type is 1 for V1 filesystems and 2 for V2 (it
  * is zero for TOS).
+ *
+ * Add-on for new file systems by Chris Felsch:
+ * RAMFS 1.6 and NEWFATFS (MiNT 1.15) also support this Dcntl().
+ * Because both systems have'nt a blocksize of 1024 by default,
+ * they returning the current blocksize in mfsinfo.res1!
  */
   _unx2dos (path, _path, sizeof (_path));
+  mfsinfo.res1 = -1;                          /* need for compatibility
check */
   if(Dcntl(0x104,_path, (long) &mfsinfo)==0)
   {
     buf->f_type = 1+mfsinfo.version;
-    buf->f_bsize = 1024;
+    if (mfsinfo.res1 == -1)                   /* backward-compatibility
for MinixFS */
+           buf->f_bsize = 1024;
+        else
+           buf->f_bsize = mfsinfo.res1;
     buf->f_blocks = mfsinfo.nzones;
     buf->f_bfree = buf->f_bavail = mfsinfo.fzones;
     buf->f_files = mfsinfo.ninodes;
 
 
------------------------------------------------------------------------
 Christian Felsch   email: felsch@tu-harburg.de         (Big mails, uue)
 Bevenser Weg 18           christian_felsch@hh.maus.de  (Mails < 16K)
 21079 Hamburg
 Germany            WWW  : http://www.tu-harburg.de/~smcf1605/   
------------------------------------------------------------------------