mnt.c 904 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. int mnt_init(void)
  14. {
  15. if (rt_device_find("virtio-blk0"))
  16. {
  17. /* mount virtio-blk as root directory */
  18. if (dfs_mount("virtio-blk0", "/", "elm", 0, RT_NULL) == 0)
  19. {
  20. rt_kprintf("file system initialization done!\n");
  21. }
  22. else
  23. {
  24. if (dfs_mount("virtio-blk0", "/", "ext", 0, RT_NULL) == 0)
  25. {
  26. rt_kprintf("file system initialization done!\n");
  27. }
  28. else
  29. {
  30. rt_kprintf("file system initialization fail!\n");
  31. }
  32. }
  33. }
  34. return 0;
  35. }
  36. INIT_ENV_EXPORT(mnt_init);
  37. #endif