#include <pkgconf/hal.h>
#include <pkgconf/kernel.h>
#include <pkgconf/io_fileio.h>
+#include <pkgconf/fs_ram.h>
#include <cyg/kernel/ktypes.h> // base kernel types
#include <cyg/infra/cyg_trac.h> // tracing macros
#include <string.h>
#include <dirent.h>
+#include <stdio.h>
#include <cyg/fileio/fileio.h>
#include <cyg/infra/testcase.h>
break;
num++;
diag_printf("<INFO>: entry %14s",entry->d_name);
+#ifdef CYGPKG_FS_RAM_RET_DIRENT_DTYPE
+ diag_printf(" d_type %2x", entry->d_type);
+#endif
if( statp )
{
char fullname[PATH_MAX];
sbuf.st_mode,sbuf.st_ino,sbuf.st_nlink,
(unsigned long) sbuf.st_size);
}
+#ifdef CYGPKG_FS_RAM_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");
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 );
{
int err;
int existingdirents=-1;
+#if defined(CYGSEM_FILEIO_BLOCK_USAGE) && defined(CYGPKG_FS_RAM_BLOCKS_ARRAY)
+ struct cyg_fs_block_usage usage;
+#endif
CYG_TEST_INIT();
listdir( "/", true, -1, &existingdirents );
if ( existingdirents < 2 )
CYG_TEST_FAIL("Not enough dir entries\n");
-
+ // --------------------------------------------------------------
+#if defined(CYGSEM_FILEIO_BLOCK_USAGE) && defined(CYGPKG_FS_RAM_BLOCKS_ARRAY)
+ 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", 202 );
listdir( "..", true, existingdirents+3, NULL );
// --------------------------------------------------------------
+#if defined(CYGSEM_FILEIO_BLOCK_USAGE) && defined(CYGPKG_FS_RAM_BLOCKS_ARRAY)
+ 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 tinky\n");
err = unlink( "tinky" );