So after a bit more hacking, I finally got this to work :-) The problem was that in ecos/packages/fs/fat/fatfs.c, the code still uses this old #define CYGSEM_FILEIO_BLOCK_USAGE so it was always returning EINVAL. Here are the fixes to get it to work w/ the new DISK_USAGE rename that is generated by configtool:
//#if defined(CYGSEM_FILEIO_BLOCK_USAGE) // case FS_INFO_BLOCK_USAGE: { #if defined(CYGSEM_FILEIO_INFO_DISK_USAGE) case FS_INFO_DISK_USAGE: { cyg_uint32 total_clusters; cyg_uint32 free_clusters; // struct cyg_fs_block_usage *usage = (struct cyg_fs_block_usage *) buf; struct cyg_fs_disk_usage *usage = (struct cyg_fs_disk_usage *) buf; And the code that uses the official ecos APIs is to read space/usage, etc is: struct cyg_fs_disk_usage usage; int err = cyg_fs_getinfo(path, FS_INFO_DISK_USAGE, &usage, sizeof(usage)); if ( err == 0 ) { uint64_t blksize, totalblocks, freeblks; totalblocks = usage.total_blocks; freeblks = usage.free_blocks; blksize = usage.block_size; diskSize = totalblocks*blksize; freeSpace = freeblks*blksize; usedSpace = diskSize - freeSpace; return true; } And wow, it's slow....2min 20sec to get free space on a 32MB card on an ancient Atmel 14MHz AT91 processor :-P ken -- Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss