@@ -38,6 +38,7 @@
#include <uci.h>
#include <uci_blob.h>
+#include <libubox/hotplug.h>
#include <libubox/ulog.h>
#include <libubox/list.h>
#include <libubox/vlist.h>
@@ -880,6 +881,24 @@ static int exec_mount(const char *source, const char *target,
return err;
}
+static int hotplug_call_mount(const char *action, const char *device)
+{
+ char actionenv[] = "ACTION=xxxxxx";
+ char deviceenv[32];
+ char *envp[] = { actionenv, deviceenv, NULL };
+ int err;
+
+ snprintf(actionenv, sizeof(actionenv), "ACTION=%s", action);
+ snprintf(deviceenv, sizeof(deviceenv), "DEVICE=%s", device);
+
+ err = hotplug_call("mount", envp);
+ if (err) {
+ ULOG_ERR("hotplug-call call failed: %d\n", err);
+ }
+
+ return err;
+}
+
static int handle_mount(const char *source, const char *target,
const char *fstype, struct mount *m)
{
@@ -1079,6 +1098,8 @@ static int mount_device(struct probe_info *pr, int type)
handle_swapfiles(true);
+ hotplug_call_mount("add", device);
+
return 0;
}
@@ -1091,6 +1112,8 @@ static int umount_device(char *path)
if (!mp)
return -1;
+ hotplug_call_mount("remove", basename(path));
+
err = umount2(mp, MNT_DETACH);
if (err)
ULOG_ERR("unmounting %s (%s) failed (%d) - %m\n", path, mp,