Explorar o código

[dfs] add re-initial check.

aozima %!s(int64=7) %!d(string=hai) anos
pai
achega
f3fc141f5f
Modificáronse 1 ficheiros con 8 adicións e 0 borrados
  1. 8 0
      components/dfs/src/dfs.c

+ 8 - 0
components/dfs/src/dfs.c

@@ -55,8 +55,16 @@ 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)
+    {
+        rt_kprintf("dfs already init.\n");
+        return 0;        
+    }
+    init_ok = 1;	
+
     /* clear filesystem operations table */
     memset((void *)filesystem_operation_table, 0, sizeof(filesystem_operation_table));
     /* clear filesystem table */