diff options
| author | aozima <[email protected]> | 2018-07-16 20:48:24 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2018-07-16 20:48:24 +0800 |
| commit | 6deeb61efb8e0e17ff0c4eaaee2a3e3b1e96877f (patch) | |
| tree | c66356afa4673de5f88d74220634b9c14894d3ed /components/dfs | |
| parent | add3eedeea382c3cfdaf80a368ce518a19489c3f (diff) | |
| parent | 730981ec42f535a285fe3c5316e5931560b17832 (diff) | |
Merge pull request #1622 from armink/fix_com_init
[components] Update dfs and lwIP 2.0.2 re-initialization process.
Diffstat (limited to 'components/dfs')
| -rw-r--r-- | components/dfs/src/dfs.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/components/dfs/src/dfs.c b/components/dfs/src/dfs.c index e7fd7394cf..31102f49bd 100644 --- a/components/dfs/src/dfs.c +++ b/components/dfs/src/dfs.c @@ -55,15 +55,15 @@ static int fd_alloc(struct dfs_fdtable *fdt, int startfd); /** * this function will initialize device file system. */ -static volatile uint8_t init_ok = 0; int dfs_init(void) { - if(init_ok) + static rt_bool_t init_ok = RT_FALSE; + + if (init_ok) { rt_kprintf("dfs already init.\n"); - return 0; + return 0; } - init_ok = 1; /* clear filesystem operations table */ memset((void *)filesystem_operation_table, 0, sizeof(filesystem_operation_table)); @@ -92,6 +92,8 @@ int dfs_init(void) } #endif + init_ok = RT_TRUE; + return 0; } INIT_PREV_EXPORT(dfs_init); @@ -506,13 +508,13 @@ struct dfs_fdtable* dfs_fdtable_get(void) { struct dfs_fdtable *fdt; #ifdef RT_USING_LWP - struct rt_lwp *lwp; + struct rt_lwp *lwp; - lwp = (struct rt_lwp *)rt_thread_self()->user_data; + lwp = (struct rt_lwp *)rt_thread_self()->user_data; if (lwp) - fdt = &lwp->fdt; - else - fdt = &_fdtab; + fdt = &lwp->fdt; + else + fdt = &_fdtab; #else fdt = &_fdtab; #endif |
