diff --git a/dm-service/dm_service.c b/dm-service/dm_service.c index e1d3b8fb..5c002827 100644 --- a/dm-service/dm_service.c +++ b/dm-service/dm_service.c @@ -71,8 +71,7 @@ int main(int argc, char **argv) bbfdm_ubus_set_log_level(log_level); bbfdm_ubus_load_data_model(NULL); - - err = bbfdm_ubus_regiter_init(&bbfdm_ctx); + err = bbfdm_ubus_register_init(&bbfdm_ctx); if (err != 0) goto exit; @@ -87,7 +86,7 @@ int main(int argc, char **argv) exit: if (err != -5) // Error code is not -5, indicating that ubus_ctx is connected, proceed with shutdown - bbfdm_ubus_regiter_free(&bbfdm_ctx); + bbfdm_ubus_register_free(&bbfdm_ctx); closelog(); diff --git a/docs/guide/libbbfdm-ubus.md b/docs/guide/libbbfdm-ubus.md index ed07a2fd..da4208dc 100644 --- a/docs/guide/libbbfdm-ubus.md +++ b/docs/guide/libbbfdm-ubus.md @@ -13,12 +13,12 @@ The `libbbfdm-ubus` library can be used by: The following APIs are provided by `libbbfdm-ubus` to expose the data model over ubus: -### bbfdm_ubus_regiter_init +### bbfdm_ubus_register_init This method initializes the `bbfdm_context` structure object and registers ubus data model methods. ```c -int bbfdm_ubus_regiter_init(struct bbfdm_context *bbfdm_ctx) +int bbfdm_ubus_register_init(struct bbfdm_context *bbfdm_ctx) Inputs: struct bbfdm_context *bbfdm_ctx @@ -29,12 +29,12 @@ Returns: Returns 0 on success, or an error code if the registration fails. ``` -### bbfdm_ubus_regiter_free +### bbfdm_ubus_register_free This method frees the `bbfdm_context` structure object. ```c -int bbfdm_ubus_regiter_free(struct bbfdm_context *bbfdm_ctx) +int bbfdm_ubus_register_free(struct bbfdm_context *bbfdm_ctx) Inputs: struct bbfdm_context *bbfdm_ctx diff --git a/libbbfdm-ubus/bbfdm-ubus.c b/libbbfdm-ubus/bbfdm-ubus.c index 6365e096..08d15057 100644 --- a/libbbfdm-ubus/bbfdm-ubus.c +++ b/libbbfdm-ubus/bbfdm-ubus.c @@ -1010,7 +1010,7 @@ static void register_bbfdm_apply_event(struct bbfdm_context *bbfdm_ctx) ubus_register_event_handler(&bbfdm_ctx->ubus_ctx, &bbfdm_ctx->apply_event, "bbfdm.apply"); } -int bbfdm_ubus_regiter_init(struct bbfdm_context *bbfdm_ctx) +int bbfdm_ubus_register_init(struct bbfdm_context *bbfdm_ctx) { int err = 0; @@ -1058,7 +1058,7 @@ int bbfdm_ubus_regiter_init(struct bbfdm_context *bbfdm_ctx) return register_events_to_ubus(&bbfdm_ctx->ubus_ctx, &bbfdm_ctx->event_handlers); } -int bbfdm_ubus_regiter_free(struct bbfdm_context *bbfdm_ctx) +int bbfdm_ubus_register_free(struct bbfdm_context *bbfdm_ctx) { free_apply_handlers(&bbfdm_ctx->config); free_changed_uci(bbfdm_ctx); @@ -1071,6 +1071,16 @@ int bbfdm_ubus_regiter_free(struct bbfdm_context *bbfdm_ctx) return 0; } +int bbfdm_ubus_regiter_init(struct bbfdm_context *bbfdm_ctx) +{ + return bbfdm_ubus_register_init(bbfdm_ctx); +} + +int bbfdm_ubus_regiter_free(struct bbfdm_context *bbfdm_ctx) +{ + return bbfdm_ubus_register_free(bbfdm_ctx); +} + void bbfdm_ubus_set_service_name(struct bbfdm_context *bbfdm_ctx, const char *srv_name) { strncpyt(bbfdm_ctx->config.service_name, srv_name, sizeof(bbfdm_ctx->config.service_name)); diff --git a/libbbfdm-ubus/bbfdm-ubus.h b/libbbfdm-ubus/bbfdm-ubus.h index 9f065c63..4df46494 100644 --- a/libbbfdm-ubus/bbfdm-ubus.h +++ b/libbbfdm-ubus/bbfdm-ubus.h @@ -47,7 +47,13 @@ typedef struct bbfdm_data { struct blob_buf bb; } bbfdm_data_t; +int bbfdm_ubus_register_init(struct bbfdm_context *bbfdm_ctx); +int bbfdm_ubus_register_free(struct bbfdm_context *bbfdm_ctx); + +__attribute__((deprecated("Use bbfdm_ubus_register_init() instead of bbfdm_ubus_regiter_init()"))) int bbfdm_ubus_regiter_init(struct bbfdm_context *bbfdm_ctx); + +__attribute__((deprecated("Use bbfdm_ubus_register_free() instead of bbfdm_ubus_regiter_free()"))) int bbfdm_ubus_regiter_free(struct bbfdm_context *bbfdm_ctx); int bbfdm_print_data_model_schema(struct bbfdm_context *bbfdm_ctx, const enum bbfdm_type_enum type);