+static void blockd_notify(char *device, struct mount *m, struct probe_info *pr)
+{
+ struct ubus_context *ctx = ubus_connect(NULL);
+ uint32_t id;
+
+ if (!ctx)
+ return;
+
+ if (!ubus_lookup_id(ctx, "block", &id)) {
+ struct blob_buf buf = { 0 };
+ char *d = strrchr(device, '/');
+
+ if (d)
+ d++;
+ else
+ d = device;
+
+ blob_buf_init(&buf, 0);
+
+ if (m) {
+
+ blobmsg_add_string(&buf, "device", d);
+ if (m->uuid)
+ blobmsg_add_string(&buf, "uuid", m->uuid);
+ if (m->label)
+ blobmsg_add_string(&buf, "label", m->label);
+ if (m->target)
+ blobmsg_add_string(&buf, "target", m->target);
+ if (m->options)
+ blobmsg_add_string(&buf, "options", m->options);
+ if (m->autofs)
+ blobmsg_add_u32(&buf, "autofs", m->autofs);
+ if (pr->type)
+ blobmsg_add_string(&buf, "type", pr->type);
+ if (pr->version)
+ blobmsg_add_string(&buf, "version", pr->version);
+ } else if (pr) {
+ blobmsg_add_string(&buf, "device", d);
+ if (pr->uuid)
+ blobmsg_add_string(&buf, "uuid", pr->uuid);
+ if (pr->label)
+ blobmsg_add_string(&buf, "label", pr->label);
+ if (pr->type)
+ blobmsg_add_string(&buf, "type", pr->type);
+ if (pr->version)
+ blobmsg_add_string(&buf, "version", pr->version);
+ blobmsg_add_u32(&buf, "anon", 1);
+ } else {
+ blobmsg_add_string(&buf, "device", d);
+ blobmsg_add_u32(&buf, "remove", 1);
+ }
+
+ ubus_invoke(ctx, id, "hotplug", buf.head, NULL, NULL, 3000);
+ }
+
+ ubus_free(ctx);
+}
+
+static int mount_device(struct probe_info *pr, int type)