]> git.kernelconcepts.de Git - karo-tx-redboot.git/blobdiff - packages/fs/fat/v2_0/tests/fatfs1.c
unified MX27, MX25, MX37 trees
[karo-tx-redboot.git] / packages / fs / fat / v2_0 / tests / fatfs1.c
index 3b875176dd35e2e392a5643f12cd9e4f9eb60097..fc9305eea08bc3e9667be682dbcbf20a56fce0ec 100644 (file)
@@ -129,6 +129,9 @@ static void listdir( char *name, int statp, int numexpected, int *numgot )
             break;
         num++;
         diag_printf("<INFO>: entry %14s",entry->d_name);
+#ifdef CYGPKG_FS_FAT_RET_DIRENT_DTYPE
+        diag_printf(" d_type %2x", entry->d_type);
+#endif
         if( statp )
         {
             char fullname[PATH_MAX];
@@ -156,6 +159,10 @@ static void listdir( char *name, int statp, int numexpected, int *numgot )
                 diag_printf(" [mode %08x ino %08x nlink %d size %ld]",
                             sbuf.st_mode,sbuf.st_ino,sbuf.st_nlink,(long)sbuf.st_size);
             }
+#ifdef CYGPKG_FS_FAT_RET_DIRENT_DTYPE
+            if ((entry->d_type & S_IFMT) != (sbuf.st_mode & S_IFMT))
+              CYG_TEST_FAIL("File mode's don't match between dirent and stat");
+#endif
         }
 
         diag_printf("\n");
@@ -179,7 +186,7 @@ static void createfile( char *name, size_t size )
     int i;
     int err;
 
-    diag_printf("<INFO>: create file %s size %d\n",name,size);
+    diag_printf("<INFO>: create file %s size %zd \n",name,size);
 
     err = access( name, F_OK );
     if( err < 0 && errno != EACCES ) SHOW_RESULT( access, err );
@@ -237,13 +244,13 @@ static void maxfile( char *name )
 
         if( (size-prevsize) > 100000 )
         {
-            diag_printf("<INFO>: size = %d \n", size);
+            diag_printf("<INFO>: size = %zd \n", size);
             prevsize = size;
         }
         
     } while( wrote == IOSIZE );
 
-    diag_printf("<INFO>: file size == %d\n",size);
+    diag_printf("<INFO>: file size == %zd\n",size);
 
     err = close( fd );
     if( err < 0 ) SHOW_RESULT( close, err );
@@ -432,6 +439,9 @@ int main( int argc, char **argv )
 {
     int err;
     int existingdirents=-1;
+#if defined(CYGSEM_FILEIO_BLOCK_USAGE)
+    struct cyg_fs_block_usage usage;
+#endif
 
     CYG_TEST_INIT();
 
@@ -448,6 +458,16 @@ int main( int argc, char **argv )
     listdir( "/", true, -1, &existingdirents );
 
     // --------------------------------------------------------------
+#if defined(CYGSEM_FILEIO_BLOCK_USAGE)
+    err = cyg_fs_getinfo("/", FS_INFO_BLOCK_USAGE, &usage, sizeof(usage));
+    if( err < 0 ) SHOW_RESULT( cyg_fs_getinfo, err );
+    diag_printf("<INFO>: total size: %6lld blocks, %10lld bytes\n",
+               usage.total_blocks, usage.total_blocks * usage.block_size); 
+    diag_printf("<INFO>: free size:  %6lld blocks, %10lld bytes\n",
+               usage.free_blocks, usage.free_blocks * usage.block_size); 
+    diag_printf("<INFO>: block size: %6u bytes\n", usage.block_size);
+#endif
+    // --------------------------------------------------------------
 
     createfile( "/foo", 20257 );
     checkfile( "foo" );
@@ -480,6 +500,15 @@ int main( int argc, char **argv )
     checkfile( "/bar/bundy" );
     comparefiles("/fee", "bundy" );
 
+#if defined(CYGSEM_FILEIO_BLOCK_USAGE)
+    err = cyg_fs_getinfo("/", FS_INFO_BLOCK_USAGE, &usage, sizeof(usage));
+    if( err < 0 ) SHOW_RESULT( cyg_fs_getinfo, err );
+    diag_printf("<INFO>: total size: %6lld blocks, %10lld bytes\n",
+               usage.total_blocks, usage.total_blocks * usage.block_size); 
+    diag_printf("<INFO>: free size:  %6lld blocks, %10lld bytes\n",
+               usage.free_blocks, usage.free_blocks * usage.block_size); 
+    diag_printf("<INFO>: block size: %6u bytes\n", usage.block_size);
+#endif
     // --------------------------------------------------------------
 
     diag_printf("<INFO>: unlink fee\n");