mirror of
https://dev.iopsys.eu/bbf/bbfdm.git
synced 2025-12-09 23:34:38 +01:00
Correct API name typo and deprecate old APIs
This commit is contained in:
parent
1596a6a8c1
commit
69134df069
4 changed files with 24 additions and 9 deletions
|
|
@ -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();
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue