diff options
| author | [email protected] <[email protected]> | 2012-04-05 03:39:47 +0000 |
|---|---|---|
| committer | [email protected] <[email protected]> | 2012-04-05 03:39:47 +0000 |
| commit | f435f7116a5de30a2efad98b107ffb6b0e394c2b (patch) | |
| tree | 930c2c9c911289a35f2082f1850dd357ce457beb /components/dfs/filesystems/uffs/src/example/flash-interface-example.c | |
| parent | 3ab019bf860ca2e8e0e9ef887e663be7026bd42e (diff) | |
update uffs from official repo(fixed bugs and support mount/unmount one partition"
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@2018 bbd45198-f89e-11dd-88c7-29a3b14d5316
Diffstat (limited to 'components/dfs/filesystems/uffs/src/example/flash-interface-example.c')
| -rw-r--r-- | components/dfs/filesystems/uffs/src/example/flash-interface-example.c | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/components/dfs/filesystems/uffs/src/example/flash-interface-example.c b/components/dfs/filesystems/uffs/src/example/flash-interface-example.c index 36734e701c..248dea1710 100644 --- a/components/dfs/filesystems/uffs/src/example/flash-interface-example.c +++ b/components/dfs/filesystems/uffs/src/example/flash-interface-example.c @@ -387,8 +387,30 @@ static int my_init_filesystem(void) uffs_RegisterMountTable(mtbl);
mtbl++;
}
-
- return uffs_InitMountTable() == U_SUCC ? 0 : -1;
+
+ // mount partitions
+ for (mtbl = &(demo_mount_table[0]); mtbl->mount != NULL; mtbl++) {
+ uffs_Mount(mtbl->mount);
+ }
+
+ return uffs_InitFileSystemObjects() == U_SUCC ? 0 : -1;
+}
+
+static int my_release_filesystem(void)
+{
+ uffs_MountTable *mtb;
+ int ret = 0;
+
+ // unmount parttions
+ for (mtb = &(demo_mount_table[0]); ret == 0 && mtb->mount != NULL; mtb++) {
+ ret = uffs_UnMount(mtb->mount);
+ }
+
+ // release objects
+ if (ret == 0)
+ ret = (uffs_ReleaseFileSystemObjects() == U_SUCC ? 0 : -1);
+
+ return ret;
}
/* application entry */
@@ -401,7 +423,7 @@ int main() // ... my application codes ....
// read/write/create/delete files ...
- uffs_ReleaseMountTable();
+ my_release_filesystem();
return 0;
}
|
