fwbank: Added refresh in dump to get un-cached info

This commit is contained in:
Vivek Kumar Dutta 2026-02-19 12:01:32 +05:30
parent 5dfb991d68
commit a4b98babe9
No known key found for this signature in database
GPG key ID: 4E09F5AD8265FD4C

View file

@ -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),
};