mnt.c 781 B

1234567891011121314151617181920212223242526272829303132333435
  1. /*
  2. * Copyright (c) 2019, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2019-09-19 Gavin first version
  9. *
  10. */
  11. #include <rtthread.h>
  12. #ifdef RT_USING_DFS_RAMFS
  13. #include <dfs_fs.h>
  14. extern struct dfs_ramfs *dfs_ramfs_create(rt_uint8_t *pool, rt_size_t size);
  15. int mnt_init(void)
  16. {
  17. rt_uint8_t *pool = RT_NULL;
  18. rt_size_t size = 8*1024*1024;
  19. pool = rt_malloc(size);
  20. if (pool == RT_NULL)
  21. return 0;
  22. if (dfs_mount(RT_NULL, "/", "ram", 0, (const void *)dfs_ramfs_create(pool, size)) == 0)
  23. rt_kprintf("RAM file system initializated!\n");
  24. else
  25. rt_kprintf("RAM file system initializate failed!\n");
  26. return 0;
  27. }
  28. INIT_ENV_EXPORT(mnt_init);
  29. #endif