Skip to content
Snippets Groups Projects
Commit 93d30270 authored by Vivek Dutta's avatar Vivek Dutta
Browse files

Rename ubus to uspc

parent 2ae29195
Branches
No related tags found
1 merge request!8Rename ubus to uspc
...@@ -98,18 +98,16 @@ static char* get_internal_path(char *obj_name, char *path) ...@@ -98,18 +98,16 @@ static char* get_internal_path(char *obj_name, char *path)
if (path == NULL || strlen(path) == 0 || strcmp(path, "Device.") == 0 || if (path == NULL || strlen(path) == 0 || strcmp(path, "Device.") == 0 ||
strcmp(path, agent->prefix) == 0) { strcmp(path, agent->prefix) == 0) {
snprintf(req_path, sizeof(req_path), "Device.SSH."); // TODO hack to shorten DM tree snprintf(req_path, sizeof(req_path), "Device.");
break; break;
} }
if (strstr(path, agent->prefix) == NULL && strstr(agent->prefix, path) != NULL) { if (strstr(path, agent->prefix) == NULL && strstr(agent->prefix, path) != NULL) {
snprintf(req_path, sizeof(req_path), "Device.SSH."); // TODO hack to shorten DM tree snprintf(req_path, sizeof(req_path), "Device.");
break; break;
} }
snprintf(req_path, sizeof(req_path), "%s", path + strlen(agent->prefix)); snprintf(req_path, sizeof(req_path), "%s", path + strlen(agent->prefix));
if (strcmp(req_path, "Device.") == 0) // TODO hack to shorten DM tree
snprintf(req_path, sizeof(req_path), "Device.SSH.");
break; break;
default: default:
break; break;
...@@ -1094,7 +1092,7 @@ int register_ubus_objects(struct ubus_context *ubus_ctx) ...@@ -1094,7 +1092,7 @@ int register_ubus_objects(struct ubus_context *ubus_ctx)
return -1; return -1;
} }
if (uci_load(ctx, "obuspc", &pkg)) { if (uci_load(ctx, "uspc", &pkg)) {
uci_free_context(ctx); uci_free_context(ctx);
USP_LOG_Error("Failed to load uci"); USP_LOG_Error("Failed to load uci");
return -1; return -1;
...@@ -1137,7 +1135,7 @@ int register_ubus_objects(struct ubus_context *ubus_ctx) ...@@ -1137,7 +1135,7 @@ int register_ubus_objects(struct ubus_context *ubus_ctx)
snprintf(pref_path, sizeof(pref_path), "%s", prefix); snprintf(pref_path, sizeof(pref_path), "%s", prefix);
char name[30] = {0}; char name[30] = {0};
snprintf(name, sizeof(name), "obuspc.proxy_%d", proxy_id); snprintf(name, sizeof(name), "uspc.proxy_%d", proxy_id);
proxy_id = proxy_id + 1; proxy_id = proxy_id + 1;
agent_node_t *new_agent = malloc(sizeof(agent_node_t)); agent_node_t *new_agent = malloc(sizeof(agent_node_t));
......
...@@ -195,7 +195,7 @@ int uci_get_value_by_path(struct uci_context *ctx, char *path, char **value) ...@@ -195,7 +195,7 @@ int uci_get_value_by_path(struct uci_context *ctx, char *path, char **value)
int obuspc_uci_add_section(struct uci_context *ctx, char *stype, struct uci_section **s) int obuspc_uci_add_section(struct uci_context *ctx, char *stype, struct uci_section **s)
{ {
struct uci_ptr ptr = {0}; struct uci_ptr ptr = {0};
char *fname = "/etc/config/obuspc"; char *fname = "/etc/config/uspc";
*s = NULL; *s = NULL;
...@@ -211,7 +211,7 @@ int obuspc_uci_add_section(struct uci_context *ctx, char *stype, struct uci_sect ...@@ -211,7 +211,7 @@ int obuspc_uci_add_section(struct uci_context *ctx, char *stype, struct uci_sect
} }
ptr.value = NULL; ptr.value = NULL;
ptr.package = "obuspc"; ptr.package = "uspc";
ptr.target = UCI_TYPE_PACKAGE; ptr.target = UCI_TYPE_PACKAGE;
if (uci_lookup_ptr(ctx, &ptr, NULL, true) == UCI_OK if (uci_lookup_ptr(ctx, &ptr, NULL, true) == UCI_OK
...@@ -254,7 +254,7 @@ int obuspc_uci_set_value(struct uci_context *ctx, char *section, char *option, c ...@@ -254,7 +254,7 @@ int obuspc_uci_set_value(struct uci_context *ctx, char *section, char *option, c
return -1; return -1;
ptr.value = value; ptr.value = value;
ptr.package = "obuspc"; ptr.package = "uspc";
ptr.section = section; ptr.section = section;
ptr.option = option; ptr.option = option;
ptr.target = UCI_TYPE_OPTION; ptr.target = UCI_TYPE_OPTION;
...@@ -276,7 +276,7 @@ void reload_obuspc(void) ...@@ -276,7 +276,7 @@ void reload_obuspc(void)
struct blob_buf b; struct blob_buf b;
memset(&b, 0, sizeof(struct blob_buf)); memset(&b, 0, sizeof(struct blob_buf));
blob_buf_init(&b, 0); blob_buf_init(&b, 0);
blobmsg_add_string(&b, "config", "obuspc"); blobmsg_add_string(&b, "config", "uspc");
uint32_t id; uint32_t id;
struct ubus_context *ubus_ctx = ubus_connect(NULL); struct ubus_context *ubus_ctx = ubus_connect(NULL);
if (!ubus_ctx) { if (!ubus_ctx) {
...@@ -295,7 +295,7 @@ static int obuspc_commit_package(struct uci_context *ctx) ...@@ -295,7 +295,7 @@ static int obuspc_commit_package(struct uci_context *ctx)
{ {
struct uci_ptr ptr = {0}; struct uci_ptr ptr = {0};
if (uci_lookup_ptr(ctx, &ptr, "obuspc", true) != UCI_OK) if (uci_lookup_ptr(ctx, &ptr, "uspc", true) != UCI_OK)
return -1; return -1;
if (uci_commit(ctx, &ptr.p, false) != UCI_OK) if (uci_commit(ctx, &ptr.p, false) != UCI_OK)
...@@ -331,7 +331,7 @@ void onboard_agent(char *endpoint_id) ...@@ -331,7 +331,7 @@ void onboard_agent(char *endpoint_id)
uci_set_confdir(ctx, "/etc/config"); uci_set_confdir(ctx, "/etc/config");
if (uci_load(ctx, "obuspc", &pkg)) { if (uci_load(ctx, "uspc", &pkg)) {
uci_free_context(ctx); uci_free_context(ctx);
return; return;
} }
...@@ -346,7 +346,7 @@ void onboard_agent(char *endpoint_id) ...@@ -346,7 +346,7 @@ void onboard_agent(char *endpoint_id)
char path[1024] = {0}; char path[1024] = {0};
char *value = NULL; char *value = NULL;
snprintf(path, sizeof(path), "obuspc.%s.EndpointID", s->e.name); snprintf(path, sizeof(path), "uspc.%s.EndpointID", s->e.name);
if (0 != uci_get_value_by_path(ctx, path, &value)) if (0 != uci_get_value_by_path(ctx, path, &value))
continue; continue;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment