diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2011-05-04 00:25:21 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2011-05-04 00:25:21 +0000 |
commit | edd31c93c28eb741cf6ffd3384e3fbb5b2d2881d (patch) | |
tree | ceaed4f1ab5d720480f325f033982fbedc05c9f3 /apps/examples/nxffs | |
parent | 9fa76295cda66557b8eb992904275cc198137efd (diff) | |
download | px4-nuttx-edd31c93c28eb741cf6ffd3384e3fbb5b2d2881d.tar.gz px4-nuttx-edd31c93c28eb741cf6ffd3384e3fbb5b2d2881d.tar.bz2 px4-nuttx-edd31c93c28eb741cf6ffd3384e3fbb5b2d2881d.zip |
Fix a few more NXFFS bugs
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3558 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'apps/examples/nxffs')
-rw-r--r-- | apps/examples/nxffs/nxffs_main.c | 84 |
1 files changed, 52 insertions, 32 deletions
diff --git a/apps/examples/nxffs/nxffs_main.c b/apps/examples/nxffs/nxffs_main.c index 738e8ecf8..19e93138d 100644 --- a/apps/examples/nxffs/nxffs_main.c +++ b/apps/examples/nxffs/nxffs_main.c @@ -553,6 +553,7 @@ int user_start(int argc, char *argv[]) { FAR struct mtd_dev_s *mtd; int ret; + int i; /* Seed the random number generated */ @@ -585,48 +586,67 @@ int user_start(int argc, char *argv[]) exit(3); } - /* Then write a files to the NXFFS file system until either (1) all of the - * open file structures are utilized or until (2) NXFFS reports an error - * (hopefully that the file system is full) + /* Loop a few times ... file the file system with some random, files, + * delete some files randomly, fill the file system with more random file, + * delete, etc. This beats the FLASH very hard! */ - ret = nxffs_fillfs(); - fprintf(stderr, "Filled file system\n"); - fprintf(stderr, " Number of files: %d\n", g_nfiles); - fprintf(stderr, " Number deleted: %d\n", g_ndeleted); - nxffs_dump(mtd); + for (i = 0; i < 2; i++) + { + /* Write a files to the NXFFS file system until either (1) all of the + * open file structures are utilized or until (2) NXFFS reports an error + * (hopefully that the file system is full) + */ + + ret = nxffs_fillfs(); + fprintf(stderr, "Filled file system\n"); + fprintf(stderr, " Number of files: %d\n", g_nfiles); + fprintf(stderr, " Number deleted: %d\n", g_ndeleted); + nxffs_dump(mtd); - /* Verify all files written to FLASH */ + /* Verify all files written to FLASH */ + + ret = nxffs_verifyfs(); + if (ret < 0) + { + fprintf(stderr, "ERROR: Failed to verify files\n"); + } + else + { + fprintf(stderr, "Verified!\n"); + } - ret = nxffs_verifyfs(); - if (ret < 0) - { - fprintf(stderr, "ERROR: Failed to verify files\n"); fprintf(stderr, " Number of files: %d\n", g_nfiles); fprintf(stderr, " Number deleted: %d\n", g_ndeleted); - } - /* Delete some files */ + /* Delete some files */ - ret = nxffs_delfiles(); - if (ret < 0) - { - fprintf(stderr, "ERROR: Failed to delete files\n"); - } - else - { - fprintf(stderr, "Deleted some files\n"); - } - fprintf(stderr, " Number of files: %d\n", g_nfiles); - fprintf(stderr, " Number deleted: %d\n", g_ndeleted); - nxffs_dump(mtd); + ret = nxffs_delfiles(); + if (ret < 0) + { + fprintf(stderr, "ERROR: Failed to delete files\n"); + } + else + { + fprintf(stderr, "Deleted some files\n"); + } + + fprintf(stderr, " Number of files: %d\n", g_nfiles); + fprintf(stderr, " Number deleted: %d\n", g_ndeleted); + nxffs_dump(mtd); - /* Verify all files written to FLASH */ + /* Verify all files written to FLASH */ + + ret = nxffs_verifyfs(); + if (ret < 0) + { + fprintf(stderr, "ERROR: Failed to verify files\n"); + } + else + { + fprintf(stderr, "Verified!\n"); + } - ret = nxffs_verifyfs(); - if (ret < 0) - { - fprintf(stderr, "ERROR: Failed to verify files\n"); fprintf(stderr, " Number of files: %d\n", g_nfiles); fprintf(stderr, " Number deleted: %d\n", g_ndeleted); } |