mnt.c 923 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*
  2. * Copyright (c) 2006-2021, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2021/08/19 bernard the first version
  9. */
  10. #include <rtthread.h>
  11. #ifdef RT_USING_DFS
  12. #include <dfs_fs.h>
  13. #include <rtdbg.h>
  14. int mnt_init(void)
  15. {
  16. if (rt_device_find("virtio-blk0"))
  17. {
  18. /* mount virtio-blk as root directory */
  19. if (dfs_mount("virtio-blk0", "/", "elm", 0, RT_NULL) == 0)
  20. {
  21. rt_kprintf("file system initialization done!\n");
  22. }
  23. else
  24. {
  25. if (dfs_mount("virtio-blk0", "/", "ext", 0, RT_NULL) == 0)
  26. {
  27. rt_kprintf("file system initialization done!\n");
  28. }
  29. else
  30. {
  31. rt_kprintf("file system initialization fail!\n");
  32. }
  33. }
  34. }
  35. return 0;
  36. }
  37. INIT_ENV_EXPORT(mnt_init);
  38. #endif