]> git.kernelconcepts.de Git - karo-tx-redboot.git/blobdiff - packages/fs/rom/v2_0/src/romfs.c
unified MX27, MX25, MX37 trees
[karo-tx-redboot.git] / packages / fs / rom / v2_0 / src / romfs.c
index 0c8599516bdf66a93e5450d9f997973cf7f9cd73..96ca498029eb6672d4ef8823dd5a9f1cede15dcd 100644 (file)
@@ -800,7 +800,7 @@ static int romfs_stat     ( cyg_mtab_entry *mte, cyg_dir dir, const char *name,
 
 // -------------------------------------------------------------------------
 // romfs_getinfo()
-// Getinfo. Currently only support pathconf().
+// Getinfo. Currently only support pathconf() and file system block usage
 
 static int romfs_getinfo  ( cyg_mtab_entry *mte, cyg_dir dir, const char *name,
                              int key, void *buf, int len )
@@ -819,7 +819,16 @@ static int romfs_getinfo  ( cyg_mtab_entry *mte, cyg_dir dir, const char *name,
     case FS_INFO_CONF:
         err = romfs_pathconf( ds.node, (struct cyg_pathconf_info *)buf );
         break;
-        
+#if defined(CYGSEM_FILEIO_BLOCK_USAGE)
+    case FS_INFO_BLOCK_USAGE: {
+      struct cyg_fs_block_usage *usage = (struct cyg_fs_block_usage *) buf;
+      struct romfs_disk *disk = (struct romfs_disk*) mte->data;
+      usage->total_blocks = disk->disksize;
+      usage->free_blocks = 0;
+      usage->block_size = 1;
+      return ENOERR;
+    }
+#endif
     default:
         err = EINVAL;
     }
@@ -1068,6 +1077,9 @@ static int romfs_fo_dirread      (struct CYG_FILE_TAG *fp, struct CYG_UIO_TAG *u
 
     for ( i = 0 ; i < nlen && d->name[i] ; i++, nbuf++ )
        *nbuf = d->name[i];
+#ifdef CYGPKG_FS_ROM_RET_DIRENT_DTYPE
+       ent->d_type = (((romfs_disk *)fp->f_mte->data)->node[d->node]).mode;
+#endif
 
     // A successful read. Terminate the entry name with a NUL, set the
     // residue and set the file offset to restart at the next