Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
Obuspa Test Controller
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
BBF
Obuspa Test Controller
Commits
93d30270
Commit
93d30270
authored
1 year ago
by
Vivek Dutta
Browse files
Options
Downloads
Patches
Plain Diff
Rename ubus to uspc
parent
2ae29195
Branches
Branches containing commit
No related tags found
1 merge request
!8
Rename ubus to uspc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/vendor/ubus_req_handler.c
+4
-6
4 additions, 6 deletions
src/vendor/ubus_req_handler.c
src/vendor/vendor_utils.c
+7
-7
7 additions, 7 deletions
src/vendor/vendor_utils.c
with
11 additions
and
13 deletions
src/vendor/ubus_req_handler.c
+
4
−
6
View file @
93d30270
...
@@ -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
,
"
ob
uspc"
,
&
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
),
"
ob
uspc.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
));
...
...
This diff is collapsed.
Click to expand it.
src/vendor/vendor_utils.c
+
7
−
7
View file @
93d30270
...
@@ -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/
ob
uspc"
;
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
=
"
ob
uspc"
;
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
=
"
ob
uspc"
;
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"
,
"
ob
uspc"
);
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
,
"
ob
uspc"
,
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
,
"
ob
uspc"
,
&
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
),
"
ob
uspc.%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
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment