mirror of
https://dev.iopsys.eu/system/sysmngr.git
synced 2026-03-14 21:20:18 +01:00
fwbank: Added refresh in dump to get un-cached info
This commit is contained in:
parent
5dfb991d68
commit
a4b98babe9
1 changed files with 26 additions and 1 deletions
27
src/fwbank.c
27
src/fwbank.c
|
|
@ -560,10 +560,35 @@ static int sysmngr_fwbank_upgrade(struct blob_buf *bbp, int bank_id, struct ubus
|
|||
return res;
|
||||
}
|
||||
|
||||
enum {
|
||||
DUMP_REFRESH,
|
||||
__DUMP_MAX
|
||||
};
|
||||
|
||||
static const struct blobmsg_policy dump_policy[] = {
|
||||
[DUMP_REFRESH] = { .name = "refresh", .type = BLOBMSG_TYPE_BOOL }
|
||||
};
|
||||
|
||||
static int dump_handler(struct ubus_context *ctx, struct ubus_object *obj,
|
||||
struct ubus_request_data *req, const char *method,
|
||||
struct blob_attr *msg)
|
||||
{
|
||||
struct blob_attr *tb[__DUMP_MAX];
|
||||
bool refresh = false;
|
||||
|
||||
if (blob_len(msg)) {
|
||||
if (blobmsg_parse(dump_policy, __DUMP_MAX, tb, blob_data(msg), blob_len(msg))) {
|
||||
BBFDM_ERR("Failed to parse the 'dump' message");
|
||||
return UBUS_STATUS_UNKNOWN_ERROR;
|
||||
}
|
||||
if (tb[DUMP_REFRESH]) {
|
||||
refresh = blobmsg_get_bool(tb[DUMP_REFRESH]);
|
||||
}
|
||||
}
|
||||
if (refresh == true) {
|
||||
init_global_fwbank_dump();
|
||||
}
|
||||
|
||||
ubus_send_reply(ctx, req, g_fwbank_dump.output.head);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -736,7 +761,7 @@ static int upgrade_handler(struct ubus_context *ctx, struct ubus_object *obj,
|
|||
}
|
||||
|
||||
static struct ubus_method fwbank_methods[] = {
|
||||
UBUS_METHOD_NOARG("dump", dump_handler),
|
||||
UBUS_METHOD("dump", dump_handler, dump_policy),
|
||||
UBUS_METHOD("set_bootbank", set_bootbank_handler, set_bootbank_policy),
|
||||
UBUS_METHOD("upgrade", upgrade_handler, upgrade_policy),
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue