mirror of
https://dev.iopsys.eu/bbf/bbfdm.git
synced 2025-12-10 07:44:39 +01:00
Remove the handling of instance wildcard from bbfdmd
This commit is contained in:
parent
6cfbb2f966
commit
a0a0dbd2c5
2 changed files with 2 additions and 54 deletions
|
|
@ -69,13 +69,6 @@ static bool get_base_path(const char *query_path, char *base_path)
|
|||
}
|
||||
}
|
||||
break;
|
||||
case '*':
|
||||
if (query_path[i - 1] != '.' ||
|
||||
query_path[i + 1] != '.' ||
|
||||
query_path[i + 2] == 0)
|
||||
return false;
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (found)
|
||||
|
|
@ -139,20 +132,6 @@ static bool get_next_param(char *qPath, size_t *pos, char *param)
|
|||
param[qlen - 1] = '\0';
|
||||
}
|
||||
|
||||
if (param[0] == '*') {
|
||||
size_t param_len = DM_STRLEN(param);
|
||||
if (param_len > 1) {
|
||||
ERR("* followed by other characters(%s)", param);
|
||||
return false;
|
||||
}
|
||||
|
||||
// * is not followed by .
|
||||
if (qPath[*pos - 1] != '.') {
|
||||
ERR("* not followed by dot(%c)", qPath[*pos - 1]);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -715,35 +694,6 @@ static void refresh_path_list(struct list_head *path_list, struct list_head *pli
|
|||
}
|
||||
}
|
||||
|
||||
static int append_all_instances(unsigned int dm_type, char *bPath, struct list_head *plist_local)
|
||||
{
|
||||
char temp[MAX_DM_PATH];
|
||||
int fault = 0;
|
||||
struct dmctx bbf_ctx = {
|
||||
.in_param = bPath,
|
||||
.nextlevel = true,
|
||||
.instance_mode = INSTANCE_MODE_NUMBER,
|
||||
.dm_type = dm_type
|
||||
};
|
||||
|
||||
bbf_sub_init(&bbf_ctx);
|
||||
|
||||
if (0 == (fault = bbfdm_cmd_exec(&bbf_ctx, BBF_INSTANCES))) {
|
||||
struct dm_parameter *n = NULL;
|
||||
|
||||
list_for_each_entry(n, &bbf_ctx.list_parameter, list) {
|
||||
temp[0] = '\0';
|
||||
|
||||
// Add .
|
||||
snprintf(temp, MAX_DM_PATH, "%s.", n->name);
|
||||
add_path_list(temp, plist_local);
|
||||
}
|
||||
}
|
||||
|
||||
bbf_sub_cleanup(&bbf_ctx);
|
||||
return fault;
|
||||
}
|
||||
|
||||
static int resolve_path(struct dmctx *bbf_ctx, char *qPath, size_t pos, struct list_head *resolved_plist)
|
||||
{
|
||||
char temp[MAX_DM_PATH + 5] = {0};
|
||||
|
|
@ -788,8 +738,6 @@ static int resolve_path(struct dmctx *bbf_ctx, char *qPath, size_t pos, struct l
|
|||
if (param[0] == '[') {
|
||||
param[plen-1] = 0;
|
||||
fault = solve_all_filters(bbf_ctx, temp, param+1, &plist_local);
|
||||
} else if (param[0] == '*') {
|
||||
fault = append_all_instances(bbf_ctx->dm_type, temp, &plist_local);
|
||||
} else {
|
||||
char buff[MAX_DM_VALUE] = {0};
|
||||
if (non_leaf)
|
||||
|
|
|
|||
|
|
@ -171,7 +171,7 @@ static void resulting(uint8_t maxdepth, char *path, struct dmctx *bbf_ctx, struc
|
|||
}
|
||||
}
|
||||
} else {
|
||||
if (!strcmp(n->name, path)) {
|
||||
if (match(n->name, path, 0, NULL)) {
|
||||
if (is_search_by_reference(bbf_ctx->in_param))
|
||||
plen = 0;
|
||||
|
||||
|
|
@ -442,7 +442,7 @@ void prepare_raw_result(struct blob_buf *bb, struct dmctx *bbf_ctx, struct list_
|
|||
blobmsg_close_table(bb, table);
|
||||
}
|
||||
} else {
|
||||
if (!strcmp(n->name, iter->path)) {
|
||||
if (match(n->name, iter->path, 0, NULL)) {
|
||||
table = blobmsg_open_table(bb, NULL);
|
||||
bb_add_string(bb, "path", n->name);
|
||||
bb_add_string(bb, "data", n->data);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue