public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] CYGSEM_FILEIO_BLOCK_USAGE, was Re: [ECOS] reading size and used space on compact flash (CF) card?
@ 2012-07-02 14:52 Ken Yee
  0 siblings, 0 replies; only message in thread
From: Ken Yee @ 2012-07-02 14:52 UTC (permalink / raw)
  To: fpagliughi; +Cc: ecos-discuss

> 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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2012-07-02 14:52 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-02 14:52 [ECOS] CYGSEM_FILEIO_BLOCK_USAGE, was Re: [ECOS] reading size and used space on compact flash (CF) card? Ken Yee

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).