unmount the filesystem from the specified mountpoint */
| 630 | |
| 631 | /* unmount the filesystem from the specified mountpoint */ |
| 632 | static 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 | } |
| 683 | MSH_CMD_EXPORT_ALIAS(cmd_umount, umount, Unmount the mountpoint); |
| 684 | |
| 685 | static int cmd_df(int argc, char **argv) |
nothing calls this directly
no test coverage detected