apps/examples/fstest: Call statfs() and show state of file system on each loop.
This commit is contained in:
parent
3ba19b0d9a
commit
65d6e8871c
@ -42,7 +42,7 @@ config EXAMPLES_FSTEST_NLOOPS
|
|||||||
|
|
||||||
config EXAMPLES_FSTEST_SPIFFS
|
config EXAMPLES_FSTEST_SPIFFS
|
||||||
bool "Enable SPIFFS testing"
|
bool "Enable SPIFFS testing"
|
||||||
default n
|
default y
|
||||||
depends on FS_SPIFFS
|
depends on FS_SPIFFS
|
||||||
---help---
|
---help---
|
||||||
SPIFFS garbage collection and integrity checking will be performed
|
SPIFFS garbage collection and integrity checking will be performed
|
||||||
@ -51,7 +51,6 @@ config EXAMPLES_FSTEST_SPIFFS
|
|||||||
If this option is not selected then the SPIFFS FLASH will likely
|
If this option is not selected then the SPIFFS FLASH will likely
|
||||||
become full before you finish the test.
|
become full before you finish the test.
|
||||||
|
|
||||||
|
|
||||||
config EXAMPLES_FSTEST_VERBOSE
|
config EXAMPLES_FSTEST_VERBOSE
|
||||||
bool "Verbose output"
|
bool "Verbose output"
|
||||||
default n
|
default n
|
||||||
|
@ -41,6 +41,7 @@
|
|||||||
|
|
||||||
#include <sys/mount.h>
|
#include <sys/mount.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
|
#include <sys/statfs.h>
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@ -823,6 +824,7 @@ int main(int argc, FAR char *argv[])
|
|||||||
int fstest_main(int argc, char *argv[])
|
int fstest_main(int argc, char *argv[])
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
struct statfs buf;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
@ -923,6 +925,24 @@ int fstest_main(int argc, char *argv[])
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Show file system usage */
|
||||||
|
|
||||||
|
ret = statfs(g_mountdir, &buf);
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
printf("ERROR: statfs failed: %d\n", errno);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printf("File System:\n");
|
||||||
|
printf(" Block Size: &lu\n", (unsigned long)buf.f_bsize);
|
||||||
|
printf(" No. Blocks: %lu\n", (unsigned long)buf.f_blocks);
|
||||||
|
printf(" Free Blocks: %ld\n", (long)buf.f_bfree);
|
||||||
|
printf(" Avail. Blocks: %ld\n", (long)buf.f_bavail);
|
||||||
|
printf(" No. File Nodes: %ld\n", (long)buf.f_files);
|
||||||
|
printf(" Free File Nodes: %ld\n", (long)buf.f_ffree);
|
||||||
|
}
|
||||||
|
|
||||||
/* Show memory usage */
|
/* Show memory usage */
|
||||||
|
|
||||||
fstest_loopmemusage();
|
fstest_loopmemusage();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user