public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
From: "Ken Yee" <kenkyee@excite.com>
To: fpagliughi@mindspring.com
Cc: ecos-discuss@ecos.sourceware.org
Subject: [ECOS] CYGSEM_FILEIO_BLOCK_USAGE, was Re: [ECOS] reading size and used space on compact flash (CF) card?
Date: Mon, 02 Jul 2012 14:52:00 -0000	[thread overview]
Message-ID: <20120702105244.5892@web007.roc2.bluetie.com> (raw)

> 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

                 reply	other threads:[~2012-07-02 14:52 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120702105244.5892@web007.roc2.bluetie.com \
    --to=kenkyee@excite.com \
    --cc=ecos-discuss@ecos.sourceware.org \
    --cc=fpagliughi@mindspring.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).