This is the mail archive of the
ecos-discuss@sourceware.org
mailing list for the eCos project.
CYGSEM_FILEIO_BLOCK_USAGE, was Re: reading size and used space on compact flash (CF) card?
- From: "Ken Yee" <kenkyee at excite dot com>
- To: fpagliughi at mindspring dot com
- Cc: ecos-discuss at ecos dot sourceware dot org
- Date: Mon, 02 Jul 2012 10:52:44 -0400
- Subject: [ECOS] CYGSEM_FILEIO_BLOCK_USAGE, was Re: [ECOS] reading size and used space on compact flash (CF) card?
> You are not using the proper key when querying for the disk information.
> You need to use CYG_IO_GET_CONFIG_DISK_INFO (not zero) as in:
> error = cyg_io_get_config(cf_handle, CYG_IO_GET_CONFIG_DISK_INFO,
&cf_info, &len);
Thanks. That worked well...
Next dumb question is how do you enable CYGSEM_FILEIO_BLOCK_USAGE for the ecos build?
If that isn't enabled, the FS_INFO_BLOCK_USAGE key is not defined, so I can't get any info on CF card free space, etc :-P
#if defined(CYGSEM_FILEIO_BLOCK_USAGE)
struct cyg_fs_block_usage usage;
int err = cyg_fs_getinfo(path, FS_INFO_BLOCK_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;
}
#endif
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss