if (!action || !device)
return -1;
- if (config_load(NULL))
- return -1;
-
- cache_load(1);
-
- list_for_each_entry(pr, &devices, list)
- if (!strcmp(basename(pr->dev), device))
- path = pr->dev;
-
- if (!path)
- return -1;
-
if (!strcmp(action, "remove")) {
if (type == TYPE_HOTPLUG)
blockd_notify("hotplug", device, NULL, NULL);
- umount_device(path, type, true);
+ umount_device(device, type, true);
return 0;
} else if (strcmp(action, "add")) {
return -1;
}
+ if (config_load(NULL))
+ return -1;
+
+ cache_load(1);
+
+ list_for_each_entry(pr, &devices, list)
+ if (!strcmp(basename(pr->dev), device))
+ path = pr->dev;
+
+ if (!path)
+ return -1;
+
return mount_device(find_block_info(NULL, NULL, path), type);
}