diff options
author | Rafał Miłecki <rafal@milecki.pl> | 2018-12-09 16:11:59 +0100 |
---|---|---|
committer | Rafał Miłecki <rafal@milecki.pl> | 2018-12-09 16:12:38 +0100 |
commit | f1bb762f0245fcbfa6555fd90e71de61480c301c (patch) | |
tree | 4f44cd2ec56c97cc1ddbdd0eda0dd432012fddef | |
parent | 71c2bde7e87e52a643411e58e0df0439419d3e7a (diff) | |
download | fstools-f1bb762f0245fcbfa6555fd90e71de61480c301c.tar.gz |
block: make blockd_notify() return an int instead of void
It allows improving block by handling blockd_notify() errors.
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
-rw-r--r-- | block.c | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -960,13 +960,14 @@ static int handle_mount(const char *source, const char *target, return err; } -static void blockd_notify(char *device, struct mount *m, struct probe_info *pr) +static int blockd_notify(char *device, struct mount *m, struct probe_info *pr) { struct ubus_context *ctx = ubus_connect(NULL); uint32_t id; + int err; if (!ctx) - return; + return -ENXIO; if (!ubus_lookup_id(ctx, "block", &id)) { struct blob_buf buf = { 0 }; @@ -1012,10 +1013,14 @@ static void blockd_notify(char *device, struct mount *m, struct probe_info *pr) blobmsg_add_u32(&buf, "remove", 1); } - ubus_invoke(ctx, id, "hotplug", buf.head, NULL, NULL, 3000); + err = ubus_invoke(ctx, id, "hotplug", buf.head, NULL, NULL, 3000); + } else { + err = -ENOENT; } ubus_free(ctx); + + return err; } static int mount_device(struct probe_info *pr, int type) |