MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / cmd_umount

Function cmd_umount

components/finsh/msh_file.c:632–682  ·  view source on GitHub ↗

unmount the filesystem from the specified mountpoint */

Source from the content-addressed store, hash-verified

630
631/* unmount the filesystem from the specified mountpoint */
632static int cmd_umount(int argc, char **argv)
633{
634#ifndef RT_USING_DFS_V2
635 char *path = argv[1];
636
637 if (argc != 2)
638 {
639 rt_kprintf("Usage: unmount <mountpoint>.\n");
640 return -1;
641 }
642
643 rt_kprintf("unmount %s ... ", path);
644 if (dfs_unmount(path) < 0)
645 {
646 rt_kprintf("failed!\n");
647 return -1;
648 }
649 else
650 {
651 rt_kprintf("succeed!\n");
652 return 0;
653 }
654#else
655 int flags = 0;
656 char *path = argv[1];
657
658 if (argc < 2)
659 {
660 rt_kprintf("Usage: unmount [-f] <mountpoint>.\n");
661 return -1;
662 }
663
664 if (argc > 2)
665 {
666 flags = strcmp(argv[1], "-f") == 0 ? MNT_FORCE : 0;
667 path = argv[2];
668 }
669
670 rt_kprintf("unmount %s ... ", path);
671 if (dfs_umount(path, flags) < 0)
672 {
673 rt_kprintf("failed!\n");
674 return -1;
675 }
676 else
677 {
678 rt_kprintf("succeed!\n");
679 return 0;
680 }
681#endif
682}
683MSH_CMD_EXPORT_ALIAS(cmd_umount, umount, Unmount the mountpoint);
684
685static int cmd_df(int argc, char **argv)

Callers

nothing calls this directly

Calls 3

rt_kprintfFunction · 0.85
dfs_umountFunction · 0.85
dfs_unmountFunction · 0.50

Tested by

no test coverage detected