return 0;
}
-static int umount_device(char *path, int type)
+static int umount_device(char *path, int type, bool all)
{
char *mp;
int err;
mp = find_mount_point(path);
if (!mp)
return -1;
+ if (!strcmp(mp, "/") && !all)
+ return 0;
if (type != TYPE_AUTOFS)
hotplug_call_mount("remove", basename(path));
if (type == TYPE_HOTPLUG)
blockd_notify(device, NULL, NULL);
- umount_device(path, type);
+ umount_device(path, type, true);
return 0;
} else if (strcmp(action, "add")) {
static int main_umount(int argc, char **argv)
{
struct probe_info *pr;
+ bool all = false;
if (config_load(NULL))
return -1;
handle_swapfiles(false);
cache_load(0);
+
+ if (argc == 3)
+ all = !strcmp(argv[2], "-a");
+
list_for_each_entry(pr, &devices, list) {
struct mount *m;
if (m && m->extroot)
continue;
- umount_device(pr->dev, TYPE_DEV);
+ umount_device(pr->dev, TYPE_DEV, all);
}
return 0;
default:
return swapon_usage();
}
-
}
if (optind != (argc - 1))