From 90a6281da67d2fa15b68436583362762f2bc886c Mon Sep 17 00:00:00 2001 From: Suvendhu Hansa Date: Thu, 29 Jan 2026 15:51:37 +0530 Subject: [PATCH] Add config in modified_uci list if delta exists --- libbbfdm-api/legacy/dmuci.c | 9 ++++++--- libbbfdm-ubus/bbfdm-ubus.c | 2 -- libbbfdm-ubus/get.c | 19 +++++++++++++++++++ 3 files changed, 25 insertions(+), 5 deletions(-) mode change 100644 => 100755 libbbfdm-api/legacy/dmuci.c diff --git a/libbbfdm-api/legacy/dmuci.c b/libbbfdm-api/legacy/dmuci.c old mode 100644 new mode 100755 index 73ff90b6..7faed416 --- a/libbbfdm-api/legacy/dmuci.c +++ b/libbbfdm-api/legacy/dmuci.c @@ -795,10 +795,13 @@ static int __uci_perform_op(int operation, bbfdm_uci_op_data *op_data) return -1; } - if (uci_save(op_data->ucictx, ptr.p) != UCI_OK) - return -1; + if (ptr.p && !uci_list_empty(&ptr.p->delta)) { + if (uci_save(op_data->ucictx, ptr.p) != UCI_OK) + return -1; + + add_list_modified_uci(op_data->dmctx, op_data->ucictx->confdir, op_data->package); + } - add_list_modified_uci(op_data->dmctx, op_data->ucictx->confdir, op_data->package); return 0; } diff --git a/libbbfdm-ubus/bbfdm-ubus.c b/libbbfdm-ubus/bbfdm-ubus.c index 71654169..54e42aa7 100644 --- a/libbbfdm-ubus/bbfdm-ubus.c +++ b/libbbfdm-ubus/bbfdm-ubus.c @@ -313,8 +313,6 @@ static int bbfdm_instances_handler(struct ubus_context *ctx, struct ubus_object fill_optional_data(&data, tb[DM_INSTANCES_OPTIONAL]); - bbfdm_refresh_references(data.bbf_ctx.dm_type, obj->name); - bbfdm_get(&data, BBF_INSTANCES); free_path_list(&paths_list); diff --git a/libbbfdm-ubus/get.c b/libbbfdm-ubus/get.c index 28b38cd7..6e46d128 100644 --- a/libbbfdm-ubus/get.c +++ b/libbbfdm-ubus/get.c @@ -19,8 +19,27 @@ void bbfdm_get(bbfdm_data_t *data, int method) struct pathNode *pn = NULL; int fault = 0; + LIST_HEAD(temp_list); + + if (method == BBF_INSTANCES) { + // referesh reference db + struct dmctx bbf_ctx = { + .in_param = ROOT_NODE, + .dm_type = data->bbf_ctx.dm_type + }; + + bbf_init(&bbf_ctx); + bbfdm_cmd_exec(&bbf_ctx, BBF_REFERENCES_DB); + list_splice_tail_init(bbf_ctx.modified_uci_head, &temp_list); + bbf_cleanup(&bbf_ctx); + } + bbf_init(&data->bbf_ctx); + if (!list_empty(&temp_list)) { + list_splice_tail_init(&temp_list, data->bbf_ctx.modified_uci_head); + } + void *array = blobmsg_open_array(&data->bbf_ctx.bb, "results"); list_for_each_entry(pn, data->plist, list) {