diff --git a/dmentry.c b/dmentry.c index 50abf53e..3f03f4e8 100644 --- a/dmentry.c +++ b/dmentry.c @@ -267,7 +267,7 @@ int dm_entry_param_method(struct dmctx *ctx, int cmd, char *inparam, char *arg1, fault = dm_entry_add_object(ctx); if (!fault) { dmuci_set_value_varstate("cwmp", "cpe", "ParameterKey", arg1 ? arg1 : ""); - dmuci_save_package_varstate("cwmp"); + dmuci_commit_package_varstate("cwmp"); dmuci_change_packages(&head_package_change); } break; @@ -275,7 +275,7 @@ int dm_entry_param_method(struct dmctx *ctx, int cmd, char *inparam, char *arg1, fault = dm_entry_delete_object(ctx); if (!fault) { dmuci_set_value_varstate("cwmp", "cpe", "ParameterKey", arg1 ? arg1 : ""); - dmuci_save_package_varstate("cwmp"); + dmuci_commit_package_varstate("cwmp"); dmuci_change_packages(&head_package_change); } break; @@ -308,12 +308,10 @@ int dm_entry_apply(struct dmctx *ctx, int cmd, char *arg1) { struct set_tmp *n = NULL, *p = NULL; int fault = 0; - bool set_success = false; switch(cmd) { case CMD_SET_VALUE: ctx->setaction = VALUESET; - set_success = false; list_for_each_entry_safe(n, p, &ctx->set_list_tmp, list) { ctx->in_param = n->name; ctx->in_value = n->value ? n->value : ""; @@ -323,11 +321,10 @@ int dm_entry_apply(struct dmctx *ctx, int cmd, char *arg1) add_list_fault_param(ctx, ctx->in_param, usp_fault_map(fault)); break; } - set_success = true; } - if (!fault && set_success == true) { + if (!fault) { dmuci_set_value_varstate("cwmp", "cpe", "ParameterKey", arg1 ? arg1 : ""); - dmuci_save_package_varstate("cwmp"); + dmuci_commit_package_varstate("cwmp"); dmuci_change_packages(&head_package_change); dmuci_save(); } @@ -410,8 +407,6 @@ int dm_entry_restart_services(void) dmubus_call_set("uci", "commit", UBUS_ARGS{{"config", pc->package, String}}, 1); } } - - dmuci_commit_package_varstate("cwmp"); free_all_list_package_change(&head_package_change); return 0; @@ -426,7 +421,6 @@ int dm_entry_revert_changes(void) list_for_each_entry(pc, &head_package_change, list) { dmubus_call_set("uci", "revert", UBUS_ARGS{{"config", pc->package, String}}, 1); } - dmuci_revert_package_varstate("cwmp"); free_all_list_package_change(&head_package_change); return 0; diff --git a/libbbf_api/dmuci.c b/libbbf_api/dmuci.c index 978e7437..f5a46fa5 100644 --- a/libbbf_api/dmuci.c +++ b/libbbf_api/dmuci.c @@ -20,7 +20,7 @@ static struct uci_context *uci_ctx = NULL; static char *db_config = NULL; NEW_UCI_PATH(bbfdm, BBFDM_CONFIG, BBFDM_SAVEDIR) -NEW_UCI_PATH(varstate, VARSTATE_CONFDIR, VARSTATE_SAVEDIR) +NEW_UCI_PATH(varstate, VARSTATE_CONFDIR, NULL) int dmuci_init(void) { diff --git a/libbbf_api/dmuci.h b/libbbf_api/dmuci.h index 8a1ba3cb..5a15c9ce 100644 --- a/libbbf_api/dmuci.h +++ b/libbbf_api/dmuci.h @@ -31,7 +31,6 @@ #define BBFDM_SAVEDIR "/tmp/.bbfdm" #define UCI_CONFIG_DIR "/etc/config/" #define VARSTATE_CONFDIR "/var/state/" -#define VARSTATE_SAVEDIR "/tmp/.bbfdm_var" enum dm_uci_cmp { CMP_SECTION, @@ -308,15 +307,6 @@ int dmuci_save_package_##UCI_PATH(char *package) \ uci_ctx = save_uci_ctx; \ return res; \ }\ -int dmuci_revert_package_##UCI_PATH(char *package) \ -{\ - struct uci_context *save_uci_ctx; \ - save_uci_ctx = uci_ctx; \ - uci_ctx = uci_ctx_##UCI_PATH; \ - int res = dmuci_revert_package(package); \ - uci_ctx = save_uci_ctx; \ - return res; \ -}\ int dmuci_delete_by_section_unnamed_##UCI_PATH(struct uci_section *s, char *option, char *value)\ {\ struct uci_context *save_uci_ctx; \ @@ -376,8 +366,6 @@ int dmuci_commit_package_bbfdm(char *package); int dmuci_commit_bbfdm(void); int dmuci_revert_bbfdm(void); int dmuci_commit_package_varstate(char *package); -int dmuci_save_package_varstate(char *package); -int dmuci_revert_package_varstate(char *package); struct uci_section *dmuci_walk_section_bbfdm(char *package, char *stype, void *arg1, void *arg2, int cmp , int (*filter)(struct uci_section *s, void *value), struct uci_section *prev_section, int walk); int dmuci_init_bbfdm(void);